@software-dlc/cli 0.192.23 → 0.192.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function rS(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const r in a)if(r!=="default"&&!(r in e)){const l=Object.getOwnPropertyDescriptor(a,r);l&&Object.defineProperty(e,r,l.get?l:{enumerable:!0,get:()=>a[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function By(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hy={exports:{}},Yu={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ function aS(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var lS=Symbol.for("react.transitional.element"),iS=Symbol.for("react.fragment");function Iy(e,t,n){var a=null;if(n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:lS,type:e,key:a,ref:t!==void 0?t:null,props:n}}Yu.Fragment=iS;Yu.jsx=Iy;Yu.jsxs=Iy;Hy.exports=Yu;var s=Hy.exports,Py={exports:{}},Te={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react.production.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ function aS(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var $m=Symbol.for("react.transitional.element"),
|
|
17
|
+
*/var $m=Symbol.for("react.transitional.element"),oS=Symbol.for("react.portal"),cS=Symbol.for("react.fragment"),uS=Symbol.for("react.strict_mode"),dS=Symbol.for("react.profiler"),fS=Symbol.for("react.consumer"),hS=Symbol.for("react.context"),mS=Symbol.for("react.forward_ref"),pS=Symbol.for("react.suspense"),xS=Symbol.for("react.memo"),qy=Symbol.for("react.lazy"),Xx=Symbol.iterator;function gS(e){return e===null||typeof e!="object"?null:(e=Xx&&e[Xx]||e["@@iterator"],typeof e=="function"?e:null)}var Gy={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Vy=Object.assign,Yy={};function $l(e,t,n){this.props=e,this.context=t,this.refs=Yy,this.updater=n||Gy}$l.prototype.isReactComponent={};$l.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")};$l.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Fy(){}Fy.prototype=$l.prototype;function Om(e,t,n){this.props=e,this.context=t,this.refs=Yy,this.updater=n||Gy}var Dm=Om.prototype=new Fy;Dm.constructor=Om;Vy(Dm,$l.prototype);Dm.isPureReactComponent=!0;var Qx=Array.isArray,lt={H:null,A:null,T:null,S:null,V:null},Ky=Object.prototype.hasOwnProperty;function zm(e,t,n,a,r,l){return n=l.ref,{$$typeof:$m,type:e,key:t,ref:n!==void 0?n:null,props:l}}function vS(e,t){return zm(e.type,t,void 0,void 0,void 0,e.props)}function Lm(e){return typeof e=="object"&&e!==null&&e.$$typeof===$m}function yS(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Wx=/\/+/g;function Zd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?yS(""+e.key):t.toString(36)}function Zx(){}function jS(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Zx,Zx):(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 Ir(e,t,n,a,r){var l=typeof e;(l==="undefined"||l==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(l){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case $m:case oS:i=!0;break;case qy:return i=e._init,Ir(i(e._payload),t,n,a,r)}}if(i)return r=r(e),i=a===""?"."+Zd(e,0):a,Qx(r)?(n="",i!=null&&(n=i.replace(Wx,"$&/")+"/"),Ir(r,t,n,"",function(d){return d})):r!=null&&(Lm(r)&&(r=vS(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(Wx,"$&/")+"/")+i)),t.push(r)),1;i=0;var o=a===""?".":a+":";if(Qx(e))for(var c=0;c<e.length;c++)a=e[c],l=o+Zd(a,c),i+=Ir(a,t,n,l,r);else if(c=gS(e),typeof c=="function")for(e=c.call(e),c=0;!(a=e.next()).done;)a=a.value,l=o+Zd(a,c++),i+=Ir(a,t,n,l,r);else if(l==="object"){if(typeof e.then=="function")return Ir(jS(e),t,n,a,r);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 i}function Qo(e,t,n){if(e==null)return e;var a=[],r=0;return Ir(e,a,"","",function(l){return t.call(n,l,r++)}),a}function bS(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 Jx=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 wS(){}Te.Children={map:Qo,forEach:function(e,t,n){Qo(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Qo(e,function(){t++}),t},toArray:function(e){return Qo(e,function(t){return t})||[]},only:function(e){if(!Lm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Te.Component=$l;Te.Fragment=cS;Te.Profiler=dS;Te.PureComponent=Om;Te.StrictMode=uS;Te.Suspense=pS;Te.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=lt;Te.__COMPILER_RUNTIME={__proto__:null,c:function(e){return lt.H.useMemoCache(e)}};Te.cache=function(e){return function(){return e.apply(null,arguments)}};Te.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var a=Vy({},e.props),r=e.key,l=void 0;if(t!=null)for(i in t.ref!==void 0&&(l=void 0),t.key!==void 0&&(r=""+t.key),t)!Ky.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(a[i]=t[i]);var i=arguments.length-2;if(i===1)a.children=n;else if(1<i){for(var o=Array(i),c=0;c<i;c++)o[c]=arguments[c+2];a.children=o}return zm(e.type,r,void 0,void 0,l,a)};Te.createContext=function(e){return e={$$typeof:hS,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:fS,_context:e},e};Te.createElement=function(e,t,n){var a,r={},l=null;if(t!=null)for(a in t.key!==void 0&&(l=""+t.key),t)Ky.call(t,a)&&a!=="key"&&a!=="__self"&&a!=="__source"&&(r[a]=t[a]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var o=Array(i),c=0;c<i;c++)o[c]=arguments[c+2];r.children=o}if(e&&e.defaultProps)for(a in i=e.defaultProps,i)r[a]===void 0&&(r[a]=i[a]);return zm(e,l,void 0,void 0,null,r)};Te.createRef=function(){return{current:null}};Te.forwardRef=function(e){return{$$typeof:mS,render:e}};Te.isValidElement=Lm;Te.lazy=function(e){return{$$typeof:qy,_payload:{_status:-1,_result:e},_init:bS}};Te.memo=function(e,t){return{$$typeof:xS,type:e,compare:t===void 0?null:t}};Te.startTransition=function(e){var t=lt.T,n={};lt.T=n;try{var a=e(),r=lt.S;r!==null&&r(n,a),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a.then(wS,Jx)}catch(l){Jx(l)}finally{lt.T=t}};Te.unstable_useCacheRefresh=function(){return lt.H.useCacheRefresh()};Te.use=function(e){return lt.H.use(e)};Te.useActionState=function(e,t,n){return lt.H.useActionState(e,t,n)};Te.useCallback=function(e,t){return lt.H.useCallback(e,t)};Te.useContext=function(e){return lt.H.useContext(e)};Te.useDebugValue=function(){};Te.useDeferredValue=function(e,t){return lt.H.useDeferredValue(e,t)};Te.useEffect=function(e,t,n){var a=lt.H;if(typeof n=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return a.useEffect(e,t)};Te.useId=function(){return lt.H.useId()};Te.useImperativeHandle=function(e,t,n){return lt.H.useImperativeHandle(e,t,n)};Te.useInsertionEffect=function(e,t){return lt.H.useInsertionEffect(e,t)};Te.useLayoutEffect=function(e,t){return lt.H.useLayoutEffect(e,t)};Te.useMemo=function(e,t){return lt.H.useMemo(e,t)};Te.useOptimistic=function(e,t){return lt.H.useOptimistic(e,t)};Te.useReducer=function(e,t,n){return lt.H.useReducer(e,t,n)};Te.useRef=function(e){return lt.H.useRef(e)};Te.useState=function(e){return lt.H.useState(e)};Te.useSyncExternalStore=function(e,t,n){return lt.H.useSyncExternalStore(e,t,n)};Te.useTransition=function(){return lt.H.useTransition()};Te.version="19.1.0";Py.exports=Te;var u=Py.exports;const fa=By(u),Xy=rS({__proto__:null,default:fa},[u]);var Qy={exports:{}},Fu={},Wy={exports:{}},Zy={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ function aS(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(R,T){var k=R.length;R.push(T);e:for(;0<k;){var O=k-1>>>1,Y=R[O];if(0<r(Y,T))R[O]=T,R[k]=Y,k=O;else break e}}function n(R){return R.length===0?null:R[0]}function a(R){if(R.length===0)return null;var T=R[0],k=R.pop();if(k!==T){R[0]=k;e:for(var O=0,Y=R.length,E=Y>>>1;O<E;){var I=2*(O+1)-1,Q=R[I],te=I+1,ce=R[te];if(0>r(Q,k))te<Y&&0>r(ce,Q)?(R[O]=ce,R[te]=k,O=te):(R[O]=Q,R[I]=k,O=I);else if(te<Y&&0>r(ce,k))R[O]=ce,R[te]=k,O=te;else break e}}return T}function r(R,T){var k=R.sortIndex-T.sortIndex;return k!==0?k:R.id-T.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],d=[],f=1,h=null,m=3,x=!1,b=!1,v=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function w(R){for(var T=n(d);T!==null;){if(T.callback===null)a(d);else if(T.startTime<=R)a(d),T.sortIndex=T.expirationTime,t(c,T);else break;T=n(d)}}function N(R){if(v=!1,w(R),!b)if(n(c)!==null)b=!0,C||(C=!0,F());else{var T=n(d);T!==null&&M(N,T.startTime-R)}}var C=!1,_=-1,S=5,D=-1;function z(){return y?!0:!(e.unstable_now()-D<S)}function P(){if(y=!1,C){var R=e.unstable_now();D=R;var T=!0;try{e:{b=!1,v&&(v=!1,p(_),_=-1),x=!0;var k=m;try{t:{for(w(R),h=n(c);h!==null&&!(h.expirationTime>R&&z());){var O=h.callback;if(typeof O=="function"){h.callback=null,m=h.priorityLevel;var Y=O(h.expirationTime<=R);if(R=e.unstable_now(),typeof Y=="function"){h.callback=Y,w(R),T=!0;break t}h===n(c)&&a(c),w(R)}else a(c);h=n(c)}if(h!==null)T=!0;else{var E=n(d);E!==null&&M(N,E.startTime-R),T=!1}}break e}finally{h=null,m=k,x=!1}T=void 0}}finally{T?F():C=!1}}}var F;if(typeof j=="function")F=function(){j(P)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,A=H.port2;H.port1.onmessage=P,F=function(){A.postMessage(null)}}else F=function(){g(P,0)};function M(R,T){_=g(function(){R(e.unstable_now())},T)}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(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):S=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(R){switch(m){case 1:case 2:case 3:var T=3;break;default:T=m}var k=m;m=T;try{return R()}finally{m=k}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(R,T){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var k=m;m=R;try{return T()}finally{m=k}},e.unstable_scheduleCallback=function(R,T,k){var O=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0<k?O+k:O):k=O,R){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=k+Y,R={id:f++,callback:T,priorityLevel:R,startTime:k,expirationTime:Y,sortIndex:-1},k>O?(R.sortIndex=k,t(d,R),n(c)===null&&R===n(d)&&(v?(p(_),_=-1):v=!0,M(N,k-O))):(R.sortIndex=Y,t(c,R),b||x||(b=!0,C||(C=!0,F()))),R},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(R){var T=m;return function(){var k=m;m=T;try{return R.apply(this,arguments)}finally{m=k}}}})(
|
|
25
|
+
*/(function(e){function t(R,T){var k=R.length;R.push(T);e:for(;0<k;){var O=k-1>>>1,Y=R[O];if(0<r(Y,T))R[O]=T,R[k]=Y,k=O;else break e}}function n(R){return R.length===0?null:R[0]}function a(R){if(R.length===0)return null;var T=R[0],k=R.pop();if(k!==T){R[0]=k;e:for(var O=0,Y=R.length,E=Y>>>1;O<E;){var I=2*(O+1)-1,Q=R[I],te=I+1,ce=R[te];if(0>r(Q,k))te<Y&&0>r(ce,Q)?(R[O]=ce,R[te]=k,O=te):(R[O]=Q,R[I]=k,O=I);else if(te<Y&&0>r(ce,k))R[O]=ce,R[te]=k,O=te;else break e}}return T}function r(R,T){var k=R.sortIndex-T.sortIndex;return k!==0?k:R.id-T.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],d=[],f=1,h=null,m=3,x=!1,b=!1,v=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function w(R){for(var T=n(d);T!==null;){if(T.callback===null)a(d);else if(T.startTime<=R)a(d),T.sortIndex=T.expirationTime,t(c,T);else break;T=n(d)}}function N(R){if(v=!1,w(R),!b)if(n(c)!==null)b=!0,C||(C=!0,F());else{var T=n(d);T!==null&&M(N,T.startTime-R)}}var C=!1,_=-1,S=5,D=-1;function z(){return y?!0:!(e.unstable_now()-D<S)}function P(){if(y=!1,C){var R=e.unstable_now();D=R;var T=!0;try{e:{b=!1,v&&(v=!1,p(_),_=-1),x=!0;var k=m;try{t:{for(w(R),h=n(c);h!==null&&!(h.expirationTime>R&&z());){var O=h.callback;if(typeof O=="function"){h.callback=null,m=h.priorityLevel;var Y=O(h.expirationTime<=R);if(R=e.unstable_now(),typeof Y=="function"){h.callback=Y,w(R),T=!0;break t}h===n(c)&&a(c),w(R)}else a(c);h=n(c)}if(h!==null)T=!0;else{var E=n(d);E!==null&&M(N,E.startTime-R),T=!1}}break e}finally{h=null,m=k,x=!1}T=void 0}}finally{T?F():C=!1}}}var F;if(typeof j=="function")F=function(){j(P)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,A=H.port2;H.port1.onmessage=P,F=function(){A.postMessage(null)}}else F=function(){g(P,0)};function M(R,T){_=g(function(){R(e.unstable_now())},T)}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(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):S=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(R){switch(m){case 1:case 2:case 3:var T=3;break;default:T=m}var k=m;m=T;try{return R()}finally{m=k}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(R,T){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var k=m;m=R;try{return T()}finally{m=k}},e.unstable_scheduleCallback=function(R,T,k){var O=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0<k?O+k:O):k=O,R){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=k+Y,R={id:f++,callback:T,priorityLevel:R,startTime:k,expirationTime:Y,sortIndex:-1},k>O?(R.sortIndex=k,t(d,R),n(c)===null&&R===n(d)&&(v?(p(_),_=-1):v=!0,M(N,k-O))):(R.sortIndex=Y,t(c,R),b||x||(b=!0,C||(C=!0,F()))),R},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(R){var T=m;return function(){var k=m;m=T;try{return R.apply(this,arguments)}finally{m=k}}}})(Zy);Wy.exports=Zy;var _S=Wy.exports,Jy={exports:{}},Zt={};/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.js
|
|
28
28
|
*
|
|
@@ -30,7 +30,7 @@ function aS(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var
|
|
33
|
+
*/var NS=u;function ej(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 oa(){}var Xt={d:{f:oa,r:function(){throw Error(ej(522))},D:oa,C:oa,L:oa,m:oa,X:oa,S:oa,M:oa},p:0,findDOMNode:null},kS=Symbol.for("react.portal");function SS(e,t,n){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:kS,key:a==null?null:""+a,children:e,containerInfo:t,implementation:n}}var Ci=NS.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Ku(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Zt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Xt;Zt.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(ej(299));return SS(e,t,null,n)};Zt.flushSync=function(e){var t=Ci.T,n=Xt.p;try{if(Ci.T=null,Xt.p=2,e)return e()}finally{Ci.T=t,Xt.p=n,Xt.d.f()}};Zt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Xt.d.C(e,t))};Zt.prefetchDNS=function(e){typeof e=="string"&&Xt.d.D(e)};Zt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,a=Ku(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,l=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Xt.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:a,integrity:r,fetchPriority:l}):n==="script"&&Xt.d.X(e,{crossOrigin:a,integrity:r,fetchPriority:l,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Zt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Ku(t.as,t.crossOrigin);Xt.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&&Xt.d.M(e)};Zt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,a=Ku(n,t.crossOrigin);Xt.d.L(e,n,{crossOrigin:a,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})}};Zt.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Ku(t.as,t.crossOrigin);Xt.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 Xt.d.m(e)};Zt.requestFormReset=function(e){Xt.d.r(e)};Zt.unstable_batchedUpdates=function(e,t){return e(t)};Zt.useFormState=function(e,t,n){return Ci.H.useFormState(e,t,n)};Zt.useFormStatus=function(){return Ci.H.useHostTransitionStatus()};Zt.version="19.1.0";function tj(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(tj)}catch(e){console.error(e)}}tj(),Jy.exports=Zt;var Ol=Jy.exports;const CS=By(Ol);/**
|
|
34
34
|
* @license React
|
|
35
35
|
* react-dom-client.production.js
|
|
36
36
|
*
|
|
@@ -38,311 +38,311 @@ function aS(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the MIT license found in the
|
|
40
40
|
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var Dt=wS,tj=u,CS=Ol;function ee(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 nj(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function vo(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 sj(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 eg(e){if(vo(e)!==e)throw Error(ee(188))}function RS(e){var t=e.alternate;if(!t){if(t=vo(e),t===null)throw Error(ee(188));return t!==e?null:e}for(var n=e,a=t;;){var r=n.return;if(r===null)break;var l=r.alternate;if(l===null){if(a=r.return,a!==null){n=a;continue}break}if(r.child===l.child){for(l=r.child;l;){if(l===n)return eg(r),e;if(l===a)return eg(r),t;l=l.sibling}throw Error(ee(188))}if(n.return!==a.return)n=r,a=l;else{for(var i=!1,o=r.child;o;){if(o===n){i=!0,n=r,a=l;break}if(o===a){i=!0,a=r,n=l;break}o=o.sibling}if(!i){for(o=l.child;o;){if(o===n){i=!0,n=l,a=r;break}if(o===a){i=!0,a=l,n=r;break}o=o.sibling}if(!i)throw Error(ee(189))}}if(n.alternate!==a)throw Error(ee(190))}if(n.tag!==3)throw Error(ee(188));return n.stateNode.current===n?e:t}function aj(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=aj(e),t!==null)return t;e=e.sibling}return null}var nt=Object.assign,TS=Symbol.for("react.element"),Wo=Symbol.for("react.transitional.element"),pi=Symbol.for("react.portal"),Vr=Symbol.for("react.fragment"),rj=Symbol.for("react.strict_mode"),ih=Symbol.for("react.profiler"),ES=Symbol.for("react.provider"),lj=Symbol.for("react.consumer"),Ys=Symbol.for("react.context"),Um=Symbol.for("react.forward_ref"),oh=Symbol.for("react.suspense"),ch=Symbol.for("react.suspense_list"),Bm=Symbol.for("react.memo"),pa=Symbol.for("react.lazy"),uh=Symbol.for("react.activity"),AS=Symbol.for("react.memo_cache_sentinel"),tg=Symbol.iterator;function si(e){return e===null||typeof e!="object"?null:(e=tg&&e[tg]||e["@@iterator"],typeof e=="function"?e:null)}var MS=Symbol.for("react.client.reference");function dh(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===MS?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Vr:return"Fragment";case ih:return"Profiler";case rj:return"StrictMode";case oh:return"Suspense";case ch:return"SuspenseList";case uh:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case pi:return"Portal";case Ys:return(e.displayName||"Context")+".Provider";case lj:return(e._context.displayName||"Context")+".Consumer";case Um:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Bm:return t=e.displayName||null,t!==null?t:dh(e.type)||"Memo";case pa:t=e._payload,e=e._init;try{return dh(e(t))}catch{}}return null}var xi=Array.isArray,Ne=tj.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Pe=CS.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,nr={pending:!1,data:null,method:null,action:null},fh=[],Yr=-1;function Ms(e){return{current:e}}function Bt(e){0>Yr||(e.current=fh[Yr],fh[Yr]=null,Yr--)}function it(e,t){Yr++,fh[Yr]=e.current,e.current=t}var Ns=Ms(null),Gi=Ms(null),Ca=Ms(null),Xc=Ms(null);function Qc(e,t){switch(it(Ca,t),it(Gi,e),it(Ns,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?lv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=lv(t),e=_w(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Bt(Ns),it(Ns,e)}function vl(){Bt(Ns),Bt(Gi),Bt(Ca)}function hh(e){e.memoizedState!==null&&it(Xc,e);var t=Ns.current,n=_w(t,e.type);t!==n&&(it(Gi,e),it(Ns,n))}function Wc(e){Gi.current===e&&(Bt(Ns),Bt(Gi)),Xc.current===e&&(Bt(Xc),eo._currentValue=nr)}var mh=Object.prototype.hasOwnProperty,Hm=Dt.unstable_scheduleCallback,Jd=Dt.unstable_cancelCallback,$S=Dt.unstable_shouldYield,OS=Dt.unstable_requestPaint,ks=Dt.unstable_now,DS=Dt.unstable_getCurrentPriorityLevel,ij=Dt.unstable_ImmediatePriority,oj=Dt.unstable_UserBlockingPriority,Zc=Dt.unstable_NormalPriority,zS=Dt.unstable_LowPriority,cj=Dt.unstable_IdlePriority,LS=Dt.log,US=Dt.unstable_setDisableYieldValue,yo=null,Rn=null;function ba(e){if(typeof LS=="function"&&US(e),Rn&&typeof Rn.setStrictMode=="function")try{Rn.setStrictMode(yo,e)}catch{}}var Tn=Math.clz32?Math.clz32:IS,BS=Math.log,HS=Math.LN2;function IS(e){return e>>>=0,e===0?32:31-(BS(e)/HS|0)|0}var Zo=256,Jo=4194304;function Za(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 Xu(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var o=a&134217727;return o!==0?(a=o&~l,a!==0?r=Za(a):(i&=o,i!==0?r=Za(i):n||(n=o&~e,n!==0&&(r=Za(n))))):(o=a&~l,o!==0?r=Za(o):i!==0?r=Za(i):n||(n=a&~e,n!==0&&(r=Za(n)))),r===0?0:t!==0&&t!==r&&!(t&l)&&(l=r&-r,n=t&-t,l>=n||l===32&&(n&4194048)!==0)?t:r}function jo(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function PS(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 uj(){var e=Zo;return Zo<<=1,!(Zo&4194048)&&(Zo=256),e}function dj(){var e=Jo;return Jo<<=1,!(Jo&62914560)&&(Jo=4194304),e}function ef(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function bo(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function qS(e,t,n,a,r,l){var i=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 o=e.entanglements,c=e.expirationTimes,d=e.hiddenUpdates;for(n=i&~n;0<n;){var f=31-Tn(n),h=1<<f;o[f]=0,c[f]=-1;var m=d[f];if(m!==null)for(d[f]=null,f=0;f<m.length;f++){var x=m[f];x!==null&&(x.lane&=-536870913)}n&=~h}a!==0&&fj(e,a,0),l!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=l&~(i&~t))}function fj(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-Tn(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&4194090}function hj(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-Tn(n),r=1<<a;r&t|e[a]&t&&(e[a]|=t),n&=~r}}function Im(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 Pm(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function mj(){var e=Pe.p;return e!==0?e:(e=window.event,e===void 0?32:$w(e.type))}function GS(e,t){var n=Pe.p;try{return Pe.p=e,t()}finally{Pe.p=n}}var Pa=Math.random().toString(36).slice(2),Vt="__reactFiber$"+Pa,fn="__reactProps$"+Pa,Dl="__reactContainer$"+Pa,ph="__reactEvents$"+Pa,VS="__reactListeners$"+Pa,YS="__reactHandles$"+Pa,ng="__reactResources$"+Pa,wo="__reactMarker$"+Pa;function qm(e){delete e[Vt],delete e[fn],delete e[ph],delete e[VS],delete e[YS]}function Fr(e){var t=e[Vt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Dl]||n[Vt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=cv(e);e!==null;){if(n=e[Vt])return n;e=cv(e)}return t}e=n,n=e.parentNode}return null}function zl(e){if(e=e[Vt]||e[Dl]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function gi(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(ee(33))}function al(e){var t=e[ng];return t||(t=e[ng]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Lt(e){e[wo]=!0}var pj=new Set,xj={};function jr(e,t){yl(e,t),yl(e+"Capture",t)}function yl(e,t){for(xj[e]=t,e=0;e<t.length;e++)pj.add(t[e])}var FS=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]*$"),sg={},ag={};function KS(e){return mh.call(ag,e)?!0:mh.call(sg,e)?!1:FS.test(e)?ag[e]=!0:(sg[e]=!0,!1)}function Rc(e,t,n){if(KS(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function ec(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 Us(e,t,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+a)}}var tf,rg;function Pr(e){if(tf===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);tf=t&&t[1]||"",rg=-1<n.stack.indexOf(`
|
|
41
|
+
*/var Dt=_S,nj=u,RS=Ol;function ee(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 sj(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function vo(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 aj(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 eg(e){if(vo(e)!==e)throw Error(ee(188))}function TS(e){var t=e.alternate;if(!t){if(t=vo(e),t===null)throw Error(ee(188));return t!==e?null:e}for(var n=e,a=t;;){var r=n.return;if(r===null)break;var l=r.alternate;if(l===null){if(a=r.return,a!==null){n=a;continue}break}if(r.child===l.child){for(l=r.child;l;){if(l===n)return eg(r),e;if(l===a)return eg(r),t;l=l.sibling}throw Error(ee(188))}if(n.return!==a.return)n=r,a=l;else{for(var i=!1,o=r.child;o;){if(o===n){i=!0,n=r,a=l;break}if(o===a){i=!0,a=r,n=l;break}o=o.sibling}if(!i){for(o=l.child;o;){if(o===n){i=!0,n=l,a=r;break}if(o===a){i=!0,a=l,n=r;break}o=o.sibling}if(!i)throw Error(ee(189))}}if(n.alternate!==a)throw Error(ee(190))}if(n.tag!==3)throw Error(ee(188));return n.stateNode.current===n?e:t}function rj(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=rj(e),t!==null)return t;e=e.sibling}return null}var nt=Object.assign,ES=Symbol.for("react.element"),Wo=Symbol.for("react.transitional.element"),xi=Symbol.for("react.portal"),Vr=Symbol.for("react.fragment"),lj=Symbol.for("react.strict_mode"),ih=Symbol.for("react.profiler"),AS=Symbol.for("react.provider"),ij=Symbol.for("react.consumer"),Ys=Symbol.for("react.context"),Um=Symbol.for("react.forward_ref"),oh=Symbol.for("react.suspense"),ch=Symbol.for("react.suspense_list"),Bm=Symbol.for("react.memo"),pa=Symbol.for("react.lazy"),uh=Symbol.for("react.activity"),MS=Symbol.for("react.memo_cache_sentinel"),tg=Symbol.iterator;function ai(e){return e===null||typeof e!="object"?null:(e=tg&&e[tg]||e["@@iterator"],typeof e=="function"?e:null)}var $S=Symbol.for("react.client.reference");function dh(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===$S?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Vr:return"Fragment";case ih:return"Profiler";case lj:return"StrictMode";case oh:return"Suspense";case ch:return"SuspenseList";case uh:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case xi:return"Portal";case Ys:return(e.displayName||"Context")+".Provider";case ij:return(e._context.displayName||"Context")+".Consumer";case Um:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Bm:return t=e.displayName||null,t!==null?t:dh(e.type)||"Memo";case pa:t=e._payload,e=e._init;try{return dh(e(t))}catch{}}return null}var gi=Array.isArray,Ne=nj.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Pe=RS.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,nr={pending:!1,data:null,method:null,action:null},fh=[],Yr=-1;function Ms(e){return{current:e}}function Bt(e){0>Yr||(e.current=fh[Yr],fh[Yr]=null,Yr--)}function it(e,t){Yr++,fh[Yr]=e.current,e.current=t}var Ns=Ms(null),Vi=Ms(null),Ca=Ms(null),Xc=Ms(null);function Qc(e,t){switch(it(Ca,t),it(Vi,e),it(Ns,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?lv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=lv(t),e=N0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Bt(Ns),it(Ns,e)}function vl(){Bt(Ns),Bt(Vi),Bt(Ca)}function hh(e){e.memoizedState!==null&&it(Xc,e);var t=Ns.current,n=N0(t,e.type);t!==n&&(it(Vi,e),it(Ns,n))}function Wc(e){Vi.current===e&&(Bt(Ns),Bt(Vi)),Xc.current===e&&(Bt(Xc),to._currentValue=nr)}var mh=Object.prototype.hasOwnProperty,Hm=Dt.unstable_scheduleCallback,Jd=Dt.unstable_cancelCallback,OS=Dt.unstable_shouldYield,DS=Dt.unstable_requestPaint,ks=Dt.unstable_now,zS=Dt.unstable_getCurrentPriorityLevel,oj=Dt.unstable_ImmediatePriority,cj=Dt.unstable_UserBlockingPriority,Zc=Dt.unstable_NormalPriority,LS=Dt.unstable_LowPriority,uj=Dt.unstable_IdlePriority,US=Dt.log,BS=Dt.unstable_setDisableYieldValue,yo=null,Rn=null;function ba(e){if(typeof US=="function"&&BS(e),Rn&&typeof Rn.setStrictMode=="function")try{Rn.setStrictMode(yo,e)}catch{}}var Tn=Math.clz32?Math.clz32:PS,HS=Math.log,IS=Math.LN2;function PS(e){return e>>>=0,e===0?32:31-(HS(e)/IS|0)|0}var Zo=256,Jo=4194304;function Za(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 Xu(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var o=a&134217727;return o!==0?(a=o&~l,a!==0?r=Za(a):(i&=o,i!==0?r=Za(i):n||(n=o&~e,n!==0&&(r=Za(n))))):(o=a&~l,o!==0?r=Za(o):i!==0?r=Za(i):n||(n=a&~e,n!==0&&(r=Za(n)))),r===0?0:t!==0&&t!==r&&!(t&l)&&(l=r&-r,n=t&-t,l>=n||l===32&&(n&4194048)!==0)?t:r}function jo(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function qS(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 dj(){var e=Zo;return Zo<<=1,!(Zo&4194048)&&(Zo=256),e}function fj(){var e=Jo;return Jo<<=1,!(Jo&62914560)&&(Jo=4194304),e}function ef(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function bo(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function GS(e,t,n,a,r,l){var i=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 o=e.entanglements,c=e.expirationTimes,d=e.hiddenUpdates;for(n=i&~n;0<n;){var f=31-Tn(n),h=1<<f;o[f]=0,c[f]=-1;var m=d[f];if(m!==null)for(d[f]=null,f=0;f<m.length;f++){var x=m[f];x!==null&&(x.lane&=-536870913)}n&=~h}a!==0&&hj(e,a,0),l!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=l&~(i&~t))}function hj(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-Tn(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&4194090}function mj(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-Tn(n),r=1<<a;r&t|e[a]&t&&(e[a]|=t),n&=~r}}function Im(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 Pm(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function pj(){var e=Pe.p;return e!==0?e:(e=window.event,e===void 0?32:O0(e.type))}function VS(e,t){var n=Pe.p;try{return Pe.p=e,t()}finally{Pe.p=n}}var Pa=Math.random().toString(36).slice(2),Vt="__reactFiber$"+Pa,fn="__reactProps$"+Pa,Dl="__reactContainer$"+Pa,ph="__reactEvents$"+Pa,YS="__reactListeners$"+Pa,FS="__reactHandles$"+Pa,ng="__reactResources$"+Pa,wo="__reactMarker$"+Pa;function qm(e){delete e[Vt],delete e[fn],delete e[ph],delete e[YS],delete e[FS]}function Fr(e){var t=e[Vt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Dl]||n[Vt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=cv(e);e!==null;){if(n=e[Vt])return n;e=cv(e)}return t}e=n,n=e.parentNode}return null}function zl(e){if(e=e[Vt]||e[Dl]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function vi(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(ee(33))}function al(e){var t=e[ng];return t||(t=e[ng]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Lt(e){e[wo]=!0}var xj=new Set,gj={};function jr(e,t){yl(e,t),yl(e+"Capture",t)}function yl(e,t){for(gj[e]=t,e=0;e<t.length;e++)xj.add(t[e])}var KS=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]*$"),sg={},ag={};function XS(e){return mh.call(ag,e)?!0:mh.call(sg,e)?!1:KS.test(e)?ag[e]=!0:(sg[e]=!0,!1)}function Rc(e,t,n){if(XS(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function ec(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 Us(e,t,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+a)}}var tf,rg;function Pr(e){if(tf===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);tf=t&&t[1]||"",rg=-1<n.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
43
|
`+tf+e+rg}var nf=!1;function sf(e,t){if(!e||nf)return"";nf=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(x){var m=x}Reflect.construct(e,[],h)}else{try{h.call()}catch(x){m=x}e.call(h.prototype)}}else{try{throw Error()}catch(x){m=x}(h=e())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(x){if(x&&m&&typeof x.stack=="string")return[x.stack,m.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var l=a.DetermineComponentFrameRoot(),i=l[0],o=l[1];if(i&&o){var c=i.split(`
|
|
44
44
|
`),d=o.split(`
|
|
45
45
|
`);for(r=a=0;a<c.length&&!c[a].includes("DetermineComponentFrameRoot");)a++;for(;r<d.length&&!d[r].includes("DetermineComponentFrameRoot");)r++;if(a===c.length||r===d.length)for(a=c.length-1,r=d.length-1;1<=a&&0<=r&&c[a]!==d[r];)r--;for(;1<=a&&0<=r;a--,r--)if(c[a]!==d[r]){if(a!==1||r!==1)do if(a--,r--,0>r||c[a]!==d[r]){var f=`
|
|
46
|
-
`+c[a].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),f}while(1<=a&&0<=r);break}}}finally{nf=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Pr(n):""}function
|
|
46
|
+
`+c[a].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),f}while(1<=a&&0<=r);break}}}finally{nf=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Pr(n):""}function QS(e){switch(e.tag){case 26:case 27:case 5:return Pr(e.type);case 16:return Pr("Lazy");case 13:return Pr("Suspense");case 19:return Pr("SuspenseList");case 0:case 15:return sf(e.type,!1);case 11:return sf(e.type.render,!1);case 1:return sf(e.type,!0);case 31:return Pr("Activity");default:return""}}function lg(e){try{var t="";do t+=QS(e),e=e.return;while(e);return t}catch(n){return`
|
|
47
47
|
Error generating stack: `+n.message+`
|
|
48
|
-
`+n.stack}}function Un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gj(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function QS(e){var t=gj(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),a=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(i){a=""+i,l.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(i){a=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Jc(e){e._valueTracker||(e._valueTracker=QS(e))}function vj(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=gj(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function eu(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 WS=/[\n"\\]/g;function In(e){return e.replace(WS,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function xh(e,t,n,a,r,l,i,o){e.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?e.type=i:e.removeAttribute("type"),t!=null?i==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Un(t)):e.value!==""+Un(t)&&(e.value=""+Un(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?gh(e,i,Un(t)):n!=null?gh(e,i,Un(n)):a!=null&&e.removeAttribute("value"),r==null&&l!=null&&(e.defaultChecked=!!l),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+Un(o):e.removeAttribute("name")}function yj(e,t,n,a,r,l,i,o){if(l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(e.type=l),t!=null||n!=null){if(!(l!=="submit"&&l!=="reset"||t!=null))return;n=n!=null?""+Un(n):"",t=t!=null?""+Un(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}a=a??r,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=o?e.checked:!!a,e.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.name=i)}function gh(e,t,n){t==="number"&&eu(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function rl(e,t,n,a){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&a&&(e[n].defaultSelected=!0)}else{for(n=""+Un(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,a&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function jj(e,t,n){if(t!=null&&(t=""+Un(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Un(n):""}function bj(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(ee(92));if(xi(a)){if(1<a.length)throw Error(ee(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=Un(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a)}function jl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ZS=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 ig(e,t,n){var a=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,n):typeof n!="number"||n===0||ZS.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function wj(e,t,n){if(t!=null&&typeof t!="object")throw Error(ee(62));if(e=e.style,n!=null){for(var a in n)!n.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var r in t)a=t[r],t.hasOwnProperty(r)&&n[r]!==a&&ig(e,r,a)}else for(var l in t)t.hasOwnProperty(l)&&ig(e,l,t[l])}function Gm(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 JS=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"]]),e2=/^[\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 Tc(e){return e2.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var vh=null;function Vm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Kr=null,ll=null;function og(e){var t=zl(e);if(t&&(e=t.stateNode)){var n=e[fn]||null;e:switch(e=t.stateNode,t.type){case"input":if(xh(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="'+In(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var r=a[fn]||null;if(!r)throw Error(ee(90));xh(a,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&vj(a)}break e;case"textarea":jj(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&rl(e,!!n.multiple,t,!1)}}}var af=!1;function _j(e,t,n){if(af)return e(t,n);af=!0;try{var a=e(t);return a}finally{if(af=!1,(Kr!==null||ll!==null)&&(rd(),Kr&&(t=Kr,e=ll,ll=Kr=null,og(t),e)))for(t=0;t<e.length;t++)og(e[t])}}function Vi(e,t){var n=e.stateNode;if(n===null)return null;var a=n[fn]||null;if(a===null)return null;n=a[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":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ee(231,t,typeof n));return n}var Js=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yh=!1;if(Js)try{var ai={};Object.defineProperty(ai,"passive",{get:function(){yh=!0}}),window.addEventListener("test",ai,ai),window.removeEventListener("test",ai,ai)}catch{yh=!1}var wa=null,Ym=null,Ec=null;function Nj(){if(Ec)return Ec;var e,t=Ym,n=t.length,a,r="value"in wa?wa.value:wa.textContent,l=r.length;for(e=0;e<n&&t[e]===r[e];e++);var i=n-e;for(a=1;a<=i&&t[n-a]===r[l-a];a++);return Ec=r.slice(e,1<a?1-a:void 0)}function Ac(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 tc(){return!0}function cg(){return!1}function hn(e){function t(n,a,r,l,i){this._reactName=n,this._targetInst=r,this.type=a,this.nativeEvent=l,this.target=i,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(l):l[o]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?tc:cg,this.isPropagationStopped=cg,this}return nt(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=tc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=tc)},persist:function(){},isPersistent:tc}),t}var br={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qu=hn(br),_o=nt({},br,{view:0,detail:0}),t2=hn(_o),rf,lf,ri,Wu=nt({},_o,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fm,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!==ri&&(ri&&e.type==="mousemove"?(rf=e.screenX-ri.screenX,lf=e.screenY-ri.screenY):lf=rf=0,ri=e),rf)},movementY:function(e){return"movementY"in e?e.movementY:lf}}),ug=hn(Wu),n2=nt({},Wu,{dataTransfer:0}),s2=hn(n2),a2=nt({},_o,{relatedTarget:0}),of=hn(a2),r2=nt({},br,{animationName:0,elapsedTime:0,pseudoElement:0}),l2=hn(r2),i2=nt({},br,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),o2=hn(i2),c2=nt({},br,{data:0}),dg=hn(c2),u2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},d2={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"},f2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function h2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=f2[e])?!!t[e]:!1}function Fm(){return h2}var m2=nt({},_o,{key:function(e){if(e.key){var t=u2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ac(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?d2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fm,charCode:function(e){return e.type==="keypress"?Ac(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ac(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),p2=hn(m2),x2=nt({},Wu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),fg=hn(x2),g2=nt({},_o,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fm}),v2=hn(g2),y2=nt({},br,{propertyName:0,elapsedTime:0,pseudoElement:0}),j2=hn(y2),b2=nt({},Wu,{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}),w2=hn(b2),_2=nt({},br,{newState:0,oldState:0}),N2=hn(_2),k2=[9,13,27,32],Km=Js&&"CompositionEvent"in window,Ci=null;Js&&"documentMode"in document&&(Ci=document.documentMode);var S2=Js&&"TextEvent"in window&&!Ci,kj=Js&&(!Km||Ci&&8<Ci&&11>=Ci),hg=" ",mg=!1;function Sj(e,t){switch(e){case"keyup":return k2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xr=!1;function C2(e,t){switch(e){case"compositionend":return Cj(t);case"keypress":return t.which!==32?null:(mg=!0,hg);case"textInput":return e=t.data,e===hg&&mg?null:e;default:return null}}function R2(e,t){if(Xr)return e==="compositionend"||!Km&&Sj(e,t)?(e=Nj(),Ec=Ym=wa=null,Xr=!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 kj&&t.locale!=="ko"?null:t.data;default:return null}}var T2={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 pg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!T2[e.type]:t==="textarea"}function Rj(e,t,n,a){Kr?ll?ll.push(a):ll=[a]:Kr=a,t=vu(t,"onChange"),0<t.length&&(n=new Qu("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var Ri=null,Yi=null;function E2(e){jw(e,0)}function Zu(e){var t=gi(e);if(vj(t))return e}function xg(e,t){if(e==="change")return t}var Tj=!1;if(Js){var cf;if(Js){var uf="oninput"in document;if(!uf){var gg=document.createElement("div");gg.setAttribute("oninput","return;"),uf=typeof gg.oninput=="function"}cf=uf}else cf=!1;Tj=cf&&(!document.documentMode||9<document.documentMode)}function vg(){Ri&&(Ri.detachEvent("onpropertychange",Ej),Yi=Ri=null)}function Ej(e){if(e.propertyName==="value"&&Zu(Yi)){var t=[];Rj(t,Yi,e,Vm(e)),_j(E2,t)}}function A2(e,t,n){e==="focusin"?(vg(),Ri=t,Yi=n,Ri.attachEvent("onpropertychange",Ej)):e==="focusout"&&vg()}function M2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zu(Yi)}function $2(e,t){if(e==="click")return Zu(t)}function O2(e,t){if(e==="input"||e==="change")return Zu(t)}function D2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var $n=typeof Object.is=="function"?Object.is:D2;function Fi(e,t){if($n(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var r=n[a];if(!mh.call(t,r)||!$n(e[r],t[r]))return!1}return!0}function yg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jg(e,t){var n=yg(e);e=0;for(var a;n;){if(n.nodeType===3){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=yg(n)}}function Aj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Aj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Mj(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=eu(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=eu(e.document)}return t}function Xm(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 z2=Js&&"documentMode"in document&&11>=document.documentMode,Qr=null,jh=null,Ti=null,bh=!1;function bg(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bh||Qr==null||Qr!==eu(a)||(a=Qr,"selectionStart"in a&&Xm(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ti&&Fi(Ti,a)||(Ti=a,a=vu(jh,"onSelect"),0<a.length&&(t=new Qu("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Qr)))}function Qa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Wr={animationend:Qa("Animation","AnimationEnd"),animationiteration:Qa("Animation","AnimationIteration"),animationstart:Qa("Animation","AnimationStart"),transitionrun:Qa("Transition","TransitionRun"),transitionstart:Qa("Transition","TransitionStart"),transitioncancel:Qa("Transition","TransitionCancel"),transitionend:Qa("Transition","TransitionEnd")},df={},$j={};Js&&($j=document.createElement("div").style,"AnimationEvent"in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),"TransitionEvent"in window||delete Wr.transitionend.transition);function wr(e){if(df[e])return df[e];if(!Wr[e])return e;var t=Wr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in $j)return df[e]=t[n];return e}var Oj=wr("animationend"),Dj=wr("animationiteration"),zj=wr("animationstart"),L2=wr("transitionrun"),U2=wr("transitionstart"),B2=wr("transitioncancel"),Lj=wr("transitionend"),Uj=new Map,wh="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(" ");wh.push("scrollEnd");function us(e,t){Uj.set(e,t),jr(t,[e])}var wg=new WeakMap;function Pn(e,t){if(typeof e=="object"&&e!==null){var n=wg.get(e);return n!==void 0?n:(t={value:e,source:t,stack:lg(t)},wg.set(e,t),t)}return{value:e,source:t,stack:lg(t)}}var Ln=[],Zr=0,Qm=0;function Ju(){for(var e=Zr,t=Qm=Zr=0;t<e;){var n=Ln[t];Ln[t++]=null;var a=Ln[t];Ln[t++]=null;var r=Ln[t];Ln[t++]=null;var l=Ln[t];if(Ln[t++]=null,a!==null&&r!==null){var i=a.pending;i===null?r.next=r:(r.next=i.next,i.next=r),a.pending=r}l!==0&&Bj(n,r,l)}}function ed(e,t,n,a){Ln[Zr++]=e,Ln[Zr++]=t,Ln[Zr++]=n,Ln[Zr++]=a,Qm|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Wm(e,t,n,a){return ed(e,t,n,a),tu(e)}function Ll(e,t){return ed(e,null,null,t),tu(e)}function Bj(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var r=!1,l=e.return;l!==null;)l.childLanes|=n,a=l.alternate,a!==null&&(a.childLanes|=n),l.tag===22&&(e=l.stateNode,e===null||e._visibility&1||(r=!0)),e=l,l=l.return;return e.tag===3?(l=e.stateNode,r&&t!==null&&(r=31-Tn(n),e=l.hiddenUpdates,a=e[r],a===null?e[r]=[t]:a.push(t),t.lane=n|536870912),l):null}function tu(e){if(50<Bi)throw Bi=0,qh=null,Error(ee(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Jr={};function H2(e,t,n,a){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=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cn(e,t,n,a){return new H2(e,t,n,a)}function Zm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ws(e,t){var n=e.alternate;return n===null?(n=Cn(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 Hj(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 Mc(e,t,n,a,r,l){var i=0;if(a=e,typeof e=="function")Zm(e)&&(i=1);else if(typeof e=="string")i=PC(e,n,Ns.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case uh:return e=Cn(31,n,t,r),e.elementType=uh,e.lanes=l,e;case Vr:return sr(n.children,r,l,t);case rj:i=8,r|=24;break;case ih:return e=Cn(12,n,t,r|2),e.elementType=ih,e.lanes=l,e;case oh:return e=Cn(13,n,t,r),e.elementType=oh,e.lanes=l,e;case ch:return e=Cn(19,n,t,r),e.elementType=ch,e.lanes=l,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ES:case Ys:i=10;break e;case lj:i=9;break e;case Um:i=11;break e;case Bm:i=14;break e;case pa:i=16,a=null;break e}i=29,n=Error(ee(130,e===null?"null":typeof e,"")),a=null}return t=Cn(i,n,t,r),t.elementType=e,t.type=a,t.lanes=l,t}function sr(e,t,n,a){return e=Cn(7,e,a,t),e.lanes=n,e}function ff(e,t,n){return e=Cn(6,e,null,t),e.lanes=n,e}function hf(e,t,n){return t=Cn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var el=[],tl=0,nu=null,su=0,Bn=[],Hn=0,ar=null,Fs=1,Ks="";function Ja(e,t){el[tl++]=su,el[tl++]=nu,nu=e,su=t}function Ij(e,t,n){Bn[Hn++]=Fs,Bn[Hn++]=Ks,Bn[Hn++]=ar,ar=e;var a=Fs;e=Ks;var r=32-Tn(a)-1;a&=~(1<<r),n+=1;var l=32-Tn(t)+r;if(30<l){var i=r-r%5;l=(a&(1<<i)-1).toString(32),a>>=i,r-=i,Fs=1<<32-Tn(t)+r|n<<r|a,Ks=l+e}else Fs=1<<l|n<<r|a,Ks=e}function Jm(e){e.return!==null&&(Ja(e,1),Ij(e,1,0))}function ep(e){for(;e===nu;)nu=el[--tl],el[tl]=null,su=el[--tl],el[tl]=null;for(;e===ar;)ar=Bn[--Hn],Bn[Hn]=null,Ks=Bn[--Hn],Bn[Hn]=null,Fs=Bn[--Hn],Bn[Hn]=null}var Kt=null,ht=null,Ie=!1,rr=null,vs=!1,_h=Error(ee(519));function ur(e){var t=Error(ee(418,""));throw Ki(Pn(t,e)),_h}function _g(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[Vt]=e,t[fn]=a,n){case"dialog":De("cancel",t),De("close",t);break;case"iframe":case"object":case"embed":De("load",t);break;case"video":case"audio":for(n=0;n<Wi.length;n++)De(Wi[n],t);break;case"source":De("error",t);break;case"img":case"image":case"link":De("error",t),De("load",t);break;case"details":De("toggle",t);break;case"input":De("invalid",t),yj(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0),Jc(t);break;case"select":De("invalid",t);break;case"textarea":De("invalid",t),bj(t,a.value,a.defaultValue,a.children),Jc(t)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||ww(t.textContent,n)?(a.popover!=null&&(De("beforetoggle",t),De("toggle",t)),a.onScroll!=null&&De("scroll",t),a.onScrollEnd!=null&&De("scrollend",t),a.onClick!=null&&(t.onclick=od),t=!0):t=!1,t||ur(e)}function Ng(e){for(Kt=e.return;Kt;)switch(Kt.tag){case 5:case 13:vs=!1;return;case 27:case 3:vs=!0;return;default:Kt=Kt.return}}function li(e){if(e!==Kt)return!1;if(!Ie)return Ng(e),Ie=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Xh(e.type,e.memoizedProps)),n=!n),n&&ht&&ur(e),Ng(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(n=e.data,n==="/$"){if(t===0){ht=ss(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++;e=e.nextSibling}ht=null}}else t===27?(t=ht,qa(e.type)?(e=Zh,Zh=null,ht=e):ht=t):ht=Kt?ss(e.stateNode.nextSibling):null;return!0}function No(){ht=Kt=null,Ie=!1}function kg(){var e=rr;return e!==null&&(un===null?un=e:un.push.apply(un,e),rr=null),e}function Ki(e){rr===null?rr=[e]:rr.push(e)}var Nh=Ms(null),_r=null,Xs=null;function ga(e,t,n){it(Nh,t._currentValue),t._currentValue=n}function Zs(e){e._currentValue=Nh.current,Bt(Nh)}function kh(e,t,n){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===n)break;e=e.return}}function Sh(e,t,n,a){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var l=r.dependencies;if(l!==null){var i=r.child;l=l.firstContext;e:for(;l!==null;){var o=l;l=r;for(var c=0;c<t.length;c++)if(o.context===t[c]){l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),kh(l.return,n,e),a||(i=null);break e}l=o.next}}else if(r.tag===18){if(i=r.return,i===null)throw Error(ee(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),kh(i,n,e),i=null}else i=r.child;if(i!==null)i.return=r;else for(i=r;i!==null;){if(i===e){i=null;break}if(r=i.sibling,r!==null){r.return=i.return,i=r;break}i=i.return}r=i}}function ko(e,t,n,a){e=null;for(var r=t,l=!1;r!==null;){if(!l){if(r.flags&524288)l=!0;else if(r.flags&262144)break}if(r.tag===10){var i=r.alternate;if(i===null)throw Error(ee(387));if(i=i.memoizedProps,i!==null){var o=r.type;$n(r.pendingProps.value,i.value)||(e!==null?e.push(o):e=[o])}}else if(r===Xc.current){if(i=r.alternate,i===null)throw Error(ee(387));i.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(eo):e=[eo])}r=r.return}e!==null&&Sh(t,e,n,a),t.flags|=262144}function au(e){for(e=e.firstContext;e!==null;){if(!$n(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function dr(e){_r=e,Xs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return Pj(_r,e)}function nc(e,t){return _r===null&&dr(e),Pj(e,t)}function Pj(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Xs===null){if(e===null)throw Error(ee(308));Xs=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xs=Xs.next=t;return n}var I2=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},P2=Dt.unstable_scheduleCallback,q2=Dt.unstable_NormalPriority,$t={$$typeof:Ys,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tp(){return{controller:new I2,data:new Map,refCount:0}}function So(e){e.refCount--,e.refCount===0&&P2(q2,function(){e.controller.abort()})}var Ei=null,Ch=0,bl=0,il=null;function G2(e,t){if(Ei===null){var n=Ei=[];Ch=0,bl=Np(),il={status:"pending",value:void 0,then:function(a){n.push(a)}}}return Ch++,t.then(Sg,Sg),t}function Sg(){if(--Ch===0&&Ei!==null){il!==null&&(il.status="fulfilled");var e=Ei;Ei=null,bl=0,il=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function V2(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){for(a.status="rejected",a.reason=r,r=0;r<n.length;r++)(0,n[r])(void 0)}),a}var Cg=Ne.S;Ne.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&G2(e,t),Cg!==null&&Cg(e,t)};var lr=Ms(null);function np(){var e=lr.current;return e!==null?e:Je.pooledCache}function $c(e,t){t===null?it(lr,lr.current):it(lr,t.pool)}function qj(){var e=np();return e===null?null:{parent:$t._currentValue,pool:e}}var Co=Error(ee(460)),Gj=Error(ee(474)),td=Error(ee(542)),Rh={then:function(){}};function Rg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function sc(){}function Vj(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(sc,sc),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Eg(e),e;default:if(typeof t.status=="string")t.then(sc,sc);else{if(e=Je,e!==null&&100<e.shellSuspendCounter)throw Error(ee(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=a}},function(a){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Eg(e),e}throw Ai=t,Co}}var Ai=null;function Tg(){if(Ai===null)throw Error(ee(459));var e=Ai;return Ai=null,e}function Eg(e){if(e===Co||e===td)throw Error(ee(483))}var xa=!1;function sp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Th(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 Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,Fe&2){var r=a.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),a.pending=t,t=tu(e),Bj(e,null,n),t}return ed(e,a,t,n),tu(e)}function Mi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,hj(e,n)}}function mf(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var r=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};l===null?r=l=i:l=l.next=i,n=n.next}while(n!==null);l===null?r=l=t:l=l.next=t}else r=l=t;n={baseState:a.baseState,firstBaseUpdate:r,lastBaseUpdate:l,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Eh=!1;function $i(){if(Eh){var e=il;if(e!==null)throw e}}function Oi(e,t,n,a){Eh=!1;var r=e.updateQueue;xa=!1;var l=r.firstBaseUpdate,i=r.lastBaseUpdate,o=r.shared.pending;if(o!==null){r.shared.pending=null;var c=o,d=c.next;c.next=null,i===null?l=d:i.next=d,i=c;var f=e.alternate;f!==null&&(f=f.updateQueue,o=f.lastBaseUpdate,o!==i&&(o===null?f.firstBaseUpdate=d:o.next=d,f.lastBaseUpdate=c))}if(l!==null){var h=r.baseState;i=0,f=d=c=null,o=l;do{var m=o.lane&-536870913,x=m!==o.lane;if(x?(Le&m)===m:(a&m)===m){m!==0&&m===bl&&(Eh=!0),f!==null&&(f=f.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var b=e,v=o;m=t;var y=n;switch(v.tag){case 1:if(b=v.payload,typeof b=="function"){h=b.call(y,h,m);break e}h=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=v.payload,m=typeof b=="function"?b.call(y,h,m):b,m==null)break e;h=nt({},h,m);break e;case 2:xa=!0}}m=o.callback,m!==null&&(e.flags|=64,x&&(e.flags|=8192),x=r.callbacks,x===null?r.callbacks=[m]:x.push(m))}else x={lane:m,tag:o.tag,payload:o.payload,callback:o.callback,next:null},f===null?(d=f=x,c=h):f=f.next=x,i|=m;if(o=o.next,o===null){if(o=r.shared.pending,o===null)break;x=o,o=x.next,x.next=null,r.lastBaseUpdate=x,r.shared.pending=null}}while(!0);f===null&&(c=h),r.baseState=c,r.firstBaseUpdate=d,r.lastBaseUpdate=f,l===null&&(r.shared.lanes=0),Ua|=i,e.lanes=i,e.memoizedState=h}}function Yj(e,t){if(typeof e!="function")throw Error(ee(191,e));e.call(t)}function Fj(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Yj(n[e],t)}var wl=Ms(null),ru=Ms(0);function Ag(e,t){e=na,it(ru,e),it(wl,t),na=e|t.baseLanes}function Ah(){it(ru,na),it(wl,wl.current)}function ap(){na=ru.current,Bt(wl),Bt(ru)}var za=0,Ae=null,We=null,St=null,lu=!1,ol=!1,fr=!1,iu=0,Xi=0,cl=null,Y2=0;function vt(){throw Error(ee(321))}function rp(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!$n(e[n],t[n]))return!1;return!0}function lp(e,t,n,a,r,l){return za=l,Ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ne.H=e===null||e.memoizedState===null?Nb:kb,fr=!1,l=n(a,r),fr=!1,ol&&(l=Xj(t,n,a,r)),Kj(e),l}function Kj(e){Ne.H=ou;var t=We!==null&&We.next!==null;if(za=0,St=We=Ae=null,lu=!1,Xi=0,cl=null,t)throw Error(ee(300));e===null||Ut||(e=e.dependencies,e!==null&&au(e)&&(Ut=!0))}function Xj(e,t,n,a){Ae=e;var r=0;do{if(ol&&(cl=null),Xi=0,ol=!1,25<=r)throw Error(ee(301));if(r+=1,St=We=null,e.updateQueue!=null){var l=e.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,l.memoCache!=null&&(l.memoCache.index=0)}Ne.H=J2,l=t(n,a)}while(ol);return l}function F2(){var e=Ne.H,t=e.useState()[0];return t=typeof t.then=="function"?Ro(t):t,e=e.useState()[0],(We!==null?We.memoizedState:null)!==e&&(Ae.flags|=1024),t}function ip(){var e=iu!==0;return iu=0,e}function op(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function cp(e){if(lu){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lu=!1}za=0,St=We=Ae=null,ol=!1,Xi=iu=0,cl=null}function on(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?Ae.memoizedState=St=e:St=St.next=e,St}function Tt(){if(We===null){var e=Ae.alternate;e=e!==null?e.memoizedState:null}else e=We.next;var t=St===null?Ae.memoizedState:St.next;if(t!==null)St=t,We=e;else{if(e===null)throw Ae.alternate===null?Error(ee(467)):Error(ee(310));We=e,e={memoizedState:We.memoizedState,baseState:We.baseState,baseQueue:We.baseQueue,queue:We.queue,next:null},St===null?Ae.memoizedState=St=e:St=St.next=e}return St}function up(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ro(e){var t=Xi;return Xi+=1,cl===null&&(cl=[]),e=Vj(cl,e,t),t=Ae,(St===null?t.memoizedState:St.next)===null&&(t=t.alternate,Ne.H=t===null||t.memoizedState===null?Nb:kb),e}function nd(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ro(e);if(e.$$typeof===Ys)return Yt(e)}throw Error(ee(438,String(e)))}function dp(e){var t=null,n=Ae.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Ae.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=up(),Ae.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),a=0;a<e;a++)n[a]=AS;return t.index++,n}function ea(e,t){return typeof t=="function"?t(e):t}function Oc(e){var t=Tt();return fp(t,We,e)}function fp(e,t,n){var a=e.queue;if(a===null)throw Error(ee(311));a.lastRenderedReducer=n;var r=e.baseQueue,l=a.pending;if(l!==null){if(r!==null){var i=r.next;r.next=l.next,l.next=i}t.baseQueue=r=l,a.pending=null}if(l=e.baseState,r===null)e.memoizedState=l;else{t=r.next;var o=i=null,c=null,d=t,f=!1;do{var h=d.lane&-536870913;if(h!==d.lane?(Le&h)===h:(za&h)===h){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}),h===bl&&(f=!0);else if((za&m)===m){d=d.next,m===bl&&(f=!0);continue}else h={lane:0,revertLane:d.revertLane,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},c===null?(o=c=h,i=l):c=c.next=h,Ae.lanes|=m,Ua|=m;h=d.action,fr&&n(l,h),l=d.hasEagerState?d.eagerState:n(l,h)}else m={lane:h,revertLane:d.revertLane,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},c===null?(o=c=m,i=l):c=c.next=m,Ae.lanes|=h,Ua|=h;d=d.next}while(d!==null&&d!==t);if(c===null?i=l:c.next=o,!$n(l,e.memoizedState)&&(Ut=!0,f&&(n=il,n!==null)))throw n;e.memoizedState=l,e.baseState=i,e.baseQueue=c,a.lastRenderedState=l}return r===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function pf(e){var t=Tt(),n=t.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=e;var a=n.dispatch,r=n.pending,l=t.memoizedState;if(r!==null){n.pending=null;var i=r=r.next;do l=e(l,i.action),i=i.next;while(i!==r);$n(l,t.memoizedState)||(Ut=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,a]}function Qj(e,t,n){var a=Ae,r=Tt(),l=Ie;if(l){if(n===void 0)throw Error(ee(407));n=n()}else n=t();var i=!$n((We||r).memoizedState,n);i&&(r.memoizedState=n,Ut=!0),r=r.queue;var o=Jj.bind(null,a,r,e);if(To(2048,8,o,[e]),r.getSnapshot!==t||i||St!==null&&St.memoizedState.tag&1){if(a.flags|=2048,_l(9,sd(),Zj.bind(null,a,r,n,t),null),Je===null)throw Error(ee(349));l||za&124||Wj(a,t,n)}return n}function Wj(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ae.updateQueue,t===null?(t=up(),Ae.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Zj(e,t,n,a){t.value=n,t.getSnapshot=a,eb(t)&&tb(e)}function Jj(e,t,n){return n(function(){eb(t)&&tb(e)})}function eb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!$n(e,n)}catch{return!0}}function tb(e){var t=Ll(e,2);t!==null&&An(t,e,2)}function Mh(e){var t=on();if(typeof e=="function"){var n=e;if(e=n(),fr){ba(!0);try{n()}finally{ba(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:e},t}function nb(e,t,n,a){return e.baseState=n,fp(e,We,typeof a=="function"?a:ea)}function K2(e,t,n,a,r){if(ad(e))throw Error(ee(485));if(e=t.action,e!==null){var l={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){l.listeners.push(i)}};Ne.T!==null?n(!0):l.isTransition=!1,a(l),n=t.pending,n===null?(l.next=t.pending=l,sb(t,l)):(l.next=n.next,t.pending=n.next=l)}}function sb(e,t){var n=t.action,a=t.payload,r=e.state;if(t.isTransition){var l=Ne.T,i={};Ne.T=i;try{var o=n(r,a),c=Ne.S;c!==null&&c(i,o),Mg(e,t,o)}catch(d){$h(e,t,d)}finally{Ne.T=l}}else try{l=n(r,a),Mg(e,t,l)}catch(d){$h(e,t,d)}}function Mg(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){$g(e,t,a)},function(a){return $h(e,t,a)}):$g(e,t,n)}function $g(e,t,n){t.status="fulfilled",t.value=n,ab(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,sb(e,n)))}function $h(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,ab(t),t=t.next;while(t!==a)}e.action=null}function ab(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function rb(e,t){return t}function Og(e,t){if(Ie){var n=Je.formState;if(n!==null){e:{var a=Ae;if(Ie){if(ht){t:{for(var r=ht,l=vs;r.nodeType!==8;){if(!l){r=null;break t}if(r=ss(r.nextSibling),r===null){r=null;break t}}l=r.data,r=l==="F!"||l==="F"?r:null}if(r){ht=ss(r.nextSibling),a=r.data==="F!";break e}}ur(a)}a=!1}a&&(t=n[0])}}return n=on(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rb,lastRenderedState:t},n.queue=a,n=bb.bind(null,Ae,a),a.dispatch=n,a=Mh(!1),l=xp.bind(null,Ae,!1,a.queue),a=on(),r={state:t,dispatch:null,action:e,pending:null},a.queue=r,n=K2.bind(null,Ae,r,l,n),r.dispatch=n,a.memoizedState=e,[t,n,!1]}function Dg(e){var t=Tt();return lb(t,We,e)}function lb(e,t,n){if(t=fp(e,t,rb)[0],e=Oc(ea)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Ro(t)}catch(i){throw i===Co?td:i}else a=t;t=Tt();var r=t.queue,l=r.dispatch;return n!==t.memoizedState&&(Ae.flags|=2048,_l(9,sd(),X2.bind(null,r,n),null)),[a,l,e]}function X2(e,t){e.action=t}function zg(e){var t=Tt(),n=We;if(n!==null)return lb(t,n,e);Tt(),t=t.memoizedState,n=Tt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function _l(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Ae.updateQueue,t===null&&(t=up(),Ae.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(a=n.next,n.next=e,e.next=a,t.lastEffect=e),e}function sd(){return{destroy:void 0,resource:void 0}}function ib(){return Tt().memoizedState}function Dc(e,t,n,a){var r=on();a=a===void 0?null:a,Ae.flags|=e,r.memoizedState=_l(1|t,sd(),n,a)}function To(e,t,n,a){var r=Tt();a=a===void 0?null:a;var l=r.memoizedState.inst;We!==null&&a!==null&&rp(a,We.memoizedState.deps)?r.memoizedState=_l(t,l,n,a):(Ae.flags|=e,r.memoizedState=_l(1|t,l,n,a))}function Lg(e,t){Dc(8390656,8,e,t)}function ob(e,t){To(2048,8,e,t)}function cb(e,t){return To(4,2,e,t)}function ub(e,t){return To(4,4,e,t)}function db(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 fb(e,t,n){n=n!=null?n.concat([e]):null,To(4,4,db.bind(null,t,e),n)}function hp(){}function hb(e,t){var n=Tt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&rp(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function mb(e,t){var n=Tt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&rp(t,a[1]))return a[0];if(a=e(),fr){ba(!0);try{e()}finally{ba(!1)}}return n.memoizedState=[a,t],a}function mp(e,t,n){return n===void 0||za&1073741824?e.memoizedState=t:(e.memoizedState=n,e=aw(),Ae.lanes|=e,Ua|=e,n)}function pb(e,t,n,a){return $n(n,t)?n:wl.current!==null?(e=mp(e,n,a),$n(e,t)||(Ut=!0),e):za&42?(e=aw(),Ae.lanes|=e,Ua|=e,t):(Ut=!0,e.memoizedState=n)}function xb(e,t,n,a,r){var l=Pe.p;Pe.p=l!==0&&8>l?l:8;var i=Ne.T,o={};Ne.T=o,xp(e,!1,t,n);try{var c=r(),d=Ne.S;if(d!==null&&d(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=V2(c,a);Di(e,t,f,En(e))}else Di(e,t,a,En(e))}catch(h){Di(e,t,{then:function(){},status:"rejected",reason:h},En())}finally{Pe.p=l,Ne.T=i}}function Q2(){}function Oh(e,t,n,a){if(e.tag!==5)throw Error(ee(476));var r=gb(e).queue;xb(e,r,t,nr,n===null?Q2:function(){return vb(e),n(a)})}function gb(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:nr,baseState:nr,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:nr},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function vb(e){var t=gb(e).next.queue;Di(e,t,{},En())}function pp(){return Yt(eo)}function yb(){return Tt().memoizedState}function jb(){return Tt().memoizedState}function W2(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=En();e=Ra(n);var a=Ta(t,e,n);a!==null&&(An(a,t,n),Mi(a,t,n)),t={cache:tp()},e.payload=t;return}t=t.return}}function Z2(e,t,n){var a=En();n={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},ad(e)?wb(t,n):(n=Wm(e,t,n,a),n!==null&&(An(n,e,a),_b(n,t,a)))}function bb(e,t,n){var a=En();Di(e,t,n,a)}function Di(e,t,n,a){var r={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(ad(e))wb(t,r);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var i=t.lastRenderedState,o=l(i,n);if(r.hasEagerState=!0,r.eagerState=o,$n(o,i))return ed(e,t,r,0),Je===null&&Ju(),!1}catch{}finally{}if(n=Wm(e,t,r,a),n!==null)return An(n,e,a),_b(n,t,a),!0}return!1}function xp(e,t,n,a){if(a={lane:2,revertLane:Np(),action:a,hasEagerState:!1,eagerState:null,next:null},ad(e)){if(t)throw Error(ee(479))}else t=Wm(e,n,a,2),t!==null&&An(t,e,2)}function ad(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function wb(e,t){ol=lu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _b(e,t,n){if(n&4194048){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,hj(e,n)}}var ou={readContext:Yt,use:nd,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useLayoutEffect:vt,useInsertionEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useSyncExternalStore:vt,useId:vt,useHostTransitionStatus:vt,useFormState:vt,useActionState:vt,useOptimistic:vt,useMemoCache:vt,useCacheRefresh:vt},Nb={readContext:Yt,use:nd,useCallback:function(e,t){return on().memoizedState=[e,t===void 0?null:t],e},useContext:Yt,useEffect:Lg,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Dc(4194308,4,db.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Dc(4194308,4,e,t)},useInsertionEffect:function(e,t){Dc(4,2,e,t)},useMemo:function(e,t){var n=on();t=t===void 0?null:t;var a=e();if(fr){ba(!0);try{e()}finally{ba(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=on();if(n!==void 0){var r=n(t);if(fr){ba(!0);try{n(t)}finally{ba(!1)}}}else r=t;return a.memoizedState=a.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},a.queue=e,e=e.dispatch=Z2.bind(null,Ae,e),[a.memoizedState,e]},useRef:function(e){var t=on();return e={current:e},t.memoizedState=e},useState:function(e){e=Mh(e);var t=e.queue,n=bb.bind(null,Ae,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:hp,useDeferredValue:function(e,t){var n=on();return mp(n,e,t)},useTransition:function(){var e=Mh(!1);return e=xb.bind(null,Ae,e.queue,!0,!1),on().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Ae,r=on();if(Ie){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=t(),Je===null)throw Error(ee(349));Le&124||Wj(a,t,n)}r.memoizedState=n;var l={value:n,getSnapshot:t};return r.queue=l,Lg(Jj.bind(null,a,l,e),[e]),a.flags|=2048,_l(9,sd(),Zj.bind(null,a,l,n,t),null),n},useId:function(){var e=on(),t=Je.identifierPrefix;if(Ie){var n=Ks,a=Fs;n=(a&~(1<<32-Tn(a)-1)).toString(32)+n,t="«"+t+"R"+n,n=iu++,0<n&&(t+="H"+n.toString(32)),t+="»"}else n=Y2++,t="«"+t+"r"+n.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:pp,useFormState:Og,useActionState:Og,useOptimistic:function(e){var t=on();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=xp.bind(null,Ae,!0,n),n.dispatch=t,[e,t]},useMemoCache:dp,useCacheRefresh:function(){return on().memoizedState=W2.bind(null,Ae)}},kb={readContext:Yt,use:nd,useCallback:hb,useContext:Yt,useEffect:ob,useImperativeHandle:fb,useInsertionEffect:cb,useLayoutEffect:ub,useMemo:mb,useReducer:Oc,useRef:ib,useState:function(){return Oc(ea)},useDebugValue:hp,useDeferredValue:function(e,t){var n=Tt();return pb(n,We.memoizedState,e,t)},useTransition:function(){var e=Oc(ea)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Ro(e),t]},useSyncExternalStore:Qj,useId:yb,useHostTransitionStatus:pp,useFormState:Dg,useActionState:Dg,useOptimistic:function(e,t){var n=Tt();return nb(n,We,e,t)},useMemoCache:dp,useCacheRefresh:jb},J2={readContext:Yt,use:nd,useCallback:hb,useContext:Yt,useEffect:ob,useImperativeHandle:fb,useInsertionEffect:cb,useLayoutEffect:ub,useMemo:mb,useReducer:pf,useRef:ib,useState:function(){return pf(ea)},useDebugValue:hp,useDeferredValue:function(e,t){var n=Tt();return We===null?mp(n,e,t):pb(n,We.memoizedState,e,t)},useTransition:function(){var e=pf(ea)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Ro(e),t]},useSyncExternalStore:Qj,useId:yb,useHostTransitionStatus:pp,useFormState:zg,useActionState:zg,useOptimistic:function(e,t){var n=Tt();return We!==null?nb(n,We,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:dp,useCacheRefresh:jb},ul=null,Qi=0;function ac(e){var t=Qi;return Qi+=1,ul===null&&(ul=[]),Vj(ul,e,t)}function ii(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function rc(e,t){throw t.$$typeof===TS?Error(ee(525)):(e=Object.prototype.toString.call(t),Error(ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Ug(e){var t=e._init;return t(e._payload)}function Sb(e){function t(g,p){if(e){var j=g.deletions;j===null?(g.deletions=[p],g.flags|=16):j.push(p)}}function n(g,p){if(!e)return null;for(;p!==null;)t(g,p),p=p.sibling;return null}function a(g){for(var p=new Map;g!==null;)g.key!==null?p.set(g.key,g):p.set(g.index,g),g=g.sibling;return p}function r(g,p){return g=Ws(g,p),g.index=0,g.sibling=null,g}function l(g,p,j){return g.index=j,e?(j=g.alternate,j!==null?(j=j.index,j<p?(g.flags|=67108866,p):j):(g.flags|=67108866,p)):(g.flags|=1048576,p)}function i(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function o(g,p,j,w){return p===null||p.tag!==6?(p=ff(j,g.mode,w),p.return=g,p):(p=r(p,j),p.return=g,p)}function c(g,p,j,w){var N=j.type;return N===Vr?f(g,p,j.props.children,w,j.key):p!==null&&(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===pa&&Ug(N)===p.type)?(p=r(p,j.props),ii(p,j),p.return=g,p):(p=Mc(j.type,j.key,j.props,null,g.mode,w),ii(p,j),p.return=g,p)}function d(g,p,j,w){return p===null||p.tag!==4||p.stateNode.containerInfo!==j.containerInfo||p.stateNode.implementation!==j.implementation?(p=hf(j,g.mode,w),p.return=g,p):(p=r(p,j.children||[]),p.return=g,p)}function f(g,p,j,w,N){return p===null||p.tag!==7?(p=sr(j,g.mode,w,N),p.return=g,p):(p=r(p,j),p.return=g,p)}function h(g,p,j){if(typeof p=="string"&&p!==""||typeof p=="number"||typeof p=="bigint")return p=ff(""+p,g.mode,j),p.return=g,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Wo:return j=Mc(p.type,p.key,p.props,null,g.mode,j),ii(j,p),j.return=g,j;case pi:return p=hf(p,g.mode,j),p.return=g,p;case pa:var w=p._init;return p=w(p._payload),h(g,p,j)}if(xi(p)||si(p))return p=sr(p,g.mode,j,null),p.return=g,p;if(typeof p.then=="function")return h(g,ac(p),j);if(p.$$typeof===Ys)return h(g,nc(g,p),j);rc(g,p)}return null}function m(g,p,j,w){var N=p!==null?p.key:null;if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return N!==null?null:o(g,p,""+j,w);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Wo:return j.key===N?c(g,p,j,w):null;case pi:return j.key===N?d(g,p,j,w):null;case pa:return N=j._init,j=N(j._payload),m(g,p,j,w)}if(xi(j)||si(j))return N!==null?null:f(g,p,j,w,null);if(typeof j.then=="function")return m(g,p,ac(j),w);if(j.$$typeof===Ys)return m(g,p,nc(g,j),w);rc(g,j)}return null}function x(g,p,j,w,N){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return g=g.get(j)||null,o(p,g,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Wo:return g=g.get(w.key===null?j:w.key)||null,c(p,g,w,N);case pi:return g=g.get(w.key===null?j:w.key)||null,d(p,g,w,N);case pa:var C=w._init;return w=C(w._payload),x(g,p,j,w,N)}if(xi(w)||si(w))return g=g.get(j)||null,f(p,g,w,N,null);if(typeof w.then=="function")return x(g,p,j,ac(w),N);if(w.$$typeof===Ys)return x(g,p,j,nc(p,w),N);rc(p,w)}return null}function b(g,p,j,w){for(var N=null,C=null,_=p,S=p=0,D=null;_!==null&&S<j.length;S++){_.index>S?(D=_,_=null):D=_.sibling;var z=m(g,_,j[S],w);if(z===null){_===null&&(_=D);break}e&&_&&z.alternate===null&&t(g,_),p=l(z,p,S),C===null?N=z:C.sibling=z,C=z,_=D}if(S===j.length)return n(g,_),Ie&&Ja(g,S),N;if(_===null){for(;S<j.length;S++)_=h(g,j[S],w),_!==null&&(p=l(_,p,S),C===null?N=_:C.sibling=_,C=_);return Ie&&Ja(g,S),N}for(_=a(_);S<j.length;S++)D=x(_,g,S,j[S],w),D!==null&&(e&&D.alternate!==null&&_.delete(D.key===null?S:D.key),p=l(D,p,S),C===null?N=D:C.sibling=D,C=D);return e&&_.forEach(function(P){return t(g,P)}),Ie&&Ja(g,S),N}function v(g,p,j,w){if(j==null)throw Error(ee(151));for(var N=null,C=null,_=p,S=p=0,D=null,z=j.next();_!==null&&!z.done;S++,z=j.next()){_.index>S?(D=_,_=null):D=_.sibling;var P=m(g,_,z.value,w);if(P===null){_===null&&(_=D);break}e&&_&&P.alternate===null&&t(g,_),p=l(P,p,S),C===null?N=P:C.sibling=P,C=P,_=D}if(z.done)return n(g,_),Ie&&Ja(g,S),N;if(_===null){for(;!z.done;S++,z=j.next())z=h(g,z.value,w),z!==null&&(p=l(z,p,S),C===null?N=z:C.sibling=z,C=z);return Ie&&Ja(g,S),N}for(_=a(_);!z.done;S++,z=j.next())z=x(_,g,S,z.value,w),z!==null&&(e&&z.alternate!==null&&_.delete(z.key===null?S:z.key),p=l(z,p,S),C===null?N=z:C.sibling=z,C=z);return e&&_.forEach(function(F){return t(g,F)}),Ie&&Ja(g,S),N}function y(g,p,j,w){if(typeof j=="object"&&j!==null&&j.type===Vr&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case Wo:e:{for(var N=j.key;p!==null;){if(p.key===N){if(N=j.type,N===Vr){if(p.tag===7){n(g,p.sibling),w=r(p,j.props.children),w.return=g,g=w;break e}}else if(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===pa&&Ug(N)===p.type){n(g,p.sibling),w=r(p,j.props),ii(w,j),w.return=g,g=w;break e}n(g,p);break}else t(g,p);p=p.sibling}j.type===Vr?(w=sr(j.props.children,g.mode,w,j.key),w.return=g,g=w):(w=Mc(j.type,j.key,j.props,null,g.mode,w),ii(w,j),w.return=g,g=w)}return i(g);case pi:e:{for(N=j.key;p!==null;){if(p.key===N)if(p.tag===4&&p.stateNode.containerInfo===j.containerInfo&&p.stateNode.implementation===j.implementation){n(g,p.sibling),w=r(p,j.children||[]),w.return=g,g=w;break e}else{n(g,p);break}else t(g,p);p=p.sibling}w=hf(j,g.mode,w),w.return=g,g=w}return i(g);case pa:return N=j._init,j=N(j._payload),y(g,p,j,w)}if(xi(j))return b(g,p,j,w);if(si(j)){if(N=si(j),typeof N!="function")throw Error(ee(150));return j=N.call(j),v(g,p,j,w)}if(typeof j.then=="function")return y(g,p,ac(j),w);if(j.$$typeof===Ys)return y(g,p,nc(g,j),w);rc(g,j)}return typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint"?(j=""+j,p!==null&&p.tag===6?(n(g,p.sibling),w=r(p,j),w.return=g,g=w):(n(g,p),w=ff(j,g.mode,w),w.return=g,g=w),i(g)):n(g,p)}return function(g,p,j,w){try{Qi=0;var N=y(g,p,j,w);return ul=null,N}catch(_){if(_===Co||_===td)throw _;var C=Cn(29,_,null,g.mode);return C.lanes=w,C.return=g,C}finally{}}}var Nl=Sb(!0),Cb=Sb(!1),Kn=Ms(null),Ss=null;function va(e){var t=e.alternate;it(Ot,Ot.current&1),it(Kn,e),Ss===null&&(t===null||wl.current!==null||t.memoizedState!==null)&&(Ss=e)}function Rb(e){if(e.tag===22){if(it(Ot,Ot.current),it(Kn,e),Ss===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(Ss=e)}}else ya()}function ya(){it(Ot,Ot.current),it(Kn,Kn.current)}function Qs(e){Bt(Kn),Ss===e&&(Ss=null),Bt(Ot)}var Ot=Ms(0);function cu(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==="$?"||Wh(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 xf(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:nt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Dh={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=En(),r=Ra(a);r.payload=t,n!=null&&(r.callback=n),t=Ta(e,r,a),t!==null&&(An(t,e,a),Mi(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=En(),r=Ra(a);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=Ta(e,r,a),t!==null&&(An(t,e,a),Mi(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=En(),a=Ra(n);a.tag=2,t!=null&&(a.callback=t),t=Ta(e,a,n),t!==null&&(An(t,e,n),Mi(t,e,n))}};function Bg(e,t,n,a,r,l,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,l,i):t.prototype&&t.prototype.isPureReactComponent?!Fi(n,a)||!Fi(r,l):!0}function Hg(e,t,n,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&Dh.enqueueReplaceState(t,t.state,null)}function hr(e,t){var n=t;if("ref"in t){n={};for(var a in t)a!=="ref"&&(n[a]=t[a])}if(e=e.defaultProps){n===t&&(n=nt({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}var uu=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 Tb(e){uu(e)}function Eb(e){console.error(e)}function Ab(e){uu(e)}function du(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Ig(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function zh(e,t,n){return n=Ra(n),n.tag=3,n.payload={element:null},n.callback=function(){du(e,t)},n}function Mb(e){return e=Ra(e),e.tag=3,e}function $b(e,t,n,a){var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var l=a.value;e.payload=function(){return r(l)},e.callback=function(){Ig(t,n,a)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){Ig(t,n,a),typeof r!="function"&&(Ea===null?Ea=new Set([this]):Ea.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function eC(e,t,n,a,r){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&ko(t,n,r,!0),n=Kn.current,n!==null){switch(n.tag){case 13:return Ss===null?Gh():n.alternate===null&&mt===0&&(mt=3),n.flags&=-257,n.flags|=65536,n.lanes=r,a===Rh?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),Cf(e,a,r)),!1;case 22:return n.flags|=65536,a===Rh?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),Cf(e,a,r)),!1}throw Error(ee(435,n.tag))}return Cf(e,a,r),Gh(),!1}if(Ie)return t=Kn.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,a!==_h&&(e=Error(ee(422),{cause:a}),Ki(Pn(e,n)))):(a!==_h&&(t=Error(ee(423),{cause:a}),Ki(Pn(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,a=Pn(a,n),r=zh(e.stateNode,a,r),mf(e,r),mt!==4&&(mt=2)),!1;var l=Error(ee(520),{cause:a});if(l=Pn(l,n),Ui===null?Ui=[l]:Ui.push(l),mt!==4&&(mt=2),t===null)return!0;a=Pn(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=zh(n.stateNode,a,e),mf(n,e),!1;case 1:if(t=n.type,l=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||l!==null&&typeof l.componentDidCatch=="function"&&(Ea===null||!Ea.has(l))))return n.flags|=65536,r&=-r,n.lanes|=r,r=Mb(r),$b(r,e,n,a),mf(n,r),!1}n=n.return}while(n!==null);return!1}var Ob=Error(ee(461)),Ut=!1;function It(e,t,n,a){t.child=e===null?Cb(t,null,n,a):Nl(t,e.child,n,a)}function Pg(e,t,n,a,r){n=n.render;var l=t.ref;if("ref"in a){var i={};for(var o in a)o!=="ref"&&(i[o]=a[o])}else i=a;return dr(t),a=lp(e,t,n,i,l,r),o=ip(),e!==null&&!Ut?(op(e,t,r),ta(e,t,r)):(Ie&&o&&Jm(t),t.flags|=1,It(e,t,a,r),t.child)}function qg(e,t,n,a,r){if(e===null){var l=n.type;return typeof l=="function"&&!Zm(l)&&l.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=l,Db(e,t,l,a,r)):(e=Mc(n.type,null,a,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!gp(e,r)){var i=l.memoizedProps;if(n=n.compare,n=n!==null?n:Fi,n(i,a)&&e.ref===t.ref)return ta(e,t,r)}return t.flags|=1,e=Ws(l,a),e.ref=t.ref,e.return=t,t.child=e}function Db(e,t,n,a,r){if(e!==null){var l=e.memoizedProps;if(Fi(l,a)&&e.ref===t.ref)if(Ut=!1,t.pendingProps=a=l,gp(e,r))e.flags&131072&&(Ut=!0);else return t.lanes=e.lanes,ta(e,t,r)}return Lh(e,t,n,a,r)}function zb(e,t,n){var a=t.pendingProps,r=a.children,l=e!==null?e.memoizedState:null;if(a.mode==="hidden"){if(t.flags&128){if(a=l!==null?l.baseLanes|n:n,e!==null){for(r=t.child=e.child,l=0;r!==null;)l=l|r.lanes|r.childLanes,r=r.sibling;t.childLanes=l&~a}else t.childLanes=0,t.child=null;return Gg(e,t,a,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&$c(t,l!==null?l.cachePool:null),l!==null?Ag(t,l):Ah(),Rb(t);else return t.lanes=t.childLanes=536870912,Gg(e,t,l!==null?l.baseLanes|n:n,n)}else l!==null?($c(t,l.cachePool),Ag(t,l),ya(),t.memoizedState=null):(e!==null&&$c(t,null),Ah(),ya());return It(e,t,r,n),t.child}function Gg(e,t,n,a){var r=np();return r=r===null?null:{parent:$t._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&$c(t,null),Ah(),Rb(t),e!==null&&ko(e,t,a,!0),null}function zc(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(ee(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Lh(e,t,n,a,r){return dr(t),n=lp(e,t,n,a,void 0,r),a=ip(),e!==null&&!Ut?(op(e,t,r),ta(e,t,r)):(Ie&&a&&Jm(t),t.flags|=1,It(e,t,n,r),t.child)}function Vg(e,t,n,a,r,l){return dr(t),t.updateQueue=null,n=Xj(t,a,n,r),Kj(e),a=ip(),e!==null&&!Ut?(op(e,t,l),ta(e,t,l)):(Ie&&a&&Jm(t),t.flags|=1,It(e,t,n,l),t.child)}function Yg(e,t,n,a,r){if(dr(t),t.stateNode===null){var l=Jr,i=n.contextType;typeof i=="object"&&i!==null&&(l=Yt(i)),l=new n(a,l),t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Dh,t.stateNode=l,l._reactInternals=t,l=t.stateNode,l.props=a,l.state=t.memoizedState,l.refs={},sp(t),i=n.contextType,l.context=typeof i=="object"&&i!==null?Yt(i):Jr,l.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(xf(t,n,i,a),l.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(i=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),i!==l.state&&Dh.enqueueReplaceState(l,l.state,null),Oi(t,a,l,r),$i(),l.state=t.memoizedState),typeof l.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){l=t.stateNode;var o=t.memoizedProps,c=hr(n,o);l.props=c;var d=l.context,f=n.contextType;i=Jr,typeof f=="object"&&f!==null&&(i=Yt(f));var h=n.getDerivedStateFromProps;f=typeof h=="function"||typeof l.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,f||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(o||d!==i)&&Hg(t,l,a,i),xa=!1;var m=t.memoizedState;l.state=m,Oi(t,a,l,r),$i(),d=t.memoizedState,o||m!==d||xa?(typeof h=="function"&&(xf(t,n,h,a),d=t.memoizedState),(c=xa||Bg(t,n,c,a,m,d,i))?(f||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(t.flags|=4194308)):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=d),l.props=a,l.state=d,l.context=i,a=c):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{l=t.stateNode,Th(e,t),i=t.memoizedProps,f=hr(n,i),l.props=f,h=t.pendingProps,m=l.context,d=n.contextType,c=Jr,typeof d=="object"&&d!==null&&(c=Yt(d)),o=n.getDerivedStateFromProps,(d=typeof o=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(i!==h||m!==c)&&Hg(t,l,a,c),xa=!1,m=t.memoizedState,l.state=m,Oi(t,a,l,r),$i();var x=t.memoizedState;i!==h||m!==x||xa||e!==null&&e.dependencies!==null&&au(e.dependencies)?(typeof o=="function"&&(xf(t,n,o,a),x=t.memoizedState),(f=xa||Bg(t,n,f,a,m,x,c)||e!==null&&e.dependencies!==null&&au(e.dependencies))?(d||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(a,x,c),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(a,x,c)),typeof l.componentDidUpdate=="function"&&(t.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof l.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=x),l.props=a,l.state=x,l.context=c,a=f):(typeof l.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),a=!1)}return l=a,zc(e,t),a=(t.flags&128)!==0,l||a?(l=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:l.render(),t.flags|=1,e!==null&&a?(t.child=Nl(t,e.child,null,r),t.child=Nl(t,null,n,r)):It(e,t,n,r),t.memoizedState=l.state,e=t.child):e=ta(e,t,r),e}function Fg(e,t,n,a){return No(),t.flags|=256,It(e,t,n,a),t.child}var gf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vf(e){return{baseLanes:e,cachePool:qj()}}function yf(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=qn),e}function Lb(e,t,n){var a=t.pendingProps,r=!1,l=(t.flags&128)!==0,i;if((i=l)||(i=e!==null&&e.memoizedState===null?!1:(Ot.current&2)!==0),i&&(r=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ie){if(r?va(t):ya(),Ie){var o=ht,c;if(c=o){e:{for(c=o,o=vs;c.nodeType!==8;){if(!o){o=null;break e}if(c=ss(c.nextSibling),c===null){o=null;break e}}o=c}o!==null?(t.memoizedState={dehydrated:o,treeContext:ar!==null?{id:Fs,overflow:Ks}:null,retryLane:536870912,hydrationErrors:null},c=Cn(18,null,null,0),c.stateNode=o,c.return=t,t.child=c,Kt=t,ht=null,c=!0):c=!1}c||ur(t)}if(o=t.memoizedState,o!==null&&(o=o.dehydrated,o!==null))return Wh(o)?t.lanes=32:t.lanes=536870912,null;Qs(t)}return o=a.children,a=a.fallback,r?(ya(),r=t.mode,o=fu({mode:"hidden",children:o},r),a=sr(a,r,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,r=t.child,r.memoizedState=vf(n),r.childLanes=yf(e,i,n),t.memoizedState=gf,a):(va(t),Uh(t,o))}if(c=e.memoizedState,c!==null&&(o=c.dehydrated,o!==null)){if(l)t.flags&256?(va(t),t.flags&=-257,t=jf(e,t,n)):t.memoizedState!==null?(ya(),t.child=e.child,t.flags|=128,t=null):(ya(),r=a.fallback,o=t.mode,a=fu({mode:"visible",children:a.children},o),r=sr(r,o,n,null),r.flags|=2,a.return=t,r.return=t,a.sibling=r,t.child=a,Nl(t,e.child,null,n),a=t.child,a.memoizedState=vf(n),a.childLanes=yf(e,i,n),t.memoizedState=gf,t=r);else if(va(t),Wh(o)){if(i=o.nextSibling&&o.nextSibling.dataset,i)var d=i.dgst;i=d,a=Error(ee(419)),a.stack="",a.digest=i,Ki({value:a,source:null,stack:null}),t=jf(e,t,n)}else if(Ut||ko(e,t,n,!1),i=(n&e.childLanes)!==0,Ut||i){if(i=Je,i!==null&&(a=n&-n,a=a&42?1:Im(a),a=a&(i.suspendedLanes|n)?0:a,a!==0&&a!==c.retryLane))throw c.retryLane=a,Ll(e,a),An(i,e,a),Ob;o.data==="$?"||Gh(),t=jf(e,t,n)}else o.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,ht=ss(o.nextSibling),Kt=t,Ie=!0,rr=null,vs=!1,e!==null&&(Bn[Hn++]=Fs,Bn[Hn++]=Ks,Bn[Hn++]=ar,Fs=e.id,Ks=e.overflow,ar=t),t=Uh(t,a.children),t.flags|=4096);return t}return r?(ya(),r=a.fallback,o=t.mode,c=e.child,d=c.sibling,a=Ws(c,{mode:"hidden",children:a.children}),a.subtreeFlags=c.subtreeFlags&65011712,d!==null?r=Ws(d,r):(r=sr(r,o,n,null),r.flags|=2),r.return=t,a.return=t,a.sibling=r,t.child=a,a=r,r=t.child,o=e.child.memoizedState,o===null?o=vf(n):(c=o.cachePool,c!==null?(d=$t._currentValue,c=c.parent!==d?{parent:d,pool:d}:c):c=qj(),o={baseLanes:o.baseLanes|n,cachePool:c}),r.memoizedState=o,r.childLanes=yf(e,i,n),t.memoizedState=gf,a):(va(t),n=e.child,e=n.sibling,n=Ws(n,{mode:"visible",children:a.children}),n.return=t,n.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=n,t.memoizedState=null,n)}function Uh(e,t){return t=fu({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function fu(e,t){return e=Cn(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function jf(e,t,n){return Nl(t,e.child,null,n),e=Uh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Kg(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),kh(e.return,t,n)}function bf(e,t,n,a,r){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:r}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=a,l.tail=n,l.tailMode=r)}function Ub(e,t,n){var a=t.pendingProps,r=a.revealOrder,l=a.tail;if(It(e,t,a.children,n),a=Ot.current,a&2)a=a&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&&Kg(e,n,t);else if(e.tag===19)Kg(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}a&=1}switch(it(Ot,a),r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&cu(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),bf(t,!1,r,n,l);break;case"backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&cu(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}bf(t,!0,n,null,l);break;case"together":bf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ta(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ua|=t.lanes,!(n&t.childLanes))if(e!==null){if(ko(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(ee(153));if(t.child!==null){for(e=t.child,n=Ws(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ws(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function gp(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&au(e)))}function tC(e,t,n){switch(t.tag){case 3:Qc(t,t.stateNode.containerInfo),ga(t,$t,e.memoizedState.cache),No();break;case 27:case 5:hh(t);break;case 4:Qc(t,t.stateNode.containerInfo);break;case 10:ga(t,t.type,t.memoizedProps.value);break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(va(t),t.flags|=128,null):n&t.child.childLanes?Lb(e,t,n):(va(t),e=ta(e,t,n),e!==null?e.sibling:null);va(t);break;case 19:var r=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(ko(e,t,n,!1),a=(n&t.childLanes)!==0),r){if(a)return Ub(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),it(Ot,Ot.current),a)break;return null;case 22:case 23:return t.lanes=0,zb(e,t,n);case 24:ga(t,$t,e.memoizedState.cache)}return ta(e,t,n)}function Bb(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ut=!0;else{if(!gp(e,n)&&!(t.flags&128))return Ut=!1,tC(e,t,n);Ut=!!(e.flags&131072)}else Ut=!1,Ie&&t.flags&1048576&&Ij(t,su,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var a=t.elementType,r=a._init;if(a=r(a._payload),t.type=a,typeof a=="function")Zm(a)?(e=hr(a,e),t.tag=1,t=Yg(null,t,a,e,n)):(t.tag=0,t=Lh(null,t,a,e,n));else{if(a!=null){if(r=a.$$typeof,r===Um){t.tag=11,t=Pg(null,t,a,e,n);break e}else if(r===Bm){t.tag=14,t=qg(null,t,a,e,n);break e}}throw t=dh(a)||a,Error(ee(306,t,""))}}return t;case 0:return Lh(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,r=hr(a,t.pendingProps),Yg(e,t,a,r,n);case 3:e:{if(Qc(t,t.stateNode.containerInfo),e===null)throw Error(ee(387));a=t.pendingProps;var l=t.memoizedState;r=l.element,Th(e,t),Oi(t,a,null,n);var i=t.memoizedState;if(a=i.cache,ga(t,$t,a),a!==l.cache&&Sh(t,[$t],n,!0),$i(),a=i.element,l.isDehydrated)if(l={element:a,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){t=Fg(e,t,a,n);break e}else if(a!==r){r=Pn(Error(ee(424)),t),Ki(r),t=Fg(e,t,a,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(ht=ss(e.firstChild),Kt=t,Ie=!0,rr=null,vs=!0,n=Cb(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(No(),a===r){t=ta(e,t,n);break e}It(e,t,a,n)}t=t.child}return t;case 26:return zc(e,t),e===null?(n=dv(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ie||(n=t.type,e=t.pendingProps,a=yu(Ca.current).createElement(n),a[Vt]=t,a[fn]=e,qt(a,n,e),Lt(a),t.stateNode=a):t.memoizedState=dv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return hh(t),e===null&&Ie&&(a=t.stateNode=kw(t.type,t.pendingProps,Ca.current),Kt=t,vs=!0,r=ht,qa(t.type)?(Zh=r,ht=ss(a.firstChild)):ht=r),It(e,t,t.pendingProps.children,n),zc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ie&&((r=a=ht)&&(a=TC(a,t.type,t.pendingProps,vs),a!==null?(t.stateNode=a,Kt=t,ht=ss(a.firstChild),vs=!1,r=!0):r=!1),r||ur(t)),hh(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,Xh(r,l)?a=null:i!==null&&Xh(r,i)&&(t.flags|=32),t.memoizedState!==null&&(r=lp(e,t,F2,null,null,n),eo._currentValue=r),zc(e,t),It(e,t,a,n),t.child;case 6:return e===null&&Ie&&((e=n=ht)&&(n=EC(n,t.pendingProps,vs),n!==null?(t.stateNode=n,Kt=t,ht=null,e=!0):e=!1),e||ur(t)),null;case 13:return Lb(e,t,n);case 4:return Qc(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Nl(t,null,a,n):It(e,t,a,n),t.child;case 11:return Pg(e,t,t.type,t.pendingProps,n);case 7:return It(e,t,t.pendingProps,n),t.child;case 8:return It(e,t,t.pendingProps.children,n),t.child;case 12:return It(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,ga(t,t.type,a.value),It(e,t,a.children,n),t.child;case 9:return r=t.type._context,a=t.pendingProps.children,dr(t),r=Yt(r),a=a(r),t.flags|=1,It(e,t,a,n),t.child;case 14:return qg(e,t,t.type,t.pendingProps,n);case 15:return Db(e,t,t.type,t.pendingProps,n);case 19:return Ub(e,t,n);case 31:return a=t.pendingProps,n=t.mode,a={mode:a.mode,children:a.children},e===null?(n=fu(a,n),n.ref=t.ref,t.child=n,n.return=t,t=n):(n=Ws(e.child,a),n.ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return zb(e,t,n);case 24:return dr(t),a=Yt($t),e===null?(r=np(),r===null&&(r=Je,l=tp(),r.pooledCache=l,l.refCount++,l!==null&&(r.pooledCacheLanes|=n),r=l),t.memoizedState={parent:a,cache:r},sp(t),ga(t,$t,r)):(e.lanes&n&&(Th(e,t),Oi(t,null,null,n),$i()),r=e.memoizedState,l=t.memoizedState,r.parent!==a?(r={parent:a,cache:a},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),ga(t,$t,a)):(a=l.cache,ga(t,$t,a),a!==r.cache&&Sh(t,[$t],n,!0))),It(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(ee(156,t.tag))}function Bs(e){e.flags|=4}function Xg(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Rw(t)){if(t=Kn.current,t!==null&&((Le&4194048)===Le?Ss!==null:(Le&62914560)!==Le&&!(Le&536870912)||t!==Ss))throw Ai=Rh,Gj;e.flags|=8192}}function lc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?dj():536870912,e.lanes|=t,kl|=t)}function oi(e,t){if(!Ie)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 a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function ct(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,a|=r.subtreeFlags&65011712,a|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,a|=r.subtreeFlags,a|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function nC(e,t,n){var a=t.pendingProps;switch(ep(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(t),null;case 1:return ct(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Zs($t),vl(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(li(t)?Bs(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,kg())),ct(t),null;case 26:return n=t.memoizedState,e===null?(Bs(t),n!==null?(ct(t),Xg(t,n)):(ct(t),t.flags&=-16777217)):n?n!==e.memoizedState?(Bs(t),ct(t),Xg(t,n)):(ct(t),t.flags&=-16777217):(e.memoizedProps!==a&&Bs(t),ct(t),t.flags&=-16777217),null;case 27:Wc(t),n=Ca.current;var r=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Bs(t);else{if(!a){if(t.stateNode===null)throw Error(ee(166));return ct(t),null}e=Ns.current,li(t)?_g(t):(e=kw(r,a,n),t.stateNode=e,Bs(t))}return ct(t),null;case 5:if(Wc(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Bs(t);else{if(!a){if(t.stateNode===null)throw Error(ee(166));return ct(t),null}if(e=Ns.current,li(t))_g(t);else{switch(r=yu(Ca.current),e){case 1:e=r.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=r.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=r.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=r.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":e=r.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof a.is=="string"?r.createElement("select",{is:a.is}):r.createElement("select"),a.multiple?e.multiple=!0:a.size&&(e.size=a.size);break;default:e=typeof a.is=="string"?r.createElement(n,{is:a.is}):r.createElement(n)}}e[Vt]=t,e[fn]=a;e:for(r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.tag!==27&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}t.stateNode=e;e:switch(qt(e,n,a),n){case"button":case"input":case"select":case"textarea":e=!!a.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&Bs(t)}}return ct(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Bs(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(ee(166));if(e=Ca.current,li(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,r=Kt,r!==null)switch(r.tag){case 27:case 5:a=r.memoizedProps}e[Vt]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||ww(e.nodeValue,n)),e||ur(t)}else e=yu(e).createTextNode(a),e[Vt]=t,t.stateNode=e}return ct(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=li(t),a!==null&&a.dehydrated!==null){if(e===null){if(!r)throw Error(ee(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(ee(317));r[Vt]=t}else No(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ct(t),r=!1}else r=kg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Qs(t),t):(Qs(t),null)}if(Qs(t),t.flags&128)return t.lanes=n,t;if(n=a!==null,e=e!==null&&e.memoizedState!==null,n){a=t.child,r=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(r=a.alternate.memoizedState.cachePool.pool);var l=null;a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),l!==r&&(a.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),lc(t,t.updateQueue),ct(t),null;case 4:return vl(),e===null&&kp(t.stateNode.containerInfo),ct(t),null;case 10:return Zs(t.type),ct(t),null;case 19:if(Bt(Ot),r=t.memoizedState,r===null)return ct(t),null;if(a=(t.flags&128)!==0,l=r.rendering,l===null)if(a)oi(r,!1);else{if(mt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=cu(e),l!==null){for(t.flags|=128,oi(r,!1),e=l.updateQueue,t.updateQueue=e,lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Hj(n,e),n=n.sibling;return it(Ot,Ot.current&1|2),t.child}e=e.sibling}r.tail!==null&&ks()>mu&&(t.flags|=128,a=!0,oi(r,!1),t.lanes=4194304)}else{if(!a)if(e=cu(l),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,lc(t,e),oi(r,!0),r.tail===null&&r.tailMode==="hidden"&&!l.alternate&&!Ie)return ct(t),null}else 2*ks()-r.renderingStartTime>mu&&n!==536870912&&(t.flags|=128,a=!0,oi(r,!1),t.lanes=4194304);r.isBackwards?(l.sibling=t.child,t.child=l):(e=r.last,e!==null?e.sibling=l:t.child=l,r.last=l)}return r.tail!==null?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=ks(),t.sibling=null,e=Ot.current,it(Ot,a?e&1|2:e&1),t):(ct(t),null);case 22:case 23:return Qs(t),ap(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?n&536870912&&!(t.flags&128)&&(ct(t),t.subtreeFlags&6&&(t.flags|=8192)):ct(t),n=t.updateQueue,n!==null&&lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&Bt(lr),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Zs($t),ct(t),null;case 25:return null;case 30:return null}throw Error(ee(156,t.tag))}function sC(e,t){switch(ep(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zs($t),vl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Wc(t),null;case 13:if(Qs(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));No()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Bt(Ot),null;case 4:return vl(),null;case 10:return Zs(t.type),null;case 22:case 23:return Qs(t),ap(),e!==null&&Bt(lr),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zs($t),null;case 25:return null;default:return null}}function Hb(e,t){switch(ep(t),t.tag){case 3:Zs($t),vl();break;case 26:case 27:case 5:Wc(t);break;case 4:vl();break;case 13:Qs(t);break;case 19:Bt(Ot);break;case 10:Zs(t.type);break;case 22:case 23:Qs(t),ap(),e!==null&&Bt(lr);break;case 24:Zs($t)}}function Eo(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var r=a.next;n=r;do{if((n.tag&e)===e){a=void 0;var l=n.create,i=n.inst;a=l(),i.destroy=a}n=n.next}while(n!==r)}}catch(o){Ze(t,t.return,o)}}function La(e,t,n){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var l=r.next;a=l;do{if((a.tag&e)===e){var i=a.inst,o=i.destroy;if(o!==void 0){i.destroy=void 0,r=t;var c=n,d=o;try{d()}catch(f){Ze(r,c,f)}}}a=a.next}while(a!==l)}}catch(f){Ze(t,t.return,f)}}function Ib(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Fj(t,n)}catch(a){Ze(e,e.return,a)}}}function Pb(e,t,n){n.props=hr(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){Ze(e,t,a)}}function zi(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(r){Ze(e,t,r)}}function bs(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(r){Ze(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){Ze(e,t,r)}else n.current=null}function qb(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(r){Ze(e,e.return,r)}}function wf(e,t,n){try{var a=e.stateNode;NC(a,e.type,n,t),a[fn]=t}catch(r){Ze(e,e.return,r)}}function Gb(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&qa(e.type)||e.tag===4}function _f(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gb(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&&qa(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 Bh(e,t,n){var a=e.tag;if(a===5||a===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=od));else if(a!==4&&(a===27&&qa(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Bh(e,t,n),e=e.sibling;e!==null;)Bh(e,t,n),e=e.sibling}function hu(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(a!==4&&(a===27&&qa(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(hu(e,t,n),e=e.sibling;e!==null;)hu(e,t,n),e=e.sibling}function Vb(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);qt(t,a,n),t[Vt]=e,t[fn]=n}catch(l){Ze(e,e.return,l)}}var Vs=!1,yt=!1,Nf=!1,Qg=typeof WeakSet=="function"?WeakSet:Set,zt=null;function aC(e,t){if(e=e.containerInfo,Fh=_u,e=Mj(e),Xm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var a=n.getSelection&&n.getSelection();if(a&&a.rangeCount!==0){n=a.anchorNode;var r=a.anchorOffset,l=a.focusNode;a=a.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var i=0,o=-1,c=-1,d=0,f=0,h=e,m=null;t:for(;;){for(var x;h!==n||r!==0&&h.nodeType!==3||(o=i+r),h!==l||a!==0&&h.nodeType!==3||(c=i+a),h.nodeType===3&&(i+=h.nodeValue.length),(x=h.firstChild)!==null;)m=h,h=x;for(;;){if(h===e)break t;if(m===n&&++d===r&&(o=i),m===l&&++f===a&&(c=i),(x=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=x}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Kh={focusedElem:e,selectionRange:n},_u=!1,zt=t;zt!==null;)if(t=zt,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,zt=e;else for(;zt!==null;){switch(t=zt,l=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if(e&1024&&l!==null){e=void 0,n=t,r=l.memoizedProps,l=l.memoizedState,a=n.stateNode;try{var b=hr(n.type,r,n.elementType===n.type);e=a.getSnapshotBeforeUpdate(b,l),a.__reactInternalSnapshotBeforeUpdate=e}catch(v){Ze(n,n.return,v)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Qh(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Qh(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(ee(163))}if(e=t.sibling,e!==null){e.return=t.return,zt=e;break}zt=t.return}}function Yb(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:ca(e,n),a&4&&Eo(5,n);break;case 1:if(ca(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){Ze(n,n.return,i)}else{var r=hr(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){Ze(n,n.return,i)}}a&64&&Ib(n),a&512&&zi(n,n.return);break;case 3:if(ca(e,n),a&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{Fj(e,t)}catch(i){Ze(n,n.return,i)}}break;case 27:t===null&&a&4&&Vb(n);case 26:case 5:ca(e,n),t===null&&a&4&&qb(n),a&512&&zi(n,n.return);break;case 12:ca(e,n);break;case 13:ca(e,n),a&4&&Xb(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=hC.bind(null,n),AC(e,n))));break;case 22:if(a=n.memoizedState!==null||Vs,!a){t=t!==null&&t.memoizedState!==null||yt,r=Vs;var l=yt;Vs=a,(yt=t)&&!l?ha(e,n,(n.subtreeFlags&8772)!==0):ca(e,n),Vs=r,yt=l}break;case 30:break;default:ca(e,n)}}function Fb(e){var t=e.alternate;t!==null&&(e.alternate=null,Fb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&qm(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 rt=null,cn=!1;function Hs(e,t,n){for(n=n.child;n!==null;)Kb(e,t,n),n=n.sibling}function Kb(e,t,n){if(Rn&&typeof Rn.onCommitFiberUnmount=="function")try{Rn.onCommitFiberUnmount(yo,n)}catch{}switch(n.tag){case 26:yt||bs(n,t),Hs(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:yt||bs(n,t);var a=rt,r=cn;qa(n.type)&&(rt=n.stateNode,cn=!1),Hs(e,t,n),Hi(n.stateNode),rt=a,cn=r;break;case 5:yt||bs(n,t);case 6:if(a=rt,r=cn,rt=null,Hs(e,t,n),rt=a,cn=r,rt!==null)if(cn)try{(rt.nodeType===9?rt.body:rt.nodeName==="HTML"?rt.ownerDocument.body:rt).removeChild(n.stateNode)}catch(l){Ze(n,t,l)}else try{rt.removeChild(n.stateNode)}catch(l){Ze(n,t,l)}break;case 18:rt!==null&&(cn?(e=rt,ov(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),so(e)):ov(rt,n.stateNode));break;case 4:a=rt,r=cn,rt=n.stateNode.containerInfo,cn=!0,Hs(e,t,n),rt=a,cn=r;break;case 0:case 11:case 14:case 15:yt||La(2,n,t),yt||La(4,n,t),Hs(e,t,n);break;case 1:yt||(bs(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&Pb(n,t,a)),Hs(e,t,n);break;case 21:Hs(e,t,n);break;case 22:yt=(a=yt)||n.memoizedState!==null,Hs(e,t,n),yt=a;break;default:Hs(e,t,n)}}function Xb(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{so(e)}catch(n){Ze(t,t.return,n)}}function rC(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Qg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Qg),t;default:throw Error(ee(435,e.tag))}}function kf(e,t){var n=rC(e);t.forEach(function(a){var r=mC.bind(null,e,a);n.has(a)||(n.add(a),a.then(r,r))})}function wn(e,t){var n=t.deletions;if(n!==null)for(var a=0;a<n.length;a++){var r=n[a],l=e,i=t,o=i;e:for(;o!==null;){switch(o.tag){case 27:if(qa(o.type)){rt=o.stateNode,cn=!1;break e}break;case 5:rt=o.stateNode,cn=!1;break e;case 3:case 4:rt=o.stateNode.containerInfo,cn=!0;break e}o=o.return}if(rt===null)throw Error(ee(160));Kb(l,i,r),rt=null,cn=!1,l=r.alternate,l!==null&&(l.return=null),r.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)Qb(t,e),t=t.sibling}var Jn=null;function Qb(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:wn(t,e),_n(e),a&4&&(La(3,e,e.return),Eo(3,e),La(5,e,e.return));break;case 1:wn(t,e),_n(e),a&512&&(yt||n===null||bs(n,n.return)),a&64&&Vs&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?a:n.concat(a))));break;case 26:var r=Jn;if(wn(t,e),_n(e),a&512&&(yt||n===null||bs(n,n.return)),a&4){var l=n!==null?n.memoizedState:null;if(a=e.memoizedState,n===null)if(a===null)if(e.stateNode===null){e:{a=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(a){case"title":l=r.getElementsByTagName("title")[0],(!l||l[wo]||l[Vt]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=r.createElement(a),r.head.insertBefore(l,r.querySelector("head > title"))),qt(l,a,n),l[Vt]=e,Lt(l),a=l;break e;case"link":var i=hv("link","href",r).get(a+(n.href||""));if(i){for(var o=0;o<i.length;o++)if(l=i[o],l.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&l.getAttribute("rel")===(n.rel==null?null:n.rel)&&l.getAttribute("title")===(n.title==null?null:n.title)&&l.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){i.splice(o,1);break t}}l=r.createElement(a),qt(l,a,n),r.head.appendChild(l);break;case"meta":if(i=hv("meta","content",r).get(a+(n.content||""))){for(o=0;o<i.length;o++)if(l=i[o],l.getAttribute("content")===(n.content==null?null:""+n.content)&&l.getAttribute("name")===(n.name==null?null:n.name)&&l.getAttribute("property")===(n.property==null?null:n.property)&&l.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&l.getAttribute("charset")===(n.charSet==null?null:n.charSet)){i.splice(o,1);break t}}l=r.createElement(a),qt(l,a,n),r.head.appendChild(l);break;default:throw Error(ee(468,a))}l[Vt]=e,Lt(l),a=l}e.stateNode=a}else mv(r,e.type,e.stateNode);else e.stateNode=fv(r,a,e.memoizedProps);else l!==a?(l===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):l.count--,a===null?mv(r,e.type,e.stateNode):fv(r,a,e.memoizedProps)):a===null&&e.stateNode!==null&&wf(e,e.memoizedProps,n.memoizedProps)}break;case 27:wn(t,e),_n(e),a&512&&(yt||n===null||bs(n,n.return)),n!==null&&a&4&&wf(e,e.memoizedProps,n.memoizedProps);break;case 5:if(wn(t,e),_n(e),a&512&&(yt||n===null||bs(n,n.return)),e.flags&32){r=e.stateNode;try{jl(r,"")}catch(x){Ze(e,e.return,x)}}a&4&&e.stateNode!=null&&(r=e.memoizedProps,wf(e,r,n!==null?n.memoizedProps:r)),a&1024&&(Nf=!0);break;case 6:if(wn(t,e),_n(e),a&4){if(e.stateNode===null)throw Error(ee(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(x){Ze(e,e.return,x)}}break;case 3:if(Bc=null,r=Jn,Jn=ju(t.containerInfo),wn(t,e),Jn=r,_n(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{so(t.containerInfo)}catch(x){Ze(e,e.return,x)}Nf&&(Nf=!1,Wb(e));break;case 4:a=Jn,Jn=ju(e.stateNode.containerInfo),wn(t,e),_n(e),Jn=a;break;case 12:wn(t,e),_n(e);break;case 13:wn(t,e),_n(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(wp=ks()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,kf(e,a)));break;case 22:r=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,d=Vs,f=yt;if(Vs=d||r,yt=f||c,wn(t,e),yt=f,Vs=d,_n(e),a&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||c||Vs||yt||er(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(l=c.stateNode,r)i=l.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none";else{o=c.stateNode;var h=c.memoizedProps.style,m=h!=null&&h.hasOwnProperty("display")?h.display:null;o.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(x){Ze(c,c.return,x)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=r?"":c.memoizedProps}catch(x){Ze(c,c.return,x)}}}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}a&4&&(a=e.updateQueue,a!==null&&(n=a.retryQueue,n!==null&&(a.retryQueue=null,kf(e,n))));break;case 19:wn(t,e),_n(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,kf(e,a)));break;case 30:break;case 21:break;default:wn(t,e),_n(e)}}function _n(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(Gb(a)){n=a;break}a=a.return}if(n==null)throw Error(ee(160));switch(n.tag){case 27:var r=n.stateNode,l=_f(e);hu(e,l,r);break;case 5:var i=n.stateNode;n.flags&32&&(jl(i,""),n.flags&=-33);var o=_f(e);hu(e,o,i);break;case 3:case 4:var c=n.stateNode.containerInfo,d=_f(e);Bh(e,d,c);break;default:throw Error(ee(161))}}catch(f){Ze(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Wb(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Wb(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ca(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Yb(e,t.alternate,t),t=t.sibling}function er(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:La(4,t,t.return),er(t);break;case 1:bs(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Pb(t,t.return,n),er(t);break;case 27:Hi(t.stateNode);case 26:case 5:bs(t,t.return),er(t);break;case 22:t.memoizedState===null&&er(t);break;case 30:er(t);break;default:er(t)}e=e.sibling}}function ha(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,r=e,l=t,i=l.flags;switch(l.tag){case 0:case 11:case 15:ha(r,l,n),Eo(4,l);break;case 1:if(ha(r,l,n),a=l,r=a.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(d){Ze(a,a.return,d)}if(a=l,r=a.updateQueue,r!==null){var o=a.stateNode;try{var c=r.shared.hiddenCallbacks;if(c!==null)for(r.shared.hiddenCallbacks=null,r=0;r<c.length;r++)Yj(c[r],o)}catch(d){Ze(a,a.return,d)}}n&&i&64&&Ib(l),zi(l,l.return);break;case 27:Vb(l);case 26:case 5:ha(r,l,n),n&&a===null&&i&4&&qb(l),zi(l,l.return);break;case 12:ha(r,l,n);break;case 13:ha(r,l,n),n&&i&4&&Xb(r,l);break;case 22:l.memoizedState===null&&ha(r,l,n),zi(l,l.return);break;case 30:break;default:ha(r,l,n)}t=t.sibling}}function vp(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&&So(n))}function yp(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&So(e))}function gs(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Zb(e,t,n,a),t=t.sibling}function Zb(e,t,n,a){var r=t.flags;switch(t.tag){case 0:case 11:case 15:gs(e,t,n,a),r&2048&&Eo(9,t);break;case 1:gs(e,t,n,a);break;case 3:gs(e,t,n,a),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&So(e)));break;case 12:if(r&2048){gs(e,t,n,a),e=t.stateNode;try{var l=t.memoizedProps,i=l.id,o=l.onPostCommit;typeof o=="function"&&o(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Ze(t,t.return,c)}}else gs(e,t,n,a);break;case 13:gs(e,t,n,a);break;case 23:break;case 22:l=t.stateNode,i=t.alternate,t.memoizedState!==null?l._visibility&2?gs(e,t,n,a):Li(e,t):l._visibility&2?gs(e,t,n,a):(l._visibility|=2,qr(e,t,n,a,(t.subtreeFlags&10256)!==0)),r&2048&&vp(i,t);break;case 24:gs(e,t,n,a),r&2048&&yp(t.alternate,t);break;default:gs(e,t,n,a)}}function qr(e,t,n,a,r){for(r=r&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var l=e,i=t,o=n,c=a,d=i.flags;switch(i.tag){case 0:case 11:case 15:qr(l,i,o,c,r),Eo(8,i);break;case 23:break;case 22:var f=i.stateNode;i.memoizedState!==null?f._visibility&2?qr(l,i,o,c,r):Li(l,i):(f._visibility|=2,qr(l,i,o,c,r)),r&&d&2048&&vp(i.alternate,i);break;case 24:qr(l,i,o,c,r),r&&d&2048&&yp(i.alternate,i);break;default:qr(l,i,o,c,r)}t=t.sibling}}function Li(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,r=a.flags;switch(a.tag){case 22:Li(n,a),r&2048&&vp(a.alternate,a);break;case 24:Li(n,a),r&2048&&yp(a.alternate,a);break;default:Li(n,a)}t=t.sibling}}var vi=8192;function Ar(e){if(e.subtreeFlags&vi)for(e=e.child;e!==null;)Jb(e),e=e.sibling}function Jb(e){switch(e.tag){case 26:Ar(e),e.flags&vi&&e.memoizedState!==null&&GC(Jn,e.memoizedState,e.memoizedProps);break;case 5:Ar(e);break;case 3:case 4:var t=Jn;Jn=ju(e.stateNode.containerInfo),Ar(e),Jn=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=vi,vi=16777216,Ar(e),vi=t):Ar(e));break;default:Ar(e)}}function ew(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 ci(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];zt=a,nw(a,e)}ew(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)tw(e),e=e.sibling}function tw(e){switch(e.tag){case 0:case 11:case 15:ci(e),e.flags&2048&&La(9,e,e.return);break;case 3:ci(e);break;case 12:ci(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Lc(e)):ci(e);break;default:ci(e)}}function Lc(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];zt=a,nw(a,e)}ew(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:La(8,t,t.return),Lc(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Lc(t));break;default:Lc(t)}e=e.sibling}}function nw(e,t){for(;zt!==null;){var n=zt;switch(n.tag){case 0:case 11:case 15:La(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var a=n.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:So(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,zt=a;else e:for(n=e;zt!==null;){a=zt;var r=a.sibling,l=a.return;if(Fb(a),a===n){zt=null;break e}if(r!==null){r.return=l,zt=r;break e}zt=l}}}var lC={getCacheForType:function(e){var t=Yt($t),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n}},iC=typeof WeakMap=="function"?WeakMap:Map,Fe=0,Je=null,ze=null,Le=0,Ye=0,kn=null,_a=!1,Ul=!1,jp=!1,na=0,mt=0,Ua=0,ir=0,bp=0,qn=0,kl=0,Ui=null,un=null,Hh=!1,wp=0,mu=1/0,pu=null,Ea=null,Pt=0,Aa=null,Sl=null,dl=0,Ih=0,Ph=null,sw=null,Bi=0,qh=null;function En(){if(Fe&2&&Le!==0)return Le&-Le;if(Ne.T!==null){var e=bl;return e!==0?e:Np()}return mj()}function aw(){qn===0&&(qn=!(Le&536870912)||Ie?uj():536870912);var e=Kn.current;return e!==null&&(e.flags|=32),qn}function An(e,t,n){(e===Je&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)&&(Cl(e,0),Na(e,Le,qn,!1)),bo(e,n),(!(Fe&2)||e!==Je)&&(e===Je&&(!(Fe&2)&&(ir|=n),mt===4&&Na(e,Le,qn,!1)),$s(e))}function rw(e,t,n){if(Fe&6)throw Error(ee(327));var a=!n&&(t&124)===0&&(t&e.expiredLanes)===0||jo(e,t),r=a?uC(e,t):Sf(e,t,!0),l=a;do{if(r===0){Ul&&!a&&Na(e,t,0,!1);break}else{if(n=e.current.alternate,l&&!oC(n)){r=Sf(e,t,!1),l=!1;continue}if(r===2){if(l=t,e.errorRecoveryDisabledLanes&l)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var o=e;r=Ui;var c=o.current.memoizedState.isDehydrated;if(c&&(Cl(o,i).flags|=256),i=Sf(o,i,!1),i!==2){if(jp&&!c){o.errorRecoveryDisabledLanes|=l,ir|=l,r=4;break e}l=un,un=r,l!==null&&(un===null?un=l:un.push.apply(un,l))}r=i}if(l=!1,r!==2)continue}}if(r===1){Cl(e,0),Na(e,t,0,!0);break}e:{switch(a=e,l=r,l){case 0:case 1:throw Error(ee(345));case 4:if((t&4194048)!==t)break;case 6:Na(a,t,qn,!_a);break e;case 2:un=null;break;case 3:case 5:break;default:throw Error(ee(329))}if((t&62914560)===t&&(r=wp+300-ks(),10<r)){if(Na(a,t,qn,!_a),Xu(a,0,!0)!==0)break e;a.timeoutHandle=Nw(Wg.bind(null,a,n,un,pu,Hh,t,qn,ir,kl,_a,l,2,-0,0),r);break e}Wg(a,n,un,pu,Hh,t,qn,ir,kl,_a,l,0,-0,0)}}break}while(!0);$s(e)}function Wg(e,t,n,a,r,l,i,o,c,d,f,h,m,x){if(e.timeoutHandle=-1,h=t.subtreeFlags,(h&8192||(h&16785408)===16785408)&&(Ji={stylesheets:null,count:0,unsuspend:qC},Jb(t),h=VC(),h!==null)){e.cancelPendingCommit=h(Jg.bind(null,e,t,l,n,a,r,i,o,c,f,1,m,x)),Na(e,l,i,!d);return}Jg(e,t,l,n,a,r,i,o,c)}function oC(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 a=0;a<n.length;a++){var r=n[a],l=r.getSnapshot;r=r.value;try{if(!$n(l(),r))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 Na(e,t,n,a){t&=~bp,t&=~ir,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var r=t;0<r;){var l=31-Tn(r),i=1<<l;a[l]=-1,r&=~i}n!==0&&fj(e,n,t)}function rd(){return Fe&6?!0:(Ao(0),!1)}function _p(){if(ze!==null){if(Ye===0)var e=ze.return;else e=ze,Xs=_r=null,cp(e),ul=null,Qi=0,e=ze;for(;e!==null;)Hb(e.alternate,e),e=e.return;ze=null}}function Cl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,SC(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),_p(),Je=e,ze=n=Ws(e.current,null),Le=t,Ye=0,kn=null,_a=!1,Ul=jo(e,t),jp=!1,kl=qn=bp=ir=Ua=mt=0,un=Ui=null,Hh=!1,t&8&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var r=31-Tn(a),l=1<<r;t|=e[r],a&=~l}return na=t,Ju(),n}function lw(e,t){Ae=null,Ne.H=ou,t===Co||t===td?(t=Tg(),Ye=3):t===Gj?(t=Tg(),Ye=4):Ye=t===Ob?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,kn=t,ze===null&&(mt=1,du(e,Pn(t,e.current)))}function iw(){var e=Ne.H;return Ne.H=ou,e===null?ou:e}function ow(){var e=Ne.A;return Ne.A=lC,e}function Gh(){mt=4,_a||(Le&4194048)!==Le&&Kn.current!==null||(Ul=!0),!(Ua&134217727)&&!(ir&134217727)||Je===null||Na(Je,Le,qn,!1)}function Sf(e,t,n){var a=Fe;Fe|=2;var r=iw(),l=ow();(Je!==e||Le!==t)&&(pu=null,Cl(e,t)),t=!1;var i=mt;e:do try{if(Ye!==0&&ze!==null){var o=ze,c=kn;switch(Ye){case 8:_p(),i=6;break e;case 3:case 2:case 9:case 6:Kn.current===null&&(t=!0);var d=Ye;if(Ye=0,kn=null,nl(e,o,c,d),n&&Ul){i=0;break e}break;default:d=Ye,Ye=0,kn=null,nl(e,o,c,d)}}cC(),i=mt;break}catch(f){lw(e,f)}while(!0);return t&&e.shellSuspendCounter++,Xs=_r=null,Fe=a,Ne.H=r,Ne.A=l,ze===null&&(Je=null,Le=0,Ju()),i}function cC(){for(;ze!==null;)cw(ze)}function uC(e,t){var n=Fe;Fe|=2;var a=iw(),r=ow();Je!==e||Le!==t?(pu=null,mu=ks()+500,Cl(e,t)):Ul=jo(e,t);e:do try{if(Ye!==0&&ze!==null){t=ze;var l=kn;t:switch(Ye){case 1:Ye=0,kn=null,nl(e,t,l,1);break;case 2:case 9:if(Rg(l)){Ye=0,kn=null,Zg(t);break}t=function(){Ye!==2&&Ye!==9||Je!==e||(Ye=7),$s(e)},l.then(t,t);break e;case 3:Ye=7;break e;case 4:Ye=5;break e;case 7:Rg(l)?(Ye=0,kn=null,Zg(t)):(Ye=0,kn=null,nl(e,t,l,7));break;case 5:var i=null;switch(ze.tag){case 26:i=ze.memoizedState;case 5:case 27:var o=ze;if(!i||Rw(i)){Ye=0,kn=null;var c=o.sibling;if(c!==null)ze=c;else{var d=o.return;d!==null?(ze=d,ld(d)):ze=null}break t}}Ye=0,kn=null,nl(e,t,l,5);break;case 6:Ye=0,kn=null,nl(e,t,l,6);break;case 8:_p(),mt=6;break e;default:throw Error(ee(462))}}dC();break}catch(f){lw(e,f)}while(!0);return Xs=_r=null,Ne.H=a,Ne.A=r,Fe=n,ze!==null?0:(Je=null,Le=0,Ju(),mt)}function dC(){for(;ze!==null&&!$S();)cw(ze)}function cw(e){var t=Bb(e.alternate,e,na);e.memoizedProps=e.pendingProps,t===null?ld(e):ze=t}function Zg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Vg(n,t,t.pendingProps,t.type,void 0,Le);break;case 11:t=Vg(n,t,t.pendingProps,t.type.render,t.ref,Le);break;case 5:cp(t);default:Hb(n,t),t=ze=Hj(t,na),t=Bb(n,t,na)}e.memoizedProps=e.pendingProps,t===null?ld(e):ze=t}function nl(e,t,n,a){Xs=_r=null,cp(t),ul=null,Qi=0;var r=t.return;try{if(eC(e,r,t,n,Le)){mt=1,du(e,Pn(n,e.current)),ze=null;return}}catch(l){if(r!==null)throw ze=r,l;mt=1,du(e,Pn(n,e.current)),ze=null;return}t.flags&32768?(Ie||a===1?e=!0:Ul||Le&536870912?e=!1:(_a=e=!0,(a===2||a===9||a===3||a===6)&&(a=Kn.current,a!==null&&a.tag===13&&(a.flags|=16384))),uw(t,e)):ld(t)}function ld(e){var t=e;do{if(t.flags&32768){uw(t,_a);return}e=t.return;var n=nC(t.alternate,t,na);if(n!==null){ze=n;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);mt===0&&(mt=5)}function uw(e,t){do{var n=sC(e.alternate,e);if(n!==null){n.flags&=32767,ze=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ze=e;return}ze=e=n}while(e!==null);mt=6,ze=null}function Jg(e,t,n,a,r,l,i,o,c){e.cancelPendingCommit=null;do id();while(Pt!==0);if(Fe&6)throw Error(ee(327));if(t!==null){if(t===e.current)throw Error(ee(177));if(l=t.lanes|t.childLanes,l|=Qm,qS(e,n,l,i,o,c),e===Je&&(ze=Je=null,Le=0),Sl=t,Aa=e,dl=n,Ih=l,Ph=r,sw=a,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,pC(Zc,function(){return pw(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,t.subtreeFlags&13878||a){a=Ne.T,Ne.T=null,r=Pe.p,Pe.p=2,i=Fe,Fe|=4;try{aC(e,t,n)}finally{Fe=i,Pe.p=r,Ne.T=a}}Pt=1,dw(),fw(),hw()}}function dw(){if(Pt===1){Pt=0;var e=Aa,t=Sl,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Ne.T,Ne.T=null;var a=Pe.p;Pe.p=2;var r=Fe;Fe|=4;try{Qb(t,e);var l=Kh,i=Mj(e.containerInfo),o=l.focusedElem,c=l.selectionRange;if(i!==o&&o&&o.ownerDocument&&Aj(o.ownerDocument.documentElement,o)){if(c!==null&&Xm(o)){var d=c.start,f=c.end;if(f===void 0&&(f=d),"selectionStart"in o)o.selectionStart=d,o.selectionEnd=Math.min(f,o.value.length);else{var h=o.ownerDocument||document,m=h&&h.defaultView||window;if(m.getSelection){var x=m.getSelection(),b=o.textContent.length,v=Math.min(c.start,b),y=c.end===void 0?v:Math.min(c.end,b);!x.extend&&v>y&&(i=y,y=v,v=i);var g=jg(o,v),p=jg(o,y);if(g&&p&&(x.rangeCount!==1||x.anchorNode!==g.node||x.anchorOffset!==g.offset||x.focusNode!==p.node||x.focusOffset!==p.offset)){var j=h.createRange();j.setStart(g.node,g.offset),x.removeAllRanges(),v>y?(x.addRange(j),x.extend(p.node,p.offset)):(j.setEnd(p.node,p.offset),x.addRange(j))}}}}for(h=[],x=o;x=x.parentNode;)x.nodeType===1&&h.push({element:x,left:x.scrollLeft,top:x.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<h.length;o++){var w=h[o];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}_u=!!Fh,Kh=Fh=null}finally{Fe=r,Pe.p=a,Ne.T=n}}e.current=t,Pt=2}}function fw(){if(Pt===2){Pt=0;var e=Aa,t=Sl,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Ne.T,Ne.T=null;var a=Pe.p;Pe.p=2;var r=Fe;Fe|=4;try{Yb(e,t.alternate,t)}finally{Fe=r,Pe.p=a,Ne.T=n}}Pt=3}}function hw(){if(Pt===4||Pt===3){Pt=0,OS();var e=Aa,t=Sl,n=dl,a=sw;t.subtreeFlags&10256||t.flags&10256?Pt=5:(Pt=0,Sl=Aa=null,mw(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Ea=null),Pm(n),t=t.stateNode,Rn&&typeof Rn.onCommitFiberRoot=="function")try{Rn.onCommitFiberRoot(yo,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=Ne.T,r=Pe.p,Pe.p=2,Ne.T=null;try{for(var l=e.onRecoverableError,i=0;i<a.length;i++){var o=a[i];l(o.value,{componentStack:o.stack})}}finally{Ne.T=t,Pe.p=r}}dl&3&&id(),$s(e),r=e.pendingLanes,n&4194090&&r&42?e===qh?Bi++:(Bi=0,qh=e):Bi=0,Ao(0)}}function mw(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,So(t)))}function id(e){return dw(),fw(),hw(),pw()}function pw(){if(Pt!==5)return!1;var e=Aa,t=Ih;Ih=0;var n=Pm(dl),a=Ne.T,r=Pe.p;try{Pe.p=32>n?32:n,Ne.T=null,n=Ph,Ph=null;var l=Aa,i=dl;if(Pt=0,Sl=Aa=null,dl=0,Fe&6)throw Error(ee(331));var o=Fe;if(Fe|=4,tw(l.current),Zb(l,l.current,i,n),Fe=o,Ao(0,!1),Rn&&typeof Rn.onPostCommitFiberRoot=="function")try{Rn.onPostCommitFiberRoot(yo,l)}catch{}return!0}finally{Pe.p=r,Ne.T=a,mw(e,t)}}function ev(e,t,n){t=Pn(n,t),t=zh(e.stateNode,t,2),e=Ta(e,t,2),e!==null&&(bo(e,2),$s(e))}function Ze(e,t,n){if(e.tag===3)ev(e,e,n);else for(;t!==null;){if(t.tag===3){ev(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ea===null||!Ea.has(a))){e=Pn(n,e),n=Mb(2),a=Ta(t,n,2),a!==null&&($b(n,a,t,e),bo(a,2),$s(a));break}}t=t.return}}function Cf(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new iC;var r=new Set;a.set(t,r)}else r=a.get(t),r===void 0&&(r=new Set,a.set(t,r));r.has(n)||(jp=!0,r.add(n),e=fC.bind(null,e,t,n),t.then(e,e))}function fC(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Je===e&&(Le&n)===n&&(mt===4||mt===3&&(Le&62914560)===Le&&300>ks()-wp?!(Fe&2)&&Cl(e,0):bp|=n,kl===Le&&(kl=0)),$s(e)}function xw(e,t){t===0&&(t=dj()),e=Ll(e,t),e!==null&&(bo(e,t),$s(e))}function hC(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),xw(e,n)}function mC(e,t){var n=0;switch(e.tag){case 13:var a=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(ee(314))}a!==null&&a.delete(t),xw(e,n)}function pC(e,t){return Hm(e,t)}var xu=null,Gr=null,Vh=!1,gu=!1,Rf=!1,or=0;function $s(e){e!==Gr&&e.next===null&&(Gr===null?xu=Gr=e:Gr=Gr.next=e),gu=!0,Vh||(Vh=!0,gC())}function Ao(e,t){if(!Rf&&gu){Rf=!0;do for(var n=!1,a=xu;a!==null;){if(e!==0){var r=a.pendingLanes;if(r===0)var l=0;else{var i=a.suspendedLanes,o=a.pingedLanes;l=(1<<31-Tn(42|e)+1)-1,l&=r&~(i&~o),l=l&201326741?l&201326741|1:l?l|2:0}l!==0&&(n=!0,tv(a,l))}else l=Le,l=Xu(a,a===Je?l:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),!(l&3)||jo(a,l)||(n=!0,tv(a,l));a=a.next}while(n);Rf=!1}}function xC(){gw()}function gw(){gu=Vh=!1;var e=0;or!==0&&(kC()&&(e=or),or=0);for(var t=ks(),n=null,a=xu;a!==null;){var r=a.next,l=vw(a,t);l===0?(a.next=null,n===null?xu=r:n.next=r,r===null&&(Gr=n)):(n=a,(e!==0||l&3)&&(gu=!0)),a=r}Ao(e)}function vw(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,r=e.expirationTimes,l=e.pendingLanes&-62914561;0<l;){var i=31-Tn(l),o=1<<i,c=r[i];c===-1?(!(o&n)||o&a)&&(r[i]=PS(o,t)):c<=t&&(e.expiredLanes|=o),l&=~o}if(t=Je,n=Le,n=Xu(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Jd(a),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||jo(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&Jd(a),Pm(n)){case 2:case 8:n=oj;break;case 32:n=Zc;break;case 268435456:n=cj;break;default:n=Zc}return a=yw.bind(null,e),n=Hm(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&Jd(a),e.callbackPriority=2,e.callbackNode=null,2}function yw(e,t){if(Pt!==0&&Pt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(id()&&e.callbackNode!==n)return null;var a=Le;return a=Xu(e,e===Je?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(rw(e,a,t),vw(e,ks()),e.callbackNode!=null&&e.callbackNode===n?yw.bind(null,e):null)}function tv(e,t){if(id())return null;rw(e,t,!0)}function gC(){CC(function(){Fe&6?Hm(ij,xC):gw()})}function Np(){return or===0&&(or=uj()),or}function nv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Tc(""+e)}function sv(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 vC(e,t,n,a,r){if(t==="submit"&&n&&n.stateNode===r){var l=nv((r[fn]||null).action),i=a.submitter;i&&(t=(t=i[fn]||null)?nv(t.formAction):i.getAttribute("formAction"),t!==null&&(l=t,i=null));var o=new Qu("action","action",null,a,r);e.push({event:o,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(or!==0){var c=i?sv(r,i):new FormData(r);Oh(n,{pending:!0,data:c,method:r.method,action:l},null,c)}}else typeof l=="function"&&(o.preventDefault(),c=i?sv(r,i):new FormData(r),Oh(n,{pending:!0,data:c,method:r.method,action:l},l,c))},currentTarget:r}]})}}for(var Tf=0;Tf<wh.length;Tf++){var Ef=wh[Tf],yC=Ef.toLowerCase(),jC=Ef[0].toUpperCase()+Ef.slice(1);us(yC,"on"+jC)}us(Oj,"onAnimationEnd");us(Dj,"onAnimationIteration");us(zj,"onAnimationStart");us("dblclick","onDoubleClick");us("focusin","onFocus");us("focusout","onBlur");us(L2,"onTransitionRun");us(U2,"onTransitionStart");us(B2,"onTransitionCancel");us(Lj,"onTransitionEnd");yl("onMouseEnter",["mouseout","mouseover"]);yl("onMouseLeave",["mouseout","mouseover"]);yl("onPointerEnter",["pointerout","pointerover"]);yl("onPointerLeave",["pointerout","pointerover"]);jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));jr("onBeforeInput",["compositionend","keypress","textInput","paste"]);jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Wi="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(" "),bC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Wi));function jw(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],r=a.event;a=a.listeners;e:{var l=void 0;if(t)for(var i=a.length-1;0<=i;i--){var o=a[i],c=o.instance,d=o.currentTarget;if(o=o.listener,c!==l&&r.isPropagationStopped())break e;l=o,r.currentTarget=d;try{l(r)}catch(f){uu(f)}r.currentTarget=null,l=c}else for(i=0;i<a.length;i++){if(o=a[i],c=o.instance,d=o.currentTarget,o=o.listener,c!==l&&r.isPropagationStopped())break e;l=o,r.currentTarget=d;try{l(r)}catch(f){uu(f)}r.currentTarget=null,l=c}}}}function De(e,t){var n=t[ph];n===void 0&&(n=t[ph]=new Set);var a=e+"__bubble";n.has(a)||(bw(t,e,2,!1),n.add(a))}function Af(e,t,n){var a=0;t&&(a|=4),bw(n,e,a,t)}var ic="_reactListening"+Math.random().toString(36).slice(2);function kp(e){if(!e[ic]){e[ic]=!0,pj.forEach(function(n){n!=="selectionchange"&&(bC.has(n)||Af(n,!1,e),Af(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ic]||(t[ic]=!0,Af("selectionchange",!1,t))}}function bw(e,t,n,a){switch($w(t)){case 2:var r=KC;break;case 8:r=XC;break;default:r=Tp}n=r.bind(null,t,n,e),r=void 0,!yh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),a?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function Mf(e,t,n,a,r){var l=a;if(!(t&1)&&!(t&2)&&a!==null)e:for(;;){if(a===null)return;var i=a.tag;if(i===3||i===4){var o=a.stateNode.containerInfo;if(o===r)break;if(i===4)for(i=a.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===r)return;i=i.return}for(;o!==null;){if(i=Fr(o),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){a=l=i;continue e}o=o.parentNode}}a=a.return}_j(function(){var d=l,f=Vm(n),h=[];e:{var m=Uj.get(e);if(m!==void 0){var x=Qu,b=e;switch(e){case"keypress":if(Ac(n)===0)break e;case"keydown":case"keyup":x=p2;break;case"focusin":b="focus",x=of;break;case"focusout":b="blur",x=of;break;case"beforeblur":case"afterblur":x=of;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":x=ug;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=s2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=v2;break;case Oj:case Dj:case zj:x=l2;break;case Lj:x=j2;break;case"scroll":case"scrollend":x=t2;break;case"wheel":x=w2;break;case"copy":case"cut":case"paste":x=o2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=fg;break;case"toggle":case"beforetoggle":x=N2}var v=(t&4)!==0,y=!v&&(e==="scroll"||e==="scrollend"),g=v?m!==null?m+"Capture":null:m;v=[];for(var p=d,j;p!==null;){var w=p;if(j=w.stateNode,w=w.tag,w!==5&&w!==26&&w!==27||j===null||g===null||(w=Vi(p,g),w!=null&&v.push(Zi(p,w,j))),y)break;p=p.return}0<v.length&&(m=new x(m,b,null,n,f),h.push({event:m,listeners:v}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",x=e==="mouseout"||e==="pointerout",m&&n!==vh&&(b=n.relatedTarget||n.fromElement)&&(Fr(b)||b[Dl]))break e;if((x||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,x?(b=n.relatedTarget||n.toElement,x=d,b=b?Fr(b):null,b!==null&&(y=vo(b),v=b.tag,b!==y||v!==5&&v!==27&&v!==6)&&(b=null)):(x=null,b=d),x!==b)){if(v=ug,w="onMouseLeave",g="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(v=fg,w="onPointerLeave",g="onPointerEnter",p="pointer"),y=x==null?m:gi(x),j=b==null?m:gi(b),m=new v(w,p+"leave",x,n,f),m.target=y,m.relatedTarget=j,w=null,Fr(f)===d&&(v=new v(g,p+"enter",b,n,f),v.target=j,v.relatedTarget=y,w=v),y=w,x&&b)t:{for(v=x,g=b,p=0,j=v;j;j=Mr(j))p++;for(j=0,w=g;w;w=Mr(w))j++;for(;0<p-j;)v=Mr(v),p--;for(;0<j-p;)g=Mr(g),j--;for(;p--;){if(v===g||g!==null&&v===g.alternate)break t;v=Mr(v),g=Mr(g)}v=null}else v=null;x!==null&&av(h,m,x,v,!1),b!==null&&y!==null&&av(h,y,b,v,!0)}}e:{if(m=d?gi(d):window,x=m.nodeName&&m.nodeName.toLowerCase(),x==="select"||x==="input"&&m.type==="file")var N=xg;else if(pg(m))if(Tj)N=O2;else{N=M2;var C=A2}else x=m.nodeName,!x||x.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?d&&Gm(d.elementType)&&(N=xg):N=$2;if(N&&(N=N(e,d))){Rj(h,N,n,f);break e}C&&C(e,m,d),e==="focusout"&&d&&m.type==="number"&&d.memoizedProps.value!=null&&gh(m,"number",m.value)}switch(C=d?gi(d):window,e){case"focusin":(pg(C)||C.contentEditable==="true")&&(Qr=C,jh=d,Ti=null);break;case"focusout":Ti=jh=Qr=null;break;case"mousedown":bh=!0;break;case"contextmenu":case"mouseup":case"dragend":bh=!1,bg(h,n,f);break;case"selectionchange":if(z2)break;case"keydown":case"keyup":bg(h,n,f)}var _;if(Km)e:{switch(e){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else Xr?Sj(e,n)&&(S="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&(kj&&n.locale!=="ko"&&(Xr||S!=="onCompositionStart"?S==="onCompositionEnd"&&Xr&&(_=Nj()):(wa=f,Ym="value"in wa?wa.value:wa.textContent,Xr=!0)),C=vu(d,S),0<C.length&&(S=new dg(S,e,null,n,f),h.push({event:S,listeners:C}),_?S.data=_:(_=Cj(n),_!==null&&(S.data=_)))),(_=S2?C2(e,n):R2(e,n))&&(S=vu(d,"onBeforeInput"),0<S.length&&(C=new dg("onBeforeInput","beforeinput",null,n,f),h.push({event:C,listeners:S}),C.data=_)),vC(h,e,d,n,f)}jw(h,t)})}function Zi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function vu(e,t){for(var n=t+"Capture",a=[];e!==null;){var r=e,l=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||l===null||(r=Vi(e,n),r!=null&&a.unshift(Zi(e,r,l)),r=Vi(e,t),r!=null&&a.push(Zi(e,r,l))),e.tag===3)return a;e=e.return}return[]}function Mr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function av(e,t,n,a,r){for(var l=t._reactName,i=[];n!==null&&n!==a;){var o=n,c=o.alternate,d=o.stateNode;if(o=o.tag,c!==null&&c===a)break;o!==5&&o!==26&&o!==27||d===null||(c=d,r?(d=Vi(n,l),d!=null&&i.unshift(Zi(n,d,c))):r||(d=Vi(n,l),d!=null&&i.push(Zi(n,d,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var wC=/\r\n?/g,_C=/\u0000|\uFFFD/g;function rv(e){return(typeof e=="string"?e:""+e).replace(wC,`
|
|
49
|
-
`).replace(_C,"")}function ww(e,t){return t=rv(t),rv(e)===t}function od(){}function Qe(e,t,n,a,r,l){switch(n){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||jl(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&jl(e,""+a);break;case"className":ec(e,"class",a);break;case"tabIndex":ec(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":ec(e,n,a);break;case"style":wj(e,a,l);break;case"data":if(t!=="object"){ec(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=Tc(""+a),e.setAttribute(n,a);break;case"action":case"formAction":if(typeof a=="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 l=="function"&&(n==="formAction"?(t!=="input"&&Qe(e,t,"name",r.name,r,null),Qe(e,t,"formEncType",r.formEncType,r,null),Qe(e,t,"formMethod",r.formMethod,r,null),Qe(e,t,"formTarget",r.formTarget,r,null)):(Qe(e,t,"encType",r.encType,r,null),Qe(e,t,"method",r.method,r,null),Qe(e,t,"target",r.target,r,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=Tc(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=od);break;case"onScroll":a!=null&&De("scroll",e);break;case"onScrollEnd":a!=null&&De("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(ee(61));if(n=a.__html,n!=null){if(r.children!=null)throw Error(ee(60));e.innerHTML=n}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}n=Tc(""+a),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":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""+a):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":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":a===!0?e.setAttribute(n,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(n,a):e.removeAttribute(n);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(n):e.setAttribute(n,a);break;case"popover":De("beforetoggle",e),De("toggle",e),Rc(e,"popover",a);break;case"xlinkActuate":Us(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Us(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Us(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Us(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Us(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Us(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Us(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Us(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Us(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Rc(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=JS.get(n)||n,Rc(e,n,a))}}function Yh(e,t,n,a,r,l){switch(n){case"style":wj(e,a,l);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(ee(61));if(n=a.__html,n!=null){if(r.children!=null)throw Error(ee(60));e.innerHTML=n}}break;case"children":typeof a=="string"?jl(e,a):(typeof a=="number"||typeof a=="bigint")&&jl(e,""+a);break;case"onScroll":a!=null&&De("scroll",e);break;case"onScrollEnd":a!=null&&De("scrollend",e);break;case"onClick":a!=null&&(e.onclick=od);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xj.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),l=e[fn]||null,l=l!=null?l[n]:null,typeof l=="function"&&e.removeEventListener(t,l,r),typeof a=="function")){typeof l!="function"&&l!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,a,r);break e}n in e?e[n]=a:a===!0?e.setAttribute(n,""):Rc(e,n,a)}}}function qt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var a=!1,r=!1,l;for(l in n)if(n.hasOwnProperty(l)){var i=n[l];if(i!=null)switch(l){case"src":a=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(ee(137,t));default:Qe(e,t,l,i,n,null)}}r&&Qe(e,t,"srcSet",n.srcSet,n,null),a&&Qe(e,t,"src",n.src,n,null);return;case"input":De("invalid",e);var o=l=i=r=null,c=null,d=null;for(a in n)if(n.hasOwnProperty(a)){var f=n[a];if(f!=null)switch(a){case"name":r=f;break;case"type":i=f;break;case"checked":c=f;break;case"defaultChecked":d=f;break;case"value":l=f;break;case"defaultValue":o=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(ee(137,t));break;default:Qe(e,t,a,f,n,null)}}yj(e,l,o,c,d,i,r,!1),Jc(e);return;case"select":De("invalid",e),a=i=l=null;for(r in n)if(n.hasOwnProperty(r)&&(o=n[r],o!=null))switch(r){case"value":l=o;break;case"defaultValue":i=o;break;case"multiple":a=o;default:Qe(e,t,r,o,n,null)}t=l,n=i,e.multiple=!!a,t!=null?rl(e,!!a,t,!1):n!=null&&rl(e,!!a,n,!0);return;case"textarea":De("invalid",e),l=r=a=null;for(i in n)if(n.hasOwnProperty(i)&&(o=n[i],o!=null))switch(i){case"value":a=o;break;case"defaultValue":r=o;break;case"children":l=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(ee(91));break;default:Qe(e,t,i,o,n,null)}bj(e,a,r,l),Jc(e);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(a=n[c],a!=null))switch(c){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:Qe(e,t,c,a,n,null)}return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(a=0;a<Wi.length;a++)De(Wi[a],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("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)&&(a=n[d],a!=null))switch(d){case"children":case"dangerouslySetInnerHTML":throw Error(ee(137,t));default:Qe(e,t,d,a,n,null)}return;default:if(Gm(t)){for(f in n)n.hasOwnProperty(f)&&(a=n[f],a!==void 0&&Yh(e,t,f,a,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(a=n[o],a!=null&&Qe(e,t,o,a,n,null))}function NC(e,t,n,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,l=null,i=null,o=null,c=null,d=null,f=null;for(x in n){var h=n[x];if(n.hasOwnProperty(x)&&h!=null)switch(x){case"checked":break;case"value":break;case"defaultValue":c=h;default:a.hasOwnProperty(x)||Qe(e,t,x,null,a,h)}}for(var m in a){var x=a[m];if(h=n[m],a.hasOwnProperty(m)&&(x!=null||h!=null))switch(m){case"type":l=x;break;case"name":r=x;break;case"checked":d=x;break;case"defaultChecked":f=x;break;case"value":i=x;break;case"defaultValue":o=x;break;case"children":case"dangerouslySetInnerHTML":if(x!=null)throw Error(ee(137,t));break;default:x!==h&&Qe(e,t,m,x,a,h)}}xh(e,i,o,c,d,f,l,r);return;case"select":x=i=o=m=null;for(l in n)if(c=n[l],n.hasOwnProperty(l)&&c!=null)switch(l){case"value":break;case"multiple":x=c;default:a.hasOwnProperty(l)||Qe(e,t,l,null,a,c)}for(r in a)if(l=a[r],c=n[r],a.hasOwnProperty(r)&&(l!=null||c!=null))switch(r){case"value":m=l;break;case"defaultValue":o=l;break;case"multiple":i=l;default:l!==c&&Qe(e,t,r,l,a,c)}t=o,n=i,a=x,m!=null?rl(e,!!n,m,!1):!!a!=!!n&&(t!=null?rl(e,!!n,t,!0):rl(e,!!n,n?[]:"",!1));return;case"textarea":x=m=null;for(o in n)if(r=n[o],n.hasOwnProperty(o)&&r!=null&&!a.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:Qe(e,t,o,null,a,r)}for(i in a)if(r=a[i],l=n[i],a.hasOwnProperty(i)&&(r!=null||l!=null))switch(i){case"value":m=r;break;case"defaultValue":x=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(ee(91));break;default:r!==l&&Qe(e,t,i,r,a,l)}jj(e,m,x);return;case"option":for(var b in n)if(m=n[b],n.hasOwnProperty(b)&&m!=null&&!a.hasOwnProperty(b))switch(b){case"selected":e.selected=!1;break;default:Qe(e,t,b,null,a,m)}for(c in a)if(m=a[c],x=n[c],a.hasOwnProperty(c)&&m!==x&&(m!=null||x!=null))switch(c){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Qe(e,t,c,m,a,x)}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 v in n)m=n[v],n.hasOwnProperty(v)&&m!=null&&!a.hasOwnProperty(v)&&Qe(e,t,v,null,a,m);for(d in a)if(m=a[d],x=n[d],a.hasOwnProperty(d)&&m!==x&&(m!=null||x!=null))switch(d){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(ee(137,t));break;default:Qe(e,t,d,m,a,x)}return;default:if(Gm(t)){for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!==void 0&&!a.hasOwnProperty(y)&&Yh(e,t,y,void 0,a,m);for(f in a)m=a[f],x=n[f],!a.hasOwnProperty(f)||m===x||m===void 0&&x===void 0||Yh(e,t,f,m,a,x);return}}for(var g in n)m=n[g],n.hasOwnProperty(g)&&m!=null&&!a.hasOwnProperty(g)&&Qe(e,t,g,null,a,m);for(h in a)m=a[h],x=n[h],!a.hasOwnProperty(h)||m===x||m==null&&x==null||Qe(e,t,h,m,a,x)}var Fh=null,Kh=null;function yu(e){return e.nodeType===9?e:e.ownerDocument}function lv(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 _w(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 Xh(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 $f=null;function kC(){var e=window.event;return e&&e.type==="popstate"?e===$f?!1:($f=e,!0):($f=null,!1)}var Nw=typeof setTimeout=="function"?setTimeout:void 0,SC=typeof clearTimeout=="function"?clearTimeout:void 0,iv=typeof Promise=="function"?Promise:void 0,CC=typeof queueMicrotask=="function"?queueMicrotask:typeof iv<"u"?function(e){return iv.resolve(null).then(e).catch(RC)}:Nw;function RC(e){setTimeout(function(){throw e})}function qa(e){return e==="head"}function ov(e,t){var n=t,a=0,r=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(0<a&&8>a){n=a;var i=e.ownerDocument;if(n&1&&Hi(i.documentElement),n&2&&Hi(i.body),n&4)for(n=i.head,Hi(n),i=n.firstChild;i;){var o=i.nextSibling,c=i.nodeName;i[wo]||c==="SCRIPT"||c==="STYLE"||c==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}if(r===0){e.removeChild(l),so(t);return}r--}else n==="$"||n==="$?"||n==="$!"?r++:a=n.charCodeAt(0)-48;else a=0;n=l}while(n);so(t)}function Qh(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":Qh(n),qm(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function TC(e,t,n,a){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[wo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(l=e.getAttribute("rel"),l==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(l!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(l=e.getAttribute("src"),(l!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&l&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var l=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===l)return e}else return e;if(e=ss(e.nextSibling),e===null)break}return null}function EC(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ss(e.nextSibling),e===null))return null;return e}function Wh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function AC(e,t){var n=e.ownerDocument;if(e.data!=="$?"||n.readyState==="complete")t();else{var a=function(){t(),n.removeEventListener("DOMContentLoaded",a)};n.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function ss(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 Zh=null;function cv(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 kw(e,t,n){switch(t=yu(n),e){case"html":if(e=t.documentElement,!e)throw Error(ee(452));return e;case"head":if(e=t.head,!e)throw Error(ee(453));return e;case"body":if(e=t.body,!e)throw Error(ee(454));return e;default:throw Error(ee(451))}}function Hi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);qm(e)}var Xn=new Map,uv=new Set;function ju(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ra=Pe.d;Pe.d={f:MC,r:$C,D:OC,C:DC,L:zC,m:LC,X:BC,S:UC,M:HC};function MC(){var e=ra.f(),t=rd();return e||t}function $C(e){var t=zl(e);t!==null&&t.tag===5&&t.type==="form"?vb(t):ra.r(e)}var Bl=typeof document>"u"?null:document;function Sw(e,t,n){var a=Bl;if(a&&typeof t=="string"&&t){var r=In(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),uv.has(r)||(uv.add(r),e={rel:e,crossOrigin:n,href:t},a.querySelector(r)===null&&(t=a.createElement("link"),qt(t,"link",e),Lt(t),a.head.appendChild(t)))}}function OC(e){ra.D(e),Sw("dns-prefetch",e,null)}function DC(e,t){ra.C(e,t),Sw("preconnect",e,t)}function zC(e,t,n){ra.L(e,t,n);var a=Bl;if(a&&e&&t){var r='link[rel="preload"][as="'+In(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+In(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+In(n.imageSizes)+'"]')):r+='[href="'+In(e)+'"]';var l=r;switch(t){case"style":l=Rl(e);break;case"script":l=Hl(e)}Xn.has(l)||(e=nt({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Xn.set(l,e),a.querySelector(r)!==null||t==="style"&&a.querySelector(Mo(l))||t==="script"&&a.querySelector($o(l))||(t=a.createElement("link"),qt(t,"link",e),Lt(t),a.head.appendChild(t)))}}function LC(e,t){ra.m(e,t);var n=Bl;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+In(a)+'"][href="'+In(e)+'"]',l=r;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=Hl(e)}if(!Xn.has(l)&&(e=nt({rel:"modulepreload",href:e},t),Xn.set(l,e),n.querySelector(r)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector($o(l)))return}a=n.createElement("link"),qt(a,"link",e),Lt(a),n.head.appendChild(a)}}}function UC(e,t,n){ra.S(e,t,n);var a=Bl;if(a&&e){var r=al(a).hoistableStyles,l=Rl(e);t=t||"default";var i=r.get(l);if(!i){var o={loading:0,preload:null};if(i=a.querySelector(Mo(l)))o.loading=5;else{e=nt({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Xn.get(l))&&Sp(e,n);var c=i=a.createElement("link");Lt(c),qt(c,"link",e),c._p=new Promise(function(d,f){c.onload=d,c.onerror=f}),c.addEventListener("load",function(){o.loading|=1}),c.addEventListener("error",function(){o.loading|=2}),o.loading|=4,Uc(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:o},r.set(l,i)}}}function BC(e,t){ra.X(e,t);var n=Bl;if(n&&e){var a=al(n).hoistableScripts,r=Hl(e),l=a.get(r);l||(l=n.querySelector($o(r)),l||(e=nt({src:e,async:!0},t),(t=Xn.get(r))&&Cp(e,t),l=n.createElement("script"),Lt(l),qt(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(r,l))}}function HC(e,t){ra.M(e,t);var n=Bl;if(n&&e){var a=al(n).hoistableScripts,r=Hl(e),l=a.get(r);l||(l=n.querySelector($o(r)),l||(e=nt({src:e,async:!0,type:"module"},t),(t=Xn.get(r))&&Cp(e,t),l=n.createElement("script"),Lt(l),qt(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(r,l))}}function dv(e,t,n,a){var r=(r=Ca.current)?ju(r):null;if(!r)throw Error(ee(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Rl(n.href),n=al(r).hoistableStyles,a=n.get(t),a||(a={type:"style",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Rl(n.href);var l=al(r).hoistableStyles,i=l.get(e);if(i||(r=r.ownerDocument||r,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},l.set(e,i),(l=r.querySelector(Mo(e)))&&!l._p&&(i.instance=l,i.state.loading=5),Xn.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},Xn.set(e,n),l||IC(r,e,n,i.state))),t&&a===null)throw Error(ee(528,""));return i}if(t&&a!==null)throw Error(ee(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Hl(n),n=al(r).hoistableScripts,a=n.get(t),a||(a={type:"script",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(ee(444,e))}}function Rl(e){return'href="'+In(e)+'"'}function Mo(e){return'link[rel="stylesheet"]['+e+"]"}function Cw(e){return nt({},e,{"data-precedence":e.precedence,precedence:null})}function IC(e,t,n,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),qt(t,"link",n),Lt(t),e.head.appendChild(t))}function Hl(e){return'[src="'+In(e)+'"]'}function $o(e){return"script[async]"+e}function fv(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+In(n.href)+'"]');if(a)return t.instance=a,Lt(a),a;var r=nt({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Lt(a),qt(a,"style",r),Uc(a,n.precedence,e),t.instance=a;case"stylesheet":r=Rl(n.href);var l=e.querySelector(Mo(r));if(l)return t.state.loading|=4,t.instance=l,Lt(l),l;a=Cw(n),(r=Xn.get(r))&&Sp(a,r),l=(e.ownerDocument||e).createElement("link"),Lt(l);var i=l;return i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),qt(l,"link",a),t.state.loading|=4,Uc(l,n.precedence,e),t.instance=l;case"script":return l=Hl(n.src),(r=e.querySelector($o(l)))?(t.instance=r,Lt(r),r):(a=n,(r=Xn.get(l))&&(a=nt({},n),Cp(a,r)),e=e.ownerDocument||e,r=e.createElement("script"),Lt(r),qt(r,"link",a),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(ee(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(a=t.instance,t.state.loading|=4,Uc(a,n.precedence,e));return t.instance}function Uc(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=a.length?a[a.length-1]:null,l=r,i=0;i<a.length;i++){var o=a[i];if(o.dataset.precedence===t)l=o;else if(l!==r)break}l?l.parentNode.insertBefore(e,l.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Sp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Cp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Bc=null;function hv(e,t,n){if(Bc===null){var a=new Map,r=Bc=new Map;r.set(n,a)}else r=Bc,a=r.get(n),a||(a=new Map,r.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var l=n[r];if(!(l[wo]||l[Vt]||e==="link"&&l.getAttribute("rel")==="stylesheet")&&l.namespaceURI!=="http://www.w3.org/2000/svg"){var i=l.getAttribute(t)||"";i=e+i;var o=a.get(i);o?o.push(l):a.set(i,[l])}}return a}function mv(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function PC(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 Rw(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var Ji=null;function qC(){}function GC(e,t,n){if(Ji===null)throw Error(ee(475));var a=Ji;if(t.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var r=Rl(n.href),l=e.querySelector(Mo(r));if(l){e=l._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(a.count++,a=bu.bind(a),e.then(a,a)),t.state.loading|=4,t.instance=l,Lt(l);return}l=e.ownerDocument||e,n=Cw(n),(r=Xn.get(r))&&Sp(n,r),l=l.createElement("link"),Lt(l);var i=l;i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),qt(l,"link",n),t.instance=l}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(t,e),(e=t.state.preload)&&!(t.state.loading&3)&&(a.count++,t=bu.bind(a),e.addEventListener("load",t),e.addEventListener("error",t))}}function VC(){if(Ji===null)throw Error(ee(475));var e=Ji;return e.stylesheets&&e.count===0&&Jh(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&Jh(e,e.stylesheets),e.unsuspend){var a=e.unsuspend;e.unsuspend=null,a()}},6e4);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(n)}}:null}function bu(){if(this.count--,this.count===0){if(this.stylesheets)Jh(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var wu=null;function Jh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,wu=new Map,t.forEach(YC,e),wu=null,bu.call(e))}function YC(e,t){if(!(t.state.loading&4)){var n=wu.get(e);if(n)var a=n.get(null);else{n=new Map,wu.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),l=0;l<r.length;l++){var i=r[l];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(n.set(i.dataset.precedence,i),a=i)}a&&n.set(null,a)}r=t.instance,i=r.getAttribute("data-precedence"),l=n.get(i)||a,l===a&&n.set(null,r),n.set(i,r),this.count++,a=bu.bind(this),r.addEventListener("load",a),r.addEventListener("error",a),l?l.parentNode.insertBefore(r,l.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var eo={$$typeof:Ys,Provider:null,Consumer:null,_currentValue:nr,_currentValue2:nr,_threadCount:0};function FC(e,t,n,a,r,l,i,o){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=ef(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ef(0),this.hiddenUpdates=ef(null),this.identifierPrefix=a,this.onUncaughtError=r,this.onCaughtError=l,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function Tw(e,t,n,a,r,l,i,o,c,d,f,h){return e=new FC(e,t,n,i,o,c,d,h),t=1,l===!0&&(t|=24),l=Cn(3,null,null,t),e.current=l,l.stateNode=e,t=tp(),t.refCount++,e.pooledCache=t,t.refCount++,l.memoizedState={element:a,isDehydrated:n,cache:t},sp(l),e}function Ew(e){return e?(e=Jr,e):Jr}function Aw(e,t,n,a,r,l){r=Ew(r),a.context===null?a.context=r:a.pendingContext=r,a=Ra(t),a.payload={element:n},l=l===void 0?null:l,l!==null&&(a.callback=l),n=Ta(e,a,t),n!==null&&(An(n,e,t),Mi(n,e,t))}function pv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Rp(e,t){pv(e,t),(e=e.alternate)&&pv(e,t)}function Mw(e){if(e.tag===13){var t=Ll(e,67108864);t!==null&&An(t,e,67108864),Rp(e,67108864)}}var _u=!0;function KC(e,t,n,a){var r=Ne.T;Ne.T=null;var l=Pe.p;try{Pe.p=2,Tp(e,t,n,a)}finally{Pe.p=l,Ne.T=r}}function XC(e,t,n,a){var r=Ne.T;Ne.T=null;var l=Pe.p;try{Pe.p=8,Tp(e,t,n,a)}finally{Pe.p=l,Ne.T=r}}function Tp(e,t,n,a){if(_u){var r=em(a);if(r===null)Mf(e,t,a,Nu,n),xv(e,a);else if(WC(r,e,t,n,a))a.stopPropagation();else if(xv(e,a),t&4&&-1<QC.indexOf(e)){for(;r!==null;){var l=zl(r);if(l!==null)switch(l.tag){case 3:if(l=l.stateNode,l.current.memoizedState.isDehydrated){var i=Za(l.pendingLanes);if(i!==0){var o=l;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var c=1<<31-Tn(i);o.entanglements[1]|=c,i&=~c}$s(l),!(Fe&6)&&(mu=ks()+500,Ao(0))}}break;case 13:o=Ll(l,2),o!==null&&An(o,l,2),rd(),Rp(l,2)}if(l=em(a),l===null&&Mf(e,t,a,Nu,n),l===r)break;r=l}r!==null&&a.stopPropagation()}else Mf(e,t,a,null,n)}}function em(e){return e=Vm(e),Ep(e)}var Nu=null;function Ep(e){if(Nu=null,e=Fr(e),e!==null){var t=vo(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=sj(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 Nu=e,null}function $w(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(DS()){case ij:return 2;case oj:return 8;case Zc:case zS:return 32;case cj:return 268435456;default:return 32}default:return 32}}var tm=!1,Ma=null,$a=null,Oa=null,to=new Map,no=new Map,ja=[],QC="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 xv(e,t){switch(e){case"focusin":case"focusout":Ma=null;break;case"dragenter":case"dragleave":$a=null;break;case"mouseover":case"mouseout":Oa=null;break;case"pointerover":case"pointerout":to.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":no.delete(t.pointerId)}}function ui(e,t,n,a,r,l){return e===null||e.nativeEvent!==l?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:l,targetContainers:[r]},t!==null&&(t=zl(t),t!==null&&Mw(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function WC(e,t,n,a,r){switch(t){case"focusin":return Ma=ui(Ma,e,t,n,a,r),!0;case"dragenter":return $a=ui($a,e,t,n,a,r),!0;case"mouseover":return Oa=ui(Oa,e,t,n,a,r),!0;case"pointerover":var l=r.pointerId;return to.set(l,ui(to.get(l)||null,e,t,n,a,r)),!0;case"gotpointercapture":return l=r.pointerId,no.set(l,ui(no.get(l)||null,e,t,n,a,r)),!0}return!1}function Ow(e){var t=Fr(e.target);if(t!==null){var n=vo(t);if(n!==null){if(t=n.tag,t===13){if(t=sj(n),t!==null){e.blockedOn=t,GS(e.priority,function(){if(n.tag===13){var a=En();a=Im(a);var r=Ll(n,a);r!==null&&An(r,n,a),Rp(n,a)}});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Hc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=em(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);vh=a,n.target.dispatchEvent(a),vh=null}else return t=zl(n),t!==null&&Mw(t),e.blockedOn=n,!1;t.shift()}return!0}function gv(e,t,n){Hc(e)&&n.delete(t)}function ZC(){tm=!1,Ma!==null&&Hc(Ma)&&(Ma=null),$a!==null&&Hc($a)&&($a=null),Oa!==null&&Hc(Oa)&&(Oa=null),to.forEach(gv),no.forEach(gv)}function oc(e,t){e.blockedOn===t&&(e.blockedOn=null,tm||(tm=!0,Dt.unstable_scheduleCallback(Dt.unstable_NormalPriority,ZC)))}var cc=null;function vv(e){cc!==e&&(cc=e,Dt.unstable_scheduleCallback(Dt.unstable_NormalPriority,function(){cc===e&&(cc=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],r=e[t+2];if(typeof a!="function"){if(Ep(a||n)===null)continue;break}var l=zl(n);l!==null&&(e.splice(t,3),t-=3,Oh(l,{pending:!0,data:r,method:n.method,action:a},a,r))}}))}function so(e){function t(c){return oc(c,e)}Ma!==null&&oc(Ma,e),$a!==null&&oc($a,e),Oa!==null&&oc(Oa,e),to.forEach(t),no.forEach(t);for(var n=0;n<ja.length;n++){var a=ja[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<ja.length&&(n=ja[0],n.blockedOn===null);)Ow(n),n.blockedOn===null&&ja.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var r=n[a],l=n[a+1],i=r[fn]||null;if(typeof l=="function")i||vv(n);else if(i){var o=null;if(l&&l.hasAttribute("formAction")){if(r=l,i=l[fn]||null)o=i.formAction;else if(Ep(r)!==null)continue}else o=i.action;typeof o=="function"?n[a+1]=o:(n.splice(a,3),a-=3),vv(n)}}}function Ap(e){this._internalRoot=e}cd.prototype.render=Ap.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ee(409));var n=t.current,a=En();Aw(n,a,e,t,null,null)};cd.prototype.unmount=Ap.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Aw(e.current,2,null,e,null,null),rd(),t[Dl]=null}};function cd(e){this._internalRoot=e}cd.prototype.unstable_scheduleHydration=function(e){if(e){var t=mj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ja.length&&t!==0&&t<ja[n].priority;n++);ja.splice(n,0,e),n===0&&Ow(e)}};var yv=tj.version;if(yv!=="19.1.0")throw Error(ee(527,yv,"19.1.0"));Pe.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ee(188)):(e=Object.keys(e).join(","),Error(ee(268,e)));return e=RS(t),e=e!==null?aj(e):null,e=e===null?null:e.stateNode,e};var JC={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:Ne,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uc.isDisabled&&uc.supportsFiber)try{yo=uc.inject(JC),Rn=uc}catch{}}Fu.createRoot=function(e,t){if(!nj(e))throw Error(ee(299));var n=!1,a="",r=Tb,l=Eb,i=Ab,o=null;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(l=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(o=t.unstable_transitionCallbacks)),t=Tw(e,1,!1,null,null,n,a,r,l,i,o,null),e[Dl]=t.current,kp(e),new Ap(t)};Fu.hydrateRoot=function(e,t,n){if(!nj(e))throw Error(ee(299));var a=!1,r="",l=Tb,i=Eb,o=Ab,c=null,d=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(l=n.onUncaughtError),n.onCaughtError!==void 0&&(i=n.onCaughtError),n.onRecoverableError!==void 0&&(o=n.onRecoverableError),n.unstable_transitionCallbacks!==void 0&&(c=n.unstable_transitionCallbacks),n.formState!==void 0&&(d=n.formState)),t=Tw(e,1,!0,t,n??null,a,r,l,i,o,c,d),t.context=Ew(null),n=t.current,a=En(),a=Im(a),r=Ra(a),r.callback=null,Ta(n,r,a),n=a,t.current.lanes=n,bo(t,n),$s(t),e[Dl]=t.current,kp(e),new cd(t)};Fu.version="19.1.0";function Dw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Dw)}catch(e){console.error(e)}}Dw(),Xy.exports=Fu;var eR=Xy.exports;const zw=u.createContext(null);function Lw({data:e,router:t,identity:n,notify:a,children:r}){return s.jsx(zw.Provider,{value:{data:e,router:t,identity:n,notify:a},children:r})}function ud(){const e=u.useContext(zw);if(!e)throw new Error("A shared app page rendered outside AppUiProvider.");return e}const tR={success:()=>{},error:()=>{}},mn=()=>ud().data,Xe=()=>ud().router,dd=()=>ud().identity,Nr=()=>ud().notify??tR;function nR(){const{probe:e}=mn(),{href:t,Link:n}=Xe(),a=dd(),[r,l]=u.useState(null),[i,o]=u.useState(!1);return u.useEffect(()=>{let c=!0;if(!e){o(!0);return}return e.source().then(d=>c&&l(d.label),()=>c&&o(!0)),()=>{c=!1}},[e]),s.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:[s.jsx("h1",{className:"text-xl font-semibold",children:"Shared app UI"}),s.jsx("p",{"data-testid":"app-ui-probe-source",className:"text-sm text-muted-foreground",children:i?"Data source unavailable":r??"Loading…"}),s.jsxs("p",{"data-testid":"app-ui-probe-identity",className:"text-sm",children:[a.label," · ",a.can("tasks.write")?"can edit tasks":"read only"]}),s.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"})]})}/**
|
|
48
|
+
`+n.stack}}function Un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function vj(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function WS(e){var t=vj(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),a=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(i){a=""+i,l.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(i){a=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Jc(e){e._valueTracker||(e._valueTracker=WS(e))}function yj(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=vj(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function eu(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 ZS=/[\n"\\]/g;function In(e){return e.replace(ZS,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function xh(e,t,n,a,r,l,i,o){e.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?e.type=i:e.removeAttribute("type"),t!=null?i==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Un(t)):e.value!==""+Un(t)&&(e.value=""+Un(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?gh(e,i,Un(t)):n!=null?gh(e,i,Un(n)):a!=null&&e.removeAttribute("value"),r==null&&l!=null&&(e.defaultChecked=!!l),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+Un(o):e.removeAttribute("name")}function jj(e,t,n,a,r,l,i,o){if(l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(e.type=l),t!=null||n!=null){if(!(l!=="submit"&&l!=="reset"||t!=null))return;n=n!=null?""+Un(n):"",t=t!=null?""+Un(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}a=a??r,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=o?e.checked:!!a,e.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.name=i)}function gh(e,t,n){t==="number"&&eu(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function rl(e,t,n,a){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&a&&(e[n].defaultSelected=!0)}else{for(n=""+Un(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,a&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function bj(e,t,n){if(t!=null&&(t=""+Un(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Un(n):""}function wj(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(ee(92));if(gi(a)){if(1<a.length)throw Error(ee(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=Un(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a)}function jl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var JS=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 ig(e,t,n){var a=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,n):typeof n!="number"||n===0||JS.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function _j(e,t,n){if(t!=null&&typeof t!="object")throw Error(ee(62));if(e=e.style,n!=null){for(var a in n)!n.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var r in t)a=t[r],t.hasOwnProperty(r)&&n[r]!==a&&ig(e,r,a)}else for(var l in t)t.hasOwnProperty(l)&&ig(e,l,t[l])}function Gm(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 e2=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"]]),t2=/^[\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 Tc(e){return t2.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var vh=null;function Vm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Kr=null,ll=null;function og(e){var t=zl(e);if(t&&(e=t.stateNode)){var n=e[fn]||null;e:switch(e=t.stateNode,t.type){case"input":if(xh(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="'+In(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var r=a[fn]||null;if(!r)throw Error(ee(90));xh(a,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&yj(a)}break e;case"textarea":bj(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&rl(e,!!n.multiple,t,!1)}}}var af=!1;function Nj(e,t,n){if(af)return e(t,n);af=!0;try{var a=e(t);return a}finally{if(af=!1,(Kr!==null||ll!==null)&&(rd(),Kr&&(t=Kr,e=ll,ll=Kr=null,og(t),e)))for(t=0;t<e.length;t++)og(e[t])}}function Yi(e,t){var n=e.stateNode;if(n===null)return null;var a=n[fn]||null;if(a===null)return null;n=a[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":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ee(231,t,typeof n));return n}var Js=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yh=!1;if(Js)try{var ri={};Object.defineProperty(ri,"passive",{get:function(){yh=!0}}),window.addEventListener("test",ri,ri),window.removeEventListener("test",ri,ri)}catch{yh=!1}var wa=null,Ym=null,Ec=null;function kj(){if(Ec)return Ec;var e,t=Ym,n=t.length,a,r="value"in wa?wa.value:wa.textContent,l=r.length;for(e=0;e<n&&t[e]===r[e];e++);var i=n-e;for(a=1;a<=i&&t[n-a]===r[l-a];a++);return Ec=r.slice(e,1<a?1-a:void 0)}function Ac(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 tc(){return!0}function cg(){return!1}function hn(e){function t(n,a,r,l,i){this._reactName=n,this._targetInst=r,this.type=a,this.nativeEvent=l,this.target=i,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(l):l[o]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?tc:cg,this.isPropagationStopped=cg,this}return nt(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=tc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=tc)},persist:function(){},isPersistent:tc}),t}var br={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qu=hn(br),_o=nt({},br,{view:0,detail:0}),n2=hn(_o),rf,lf,li,Wu=nt({},_o,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fm,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!==li&&(li&&e.type==="mousemove"?(rf=e.screenX-li.screenX,lf=e.screenY-li.screenY):lf=rf=0,li=e),rf)},movementY:function(e){return"movementY"in e?e.movementY:lf}}),ug=hn(Wu),s2=nt({},Wu,{dataTransfer:0}),a2=hn(s2),r2=nt({},_o,{relatedTarget:0}),of=hn(r2),l2=nt({},br,{animationName:0,elapsedTime:0,pseudoElement:0}),i2=hn(l2),o2=nt({},br,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),c2=hn(o2),u2=nt({},br,{data:0}),dg=hn(u2),d2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},f2={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"},h2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function m2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=h2[e])?!!t[e]:!1}function Fm(){return m2}var p2=nt({},_o,{key:function(e){if(e.key){var t=d2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ac(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?f2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fm,charCode:function(e){return e.type==="keypress"?Ac(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ac(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),x2=hn(p2),g2=nt({},Wu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),fg=hn(g2),v2=nt({},_o,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fm}),y2=hn(v2),j2=nt({},br,{propertyName:0,elapsedTime:0,pseudoElement:0}),b2=hn(j2),w2=nt({},Wu,{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}),_2=hn(w2),N2=nt({},br,{newState:0,oldState:0}),k2=hn(N2),S2=[9,13,27,32],Km=Js&&"CompositionEvent"in window,Ri=null;Js&&"documentMode"in document&&(Ri=document.documentMode);var C2=Js&&"TextEvent"in window&&!Ri,Sj=Js&&(!Km||Ri&&8<Ri&&11>=Ri),hg=" ",mg=!1;function Cj(e,t){switch(e){case"keyup":return S2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xr=!1;function R2(e,t){switch(e){case"compositionend":return Rj(t);case"keypress":return t.which!==32?null:(mg=!0,hg);case"textInput":return e=t.data,e===hg&&mg?null:e;default:return null}}function T2(e,t){if(Xr)return e==="compositionend"||!Km&&Cj(e,t)?(e=kj(),Ec=Ym=wa=null,Xr=!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 Sj&&t.locale!=="ko"?null:t.data;default:return null}}var E2={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 pg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!E2[e.type]:t==="textarea"}function Tj(e,t,n,a){Kr?ll?ll.push(a):ll=[a]:Kr=a,t=vu(t,"onChange"),0<t.length&&(n=new Qu("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var Ti=null,Fi=null;function A2(e){b0(e,0)}function Zu(e){var t=vi(e);if(yj(t))return e}function xg(e,t){if(e==="change")return t}var Ej=!1;if(Js){var cf;if(Js){var uf="oninput"in document;if(!uf){var gg=document.createElement("div");gg.setAttribute("oninput","return;"),uf=typeof gg.oninput=="function"}cf=uf}else cf=!1;Ej=cf&&(!document.documentMode||9<document.documentMode)}function vg(){Ti&&(Ti.detachEvent("onpropertychange",Aj),Fi=Ti=null)}function Aj(e){if(e.propertyName==="value"&&Zu(Fi)){var t=[];Tj(t,Fi,e,Vm(e)),Nj(A2,t)}}function M2(e,t,n){e==="focusin"?(vg(),Ti=t,Fi=n,Ti.attachEvent("onpropertychange",Aj)):e==="focusout"&&vg()}function $2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zu(Fi)}function O2(e,t){if(e==="click")return Zu(t)}function D2(e,t){if(e==="input"||e==="change")return Zu(t)}function z2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var $n=typeof Object.is=="function"?Object.is:z2;function Ki(e,t){if($n(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var r=n[a];if(!mh.call(t,r)||!$n(e[r],t[r]))return!1}return!0}function yg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jg(e,t){var n=yg(e);e=0;for(var a;n;){if(n.nodeType===3){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=yg(n)}}function Mj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $j(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=eu(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=eu(e.document)}return t}function Xm(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 L2=Js&&"documentMode"in document&&11>=document.documentMode,Qr=null,jh=null,Ei=null,bh=!1;function bg(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bh||Qr==null||Qr!==eu(a)||(a=Qr,"selectionStart"in a&&Xm(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ei&&Ki(Ei,a)||(Ei=a,a=vu(jh,"onSelect"),0<a.length&&(t=new Qu("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Qr)))}function Qa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Wr={animationend:Qa("Animation","AnimationEnd"),animationiteration:Qa("Animation","AnimationIteration"),animationstart:Qa("Animation","AnimationStart"),transitionrun:Qa("Transition","TransitionRun"),transitionstart:Qa("Transition","TransitionStart"),transitioncancel:Qa("Transition","TransitionCancel"),transitionend:Qa("Transition","TransitionEnd")},df={},Oj={};Js&&(Oj=document.createElement("div").style,"AnimationEvent"in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),"TransitionEvent"in window||delete Wr.transitionend.transition);function wr(e){if(df[e])return df[e];if(!Wr[e])return e;var t=Wr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Oj)return df[e]=t[n];return e}var Dj=wr("animationend"),zj=wr("animationiteration"),Lj=wr("animationstart"),U2=wr("transitionrun"),B2=wr("transitionstart"),H2=wr("transitioncancel"),Uj=wr("transitionend"),Bj=new Map,wh="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(" ");wh.push("scrollEnd");function us(e,t){Bj.set(e,t),jr(t,[e])}var wg=new WeakMap;function Pn(e,t){if(typeof e=="object"&&e!==null){var n=wg.get(e);return n!==void 0?n:(t={value:e,source:t,stack:lg(t)},wg.set(e,t),t)}return{value:e,source:t,stack:lg(t)}}var Ln=[],Zr=0,Qm=0;function Ju(){for(var e=Zr,t=Qm=Zr=0;t<e;){var n=Ln[t];Ln[t++]=null;var a=Ln[t];Ln[t++]=null;var r=Ln[t];Ln[t++]=null;var l=Ln[t];if(Ln[t++]=null,a!==null&&r!==null){var i=a.pending;i===null?r.next=r:(r.next=i.next,i.next=r),a.pending=r}l!==0&&Hj(n,r,l)}}function ed(e,t,n,a){Ln[Zr++]=e,Ln[Zr++]=t,Ln[Zr++]=n,Ln[Zr++]=a,Qm|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Wm(e,t,n,a){return ed(e,t,n,a),tu(e)}function Ll(e,t){return ed(e,null,null,t),tu(e)}function Hj(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var r=!1,l=e.return;l!==null;)l.childLanes|=n,a=l.alternate,a!==null&&(a.childLanes|=n),l.tag===22&&(e=l.stateNode,e===null||e._visibility&1||(r=!0)),e=l,l=l.return;return e.tag===3?(l=e.stateNode,r&&t!==null&&(r=31-Tn(n),e=l.hiddenUpdates,a=e[r],a===null?e[r]=[t]:a.push(t),t.lane=n|536870912),l):null}function tu(e){if(50<Hi)throw Hi=0,qh=null,Error(ee(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Jr={};function I2(e,t,n,a){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=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cn(e,t,n,a){return new I2(e,t,n,a)}function Zm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ws(e,t){var n=e.alternate;return n===null?(n=Cn(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 Ij(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 Mc(e,t,n,a,r,l){var i=0;if(a=e,typeof e=="function")Zm(e)&&(i=1);else if(typeof e=="string")i=qC(e,n,Ns.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case uh:return e=Cn(31,n,t,r),e.elementType=uh,e.lanes=l,e;case Vr:return sr(n.children,r,l,t);case lj:i=8,r|=24;break;case ih:return e=Cn(12,n,t,r|2),e.elementType=ih,e.lanes=l,e;case oh:return e=Cn(13,n,t,r),e.elementType=oh,e.lanes=l,e;case ch:return e=Cn(19,n,t,r),e.elementType=ch,e.lanes=l,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case AS:case Ys:i=10;break e;case ij:i=9;break e;case Um:i=11;break e;case Bm:i=14;break e;case pa:i=16,a=null;break e}i=29,n=Error(ee(130,e===null?"null":typeof e,"")),a=null}return t=Cn(i,n,t,r),t.elementType=e,t.type=a,t.lanes=l,t}function sr(e,t,n,a){return e=Cn(7,e,a,t),e.lanes=n,e}function ff(e,t,n){return e=Cn(6,e,null,t),e.lanes=n,e}function hf(e,t,n){return t=Cn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var el=[],tl=0,nu=null,su=0,Bn=[],Hn=0,ar=null,Fs=1,Ks="";function Ja(e,t){el[tl++]=su,el[tl++]=nu,nu=e,su=t}function Pj(e,t,n){Bn[Hn++]=Fs,Bn[Hn++]=Ks,Bn[Hn++]=ar,ar=e;var a=Fs;e=Ks;var r=32-Tn(a)-1;a&=~(1<<r),n+=1;var l=32-Tn(t)+r;if(30<l){var i=r-r%5;l=(a&(1<<i)-1).toString(32),a>>=i,r-=i,Fs=1<<32-Tn(t)+r|n<<r|a,Ks=l+e}else Fs=1<<l|n<<r|a,Ks=e}function Jm(e){e.return!==null&&(Ja(e,1),Pj(e,1,0))}function ep(e){for(;e===nu;)nu=el[--tl],el[tl]=null,su=el[--tl],el[tl]=null;for(;e===ar;)ar=Bn[--Hn],Bn[Hn]=null,Ks=Bn[--Hn],Bn[Hn]=null,Fs=Bn[--Hn],Bn[Hn]=null}var Kt=null,ht=null,Ie=!1,rr=null,vs=!1,_h=Error(ee(519));function ur(e){var t=Error(ee(418,""));throw Xi(Pn(t,e)),_h}function _g(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[Vt]=e,t[fn]=a,n){case"dialog":De("cancel",t),De("close",t);break;case"iframe":case"object":case"embed":De("load",t);break;case"video":case"audio":for(n=0;n<Zi.length;n++)De(Zi[n],t);break;case"source":De("error",t);break;case"img":case"image":case"link":De("error",t),De("load",t);break;case"details":De("toggle",t);break;case"input":De("invalid",t),jj(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0),Jc(t);break;case"select":De("invalid",t);break;case"textarea":De("invalid",t),wj(t,a.value,a.defaultValue,a.children),Jc(t)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||_0(t.textContent,n)?(a.popover!=null&&(De("beforetoggle",t),De("toggle",t)),a.onScroll!=null&&De("scroll",t),a.onScrollEnd!=null&&De("scrollend",t),a.onClick!=null&&(t.onclick=od),t=!0):t=!1,t||ur(e)}function Ng(e){for(Kt=e.return;Kt;)switch(Kt.tag){case 5:case 13:vs=!1;return;case 27:case 3:vs=!0;return;default:Kt=Kt.return}}function ii(e){if(e!==Kt)return!1;if(!Ie)return Ng(e),Ie=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Xh(e.type,e.memoizedProps)),n=!n),n&&ht&&ur(e),Ng(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(n=e.data,n==="/$"){if(t===0){ht=ss(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++;e=e.nextSibling}ht=null}}else t===27?(t=ht,qa(e.type)?(e=Zh,Zh=null,ht=e):ht=t):ht=Kt?ss(e.stateNode.nextSibling):null;return!0}function No(){ht=Kt=null,Ie=!1}function kg(){var e=rr;return e!==null&&(un===null?un=e:un.push.apply(un,e),rr=null),e}function Xi(e){rr===null?rr=[e]:rr.push(e)}var Nh=Ms(null),_r=null,Xs=null;function ga(e,t,n){it(Nh,t._currentValue),t._currentValue=n}function Zs(e){e._currentValue=Nh.current,Bt(Nh)}function kh(e,t,n){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===n)break;e=e.return}}function Sh(e,t,n,a){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var l=r.dependencies;if(l!==null){var i=r.child;l=l.firstContext;e:for(;l!==null;){var o=l;l=r;for(var c=0;c<t.length;c++)if(o.context===t[c]){l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),kh(l.return,n,e),a||(i=null);break e}l=o.next}}else if(r.tag===18){if(i=r.return,i===null)throw Error(ee(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),kh(i,n,e),i=null}else i=r.child;if(i!==null)i.return=r;else for(i=r;i!==null;){if(i===e){i=null;break}if(r=i.sibling,r!==null){r.return=i.return,i=r;break}i=i.return}r=i}}function ko(e,t,n,a){e=null;for(var r=t,l=!1;r!==null;){if(!l){if(r.flags&524288)l=!0;else if(r.flags&262144)break}if(r.tag===10){var i=r.alternate;if(i===null)throw Error(ee(387));if(i=i.memoizedProps,i!==null){var o=r.type;$n(r.pendingProps.value,i.value)||(e!==null?e.push(o):e=[o])}}else if(r===Xc.current){if(i=r.alternate,i===null)throw Error(ee(387));i.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(to):e=[to])}r=r.return}e!==null&&Sh(t,e,n,a),t.flags|=262144}function au(e){for(e=e.firstContext;e!==null;){if(!$n(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function dr(e){_r=e,Xs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return qj(_r,e)}function nc(e,t){return _r===null&&dr(e),qj(e,t)}function qj(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Xs===null){if(e===null)throw Error(ee(308));Xs=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xs=Xs.next=t;return n}var P2=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},q2=Dt.unstable_scheduleCallback,G2=Dt.unstable_NormalPriority,$t={$$typeof:Ys,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tp(){return{controller:new P2,data:new Map,refCount:0}}function So(e){e.refCount--,e.refCount===0&&q2(G2,function(){e.controller.abort()})}var Ai=null,Ch=0,bl=0,il=null;function V2(e,t){if(Ai===null){var n=Ai=[];Ch=0,bl=Np(),il={status:"pending",value:void 0,then:function(a){n.push(a)}}}return Ch++,t.then(Sg,Sg),t}function Sg(){if(--Ch===0&&Ai!==null){il!==null&&(il.status="fulfilled");var e=Ai;Ai=null,bl=0,il=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Y2(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){for(a.status="rejected",a.reason=r,r=0;r<n.length;r++)(0,n[r])(void 0)}),a}var Cg=Ne.S;Ne.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&V2(e,t),Cg!==null&&Cg(e,t)};var lr=Ms(null);function np(){var e=lr.current;return e!==null?e:Je.pooledCache}function $c(e,t){t===null?it(lr,lr.current):it(lr,t.pool)}function Gj(){var e=np();return e===null?null:{parent:$t._currentValue,pool:e}}var Co=Error(ee(460)),Vj=Error(ee(474)),td=Error(ee(542)),Rh={then:function(){}};function Rg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function sc(){}function Yj(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(sc,sc),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Eg(e),e;default:if(typeof t.status=="string")t.then(sc,sc);else{if(e=Je,e!==null&&100<e.shellSuspendCounter)throw Error(ee(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=a}},function(a){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Eg(e),e}throw Mi=t,Co}}var Mi=null;function Tg(){if(Mi===null)throw Error(ee(459));var e=Mi;return Mi=null,e}function Eg(e){if(e===Co||e===td)throw Error(ee(483))}var xa=!1;function sp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Th(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 Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,Fe&2){var r=a.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),a.pending=t,t=tu(e),Hj(e,null,n),t}return ed(e,a,t,n),tu(e)}function $i(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,mj(e,n)}}function mf(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var r=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};l===null?r=l=i:l=l.next=i,n=n.next}while(n!==null);l===null?r=l=t:l=l.next=t}else r=l=t;n={baseState:a.baseState,firstBaseUpdate:r,lastBaseUpdate:l,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Eh=!1;function Oi(){if(Eh){var e=il;if(e!==null)throw e}}function Di(e,t,n,a){Eh=!1;var r=e.updateQueue;xa=!1;var l=r.firstBaseUpdate,i=r.lastBaseUpdate,o=r.shared.pending;if(o!==null){r.shared.pending=null;var c=o,d=c.next;c.next=null,i===null?l=d:i.next=d,i=c;var f=e.alternate;f!==null&&(f=f.updateQueue,o=f.lastBaseUpdate,o!==i&&(o===null?f.firstBaseUpdate=d:o.next=d,f.lastBaseUpdate=c))}if(l!==null){var h=r.baseState;i=0,f=d=c=null,o=l;do{var m=o.lane&-536870913,x=m!==o.lane;if(x?(Le&m)===m:(a&m)===m){m!==0&&m===bl&&(Eh=!0),f!==null&&(f=f.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var b=e,v=o;m=t;var y=n;switch(v.tag){case 1:if(b=v.payload,typeof b=="function"){h=b.call(y,h,m);break e}h=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=v.payload,m=typeof b=="function"?b.call(y,h,m):b,m==null)break e;h=nt({},h,m);break e;case 2:xa=!0}}m=o.callback,m!==null&&(e.flags|=64,x&&(e.flags|=8192),x=r.callbacks,x===null?r.callbacks=[m]:x.push(m))}else x={lane:m,tag:o.tag,payload:o.payload,callback:o.callback,next:null},f===null?(d=f=x,c=h):f=f.next=x,i|=m;if(o=o.next,o===null){if(o=r.shared.pending,o===null)break;x=o,o=x.next,x.next=null,r.lastBaseUpdate=x,r.shared.pending=null}}while(!0);f===null&&(c=h),r.baseState=c,r.firstBaseUpdate=d,r.lastBaseUpdate=f,l===null&&(r.shared.lanes=0),Ua|=i,e.lanes=i,e.memoizedState=h}}function Fj(e,t){if(typeof e!="function")throw Error(ee(191,e));e.call(t)}function Kj(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Fj(n[e],t)}var wl=Ms(null),ru=Ms(0);function Ag(e,t){e=na,it(ru,e),it(wl,t),na=e|t.baseLanes}function Ah(){it(ru,na),it(wl,wl.current)}function ap(){na=ru.current,Bt(wl),Bt(ru)}var za=0,Ae=null,We=null,St=null,lu=!1,ol=!1,fr=!1,iu=0,Qi=0,cl=null,F2=0;function vt(){throw Error(ee(321))}function rp(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!$n(e[n],t[n]))return!1;return!0}function lp(e,t,n,a,r,l){return za=l,Ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ne.H=e===null||e.memoizedState===null?kb:Sb,fr=!1,l=n(a,r),fr=!1,ol&&(l=Qj(t,n,a,r)),Xj(e),l}function Xj(e){Ne.H=ou;var t=We!==null&&We.next!==null;if(za=0,St=We=Ae=null,lu=!1,Qi=0,cl=null,t)throw Error(ee(300));e===null||Ut||(e=e.dependencies,e!==null&&au(e)&&(Ut=!0))}function Qj(e,t,n,a){Ae=e;var r=0;do{if(ol&&(cl=null),Qi=0,ol=!1,25<=r)throw Error(ee(301));if(r+=1,St=We=null,e.updateQueue!=null){var l=e.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,l.memoCache!=null&&(l.memoCache.index=0)}Ne.H=eC,l=t(n,a)}while(ol);return l}function K2(){var e=Ne.H,t=e.useState()[0];return t=typeof t.then=="function"?Ro(t):t,e=e.useState()[0],(We!==null?We.memoizedState:null)!==e&&(Ae.flags|=1024),t}function ip(){var e=iu!==0;return iu=0,e}function op(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function cp(e){if(lu){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lu=!1}za=0,St=We=Ae=null,ol=!1,Qi=iu=0,cl=null}function on(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?Ae.memoizedState=St=e:St=St.next=e,St}function Tt(){if(We===null){var e=Ae.alternate;e=e!==null?e.memoizedState:null}else e=We.next;var t=St===null?Ae.memoizedState:St.next;if(t!==null)St=t,We=e;else{if(e===null)throw Ae.alternate===null?Error(ee(467)):Error(ee(310));We=e,e={memoizedState:We.memoizedState,baseState:We.baseState,baseQueue:We.baseQueue,queue:We.queue,next:null},St===null?Ae.memoizedState=St=e:St=St.next=e}return St}function up(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ro(e){var t=Qi;return Qi+=1,cl===null&&(cl=[]),e=Yj(cl,e,t),t=Ae,(St===null?t.memoizedState:St.next)===null&&(t=t.alternate,Ne.H=t===null||t.memoizedState===null?kb:Sb),e}function nd(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ro(e);if(e.$$typeof===Ys)return Yt(e)}throw Error(ee(438,String(e)))}function dp(e){var t=null,n=Ae.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Ae.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=up(),Ae.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),a=0;a<e;a++)n[a]=MS;return t.index++,n}function ea(e,t){return typeof t=="function"?t(e):t}function Oc(e){var t=Tt();return fp(t,We,e)}function fp(e,t,n){var a=e.queue;if(a===null)throw Error(ee(311));a.lastRenderedReducer=n;var r=e.baseQueue,l=a.pending;if(l!==null){if(r!==null){var i=r.next;r.next=l.next,l.next=i}t.baseQueue=r=l,a.pending=null}if(l=e.baseState,r===null)e.memoizedState=l;else{t=r.next;var o=i=null,c=null,d=t,f=!1;do{var h=d.lane&-536870913;if(h!==d.lane?(Le&h)===h:(za&h)===h){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}),h===bl&&(f=!0);else if((za&m)===m){d=d.next,m===bl&&(f=!0);continue}else h={lane:0,revertLane:d.revertLane,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},c===null?(o=c=h,i=l):c=c.next=h,Ae.lanes|=m,Ua|=m;h=d.action,fr&&n(l,h),l=d.hasEagerState?d.eagerState:n(l,h)}else m={lane:h,revertLane:d.revertLane,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},c===null?(o=c=m,i=l):c=c.next=m,Ae.lanes|=h,Ua|=h;d=d.next}while(d!==null&&d!==t);if(c===null?i=l:c.next=o,!$n(l,e.memoizedState)&&(Ut=!0,f&&(n=il,n!==null)))throw n;e.memoizedState=l,e.baseState=i,e.baseQueue=c,a.lastRenderedState=l}return r===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function pf(e){var t=Tt(),n=t.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=e;var a=n.dispatch,r=n.pending,l=t.memoizedState;if(r!==null){n.pending=null;var i=r=r.next;do l=e(l,i.action),i=i.next;while(i!==r);$n(l,t.memoizedState)||(Ut=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,a]}function Wj(e,t,n){var a=Ae,r=Tt(),l=Ie;if(l){if(n===void 0)throw Error(ee(407));n=n()}else n=t();var i=!$n((We||r).memoizedState,n);i&&(r.memoizedState=n,Ut=!0),r=r.queue;var o=eb.bind(null,a,r,e);if(To(2048,8,o,[e]),r.getSnapshot!==t||i||St!==null&&St.memoizedState.tag&1){if(a.flags|=2048,_l(9,sd(),Jj.bind(null,a,r,n,t),null),Je===null)throw Error(ee(349));l||za&124||Zj(a,t,n)}return n}function Zj(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ae.updateQueue,t===null?(t=up(),Ae.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Jj(e,t,n,a){t.value=n,t.getSnapshot=a,tb(t)&&nb(e)}function eb(e,t,n){return n(function(){tb(t)&&nb(e)})}function tb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!$n(e,n)}catch{return!0}}function nb(e){var t=Ll(e,2);t!==null&&An(t,e,2)}function Mh(e){var t=on();if(typeof e=="function"){var n=e;if(e=n(),fr){ba(!0);try{n()}finally{ba(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:e},t}function sb(e,t,n,a){return e.baseState=n,fp(e,We,typeof a=="function"?a:ea)}function X2(e,t,n,a,r){if(ad(e))throw Error(ee(485));if(e=t.action,e!==null){var l={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){l.listeners.push(i)}};Ne.T!==null?n(!0):l.isTransition=!1,a(l),n=t.pending,n===null?(l.next=t.pending=l,ab(t,l)):(l.next=n.next,t.pending=n.next=l)}}function ab(e,t){var n=t.action,a=t.payload,r=e.state;if(t.isTransition){var l=Ne.T,i={};Ne.T=i;try{var o=n(r,a),c=Ne.S;c!==null&&c(i,o),Mg(e,t,o)}catch(d){$h(e,t,d)}finally{Ne.T=l}}else try{l=n(r,a),Mg(e,t,l)}catch(d){$h(e,t,d)}}function Mg(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){$g(e,t,a)},function(a){return $h(e,t,a)}):$g(e,t,n)}function $g(e,t,n){t.status="fulfilled",t.value=n,rb(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ab(e,n)))}function $h(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,rb(t),t=t.next;while(t!==a)}e.action=null}function rb(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function lb(e,t){return t}function Og(e,t){if(Ie){var n=Je.formState;if(n!==null){e:{var a=Ae;if(Ie){if(ht){t:{for(var r=ht,l=vs;r.nodeType!==8;){if(!l){r=null;break t}if(r=ss(r.nextSibling),r===null){r=null;break t}}l=r.data,r=l==="F!"||l==="F"?r:null}if(r){ht=ss(r.nextSibling),a=r.data==="F!";break e}}ur(a)}a=!1}a&&(t=n[0])}}return n=on(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:lb,lastRenderedState:t},n.queue=a,n=wb.bind(null,Ae,a),a.dispatch=n,a=Mh(!1),l=xp.bind(null,Ae,!1,a.queue),a=on(),r={state:t,dispatch:null,action:e,pending:null},a.queue=r,n=X2.bind(null,Ae,r,l,n),r.dispatch=n,a.memoizedState=e,[t,n,!1]}function Dg(e){var t=Tt();return ib(t,We,e)}function ib(e,t,n){if(t=fp(e,t,lb)[0],e=Oc(ea)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Ro(t)}catch(i){throw i===Co?td:i}else a=t;t=Tt();var r=t.queue,l=r.dispatch;return n!==t.memoizedState&&(Ae.flags|=2048,_l(9,sd(),Q2.bind(null,r,n),null)),[a,l,e]}function Q2(e,t){e.action=t}function zg(e){var t=Tt(),n=We;if(n!==null)return ib(t,n,e);Tt(),t=t.memoizedState,n=Tt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function _l(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Ae.updateQueue,t===null&&(t=up(),Ae.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(a=n.next,n.next=e,e.next=a,t.lastEffect=e),e}function sd(){return{destroy:void 0,resource:void 0}}function ob(){return Tt().memoizedState}function Dc(e,t,n,a){var r=on();a=a===void 0?null:a,Ae.flags|=e,r.memoizedState=_l(1|t,sd(),n,a)}function To(e,t,n,a){var r=Tt();a=a===void 0?null:a;var l=r.memoizedState.inst;We!==null&&a!==null&&rp(a,We.memoizedState.deps)?r.memoizedState=_l(t,l,n,a):(Ae.flags|=e,r.memoizedState=_l(1|t,l,n,a))}function Lg(e,t){Dc(8390656,8,e,t)}function cb(e,t){To(2048,8,e,t)}function ub(e,t){return To(4,2,e,t)}function db(e,t){return To(4,4,e,t)}function fb(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 hb(e,t,n){n=n!=null?n.concat([e]):null,To(4,4,fb.bind(null,t,e),n)}function hp(){}function mb(e,t){var n=Tt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&rp(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function pb(e,t){var n=Tt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&rp(t,a[1]))return a[0];if(a=e(),fr){ba(!0);try{e()}finally{ba(!1)}}return n.memoizedState=[a,t],a}function mp(e,t,n){return n===void 0||za&1073741824?e.memoizedState=t:(e.memoizedState=n,e=r0(),Ae.lanes|=e,Ua|=e,n)}function xb(e,t,n,a){return $n(n,t)?n:wl.current!==null?(e=mp(e,n,a),$n(e,t)||(Ut=!0),e):za&42?(e=r0(),Ae.lanes|=e,Ua|=e,t):(Ut=!0,e.memoizedState=n)}function gb(e,t,n,a,r){var l=Pe.p;Pe.p=l!==0&&8>l?l:8;var i=Ne.T,o={};Ne.T=o,xp(e,!1,t,n);try{var c=r(),d=Ne.S;if(d!==null&&d(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=Y2(c,a);zi(e,t,f,En(e))}else zi(e,t,a,En(e))}catch(h){zi(e,t,{then:function(){},status:"rejected",reason:h},En())}finally{Pe.p=l,Ne.T=i}}function W2(){}function Oh(e,t,n,a){if(e.tag!==5)throw Error(ee(476));var r=vb(e).queue;gb(e,r,t,nr,n===null?W2:function(){return yb(e),n(a)})}function vb(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:nr,baseState:nr,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:nr},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function yb(e){var t=vb(e).next.queue;zi(e,t,{},En())}function pp(){return Yt(to)}function jb(){return Tt().memoizedState}function bb(){return Tt().memoizedState}function Z2(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=En();e=Ra(n);var a=Ta(t,e,n);a!==null&&(An(a,t,n),$i(a,t,n)),t={cache:tp()},e.payload=t;return}t=t.return}}function J2(e,t,n){var a=En();n={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},ad(e)?_b(t,n):(n=Wm(e,t,n,a),n!==null&&(An(n,e,a),Nb(n,t,a)))}function wb(e,t,n){var a=En();zi(e,t,n,a)}function zi(e,t,n,a){var r={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(ad(e))_b(t,r);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var i=t.lastRenderedState,o=l(i,n);if(r.hasEagerState=!0,r.eagerState=o,$n(o,i))return ed(e,t,r,0),Je===null&&Ju(),!1}catch{}finally{}if(n=Wm(e,t,r,a),n!==null)return An(n,e,a),Nb(n,t,a),!0}return!1}function xp(e,t,n,a){if(a={lane:2,revertLane:Np(),action:a,hasEagerState:!1,eagerState:null,next:null},ad(e)){if(t)throw Error(ee(479))}else t=Wm(e,n,a,2),t!==null&&An(t,e,2)}function ad(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function _b(e,t){ol=lu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Nb(e,t,n){if(n&4194048){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,mj(e,n)}}var ou={readContext:Yt,use:nd,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useLayoutEffect:vt,useInsertionEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useSyncExternalStore:vt,useId:vt,useHostTransitionStatus:vt,useFormState:vt,useActionState:vt,useOptimistic:vt,useMemoCache:vt,useCacheRefresh:vt},kb={readContext:Yt,use:nd,useCallback:function(e,t){return on().memoizedState=[e,t===void 0?null:t],e},useContext:Yt,useEffect:Lg,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Dc(4194308,4,fb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Dc(4194308,4,e,t)},useInsertionEffect:function(e,t){Dc(4,2,e,t)},useMemo:function(e,t){var n=on();t=t===void 0?null:t;var a=e();if(fr){ba(!0);try{e()}finally{ba(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=on();if(n!==void 0){var r=n(t);if(fr){ba(!0);try{n(t)}finally{ba(!1)}}}else r=t;return a.memoizedState=a.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},a.queue=e,e=e.dispatch=J2.bind(null,Ae,e),[a.memoizedState,e]},useRef:function(e){var t=on();return e={current:e},t.memoizedState=e},useState:function(e){e=Mh(e);var t=e.queue,n=wb.bind(null,Ae,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:hp,useDeferredValue:function(e,t){var n=on();return mp(n,e,t)},useTransition:function(){var e=Mh(!1);return e=gb.bind(null,Ae,e.queue,!0,!1),on().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Ae,r=on();if(Ie){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=t(),Je===null)throw Error(ee(349));Le&124||Zj(a,t,n)}r.memoizedState=n;var l={value:n,getSnapshot:t};return r.queue=l,Lg(eb.bind(null,a,l,e),[e]),a.flags|=2048,_l(9,sd(),Jj.bind(null,a,l,n,t),null),n},useId:function(){var e=on(),t=Je.identifierPrefix;if(Ie){var n=Ks,a=Fs;n=(a&~(1<<32-Tn(a)-1)).toString(32)+n,t="«"+t+"R"+n,n=iu++,0<n&&(t+="H"+n.toString(32)),t+="»"}else n=F2++,t="«"+t+"r"+n.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:pp,useFormState:Og,useActionState:Og,useOptimistic:function(e){var t=on();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=xp.bind(null,Ae,!0,n),n.dispatch=t,[e,t]},useMemoCache:dp,useCacheRefresh:function(){return on().memoizedState=Z2.bind(null,Ae)}},Sb={readContext:Yt,use:nd,useCallback:mb,useContext:Yt,useEffect:cb,useImperativeHandle:hb,useInsertionEffect:ub,useLayoutEffect:db,useMemo:pb,useReducer:Oc,useRef:ob,useState:function(){return Oc(ea)},useDebugValue:hp,useDeferredValue:function(e,t){var n=Tt();return xb(n,We.memoizedState,e,t)},useTransition:function(){var e=Oc(ea)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Ro(e),t]},useSyncExternalStore:Wj,useId:jb,useHostTransitionStatus:pp,useFormState:Dg,useActionState:Dg,useOptimistic:function(e,t){var n=Tt();return sb(n,We,e,t)},useMemoCache:dp,useCacheRefresh:bb},eC={readContext:Yt,use:nd,useCallback:mb,useContext:Yt,useEffect:cb,useImperativeHandle:hb,useInsertionEffect:ub,useLayoutEffect:db,useMemo:pb,useReducer:pf,useRef:ob,useState:function(){return pf(ea)},useDebugValue:hp,useDeferredValue:function(e,t){var n=Tt();return We===null?mp(n,e,t):xb(n,We.memoizedState,e,t)},useTransition:function(){var e=pf(ea)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Ro(e),t]},useSyncExternalStore:Wj,useId:jb,useHostTransitionStatus:pp,useFormState:zg,useActionState:zg,useOptimistic:function(e,t){var n=Tt();return We!==null?sb(n,We,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:dp,useCacheRefresh:bb},ul=null,Wi=0;function ac(e){var t=Wi;return Wi+=1,ul===null&&(ul=[]),Yj(ul,e,t)}function oi(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function rc(e,t){throw t.$$typeof===ES?Error(ee(525)):(e=Object.prototype.toString.call(t),Error(ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Ug(e){var t=e._init;return t(e._payload)}function Cb(e){function t(g,p){if(e){var j=g.deletions;j===null?(g.deletions=[p],g.flags|=16):j.push(p)}}function n(g,p){if(!e)return null;for(;p!==null;)t(g,p),p=p.sibling;return null}function a(g){for(var p=new Map;g!==null;)g.key!==null?p.set(g.key,g):p.set(g.index,g),g=g.sibling;return p}function r(g,p){return g=Ws(g,p),g.index=0,g.sibling=null,g}function l(g,p,j){return g.index=j,e?(j=g.alternate,j!==null?(j=j.index,j<p?(g.flags|=67108866,p):j):(g.flags|=67108866,p)):(g.flags|=1048576,p)}function i(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function o(g,p,j,w){return p===null||p.tag!==6?(p=ff(j,g.mode,w),p.return=g,p):(p=r(p,j),p.return=g,p)}function c(g,p,j,w){var N=j.type;return N===Vr?f(g,p,j.props.children,w,j.key):p!==null&&(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===pa&&Ug(N)===p.type)?(p=r(p,j.props),oi(p,j),p.return=g,p):(p=Mc(j.type,j.key,j.props,null,g.mode,w),oi(p,j),p.return=g,p)}function d(g,p,j,w){return p===null||p.tag!==4||p.stateNode.containerInfo!==j.containerInfo||p.stateNode.implementation!==j.implementation?(p=hf(j,g.mode,w),p.return=g,p):(p=r(p,j.children||[]),p.return=g,p)}function f(g,p,j,w,N){return p===null||p.tag!==7?(p=sr(j,g.mode,w,N),p.return=g,p):(p=r(p,j),p.return=g,p)}function h(g,p,j){if(typeof p=="string"&&p!==""||typeof p=="number"||typeof p=="bigint")return p=ff(""+p,g.mode,j),p.return=g,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Wo:return j=Mc(p.type,p.key,p.props,null,g.mode,j),oi(j,p),j.return=g,j;case xi:return p=hf(p,g.mode,j),p.return=g,p;case pa:var w=p._init;return p=w(p._payload),h(g,p,j)}if(gi(p)||ai(p))return p=sr(p,g.mode,j,null),p.return=g,p;if(typeof p.then=="function")return h(g,ac(p),j);if(p.$$typeof===Ys)return h(g,nc(g,p),j);rc(g,p)}return null}function m(g,p,j,w){var N=p!==null?p.key:null;if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return N!==null?null:o(g,p,""+j,w);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Wo:return j.key===N?c(g,p,j,w):null;case xi:return j.key===N?d(g,p,j,w):null;case pa:return N=j._init,j=N(j._payload),m(g,p,j,w)}if(gi(j)||ai(j))return N!==null?null:f(g,p,j,w,null);if(typeof j.then=="function")return m(g,p,ac(j),w);if(j.$$typeof===Ys)return m(g,p,nc(g,j),w);rc(g,j)}return null}function x(g,p,j,w,N){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return g=g.get(j)||null,o(p,g,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Wo:return g=g.get(w.key===null?j:w.key)||null,c(p,g,w,N);case xi:return g=g.get(w.key===null?j:w.key)||null,d(p,g,w,N);case pa:var C=w._init;return w=C(w._payload),x(g,p,j,w,N)}if(gi(w)||ai(w))return g=g.get(j)||null,f(p,g,w,N,null);if(typeof w.then=="function")return x(g,p,j,ac(w),N);if(w.$$typeof===Ys)return x(g,p,j,nc(p,w),N);rc(p,w)}return null}function b(g,p,j,w){for(var N=null,C=null,_=p,S=p=0,D=null;_!==null&&S<j.length;S++){_.index>S?(D=_,_=null):D=_.sibling;var z=m(g,_,j[S],w);if(z===null){_===null&&(_=D);break}e&&_&&z.alternate===null&&t(g,_),p=l(z,p,S),C===null?N=z:C.sibling=z,C=z,_=D}if(S===j.length)return n(g,_),Ie&&Ja(g,S),N;if(_===null){for(;S<j.length;S++)_=h(g,j[S],w),_!==null&&(p=l(_,p,S),C===null?N=_:C.sibling=_,C=_);return Ie&&Ja(g,S),N}for(_=a(_);S<j.length;S++)D=x(_,g,S,j[S],w),D!==null&&(e&&D.alternate!==null&&_.delete(D.key===null?S:D.key),p=l(D,p,S),C===null?N=D:C.sibling=D,C=D);return e&&_.forEach(function(P){return t(g,P)}),Ie&&Ja(g,S),N}function v(g,p,j,w){if(j==null)throw Error(ee(151));for(var N=null,C=null,_=p,S=p=0,D=null,z=j.next();_!==null&&!z.done;S++,z=j.next()){_.index>S?(D=_,_=null):D=_.sibling;var P=m(g,_,z.value,w);if(P===null){_===null&&(_=D);break}e&&_&&P.alternate===null&&t(g,_),p=l(P,p,S),C===null?N=P:C.sibling=P,C=P,_=D}if(z.done)return n(g,_),Ie&&Ja(g,S),N;if(_===null){for(;!z.done;S++,z=j.next())z=h(g,z.value,w),z!==null&&(p=l(z,p,S),C===null?N=z:C.sibling=z,C=z);return Ie&&Ja(g,S),N}for(_=a(_);!z.done;S++,z=j.next())z=x(_,g,S,z.value,w),z!==null&&(e&&z.alternate!==null&&_.delete(z.key===null?S:z.key),p=l(z,p,S),C===null?N=z:C.sibling=z,C=z);return e&&_.forEach(function(F){return t(g,F)}),Ie&&Ja(g,S),N}function y(g,p,j,w){if(typeof j=="object"&&j!==null&&j.type===Vr&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case Wo:e:{for(var N=j.key;p!==null;){if(p.key===N){if(N=j.type,N===Vr){if(p.tag===7){n(g,p.sibling),w=r(p,j.props.children),w.return=g,g=w;break e}}else if(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===pa&&Ug(N)===p.type){n(g,p.sibling),w=r(p,j.props),oi(w,j),w.return=g,g=w;break e}n(g,p);break}else t(g,p);p=p.sibling}j.type===Vr?(w=sr(j.props.children,g.mode,w,j.key),w.return=g,g=w):(w=Mc(j.type,j.key,j.props,null,g.mode,w),oi(w,j),w.return=g,g=w)}return i(g);case xi:e:{for(N=j.key;p!==null;){if(p.key===N)if(p.tag===4&&p.stateNode.containerInfo===j.containerInfo&&p.stateNode.implementation===j.implementation){n(g,p.sibling),w=r(p,j.children||[]),w.return=g,g=w;break e}else{n(g,p);break}else t(g,p);p=p.sibling}w=hf(j,g.mode,w),w.return=g,g=w}return i(g);case pa:return N=j._init,j=N(j._payload),y(g,p,j,w)}if(gi(j))return b(g,p,j,w);if(ai(j)){if(N=ai(j),typeof N!="function")throw Error(ee(150));return j=N.call(j),v(g,p,j,w)}if(typeof j.then=="function")return y(g,p,ac(j),w);if(j.$$typeof===Ys)return y(g,p,nc(g,j),w);rc(g,j)}return typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint"?(j=""+j,p!==null&&p.tag===6?(n(g,p.sibling),w=r(p,j),w.return=g,g=w):(n(g,p),w=ff(j,g.mode,w),w.return=g,g=w),i(g)):n(g,p)}return function(g,p,j,w){try{Wi=0;var N=y(g,p,j,w);return ul=null,N}catch(_){if(_===Co||_===td)throw _;var C=Cn(29,_,null,g.mode);return C.lanes=w,C.return=g,C}finally{}}}var Nl=Cb(!0),Rb=Cb(!1),Kn=Ms(null),Ss=null;function va(e){var t=e.alternate;it(Ot,Ot.current&1),it(Kn,e),Ss===null&&(t===null||wl.current!==null||t.memoizedState!==null)&&(Ss=e)}function Tb(e){if(e.tag===22){if(it(Ot,Ot.current),it(Kn,e),Ss===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(Ss=e)}}else ya()}function ya(){it(Ot,Ot.current),it(Kn,Kn.current)}function Qs(e){Bt(Kn),Ss===e&&(Ss=null),Bt(Ot)}var Ot=Ms(0);function cu(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==="$?"||Wh(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 xf(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:nt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Dh={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=En(),r=Ra(a);r.payload=t,n!=null&&(r.callback=n),t=Ta(e,r,a),t!==null&&(An(t,e,a),$i(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=En(),r=Ra(a);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=Ta(e,r,a),t!==null&&(An(t,e,a),$i(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=En(),a=Ra(n);a.tag=2,t!=null&&(a.callback=t),t=Ta(e,a,n),t!==null&&(An(t,e,n),$i(t,e,n))}};function Bg(e,t,n,a,r,l,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,l,i):t.prototype&&t.prototype.isPureReactComponent?!Ki(n,a)||!Ki(r,l):!0}function Hg(e,t,n,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&Dh.enqueueReplaceState(t,t.state,null)}function hr(e,t){var n=t;if("ref"in t){n={};for(var a in t)a!=="ref"&&(n[a]=t[a])}if(e=e.defaultProps){n===t&&(n=nt({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}var uu=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 Eb(e){uu(e)}function Ab(e){console.error(e)}function Mb(e){uu(e)}function du(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Ig(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function zh(e,t,n){return n=Ra(n),n.tag=3,n.payload={element:null},n.callback=function(){du(e,t)},n}function $b(e){return e=Ra(e),e.tag=3,e}function Ob(e,t,n,a){var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var l=a.value;e.payload=function(){return r(l)},e.callback=function(){Ig(t,n,a)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){Ig(t,n,a),typeof r!="function"&&(Ea===null?Ea=new Set([this]):Ea.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function tC(e,t,n,a,r){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&ko(t,n,r,!0),n=Kn.current,n!==null){switch(n.tag){case 13:return Ss===null?Gh():n.alternate===null&&mt===0&&(mt=3),n.flags&=-257,n.flags|=65536,n.lanes=r,a===Rh?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),Cf(e,a,r)),!1;case 22:return n.flags|=65536,a===Rh?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),Cf(e,a,r)),!1}throw Error(ee(435,n.tag))}return Cf(e,a,r),Gh(),!1}if(Ie)return t=Kn.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,a!==_h&&(e=Error(ee(422),{cause:a}),Xi(Pn(e,n)))):(a!==_h&&(t=Error(ee(423),{cause:a}),Xi(Pn(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,a=Pn(a,n),r=zh(e.stateNode,a,r),mf(e,r),mt!==4&&(mt=2)),!1;var l=Error(ee(520),{cause:a});if(l=Pn(l,n),Bi===null?Bi=[l]:Bi.push(l),mt!==4&&(mt=2),t===null)return!0;a=Pn(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=zh(n.stateNode,a,e),mf(n,e),!1;case 1:if(t=n.type,l=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||l!==null&&typeof l.componentDidCatch=="function"&&(Ea===null||!Ea.has(l))))return n.flags|=65536,r&=-r,n.lanes|=r,r=$b(r),Ob(r,e,n,a),mf(n,r),!1}n=n.return}while(n!==null);return!1}var Db=Error(ee(461)),Ut=!1;function It(e,t,n,a){t.child=e===null?Rb(t,null,n,a):Nl(t,e.child,n,a)}function Pg(e,t,n,a,r){n=n.render;var l=t.ref;if("ref"in a){var i={};for(var o in a)o!=="ref"&&(i[o]=a[o])}else i=a;return dr(t),a=lp(e,t,n,i,l,r),o=ip(),e!==null&&!Ut?(op(e,t,r),ta(e,t,r)):(Ie&&o&&Jm(t),t.flags|=1,It(e,t,a,r),t.child)}function qg(e,t,n,a,r){if(e===null){var l=n.type;return typeof l=="function"&&!Zm(l)&&l.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=l,zb(e,t,l,a,r)):(e=Mc(n.type,null,a,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!gp(e,r)){var i=l.memoizedProps;if(n=n.compare,n=n!==null?n:Ki,n(i,a)&&e.ref===t.ref)return ta(e,t,r)}return t.flags|=1,e=Ws(l,a),e.ref=t.ref,e.return=t,t.child=e}function zb(e,t,n,a,r){if(e!==null){var l=e.memoizedProps;if(Ki(l,a)&&e.ref===t.ref)if(Ut=!1,t.pendingProps=a=l,gp(e,r))e.flags&131072&&(Ut=!0);else return t.lanes=e.lanes,ta(e,t,r)}return Lh(e,t,n,a,r)}function Lb(e,t,n){var a=t.pendingProps,r=a.children,l=e!==null?e.memoizedState:null;if(a.mode==="hidden"){if(t.flags&128){if(a=l!==null?l.baseLanes|n:n,e!==null){for(r=t.child=e.child,l=0;r!==null;)l=l|r.lanes|r.childLanes,r=r.sibling;t.childLanes=l&~a}else t.childLanes=0,t.child=null;return Gg(e,t,a,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&$c(t,l!==null?l.cachePool:null),l!==null?Ag(t,l):Ah(),Tb(t);else return t.lanes=t.childLanes=536870912,Gg(e,t,l!==null?l.baseLanes|n:n,n)}else l!==null?($c(t,l.cachePool),Ag(t,l),ya(),t.memoizedState=null):(e!==null&&$c(t,null),Ah(),ya());return It(e,t,r,n),t.child}function Gg(e,t,n,a){var r=np();return r=r===null?null:{parent:$t._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&$c(t,null),Ah(),Tb(t),e!==null&&ko(e,t,a,!0),null}function zc(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(ee(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Lh(e,t,n,a,r){return dr(t),n=lp(e,t,n,a,void 0,r),a=ip(),e!==null&&!Ut?(op(e,t,r),ta(e,t,r)):(Ie&&a&&Jm(t),t.flags|=1,It(e,t,n,r),t.child)}function Vg(e,t,n,a,r,l){return dr(t),t.updateQueue=null,n=Qj(t,a,n,r),Xj(e),a=ip(),e!==null&&!Ut?(op(e,t,l),ta(e,t,l)):(Ie&&a&&Jm(t),t.flags|=1,It(e,t,n,l),t.child)}function Yg(e,t,n,a,r){if(dr(t),t.stateNode===null){var l=Jr,i=n.contextType;typeof i=="object"&&i!==null&&(l=Yt(i)),l=new n(a,l),t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Dh,t.stateNode=l,l._reactInternals=t,l=t.stateNode,l.props=a,l.state=t.memoizedState,l.refs={},sp(t),i=n.contextType,l.context=typeof i=="object"&&i!==null?Yt(i):Jr,l.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(xf(t,n,i,a),l.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(i=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),i!==l.state&&Dh.enqueueReplaceState(l,l.state,null),Di(t,a,l,r),Oi(),l.state=t.memoizedState),typeof l.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){l=t.stateNode;var o=t.memoizedProps,c=hr(n,o);l.props=c;var d=l.context,f=n.contextType;i=Jr,typeof f=="object"&&f!==null&&(i=Yt(f));var h=n.getDerivedStateFromProps;f=typeof h=="function"||typeof l.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,f||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(o||d!==i)&&Hg(t,l,a,i),xa=!1;var m=t.memoizedState;l.state=m,Di(t,a,l,r),Oi(),d=t.memoizedState,o||m!==d||xa?(typeof h=="function"&&(xf(t,n,h,a),d=t.memoizedState),(c=xa||Bg(t,n,c,a,m,d,i))?(f||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(t.flags|=4194308)):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=d),l.props=a,l.state=d,l.context=i,a=c):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{l=t.stateNode,Th(e,t),i=t.memoizedProps,f=hr(n,i),l.props=f,h=t.pendingProps,m=l.context,d=n.contextType,c=Jr,typeof d=="object"&&d!==null&&(c=Yt(d)),o=n.getDerivedStateFromProps,(d=typeof o=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(i!==h||m!==c)&&Hg(t,l,a,c),xa=!1,m=t.memoizedState,l.state=m,Di(t,a,l,r),Oi();var x=t.memoizedState;i!==h||m!==x||xa||e!==null&&e.dependencies!==null&&au(e.dependencies)?(typeof o=="function"&&(xf(t,n,o,a),x=t.memoizedState),(f=xa||Bg(t,n,f,a,m,x,c)||e!==null&&e.dependencies!==null&&au(e.dependencies))?(d||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(a,x,c),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(a,x,c)),typeof l.componentDidUpdate=="function"&&(t.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof l.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=x),l.props=a,l.state=x,l.context=c,a=f):(typeof l.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),a=!1)}return l=a,zc(e,t),a=(t.flags&128)!==0,l||a?(l=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:l.render(),t.flags|=1,e!==null&&a?(t.child=Nl(t,e.child,null,r),t.child=Nl(t,null,n,r)):It(e,t,n,r),t.memoizedState=l.state,e=t.child):e=ta(e,t,r),e}function Fg(e,t,n,a){return No(),t.flags|=256,It(e,t,n,a),t.child}var gf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vf(e){return{baseLanes:e,cachePool:Gj()}}function yf(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=qn),e}function Ub(e,t,n){var a=t.pendingProps,r=!1,l=(t.flags&128)!==0,i;if((i=l)||(i=e!==null&&e.memoizedState===null?!1:(Ot.current&2)!==0),i&&(r=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ie){if(r?va(t):ya(),Ie){var o=ht,c;if(c=o){e:{for(c=o,o=vs;c.nodeType!==8;){if(!o){o=null;break e}if(c=ss(c.nextSibling),c===null){o=null;break e}}o=c}o!==null?(t.memoizedState={dehydrated:o,treeContext:ar!==null?{id:Fs,overflow:Ks}:null,retryLane:536870912,hydrationErrors:null},c=Cn(18,null,null,0),c.stateNode=o,c.return=t,t.child=c,Kt=t,ht=null,c=!0):c=!1}c||ur(t)}if(o=t.memoizedState,o!==null&&(o=o.dehydrated,o!==null))return Wh(o)?t.lanes=32:t.lanes=536870912,null;Qs(t)}return o=a.children,a=a.fallback,r?(ya(),r=t.mode,o=fu({mode:"hidden",children:o},r),a=sr(a,r,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,r=t.child,r.memoizedState=vf(n),r.childLanes=yf(e,i,n),t.memoizedState=gf,a):(va(t),Uh(t,o))}if(c=e.memoizedState,c!==null&&(o=c.dehydrated,o!==null)){if(l)t.flags&256?(va(t),t.flags&=-257,t=jf(e,t,n)):t.memoizedState!==null?(ya(),t.child=e.child,t.flags|=128,t=null):(ya(),r=a.fallback,o=t.mode,a=fu({mode:"visible",children:a.children},o),r=sr(r,o,n,null),r.flags|=2,a.return=t,r.return=t,a.sibling=r,t.child=a,Nl(t,e.child,null,n),a=t.child,a.memoizedState=vf(n),a.childLanes=yf(e,i,n),t.memoizedState=gf,t=r);else if(va(t),Wh(o)){if(i=o.nextSibling&&o.nextSibling.dataset,i)var d=i.dgst;i=d,a=Error(ee(419)),a.stack="",a.digest=i,Xi({value:a,source:null,stack:null}),t=jf(e,t,n)}else if(Ut||ko(e,t,n,!1),i=(n&e.childLanes)!==0,Ut||i){if(i=Je,i!==null&&(a=n&-n,a=a&42?1:Im(a),a=a&(i.suspendedLanes|n)?0:a,a!==0&&a!==c.retryLane))throw c.retryLane=a,Ll(e,a),An(i,e,a),Db;o.data==="$?"||Gh(),t=jf(e,t,n)}else o.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,ht=ss(o.nextSibling),Kt=t,Ie=!0,rr=null,vs=!1,e!==null&&(Bn[Hn++]=Fs,Bn[Hn++]=Ks,Bn[Hn++]=ar,Fs=e.id,Ks=e.overflow,ar=t),t=Uh(t,a.children),t.flags|=4096);return t}return r?(ya(),r=a.fallback,o=t.mode,c=e.child,d=c.sibling,a=Ws(c,{mode:"hidden",children:a.children}),a.subtreeFlags=c.subtreeFlags&65011712,d!==null?r=Ws(d,r):(r=sr(r,o,n,null),r.flags|=2),r.return=t,a.return=t,a.sibling=r,t.child=a,a=r,r=t.child,o=e.child.memoizedState,o===null?o=vf(n):(c=o.cachePool,c!==null?(d=$t._currentValue,c=c.parent!==d?{parent:d,pool:d}:c):c=Gj(),o={baseLanes:o.baseLanes|n,cachePool:c}),r.memoizedState=o,r.childLanes=yf(e,i,n),t.memoizedState=gf,a):(va(t),n=e.child,e=n.sibling,n=Ws(n,{mode:"visible",children:a.children}),n.return=t,n.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=n,t.memoizedState=null,n)}function Uh(e,t){return t=fu({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function fu(e,t){return e=Cn(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function jf(e,t,n){return Nl(t,e.child,null,n),e=Uh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Kg(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),kh(e.return,t,n)}function bf(e,t,n,a,r){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:r}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=a,l.tail=n,l.tailMode=r)}function Bb(e,t,n){var a=t.pendingProps,r=a.revealOrder,l=a.tail;if(It(e,t,a.children,n),a=Ot.current,a&2)a=a&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&&Kg(e,n,t);else if(e.tag===19)Kg(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}a&=1}switch(it(Ot,a),r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&cu(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),bf(t,!1,r,n,l);break;case"backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&cu(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}bf(t,!0,n,null,l);break;case"together":bf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ta(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ua|=t.lanes,!(n&t.childLanes))if(e!==null){if(ko(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(ee(153));if(t.child!==null){for(e=t.child,n=Ws(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ws(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function gp(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&au(e)))}function nC(e,t,n){switch(t.tag){case 3:Qc(t,t.stateNode.containerInfo),ga(t,$t,e.memoizedState.cache),No();break;case 27:case 5:hh(t);break;case 4:Qc(t,t.stateNode.containerInfo);break;case 10:ga(t,t.type,t.memoizedProps.value);break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(va(t),t.flags|=128,null):n&t.child.childLanes?Ub(e,t,n):(va(t),e=ta(e,t,n),e!==null?e.sibling:null);va(t);break;case 19:var r=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(ko(e,t,n,!1),a=(n&t.childLanes)!==0),r){if(a)return Bb(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),it(Ot,Ot.current),a)break;return null;case 22:case 23:return t.lanes=0,Lb(e,t,n);case 24:ga(t,$t,e.memoizedState.cache)}return ta(e,t,n)}function Hb(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ut=!0;else{if(!gp(e,n)&&!(t.flags&128))return Ut=!1,nC(e,t,n);Ut=!!(e.flags&131072)}else Ut=!1,Ie&&t.flags&1048576&&Pj(t,su,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var a=t.elementType,r=a._init;if(a=r(a._payload),t.type=a,typeof a=="function")Zm(a)?(e=hr(a,e),t.tag=1,t=Yg(null,t,a,e,n)):(t.tag=0,t=Lh(null,t,a,e,n));else{if(a!=null){if(r=a.$$typeof,r===Um){t.tag=11,t=Pg(null,t,a,e,n);break e}else if(r===Bm){t.tag=14,t=qg(null,t,a,e,n);break e}}throw t=dh(a)||a,Error(ee(306,t,""))}}return t;case 0:return Lh(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,r=hr(a,t.pendingProps),Yg(e,t,a,r,n);case 3:e:{if(Qc(t,t.stateNode.containerInfo),e===null)throw Error(ee(387));a=t.pendingProps;var l=t.memoizedState;r=l.element,Th(e,t),Di(t,a,null,n);var i=t.memoizedState;if(a=i.cache,ga(t,$t,a),a!==l.cache&&Sh(t,[$t],n,!0),Oi(),a=i.element,l.isDehydrated)if(l={element:a,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){t=Fg(e,t,a,n);break e}else if(a!==r){r=Pn(Error(ee(424)),t),Xi(r),t=Fg(e,t,a,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(ht=ss(e.firstChild),Kt=t,Ie=!0,rr=null,vs=!0,n=Rb(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(No(),a===r){t=ta(e,t,n);break e}It(e,t,a,n)}t=t.child}return t;case 26:return zc(e,t),e===null?(n=dv(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ie||(n=t.type,e=t.pendingProps,a=yu(Ca.current).createElement(n),a[Vt]=t,a[fn]=e,qt(a,n,e),Lt(a),t.stateNode=a):t.memoizedState=dv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return hh(t),e===null&&Ie&&(a=t.stateNode=S0(t.type,t.pendingProps,Ca.current),Kt=t,vs=!0,r=ht,qa(t.type)?(Zh=r,ht=ss(a.firstChild)):ht=r),It(e,t,t.pendingProps.children,n),zc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ie&&((r=a=ht)&&(a=EC(a,t.type,t.pendingProps,vs),a!==null?(t.stateNode=a,Kt=t,ht=ss(a.firstChild),vs=!1,r=!0):r=!1),r||ur(t)),hh(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,Xh(r,l)?a=null:i!==null&&Xh(r,i)&&(t.flags|=32),t.memoizedState!==null&&(r=lp(e,t,K2,null,null,n),to._currentValue=r),zc(e,t),It(e,t,a,n),t.child;case 6:return e===null&&Ie&&((e=n=ht)&&(n=AC(n,t.pendingProps,vs),n!==null?(t.stateNode=n,Kt=t,ht=null,e=!0):e=!1),e||ur(t)),null;case 13:return Ub(e,t,n);case 4:return Qc(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Nl(t,null,a,n):It(e,t,a,n),t.child;case 11:return Pg(e,t,t.type,t.pendingProps,n);case 7:return It(e,t,t.pendingProps,n),t.child;case 8:return It(e,t,t.pendingProps.children,n),t.child;case 12:return It(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,ga(t,t.type,a.value),It(e,t,a.children,n),t.child;case 9:return r=t.type._context,a=t.pendingProps.children,dr(t),r=Yt(r),a=a(r),t.flags|=1,It(e,t,a,n),t.child;case 14:return qg(e,t,t.type,t.pendingProps,n);case 15:return zb(e,t,t.type,t.pendingProps,n);case 19:return Bb(e,t,n);case 31:return a=t.pendingProps,n=t.mode,a={mode:a.mode,children:a.children},e===null?(n=fu(a,n),n.ref=t.ref,t.child=n,n.return=t,t=n):(n=Ws(e.child,a),n.ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Lb(e,t,n);case 24:return dr(t),a=Yt($t),e===null?(r=np(),r===null&&(r=Je,l=tp(),r.pooledCache=l,l.refCount++,l!==null&&(r.pooledCacheLanes|=n),r=l),t.memoizedState={parent:a,cache:r},sp(t),ga(t,$t,r)):(e.lanes&n&&(Th(e,t),Di(t,null,null,n),Oi()),r=e.memoizedState,l=t.memoizedState,r.parent!==a?(r={parent:a,cache:a},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),ga(t,$t,a)):(a=l.cache,ga(t,$t,a),a!==r.cache&&Sh(t,[$t],n,!0))),It(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(ee(156,t.tag))}function Bs(e){e.flags|=4}function Xg(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!T0(t)){if(t=Kn.current,t!==null&&((Le&4194048)===Le?Ss!==null:(Le&62914560)!==Le&&!(Le&536870912)||t!==Ss))throw Mi=Rh,Vj;e.flags|=8192}}function lc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?fj():536870912,e.lanes|=t,kl|=t)}function ci(e,t){if(!Ie)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 a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function ct(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,a|=r.subtreeFlags&65011712,a|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,a|=r.subtreeFlags,a|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function sC(e,t,n){var a=t.pendingProps;switch(ep(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(t),null;case 1:return ct(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Zs($t),vl(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ii(t)?Bs(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,kg())),ct(t),null;case 26:return n=t.memoizedState,e===null?(Bs(t),n!==null?(ct(t),Xg(t,n)):(ct(t),t.flags&=-16777217)):n?n!==e.memoizedState?(Bs(t),ct(t),Xg(t,n)):(ct(t),t.flags&=-16777217):(e.memoizedProps!==a&&Bs(t),ct(t),t.flags&=-16777217),null;case 27:Wc(t),n=Ca.current;var r=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Bs(t);else{if(!a){if(t.stateNode===null)throw Error(ee(166));return ct(t),null}e=Ns.current,ii(t)?_g(t):(e=S0(r,a,n),t.stateNode=e,Bs(t))}return ct(t),null;case 5:if(Wc(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Bs(t);else{if(!a){if(t.stateNode===null)throw Error(ee(166));return ct(t),null}if(e=Ns.current,ii(t))_g(t);else{switch(r=yu(Ca.current),e){case 1:e=r.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=r.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=r.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=r.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":e=r.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof a.is=="string"?r.createElement("select",{is:a.is}):r.createElement("select"),a.multiple?e.multiple=!0:a.size&&(e.size=a.size);break;default:e=typeof a.is=="string"?r.createElement(n,{is:a.is}):r.createElement(n)}}e[Vt]=t,e[fn]=a;e:for(r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.tag!==27&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}t.stateNode=e;e:switch(qt(e,n,a),n){case"button":case"input":case"select":case"textarea":e=!!a.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&Bs(t)}}return ct(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Bs(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(ee(166));if(e=Ca.current,ii(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,r=Kt,r!==null)switch(r.tag){case 27:case 5:a=r.memoizedProps}e[Vt]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||_0(e.nodeValue,n)),e||ur(t)}else e=yu(e).createTextNode(a),e[Vt]=t,t.stateNode=e}return ct(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=ii(t),a!==null&&a.dehydrated!==null){if(e===null){if(!r)throw Error(ee(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(ee(317));r[Vt]=t}else No(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ct(t),r=!1}else r=kg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Qs(t),t):(Qs(t),null)}if(Qs(t),t.flags&128)return t.lanes=n,t;if(n=a!==null,e=e!==null&&e.memoizedState!==null,n){a=t.child,r=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(r=a.alternate.memoizedState.cachePool.pool);var l=null;a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),l!==r&&(a.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),lc(t,t.updateQueue),ct(t),null;case 4:return vl(),e===null&&kp(t.stateNode.containerInfo),ct(t),null;case 10:return Zs(t.type),ct(t),null;case 19:if(Bt(Ot),r=t.memoizedState,r===null)return ct(t),null;if(a=(t.flags&128)!==0,l=r.rendering,l===null)if(a)ci(r,!1);else{if(mt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=cu(e),l!==null){for(t.flags|=128,ci(r,!1),e=l.updateQueue,t.updateQueue=e,lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Ij(n,e),n=n.sibling;return it(Ot,Ot.current&1|2),t.child}e=e.sibling}r.tail!==null&&ks()>mu&&(t.flags|=128,a=!0,ci(r,!1),t.lanes=4194304)}else{if(!a)if(e=cu(l),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,lc(t,e),ci(r,!0),r.tail===null&&r.tailMode==="hidden"&&!l.alternate&&!Ie)return ct(t),null}else 2*ks()-r.renderingStartTime>mu&&n!==536870912&&(t.flags|=128,a=!0,ci(r,!1),t.lanes=4194304);r.isBackwards?(l.sibling=t.child,t.child=l):(e=r.last,e!==null?e.sibling=l:t.child=l,r.last=l)}return r.tail!==null?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=ks(),t.sibling=null,e=Ot.current,it(Ot,a?e&1|2:e&1),t):(ct(t),null);case 22:case 23:return Qs(t),ap(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?n&536870912&&!(t.flags&128)&&(ct(t),t.subtreeFlags&6&&(t.flags|=8192)):ct(t),n=t.updateQueue,n!==null&&lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&Bt(lr),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Zs($t),ct(t),null;case 25:return null;case 30:return null}throw Error(ee(156,t.tag))}function aC(e,t){switch(ep(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zs($t),vl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Wc(t),null;case 13:if(Qs(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));No()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Bt(Ot),null;case 4:return vl(),null;case 10:return Zs(t.type),null;case 22:case 23:return Qs(t),ap(),e!==null&&Bt(lr),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zs($t),null;case 25:return null;default:return null}}function Ib(e,t){switch(ep(t),t.tag){case 3:Zs($t),vl();break;case 26:case 27:case 5:Wc(t);break;case 4:vl();break;case 13:Qs(t);break;case 19:Bt(Ot);break;case 10:Zs(t.type);break;case 22:case 23:Qs(t),ap(),e!==null&&Bt(lr);break;case 24:Zs($t)}}function Eo(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var r=a.next;n=r;do{if((n.tag&e)===e){a=void 0;var l=n.create,i=n.inst;a=l(),i.destroy=a}n=n.next}while(n!==r)}}catch(o){Ze(t,t.return,o)}}function La(e,t,n){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var l=r.next;a=l;do{if((a.tag&e)===e){var i=a.inst,o=i.destroy;if(o!==void 0){i.destroy=void 0,r=t;var c=n,d=o;try{d()}catch(f){Ze(r,c,f)}}}a=a.next}while(a!==l)}}catch(f){Ze(t,t.return,f)}}function Pb(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Kj(t,n)}catch(a){Ze(e,e.return,a)}}}function qb(e,t,n){n.props=hr(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){Ze(e,t,a)}}function Li(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(r){Ze(e,t,r)}}function bs(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(r){Ze(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){Ze(e,t,r)}else n.current=null}function Gb(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(r){Ze(e,e.return,r)}}function wf(e,t,n){try{var a=e.stateNode;kC(a,e.type,n,t),a[fn]=t}catch(r){Ze(e,e.return,r)}}function Vb(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&qa(e.type)||e.tag===4}function _f(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Vb(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&&qa(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 Bh(e,t,n){var a=e.tag;if(a===5||a===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=od));else if(a!==4&&(a===27&&qa(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Bh(e,t,n),e=e.sibling;e!==null;)Bh(e,t,n),e=e.sibling}function hu(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(a!==4&&(a===27&&qa(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(hu(e,t,n),e=e.sibling;e!==null;)hu(e,t,n),e=e.sibling}function Yb(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);qt(t,a,n),t[Vt]=e,t[fn]=n}catch(l){Ze(e,e.return,l)}}var Vs=!1,yt=!1,Nf=!1,Qg=typeof WeakSet=="function"?WeakSet:Set,zt=null;function rC(e,t){if(e=e.containerInfo,Fh=_u,e=$j(e),Xm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var a=n.getSelection&&n.getSelection();if(a&&a.rangeCount!==0){n=a.anchorNode;var r=a.anchorOffset,l=a.focusNode;a=a.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var i=0,o=-1,c=-1,d=0,f=0,h=e,m=null;t:for(;;){for(var x;h!==n||r!==0&&h.nodeType!==3||(o=i+r),h!==l||a!==0&&h.nodeType!==3||(c=i+a),h.nodeType===3&&(i+=h.nodeValue.length),(x=h.firstChild)!==null;)m=h,h=x;for(;;){if(h===e)break t;if(m===n&&++d===r&&(o=i),m===l&&++f===a&&(c=i),(x=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=x}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Kh={focusedElem:e,selectionRange:n},_u=!1,zt=t;zt!==null;)if(t=zt,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,zt=e;else for(;zt!==null;){switch(t=zt,l=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if(e&1024&&l!==null){e=void 0,n=t,r=l.memoizedProps,l=l.memoizedState,a=n.stateNode;try{var b=hr(n.type,r,n.elementType===n.type);e=a.getSnapshotBeforeUpdate(b,l),a.__reactInternalSnapshotBeforeUpdate=e}catch(v){Ze(n,n.return,v)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Qh(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Qh(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(ee(163))}if(e=t.sibling,e!==null){e.return=t.return,zt=e;break}zt=t.return}}function Fb(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:ca(e,n),a&4&&Eo(5,n);break;case 1:if(ca(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){Ze(n,n.return,i)}else{var r=hr(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){Ze(n,n.return,i)}}a&64&&Pb(n),a&512&&Li(n,n.return);break;case 3:if(ca(e,n),a&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{Kj(e,t)}catch(i){Ze(n,n.return,i)}}break;case 27:t===null&&a&4&&Yb(n);case 26:case 5:ca(e,n),t===null&&a&4&&Gb(n),a&512&&Li(n,n.return);break;case 12:ca(e,n);break;case 13:ca(e,n),a&4&&Qb(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=mC.bind(null,n),MC(e,n))));break;case 22:if(a=n.memoizedState!==null||Vs,!a){t=t!==null&&t.memoizedState!==null||yt,r=Vs;var l=yt;Vs=a,(yt=t)&&!l?ha(e,n,(n.subtreeFlags&8772)!==0):ca(e,n),Vs=r,yt=l}break;case 30:break;default:ca(e,n)}}function Kb(e){var t=e.alternate;t!==null&&(e.alternate=null,Kb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&qm(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 rt=null,cn=!1;function Hs(e,t,n){for(n=n.child;n!==null;)Xb(e,t,n),n=n.sibling}function Xb(e,t,n){if(Rn&&typeof Rn.onCommitFiberUnmount=="function")try{Rn.onCommitFiberUnmount(yo,n)}catch{}switch(n.tag){case 26:yt||bs(n,t),Hs(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:yt||bs(n,t);var a=rt,r=cn;qa(n.type)&&(rt=n.stateNode,cn=!1),Hs(e,t,n),Ii(n.stateNode),rt=a,cn=r;break;case 5:yt||bs(n,t);case 6:if(a=rt,r=cn,rt=null,Hs(e,t,n),rt=a,cn=r,rt!==null)if(cn)try{(rt.nodeType===9?rt.body:rt.nodeName==="HTML"?rt.ownerDocument.body:rt).removeChild(n.stateNode)}catch(l){Ze(n,t,l)}else try{rt.removeChild(n.stateNode)}catch(l){Ze(n,t,l)}break;case 18:rt!==null&&(cn?(e=rt,ov(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),ao(e)):ov(rt,n.stateNode));break;case 4:a=rt,r=cn,rt=n.stateNode.containerInfo,cn=!0,Hs(e,t,n),rt=a,cn=r;break;case 0:case 11:case 14:case 15:yt||La(2,n,t),yt||La(4,n,t),Hs(e,t,n);break;case 1:yt||(bs(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&qb(n,t,a)),Hs(e,t,n);break;case 21:Hs(e,t,n);break;case 22:yt=(a=yt)||n.memoizedState!==null,Hs(e,t,n),yt=a;break;default:Hs(e,t,n)}}function Qb(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ao(e)}catch(n){Ze(t,t.return,n)}}function lC(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Qg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Qg),t;default:throw Error(ee(435,e.tag))}}function kf(e,t){var n=lC(e);t.forEach(function(a){var r=pC.bind(null,e,a);n.has(a)||(n.add(a),a.then(r,r))})}function wn(e,t){var n=t.deletions;if(n!==null)for(var a=0;a<n.length;a++){var r=n[a],l=e,i=t,o=i;e:for(;o!==null;){switch(o.tag){case 27:if(qa(o.type)){rt=o.stateNode,cn=!1;break e}break;case 5:rt=o.stateNode,cn=!1;break e;case 3:case 4:rt=o.stateNode.containerInfo,cn=!0;break e}o=o.return}if(rt===null)throw Error(ee(160));Xb(l,i,r),rt=null,cn=!1,l=r.alternate,l!==null&&(l.return=null),r.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)Wb(t,e),t=t.sibling}var Jn=null;function Wb(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:wn(t,e),_n(e),a&4&&(La(3,e,e.return),Eo(3,e),La(5,e,e.return));break;case 1:wn(t,e),_n(e),a&512&&(yt||n===null||bs(n,n.return)),a&64&&Vs&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?a:n.concat(a))));break;case 26:var r=Jn;if(wn(t,e),_n(e),a&512&&(yt||n===null||bs(n,n.return)),a&4){var l=n!==null?n.memoizedState:null;if(a=e.memoizedState,n===null)if(a===null)if(e.stateNode===null){e:{a=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(a){case"title":l=r.getElementsByTagName("title")[0],(!l||l[wo]||l[Vt]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=r.createElement(a),r.head.insertBefore(l,r.querySelector("head > title"))),qt(l,a,n),l[Vt]=e,Lt(l),a=l;break e;case"link":var i=hv("link","href",r).get(a+(n.href||""));if(i){for(var o=0;o<i.length;o++)if(l=i[o],l.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&l.getAttribute("rel")===(n.rel==null?null:n.rel)&&l.getAttribute("title")===(n.title==null?null:n.title)&&l.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){i.splice(o,1);break t}}l=r.createElement(a),qt(l,a,n),r.head.appendChild(l);break;case"meta":if(i=hv("meta","content",r).get(a+(n.content||""))){for(o=0;o<i.length;o++)if(l=i[o],l.getAttribute("content")===(n.content==null?null:""+n.content)&&l.getAttribute("name")===(n.name==null?null:n.name)&&l.getAttribute("property")===(n.property==null?null:n.property)&&l.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&l.getAttribute("charset")===(n.charSet==null?null:n.charSet)){i.splice(o,1);break t}}l=r.createElement(a),qt(l,a,n),r.head.appendChild(l);break;default:throw Error(ee(468,a))}l[Vt]=e,Lt(l),a=l}e.stateNode=a}else mv(r,e.type,e.stateNode);else e.stateNode=fv(r,a,e.memoizedProps);else l!==a?(l===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):l.count--,a===null?mv(r,e.type,e.stateNode):fv(r,a,e.memoizedProps)):a===null&&e.stateNode!==null&&wf(e,e.memoizedProps,n.memoizedProps)}break;case 27:wn(t,e),_n(e),a&512&&(yt||n===null||bs(n,n.return)),n!==null&&a&4&&wf(e,e.memoizedProps,n.memoizedProps);break;case 5:if(wn(t,e),_n(e),a&512&&(yt||n===null||bs(n,n.return)),e.flags&32){r=e.stateNode;try{jl(r,"")}catch(x){Ze(e,e.return,x)}}a&4&&e.stateNode!=null&&(r=e.memoizedProps,wf(e,r,n!==null?n.memoizedProps:r)),a&1024&&(Nf=!0);break;case 6:if(wn(t,e),_n(e),a&4){if(e.stateNode===null)throw Error(ee(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(x){Ze(e,e.return,x)}}break;case 3:if(Bc=null,r=Jn,Jn=ju(t.containerInfo),wn(t,e),Jn=r,_n(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{ao(t.containerInfo)}catch(x){Ze(e,e.return,x)}Nf&&(Nf=!1,Zb(e));break;case 4:a=Jn,Jn=ju(e.stateNode.containerInfo),wn(t,e),_n(e),Jn=a;break;case 12:wn(t,e),_n(e);break;case 13:wn(t,e),_n(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(wp=ks()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,kf(e,a)));break;case 22:r=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,d=Vs,f=yt;if(Vs=d||r,yt=f||c,wn(t,e),yt=f,Vs=d,_n(e),a&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||c||Vs||yt||er(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(l=c.stateNode,r)i=l.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none";else{o=c.stateNode;var h=c.memoizedProps.style,m=h!=null&&h.hasOwnProperty("display")?h.display:null;o.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(x){Ze(c,c.return,x)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=r?"":c.memoizedProps}catch(x){Ze(c,c.return,x)}}}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}a&4&&(a=e.updateQueue,a!==null&&(n=a.retryQueue,n!==null&&(a.retryQueue=null,kf(e,n))));break;case 19:wn(t,e),_n(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,kf(e,a)));break;case 30:break;case 21:break;default:wn(t,e),_n(e)}}function _n(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(Vb(a)){n=a;break}a=a.return}if(n==null)throw Error(ee(160));switch(n.tag){case 27:var r=n.stateNode,l=_f(e);hu(e,l,r);break;case 5:var i=n.stateNode;n.flags&32&&(jl(i,""),n.flags&=-33);var o=_f(e);hu(e,o,i);break;case 3:case 4:var c=n.stateNode.containerInfo,d=_f(e);Bh(e,d,c);break;default:throw Error(ee(161))}}catch(f){Ze(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Zb(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Zb(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ca(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Fb(e,t.alternate,t),t=t.sibling}function er(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:La(4,t,t.return),er(t);break;case 1:bs(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&qb(t,t.return,n),er(t);break;case 27:Ii(t.stateNode);case 26:case 5:bs(t,t.return),er(t);break;case 22:t.memoizedState===null&&er(t);break;case 30:er(t);break;default:er(t)}e=e.sibling}}function ha(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,r=e,l=t,i=l.flags;switch(l.tag){case 0:case 11:case 15:ha(r,l,n),Eo(4,l);break;case 1:if(ha(r,l,n),a=l,r=a.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(d){Ze(a,a.return,d)}if(a=l,r=a.updateQueue,r!==null){var o=a.stateNode;try{var c=r.shared.hiddenCallbacks;if(c!==null)for(r.shared.hiddenCallbacks=null,r=0;r<c.length;r++)Fj(c[r],o)}catch(d){Ze(a,a.return,d)}}n&&i&64&&Pb(l),Li(l,l.return);break;case 27:Yb(l);case 26:case 5:ha(r,l,n),n&&a===null&&i&4&&Gb(l),Li(l,l.return);break;case 12:ha(r,l,n);break;case 13:ha(r,l,n),n&&i&4&&Qb(r,l);break;case 22:l.memoizedState===null&&ha(r,l,n),Li(l,l.return);break;case 30:break;default:ha(r,l,n)}t=t.sibling}}function vp(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&&So(n))}function yp(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&So(e))}function gs(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Jb(e,t,n,a),t=t.sibling}function Jb(e,t,n,a){var r=t.flags;switch(t.tag){case 0:case 11:case 15:gs(e,t,n,a),r&2048&&Eo(9,t);break;case 1:gs(e,t,n,a);break;case 3:gs(e,t,n,a),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&So(e)));break;case 12:if(r&2048){gs(e,t,n,a),e=t.stateNode;try{var l=t.memoizedProps,i=l.id,o=l.onPostCommit;typeof o=="function"&&o(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Ze(t,t.return,c)}}else gs(e,t,n,a);break;case 13:gs(e,t,n,a);break;case 23:break;case 22:l=t.stateNode,i=t.alternate,t.memoizedState!==null?l._visibility&2?gs(e,t,n,a):Ui(e,t):l._visibility&2?gs(e,t,n,a):(l._visibility|=2,qr(e,t,n,a,(t.subtreeFlags&10256)!==0)),r&2048&&vp(i,t);break;case 24:gs(e,t,n,a),r&2048&&yp(t.alternate,t);break;default:gs(e,t,n,a)}}function qr(e,t,n,a,r){for(r=r&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var l=e,i=t,o=n,c=a,d=i.flags;switch(i.tag){case 0:case 11:case 15:qr(l,i,o,c,r),Eo(8,i);break;case 23:break;case 22:var f=i.stateNode;i.memoizedState!==null?f._visibility&2?qr(l,i,o,c,r):Ui(l,i):(f._visibility|=2,qr(l,i,o,c,r)),r&&d&2048&&vp(i.alternate,i);break;case 24:qr(l,i,o,c,r),r&&d&2048&&yp(i.alternate,i);break;default:qr(l,i,o,c,r)}t=t.sibling}}function Ui(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,r=a.flags;switch(a.tag){case 22:Ui(n,a),r&2048&&vp(a.alternate,a);break;case 24:Ui(n,a),r&2048&&yp(a.alternate,a);break;default:Ui(n,a)}t=t.sibling}}var yi=8192;function Ar(e){if(e.subtreeFlags&yi)for(e=e.child;e!==null;)e0(e),e=e.sibling}function e0(e){switch(e.tag){case 26:Ar(e),e.flags&yi&&e.memoizedState!==null&&VC(Jn,e.memoizedState,e.memoizedProps);break;case 5:Ar(e);break;case 3:case 4:var t=Jn;Jn=ju(e.stateNode.containerInfo),Ar(e),Jn=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=yi,yi=16777216,Ar(e),yi=t):Ar(e));break;default:Ar(e)}}function t0(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 ui(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];zt=a,s0(a,e)}t0(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)n0(e),e=e.sibling}function n0(e){switch(e.tag){case 0:case 11:case 15:ui(e),e.flags&2048&&La(9,e,e.return);break;case 3:ui(e);break;case 12:ui(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Lc(e)):ui(e);break;default:ui(e)}}function Lc(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];zt=a,s0(a,e)}t0(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:La(8,t,t.return),Lc(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Lc(t));break;default:Lc(t)}e=e.sibling}}function s0(e,t){for(;zt!==null;){var n=zt;switch(n.tag){case 0:case 11:case 15:La(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var a=n.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:So(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,zt=a;else e:for(n=e;zt!==null;){a=zt;var r=a.sibling,l=a.return;if(Kb(a),a===n){zt=null;break e}if(r!==null){r.return=l,zt=r;break e}zt=l}}}var iC={getCacheForType:function(e){var t=Yt($t),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n}},oC=typeof WeakMap=="function"?WeakMap:Map,Fe=0,Je=null,ze=null,Le=0,Ye=0,kn=null,_a=!1,Ul=!1,jp=!1,na=0,mt=0,Ua=0,ir=0,bp=0,qn=0,kl=0,Bi=null,un=null,Hh=!1,wp=0,mu=1/0,pu=null,Ea=null,Pt=0,Aa=null,Sl=null,dl=0,Ih=0,Ph=null,a0=null,Hi=0,qh=null;function En(){if(Fe&2&&Le!==0)return Le&-Le;if(Ne.T!==null){var e=bl;return e!==0?e:Np()}return pj()}function r0(){qn===0&&(qn=!(Le&536870912)||Ie?dj():536870912);var e=Kn.current;return e!==null&&(e.flags|=32),qn}function An(e,t,n){(e===Je&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)&&(Cl(e,0),Na(e,Le,qn,!1)),bo(e,n),(!(Fe&2)||e!==Je)&&(e===Je&&(!(Fe&2)&&(ir|=n),mt===4&&Na(e,Le,qn,!1)),$s(e))}function l0(e,t,n){if(Fe&6)throw Error(ee(327));var a=!n&&(t&124)===0&&(t&e.expiredLanes)===0||jo(e,t),r=a?dC(e,t):Sf(e,t,!0),l=a;do{if(r===0){Ul&&!a&&Na(e,t,0,!1);break}else{if(n=e.current.alternate,l&&!cC(n)){r=Sf(e,t,!1),l=!1;continue}if(r===2){if(l=t,e.errorRecoveryDisabledLanes&l)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var o=e;r=Bi;var c=o.current.memoizedState.isDehydrated;if(c&&(Cl(o,i).flags|=256),i=Sf(o,i,!1),i!==2){if(jp&&!c){o.errorRecoveryDisabledLanes|=l,ir|=l,r=4;break e}l=un,un=r,l!==null&&(un===null?un=l:un.push.apply(un,l))}r=i}if(l=!1,r!==2)continue}}if(r===1){Cl(e,0),Na(e,t,0,!0);break}e:{switch(a=e,l=r,l){case 0:case 1:throw Error(ee(345));case 4:if((t&4194048)!==t)break;case 6:Na(a,t,qn,!_a);break e;case 2:un=null;break;case 3:case 5:break;default:throw Error(ee(329))}if((t&62914560)===t&&(r=wp+300-ks(),10<r)){if(Na(a,t,qn,!_a),Xu(a,0,!0)!==0)break e;a.timeoutHandle=k0(Wg.bind(null,a,n,un,pu,Hh,t,qn,ir,kl,_a,l,2,-0,0),r);break e}Wg(a,n,un,pu,Hh,t,qn,ir,kl,_a,l,0,-0,0)}}break}while(!0);$s(e)}function Wg(e,t,n,a,r,l,i,o,c,d,f,h,m,x){if(e.timeoutHandle=-1,h=t.subtreeFlags,(h&8192||(h&16785408)===16785408)&&(eo={stylesheets:null,count:0,unsuspend:GC},e0(t),h=YC(),h!==null)){e.cancelPendingCommit=h(Jg.bind(null,e,t,l,n,a,r,i,o,c,f,1,m,x)),Na(e,l,i,!d);return}Jg(e,t,l,n,a,r,i,o,c)}function cC(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 a=0;a<n.length;a++){var r=n[a],l=r.getSnapshot;r=r.value;try{if(!$n(l(),r))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 Na(e,t,n,a){t&=~bp,t&=~ir,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var r=t;0<r;){var l=31-Tn(r),i=1<<l;a[l]=-1,r&=~i}n!==0&&hj(e,n,t)}function rd(){return Fe&6?!0:(Ao(0),!1)}function _p(){if(ze!==null){if(Ye===0)var e=ze.return;else e=ze,Xs=_r=null,cp(e),ul=null,Wi=0,e=ze;for(;e!==null;)Ib(e.alternate,e),e=e.return;ze=null}}function Cl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,CC(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),_p(),Je=e,ze=n=Ws(e.current,null),Le=t,Ye=0,kn=null,_a=!1,Ul=jo(e,t),jp=!1,kl=qn=bp=ir=Ua=mt=0,un=Bi=null,Hh=!1,t&8&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var r=31-Tn(a),l=1<<r;t|=e[r],a&=~l}return na=t,Ju(),n}function i0(e,t){Ae=null,Ne.H=ou,t===Co||t===td?(t=Tg(),Ye=3):t===Vj?(t=Tg(),Ye=4):Ye=t===Db?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,kn=t,ze===null&&(mt=1,du(e,Pn(t,e.current)))}function o0(){var e=Ne.H;return Ne.H=ou,e===null?ou:e}function c0(){var e=Ne.A;return Ne.A=iC,e}function Gh(){mt=4,_a||(Le&4194048)!==Le&&Kn.current!==null||(Ul=!0),!(Ua&134217727)&&!(ir&134217727)||Je===null||Na(Je,Le,qn,!1)}function Sf(e,t,n){var a=Fe;Fe|=2;var r=o0(),l=c0();(Je!==e||Le!==t)&&(pu=null,Cl(e,t)),t=!1;var i=mt;e:do try{if(Ye!==0&&ze!==null){var o=ze,c=kn;switch(Ye){case 8:_p(),i=6;break e;case 3:case 2:case 9:case 6:Kn.current===null&&(t=!0);var d=Ye;if(Ye=0,kn=null,nl(e,o,c,d),n&&Ul){i=0;break e}break;default:d=Ye,Ye=0,kn=null,nl(e,o,c,d)}}uC(),i=mt;break}catch(f){i0(e,f)}while(!0);return t&&e.shellSuspendCounter++,Xs=_r=null,Fe=a,Ne.H=r,Ne.A=l,ze===null&&(Je=null,Le=0,Ju()),i}function uC(){for(;ze!==null;)u0(ze)}function dC(e,t){var n=Fe;Fe|=2;var a=o0(),r=c0();Je!==e||Le!==t?(pu=null,mu=ks()+500,Cl(e,t)):Ul=jo(e,t);e:do try{if(Ye!==0&&ze!==null){t=ze;var l=kn;t:switch(Ye){case 1:Ye=0,kn=null,nl(e,t,l,1);break;case 2:case 9:if(Rg(l)){Ye=0,kn=null,Zg(t);break}t=function(){Ye!==2&&Ye!==9||Je!==e||(Ye=7),$s(e)},l.then(t,t);break e;case 3:Ye=7;break e;case 4:Ye=5;break e;case 7:Rg(l)?(Ye=0,kn=null,Zg(t)):(Ye=0,kn=null,nl(e,t,l,7));break;case 5:var i=null;switch(ze.tag){case 26:i=ze.memoizedState;case 5:case 27:var o=ze;if(!i||T0(i)){Ye=0,kn=null;var c=o.sibling;if(c!==null)ze=c;else{var d=o.return;d!==null?(ze=d,ld(d)):ze=null}break t}}Ye=0,kn=null,nl(e,t,l,5);break;case 6:Ye=0,kn=null,nl(e,t,l,6);break;case 8:_p(),mt=6;break e;default:throw Error(ee(462))}}fC();break}catch(f){i0(e,f)}while(!0);return Xs=_r=null,Ne.H=a,Ne.A=r,Fe=n,ze!==null?0:(Je=null,Le=0,Ju(),mt)}function fC(){for(;ze!==null&&!OS();)u0(ze)}function u0(e){var t=Hb(e.alternate,e,na);e.memoizedProps=e.pendingProps,t===null?ld(e):ze=t}function Zg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Vg(n,t,t.pendingProps,t.type,void 0,Le);break;case 11:t=Vg(n,t,t.pendingProps,t.type.render,t.ref,Le);break;case 5:cp(t);default:Ib(n,t),t=ze=Ij(t,na),t=Hb(n,t,na)}e.memoizedProps=e.pendingProps,t===null?ld(e):ze=t}function nl(e,t,n,a){Xs=_r=null,cp(t),ul=null,Wi=0;var r=t.return;try{if(tC(e,r,t,n,Le)){mt=1,du(e,Pn(n,e.current)),ze=null;return}}catch(l){if(r!==null)throw ze=r,l;mt=1,du(e,Pn(n,e.current)),ze=null;return}t.flags&32768?(Ie||a===1?e=!0:Ul||Le&536870912?e=!1:(_a=e=!0,(a===2||a===9||a===3||a===6)&&(a=Kn.current,a!==null&&a.tag===13&&(a.flags|=16384))),d0(t,e)):ld(t)}function ld(e){var t=e;do{if(t.flags&32768){d0(t,_a);return}e=t.return;var n=sC(t.alternate,t,na);if(n!==null){ze=n;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);mt===0&&(mt=5)}function d0(e,t){do{var n=aC(e.alternate,e);if(n!==null){n.flags&=32767,ze=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ze=e;return}ze=e=n}while(e!==null);mt=6,ze=null}function Jg(e,t,n,a,r,l,i,o,c){e.cancelPendingCommit=null;do id();while(Pt!==0);if(Fe&6)throw Error(ee(327));if(t!==null){if(t===e.current)throw Error(ee(177));if(l=t.lanes|t.childLanes,l|=Qm,GS(e,n,l,i,o,c),e===Je&&(ze=Je=null,Le=0),Sl=t,Aa=e,dl=n,Ih=l,Ph=r,a0=a,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,xC(Zc,function(){return x0(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,t.subtreeFlags&13878||a){a=Ne.T,Ne.T=null,r=Pe.p,Pe.p=2,i=Fe,Fe|=4;try{rC(e,t,n)}finally{Fe=i,Pe.p=r,Ne.T=a}}Pt=1,f0(),h0(),m0()}}function f0(){if(Pt===1){Pt=0;var e=Aa,t=Sl,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Ne.T,Ne.T=null;var a=Pe.p;Pe.p=2;var r=Fe;Fe|=4;try{Wb(t,e);var l=Kh,i=$j(e.containerInfo),o=l.focusedElem,c=l.selectionRange;if(i!==o&&o&&o.ownerDocument&&Mj(o.ownerDocument.documentElement,o)){if(c!==null&&Xm(o)){var d=c.start,f=c.end;if(f===void 0&&(f=d),"selectionStart"in o)o.selectionStart=d,o.selectionEnd=Math.min(f,o.value.length);else{var h=o.ownerDocument||document,m=h&&h.defaultView||window;if(m.getSelection){var x=m.getSelection(),b=o.textContent.length,v=Math.min(c.start,b),y=c.end===void 0?v:Math.min(c.end,b);!x.extend&&v>y&&(i=y,y=v,v=i);var g=jg(o,v),p=jg(o,y);if(g&&p&&(x.rangeCount!==1||x.anchorNode!==g.node||x.anchorOffset!==g.offset||x.focusNode!==p.node||x.focusOffset!==p.offset)){var j=h.createRange();j.setStart(g.node,g.offset),x.removeAllRanges(),v>y?(x.addRange(j),x.extend(p.node,p.offset)):(j.setEnd(p.node,p.offset),x.addRange(j))}}}}for(h=[],x=o;x=x.parentNode;)x.nodeType===1&&h.push({element:x,left:x.scrollLeft,top:x.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<h.length;o++){var w=h[o];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}_u=!!Fh,Kh=Fh=null}finally{Fe=r,Pe.p=a,Ne.T=n}}e.current=t,Pt=2}}function h0(){if(Pt===2){Pt=0;var e=Aa,t=Sl,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Ne.T,Ne.T=null;var a=Pe.p;Pe.p=2;var r=Fe;Fe|=4;try{Fb(e,t.alternate,t)}finally{Fe=r,Pe.p=a,Ne.T=n}}Pt=3}}function m0(){if(Pt===4||Pt===3){Pt=0,DS();var e=Aa,t=Sl,n=dl,a=a0;t.subtreeFlags&10256||t.flags&10256?Pt=5:(Pt=0,Sl=Aa=null,p0(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Ea=null),Pm(n),t=t.stateNode,Rn&&typeof Rn.onCommitFiberRoot=="function")try{Rn.onCommitFiberRoot(yo,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=Ne.T,r=Pe.p,Pe.p=2,Ne.T=null;try{for(var l=e.onRecoverableError,i=0;i<a.length;i++){var o=a[i];l(o.value,{componentStack:o.stack})}}finally{Ne.T=t,Pe.p=r}}dl&3&&id(),$s(e),r=e.pendingLanes,n&4194090&&r&42?e===qh?Hi++:(Hi=0,qh=e):Hi=0,Ao(0)}}function p0(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,So(t)))}function id(e){return f0(),h0(),m0(),x0()}function x0(){if(Pt!==5)return!1;var e=Aa,t=Ih;Ih=0;var n=Pm(dl),a=Ne.T,r=Pe.p;try{Pe.p=32>n?32:n,Ne.T=null,n=Ph,Ph=null;var l=Aa,i=dl;if(Pt=0,Sl=Aa=null,dl=0,Fe&6)throw Error(ee(331));var o=Fe;if(Fe|=4,n0(l.current),Jb(l,l.current,i,n),Fe=o,Ao(0,!1),Rn&&typeof Rn.onPostCommitFiberRoot=="function")try{Rn.onPostCommitFiberRoot(yo,l)}catch{}return!0}finally{Pe.p=r,Ne.T=a,p0(e,t)}}function ev(e,t,n){t=Pn(n,t),t=zh(e.stateNode,t,2),e=Ta(e,t,2),e!==null&&(bo(e,2),$s(e))}function Ze(e,t,n){if(e.tag===3)ev(e,e,n);else for(;t!==null;){if(t.tag===3){ev(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ea===null||!Ea.has(a))){e=Pn(n,e),n=$b(2),a=Ta(t,n,2),a!==null&&(Ob(n,a,t,e),bo(a,2),$s(a));break}}t=t.return}}function Cf(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new oC;var r=new Set;a.set(t,r)}else r=a.get(t),r===void 0&&(r=new Set,a.set(t,r));r.has(n)||(jp=!0,r.add(n),e=hC.bind(null,e,t,n),t.then(e,e))}function hC(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Je===e&&(Le&n)===n&&(mt===4||mt===3&&(Le&62914560)===Le&&300>ks()-wp?!(Fe&2)&&Cl(e,0):bp|=n,kl===Le&&(kl=0)),$s(e)}function g0(e,t){t===0&&(t=fj()),e=Ll(e,t),e!==null&&(bo(e,t),$s(e))}function mC(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),g0(e,n)}function pC(e,t){var n=0;switch(e.tag){case 13:var a=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(ee(314))}a!==null&&a.delete(t),g0(e,n)}function xC(e,t){return Hm(e,t)}var xu=null,Gr=null,Vh=!1,gu=!1,Rf=!1,or=0;function $s(e){e!==Gr&&e.next===null&&(Gr===null?xu=Gr=e:Gr=Gr.next=e),gu=!0,Vh||(Vh=!0,vC())}function Ao(e,t){if(!Rf&&gu){Rf=!0;do for(var n=!1,a=xu;a!==null;){if(e!==0){var r=a.pendingLanes;if(r===0)var l=0;else{var i=a.suspendedLanes,o=a.pingedLanes;l=(1<<31-Tn(42|e)+1)-1,l&=r&~(i&~o),l=l&201326741?l&201326741|1:l?l|2:0}l!==0&&(n=!0,tv(a,l))}else l=Le,l=Xu(a,a===Je?l:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),!(l&3)||jo(a,l)||(n=!0,tv(a,l));a=a.next}while(n);Rf=!1}}function gC(){v0()}function v0(){gu=Vh=!1;var e=0;or!==0&&(SC()&&(e=or),or=0);for(var t=ks(),n=null,a=xu;a!==null;){var r=a.next,l=y0(a,t);l===0?(a.next=null,n===null?xu=r:n.next=r,r===null&&(Gr=n)):(n=a,(e!==0||l&3)&&(gu=!0)),a=r}Ao(e)}function y0(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,r=e.expirationTimes,l=e.pendingLanes&-62914561;0<l;){var i=31-Tn(l),o=1<<i,c=r[i];c===-1?(!(o&n)||o&a)&&(r[i]=qS(o,t)):c<=t&&(e.expiredLanes|=o),l&=~o}if(t=Je,n=Le,n=Xu(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Jd(a),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||jo(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&Jd(a),Pm(n)){case 2:case 8:n=cj;break;case 32:n=Zc;break;case 268435456:n=uj;break;default:n=Zc}return a=j0.bind(null,e),n=Hm(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&Jd(a),e.callbackPriority=2,e.callbackNode=null,2}function j0(e,t){if(Pt!==0&&Pt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(id()&&e.callbackNode!==n)return null;var a=Le;return a=Xu(e,e===Je?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(l0(e,a,t),y0(e,ks()),e.callbackNode!=null&&e.callbackNode===n?j0.bind(null,e):null)}function tv(e,t){if(id())return null;l0(e,t,!0)}function vC(){RC(function(){Fe&6?Hm(oj,gC):v0()})}function Np(){return or===0&&(or=dj()),or}function nv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Tc(""+e)}function sv(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 yC(e,t,n,a,r){if(t==="submit"&&n&&n.stateNode===r){var l=nv((r[fn]||null).action),i=a.submitter;i&&(t=(t=i[fn]||null)?nv(t.formAction):i.getAttribute("formAction"),t!==null&&(l=t,i=null));var o=new Qu("action","action",null,a,r);e.push({event:o,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(or!==0){var c=i?sv(r,i):new FormData(r);Oh(n,{pending:!0,data:c,method:r.method,action:l},null,c)}}else typeof l=="function"&&(o.preventDefault(),c=i?sv(r,i):new FormData(r),Oh(n,{pending:!0,data:c,method:r.method,action:l},l,c))},currentTarget:r}]})}}for(var Tf=0;Tf<wh.length;Tf++){var Ef=wh[Tf],jC=Ef.toLowerCase(),bC=Ef[0].toUpperCase()+Ef.slice(1);us(jC,"on"+bC)}us(Dj,"onAnimationEnd");us(zj,"onAnimationIteration");us(Lj,"onAnimationStart");us("dblclick","onDoubleClick");us("focusin","onFocus");us("focusout","onBlur");us(U2,"onTransitionRun");us(B2,"onTransitionStart");us(H2,"onTransitionCancel");us(Uj,"onTransitionEnd");yl("onMouseEnter",["mouseout","mouseover"]);yl("onMouseLeave",["mouseout","mouseover"]);yl("onPointerEnter",["pointerout","pointerover"]);yl("onPointerLeave",["pointerout","pointerover"]);jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));jr("onBeforeInput",["compositionend","keypress","textInput","paste"]);jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zi="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(" "),wC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Zi));function b0(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],r=a.event;a=a.listeners;e:{var l=void 0;if(t)for(var i=a.length-1;0<=i;i--){var o=a[i],c=o.instance,d=o.currentTarget;if(o=o.listener,c!==l&&r.isPropagationStopped())break e;l=o,r.currentTarget=d;try{l(r)}catch(f){uu(f)}r.currentTarget=null,l=c}else for(i=0;i<a.length;i++){if(o=a[i],c=o.instance,d=o.currentTarget,o=o.listener,c!==l&&r.isPropagationStopped())break e;l=o,r.currentTarget=d;try{l(r)}catch(f){uu(f)}r.currentTarget=null,l=c}}}}function De(e,t){var n=t[ph];n===void 0&&(n=t[ph]=new Set);var a=e+"__bubble";n.has(a)||(w0(t,e,2,!1),n.add(a))}function Af(e,t,n){var a=0;t&&(a|=4),w0(n,e,a,t)}var ic="_reactListening"+Math.random().toString(36).slice(2);function kp(e){if(!e[ic]){e[ic]=!0,xj.forEach(function(n){n!=="selectionchange"&&(wC.has(n)||Af(n,!1,e),Af(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ic]||(t[ic]=!0,Af("selectionchange",!1,t))}}function w0(e,t,n,a){switch(O0(t)){case 2:var r=XC;break;case 8:r=QC;break;default:r=Tp}n=r.bind(null,t,n,e),r=void 0,!yh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),a?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function Mf(e,t,n,a,r){var l=a;if(!(t&1)&&!(t&2)&&a!==null)e:for(;;){if(a===null)return;var i=a.tag;if(i===3||i===4){var o=a.stateNode.containerInfo;if(o===r)break;if(i===4)for(i=a.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===r)return;i=i.return}for(;o!==null;){if(i=Fr(o),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){a=l=i;continue e}o=o.parentNode}}a=a.return}Nj(function(){var d=l,f=Vm(n),h=[];e:{var m=Bj.get(e);if(m!==void 0){var x=Qu,b=e;switch(e){case"keypress":if(Ac(n)===0)break e;case"keydown":case"keyup":x=x2;break;case"focusin":b="focus",x=of;break;case"focusout":b="blur",x=of;break;case"beforeblur":case"afterblur":x=of;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":x=ug;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=a2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=y2;break;case Dj:case zj:case Lj:x=i2;break;case Uj:x=b2;break;case"scroll":case"scrollend":x=n2;break;case"wheel":x=_2;break;case"copy":case"cut":case"paste":x=c2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=fg;break;case"toggle":case"beforetoggle":x=k2}var v=(t&4)!==0,y=!v&&(e==="scroll"||e==="scrollend"),g=v?m!==null?m+"Capture":null:m;v=[];for(var p=d,j;p!==null;){var w=p;if(j=w.stateNode,w=w.tag,w!==5&&w!==26&&w!==27||j===null||g===null||(w=Yi(p,g),w!=null&&v.push(Ji(p,w,j))),y)break;p=p.return}0<v.length&&(m=new x(m,b,null,n,f),h.push({event:m,listeners:v}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",x=e==="mouseout"||e==="pointerout",m&&n!==vh&&(b=n.relatedTarget||n.fromElement)&&(Fr(b)||b[Dl]))break e;if((x||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,x?(b=n.relatedTarget||n.toElement,x=d,b=b?Fr(b):null,b!==null&&(y=vo(b),v=b.tag,b!==y||v!==5&&v!==27&&v!==6)&&(b=null)):(x=null,b=d),x!==b)){if(v=ug,w="onMouseLeave",g="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(v=fg,w="onPointerLeave",g="onPointerEnter",p="pointer"),y=x==null?m:vi(x),j=b==null?m:vi(b),m=new v(w,p+"leave",x,n,f),m.target=y,m.relatedTarget=j,w=null,Fr(f)===d&&(v=new v(g,p+"enter",b,n,f),v.target=j,v.relatedTarget=y,w=v),y=w,x&&b)t:{for(v=x,g=b,p=0,j=v;j;j=Mr(j))p++;for(j=0,w=g;w;w=Mr(w))j++;for(;0<p-j;)v=Mr(v),p--;for(;0<j-p;)g=Mr(g),j--;for(;p--;){if(v===g||g!==null&&v===g.alternate)break t;v=Mr(v),g=Mr(g)}v=null}else v=null;x!==null&&av(h,m,x,v,!1),b!==null&&y!==null&&av(h,y,b,v,!0)}}e:{if(m=d?vi(d):window,x=m.nodeName&&m.nodeName.toLowerCase(),x==="select"||x==="input"&&m.type==="file")var N=xg;else if(pg(m))if(Ej)N=D2;else{N=$2;var C=M2}else x=m.nodeName,!x||x.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?d&&Gm(d.elementType)&&(N=xg):N=O2;if(N&&(N=N(e,d))){Tj(h,N,n,f);break e}C&&C(e,m,d),e==="focusout"&&d&&m.type==="number"&&d.memoizedProps.value!=null&&gh(m,"number",m.value)}switch(C=d?vi(d):window,e){case"focusin":(pg(C)||C.contentEditable==="true")&&(Qr=C,jh=d,Ei=null);break;case"focusout":Ei=jh=Qr=null;break;case"mousedown":bh=!0;break;case"contextmenu":case"mouseup":case"dragend":bh=!1,bg(h,n,f);break;case"selectionchange":if(L2)break;case"keydown":case"keyup":bg(h,n,f)}var _;if(Km)e:{switch(e){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else Xr?Cj(e,n)&&(S="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&(Sj&&n.locale!=="ko"&&(Xr||S!=="onCompositionStart"?S==="onCompositionEnd"&&Xr&&(_=kj()):(wa=f,Ym="value"in wa?wa.value:wa.textContent,Xr=!0)),C=vu(d,S),0<C.length&&(S=new dg(S,e,null,n,f),h.push({event:S,listeners:C}),_?S.data=_:(_=Rj(n),_!==null&&(S.data=_)))),(_=C2?R2(e,n):T2(e,n))&&(S=vu(d,"onBeforeInput"),0<S.length&&(C=new dg("onBeforeInput","beforeinput",null,n,f),h.push({event:C,listeners:S}),C.data=_)),yC(h,e,d,n,f)}b0(h,t)})}function Ji(e,t,n){return{instance:e,listener:t,currentTarget:n}}function vu(e,t){for(var n=t+"Capture",a=[];e!==null;){var r=e,l=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||l===null||(r=Yi(e,n),r!=null&&a.unshift(Ji(e,r,l)),r=Yi(e,t),r!=null&&a.push(Ji(e,r,l))),e.tag===3)return a;e=e.return}return[]}function Mr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function av(e,t,n,a,r){for(var l=t._reactName,i=[];n!==null&&n!==a;){var o=n,c=o.alternate,d=o.stateNode;if(o=o.tag,c!==null&&c===a)break;o!==5&&o!==26&&o!==27||d===null||(c=d,r?(d=Yi(n,l),d!=null&&i.unshift(Ji(n,d,c))):r||(d=Yi(n,l),d!=null&&i.push(Ji(n,d,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var _C=/\r\n?/g,NC=/\u0000|\uFFFD/g;function rv(e){return(typeof e=="string"?e:""+e).replace(_C,`
|
|
49
|
+
`).replace(NC,"")}function _0(e,t){return t=rv(t),rv(e)===t}function od(){}function Qe(e,t,n,a,r,l){switch(n){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||jl(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&jl(e,""+a);break;case"className":ec(e,"class",a);break;case"tabIndex":ec(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":ec(e,n,a);break;case"style":_j(e,a,l);break;case"data":if(t!=="object"){ec(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=Tc(""+a),e.setAttribute(n,a);break;case"action":case"formAction":if(typeof a=="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 l=="function"&&(n==="formAction"?(t!=="input"&&Qe(e,t,"name",r.name,r,null),Qe(e,t,"formEncType",r.formEncType,r,null),Qe(e,t,"formMethod",r.formMethod,r,null),Qe(e,t,"formTarget",r.formTarget,r,null)):(Qe(e,t,"encType",r.encType,r,null),Qe(e,t,"method",r.method,r,null),Qe(e,t,"target",r.target,r,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=Tc(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=od);break;case"onScroll":a!=null&&De("scroll",e);break;case"onScrollEnd":a!=null&&De("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(ee(61));if(n=a.__html,n!=null){if(r.children!=null)throw Error(ee(60));e.innerHTML=n}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}n=Tc(""+a),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":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""+a):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":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":a===!0?e.setAttribute(n,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(n,a):e.removeAttribute(n);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(n):e.setAttribute(n,a);break;case"popover":De("beforetoggle",e),De("toggle",e),Rc(e,"popover",a);break;case"xlinkActuate":Us(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Us(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Us(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Us(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Us(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Us(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Us(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Us(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Us(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Rc(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=e2.get(n)||n,Rc(e,n,a))}}function Yh(e,t,n,a,r,l){switch(n){case"style":_j(e,a,l);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(ee(61));if(n=a.__html,n!=null){if(r.children!=null)throw Error(ee(60));e.innerHTML=n}}break;case"children":typeof a=="string"?jl(e,a):(typeof a=="number"||typeof a=="bigint")&&jl(e,""+a);break;case"onScroll":a!=null&&De("scroll",e);break;case"onScrollEnd":a!=null&&De("scrollend",e);break;case"onClick":a!=null&&(e.onclick=od);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!gj.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),l=e[fn]||null,l=l!=null?l[n]:null,typeof l=="function"&&e.removeEventListener(t,l,r),typeof a=="function")){typeof l!="function"&&l!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,a,r);break e}n in e?e[n]=a:a===!0?e.setAttribute(n,""):Rc(e,n,a)}}}function qt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var a=!1,r=!1,l;for(l in n)if(n.hasOwnProperty(l)){var i=n[l];if(i!=null)switch(l){case"src":a=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(ee(137,t));default:Qe(e,t,l,i,n,null)}}r&&Qe(e,t,"srcSet",n.srcSet,n,null),a&&Qe(e,t,"src",n.src,n,null);return;case"input":De("invalid",e);var o=l=i=r=null,c=null,d=null;for(a in n)if(n.hasOwnProperty(a)){var f=n[a];if(f!=null)switch(a){case"name":r=f;break;case"type":i=f;break;case"checked":c=f;break;case"defaultChecked":d=f;break;case"value":l=f;break;case"defaultValue":o=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(ee(137,t));break;default:Qe(e,t,a,f,n,null)}}jj(e,l,o,c,d,i,r,!1),Jc(e);return;case"select":De("invalid",e),a=i=l=null;for(r in n)if(n.hasOwnProperty(r)&&(o=n[r],o!=null))switch(r){case"value":l=o;break;case"defaultValue":i=o;break;case"multiple":a=o;default:Qe(e,t,r,o,n,null)}t=l,n=i,e.multiple=!!a,t!=null?rl(e,!!a,t,!1):n!=null&&rl(e,!!a,n,!0);return;case"textarea":De("invalid",e),l=r=a=null;for(i in n)if(n.hasOwnProperty(i)&&(o=n[i],o!=null))switch(i){case"value":a=o;break;case"defaultValue":r=o;break;case"children":l=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(ee(91));break;default:Qe(e,t,i,o,n,null)}wj(e,a,r,l),Jc(e);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(a=n[c],a!=null))switch(c){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:Qe(e,t,c,a,n,null)}return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(a=0;a<Zi.length;a++)De(Zi[a],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("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)&&(a=n[d],a!=null))switch(d){case"children":case"dangerouslySetInnerHTML":throw Error(ee(137,t));default:Qe(e,t,d,a,n,null)}return;default:if(Gm(t)){for(f in n)n.hasOwnProperty(f)&&(a=n[f],a!==void 0&&Yh(e,t,f,a,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(a=n[o],a!=null&&Qe(e,t,o,a,n,null))}function kC(e,t,n,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,l=null,i=null,o=null,c=null,d=null,f=null;for(x in n){var h=n[x];if(n.hasOwnProperty(x)&&h!=null)switch(x){case"checked":break;case"value":break;case"defaultValue":c=h;default:a.hasOwnProperty(x)||Qe(e,t,x,null,a,h)}}for(var m in a){var x=a[m];if(h=n[m],a.hasOwnProperty(m)&&(x!=null||h!=null))switch(m){case"type":l=x;break;case"name":r=x;break;case"checked":d=x;break;case"defaultChecked":f=x;break;case"value":i=x;break;case"defaultValue":o=x;break;case"children":case"dangerouslySetInnerHTML":if(x!=null)throw Error(ee(137,t));break;default:x!==h&&Qe(e,t,m,x,a,h)}}xh(e,i,o,c,d,f,l,r);return;case"select":x=i=o=m=null;for(l in n)if(c=n[l],n.hasOwnProperty(l)&&c!=null)switch(l){case"value":break;case"multiple":x=c;default:a.hasOwnProperty(l)||Qe(e,t,l,null,a,c)}for(r in a)if(l=a[r],c=n[r],a.hasOwnProperty(r)&&(l!=null||c!=null))switch(r){case"value":m=l;break;case"defaultValue":o=l;break;case"multiple":i=l;default:l!==c&&Qe(e,t,r,l,a,c)}t=o,n=i,a=x,m!=null?rl(e,!!n,m,!1):!!a!=!!n&&(t!=null?rl(e,!!n,t,!0):rl(e,!!n,n?[]:"",!1));return;case"textarea":x=m=null;for(o in n)if(r=n[o],n.hasOwnProperty(o)&&r!=null&&!a.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:Qe(e,t,o,null,a,r)}for(i in a)if(r=a[i],l=n[i],a.hasOwnProperty(i)&&(r!=null||l!=null))switch(i){case"value":m=r;break;case"defaultValue":x=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(ee(91));break;default:r!==l&&Qe(e,t,i,r,a,l)}bj(e,m,x);return;case"option":for(var b in n)if(m=n[b],n.hasOwnProperty(b)&&m!=null&&!a.hasOwnProperty(b))switch(b){case"selected":e.selected=!1;break;default:Qe(e,t,b,null,a,m)}for(c in a)if(m=a[c],x=n[c],a.hasOwnProperty(c)&&m!==x&&(m!=null||x!=null))switch(c){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Qe(e,t,c,m,a,x)}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 v in n)m=n[v],n.hasOwnProperty(v)&&m!=null&&!a.hasOwnProperty(v)&&Qe(e,t,v,null,a,m);for(d in a)if(m=a[d],x=n[d],a.hasOwnProperty(d)&&m!==x&&(m!=null||x!=null))switch(d){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(ee(137,t));break;default:Qe(e,t,d,m,a,x)}return;default:if(Gm(t)){for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!==void 0&&!a.hasOwnProperty(y)&&Yh(e,t,y,void 0,a,m);for(f in a)m=a[f],x=n[f],!a.hasOwnProperty(f)||m===x||m===void 0&&x===void 0||Yh(e,t,f,m,a,x);return}}for(var g in n)m=n[g],n.hasOwnProperty(g)&&m!=null&&!a.hasOwnProperty(g)&&Qe(e,t,g,null,a,m);for(h in a)m=a[h],x=n[h],!a.hasOwnProperty(h)||m===x||m==null&&x==null||Qe(e,t,h,m,a,x)}var Fh=null,Kh=null;function yu(e){return e.nodeType===9?e:e.ownerDocument}function lv(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 N0(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 Xh(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 $f=null;function SC(){var e=window.event;return e&&e.type==="popstate"?e===$f?!1:($f=e,!0):($f=null,!1)}var k0=typeof setTimeout=="function"?setTimeout:void 0,CC=typeof clearTimeout=="function"?clearTimeout:void 0,iv=typeof Promise=="function"?Promise:void 0,RC=typeof queueMicrotask=="function"?queueMicrotask:typeof iv<"u"?function(e){return iv.resolve(null).then(e).catch(TC)}:k0;function TC(e){setTimeout(function(){throw e})}function qa(e){return e==="head"}function ov(e,t){var n=t,a=0,r=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(0<a&&8>a){n=a;var i=e.ownerDocument;if(n&1&&Ii(i.documentElement),n&2&&Ii(i.body),n&4)for(n=i.head,Ii(n),i=n.firstChild;i;){var o=i.nextSibling,c=i.nodeName;i[wo]||c==="SCRIPT"||c==="STYLE"||c==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}if(r===0){e.removeChild(l),ao(t);return}r--}else n==="$"||n==="$?"||n==="$!"?r++:a=n.charCodeAt(0)-48;else a=0;n=l}while(n);ao(t)}function Qh(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":Qh(n),qm(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function EC(e,t,n,a){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[wo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(l=e.getAttribute("rel"),l==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(l!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(l=e.getAttribute("src"),(l!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&l&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var l=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===l)return e}else return e;if(e=ss(e.nextSibling),e===null)break}return null}function AC(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ss(e.nextSibling),e===null))return null;return e}function Wh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function MC(e,t){var n=e.ownerDocument;if(e.data!=="$?"||n.readyState==="complete")t();else{var a=function(){t(),n.removeEventListener("DOMContentLoaded",a)};n.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function ss(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 Zh=null;function cv(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 S0(e,t,n){switch(t=yu(n),e){case"html":if(e=t.documentElement,!e)throw Error(ee(452));return e;case"head":if(e=t.head,!e)throw Error(ee(453));return e;case"body":if(e=t.body,!e)throw Error(ee(454));return e;default:throw Error(ee(451))}}function Ii(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);qm(e)}var Xn=new Map,uv=new Set;function ju(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ra=Pe.d;Pe.d={f:$C,r:OC,D:DC,C:zC,L:LC,m:UC,X:HC,S:BC,M:IC};function $C(){var e=ra.f(),t=rd();return e||t}function OC(e){var t=zl(e);t!==null&&t.tag===5&&t.type==="form"?yb(t):ra.r(e)}var Bl=typeof document>"u"?null:document;function C0(e,t,n){var a=Bl;if(a&&typeof t=="string"&&t){var r=In(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),uv.has(r)||(uv.add(r),e={rel:e,crossOrigin:n,href:t},a.querySelector(r)===null&&(t=a.createElement("link"),qt(t,"link",e),Lt(t),a.head.appendChild(t)))}}function DC(e){ra.D(e),C0("dns-prefetch",e,null)}function zC(e,t){ra.C(e,t),C0("preconnect",e,t)}function LC(e,t,n){ra.L(e,t,n);var a=Bl;if(a&&e&&t){var r='link[rel="preload"][as="'+In(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+In(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+In(n.imageSizes)+'"]')):r+='[href="'+In(e)+'"]';var l=r;switch(t){case"style":l=Rl(e);break;case"script":l=Hl(e)}Xn.has(l)||(e=nt({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Xn.set(l,e),a.querySelector(r)!==null||t==="style"&&a.querySelector(Mo(l))||t==="script"&&a.querySelector($o(l))||(t=a.createElement("link"),qt(t,"link",e),Lt(t),a.head.appendChild(t)))}}function UC(e,t){ra.m(e,t);var n=Bl;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+In(a)+'"][href="'+In(e)+'"]',l=r;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=Hl(e)}if(!Xn.has(l)&&(e=nt({rel:"modulepreload",href:e},t),Xn.set(l,e),n.querySelector(r)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector($o(l)))return}a=n.createElement("link"),qt(a,"link",e),Lt(a),n.head.appendChild(a)}}}function BC(e,t,n){ra.S(e,t,n);var a=Bl;if(a&&e){var r=al(a).hoistableStyles,l=Rl(e);t=t||"default";var i=r.get(l);if(!i){var o={loading:0,preload:null};if(i=a.querySelector(Mo(l)))o.loading=5;else{e=nt({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Xn.get(l))&&Sp(e,n);var c=i=a.createElement("link");Lt(c),qt(c,"link",e),c._p=new Promise(function(d,f){c.onload=d,c.onerror=f}),c.addEventListener("load",function(){o.loading|=1}),c.addEventListener("error",function(){o.loading|=2}),o.loading|=4,Uc(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:o},r.set(l,i)}}}function HC(e,t){ra.X(e,t);var n=Bl;if(n&&e){var a=al(n).hoistableScripts,r=Hl(e),l=a.get(r);l||(l=n.querySelector($o(r)),l||(e=nt({src:e,async:!0},t),(t=Xn.get(r))&&Cp(e,t),l=n.createElement("script"),Lt(l),qt(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(r,l))}}function IC(e,t){ra.M(e,t);var n=Bl;if(n&&e){var a=al(n).hoistableScripts,r=Hl(e),l=a.get(r);l||(l=n.querySelector($o(r)),l||(e=nt({src:e,async:!0,type:"module"},t),(t=Xn.get(r))&&Cp(e,t),l=n.createElement("script"),Lt(l),qt(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(r,l))}}function dv(e,t,n,a){var r=(r=Ca.current)?ju(r):null;if(!r)throw Error(ee(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Rl(n.href),n=al(r).hoistableStyles,a=n.get(t),a||(a={type:"style",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Rl(n.href);var l=al(r).hoistableStyles,i=l.get(e);if(i||(r=r.ownerDocument||r,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},l.set(e,i),(l=r.querySelector(Mo(e)))&&!l._p&&(i.instance=l,i.state.loading=5),Xn.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},Xn.set(e,n),l||PC(r,e,n,i.state))),t&&a===null)throw Error(ee(528,""));return i}if(t&&a!==null)throw Error(ee(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Hl(n),n=al(r).hoistableScripts,a=n.get(t),a||(a={type:"script",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(ee(444,e))}}function Rl(e){return'href="'+In(e)+'"'}function Mo(e){return'link[rel="stylesheet"]['+e+"]"}function R0(e){return nt({},e,{"data-precedence":e.precedence,precedence:null})}function PC(e,t,n,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),qt(t,"link",n),Lt(t),e.head.appendChild(t))}function Hl(e){return'[src="'+In(e)+'"]'}function $o(e){return"script[async]"+e}function fv(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+In(n.href)+'"]');if(a)return t.instance=a,Lt(a),a;var r=nt({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Lt(a),qt(a,"style",r),Uc(a,n.precedence,e),t.instance=a;case"stylesheet":r=Rl(n.href);var l=e.querySelector(Mo(r));if(l)return t.state.loading|=4,t.instance=l,Lt(l),l;a=R0(n),(r=Xn.get(r))&&Sp(a,r),l=(e.ownerDocument||e).createElement("link"),Lt(l);var i=l;return i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),qt(l,"link",a),t.state.loading|=4,Uc(l,n.precedence,e),t.instance=l;case"script":return l=Hl(n.src),(r=e.querySelector($o(l)))?(t.instance=r,Lt(r),r):(a=n,(r=Xn.get(l))&&(a=nt({},n),Cp(a,r)),e=e.ownerDocument||e,r=e.createElement("script"),Lt(r),qt(r,"link",a),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(ee(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(a=t.instance,t.state.loading|=4,Uc(a,n.precedence,e));return t.instance}function Uc(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=a.length?a[a.length-1]:null,l=r,i=0;i<a.length;i++){var o=a[i];if(o.dataset.precedence===t)l=o;else if(l!==r)break}l?l.parentNode.insertBefore(e,l.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Sp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Cp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Bc=null;function hv(e,t,n){if(Bc===null){var a=new Map,r=Bc=new Map;r.set(n,a)}else r=Bc,a=r.get(n),a||(a=new Map,r.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var l=n[r];if(!(l[wo]||l[Vt]||e==="link"&&l.getAttribute("rel")==="stylesheet")&&l.namespaceURI!=="http://www.w3.org/2000/svg"){var i=l.getAttribute(t)||"";i=e+i;var o=a.get(i);o?o.push(l):a.set(i,[l])}}return a}function mv(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function qC(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 T0(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var eo=null;function GC(){}function VC(e,t,n){if(eo===null)throw Error(ee(475));var a=eo;if(t.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var r=Rl(n.href),l=e.querySelector(Mo(r));if(l){e=l._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(a.count++,a=bu.bind(a),e.then(a,a)),t.state.loading|=4,t.instance=l,Lt(l);return}l=e.ownerDocument||e,n=R0(n),(r=Xn.get(r))&&Sp(n,r),l=l.createElement("link"),Lt(l);var i=l;i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),qt(l,"link",n),t.instance=l}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(t,e),(e=t.state.preload)&&!(t.state.loading&3)&&(a.count++,t=bu.bind(a),e.addEventListener("load",t),e.addEventListener("error",t))}}function YC(){if(eo===null)throw Error(ee(475));var e=eo;return e.stylesheets&&e.count===0&&Jh(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&Jh(e,e.stylesheets),e.unsuspend){var a=e.unsuspend;e.unsuspend=null,a()}},6e4);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(n)}}:null}function bu(){if(this.count--,this.count===0){if(this.stylesheets)Jh(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var wu=null;function Jh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,wu=new Map,t.forEach(FC,e),wu=null,bu.call(e))}function FC(e,t){if(!(t.state.loading&4)){var n=wu.get(e);if(n)var a=n.get(null);else{n=new Map,wu.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),l=0;l<r.length;l++){var i=r[l];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(n.set(i.dataset.precedence,i),a=i)}a&&n.set(null,a)}r=t.instance,i=r.getAttribute("data-precedence"),l=n.get(i)||a,l===a&&n.set(null,r),n.set(i,r),this.count++,a=bu.bind(this),r.addEventListener("load",a),r.addEventListener("error",a),l?l.parentNode.insertBefore(r,l.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var to={$$typeof:Ys,Provider:null,Consumer:null,_currentValue:nr,_currentValue2:nr,_threadCount:0};function KC(e,t,n,a,r,l,i,o){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=ef(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ef(0),this.hiddenUpdates=ef(null),this.identifierPrefix=a,this.onUncaughtError=r,this.onCaughtError=l,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function E0(e,t,n,a,r,l,i,o,c,d,f,h){return e=new KC(e,t,n,i,o,c,d,h),t=1,l===!0&&(t|=24),l=Cn(3,null,null,t),e.current=l,l.stateNode=e,t=tp(),t.refCount++,e.pooledCache=t,t.refCount++,l.memoizedState={element:a,isDehydrated:n,cache:t},sp(l),e}function A0(e){return e?(e=Jr,e):Jr}function M0(e,t,n,a,r,l){r=A0(r),a.context===null?a.context=r:a.pendingContext=r,a=Ra(t),a.payload={element:n},l=l===void 0?null:l,l!==null&&(a.callback=l),n=Ta(e,a,t),n!==null&&(An(n,e,t),$i(n,e,t))}function pv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Rp(e,t){pv(e,t),(e=e.alternate)&&pv(e,t)}function $0(e){if(e.tag===13){var t=Ll(e,67108864);t!==null&&An(t,e,67108864),Rp(e,67108864)}}var _u=!0;function XC(e,t,n,a){var r=Ne.T;Ne.T=null;var l=Pe.p;try{Pe.p=2,Tp(e,t,n,a)}finally{Pe.p=l,Ne.T=r}}function QC(e,t,n,a){var r=Ne.T;Ne.T=null;var l=Pe.p;try{Pe.p=8,Tp(e,t,n,a)}finally{Pe.p=l,Ne.T=r}}function Tp(e,t,n,a){if(_u){var r=em(a);if(r===null)Mf(e,t,a,Nu,n),xv(e,a);else if(ZC(r,e,t,n,a))a.stopPropagation();else if(xv(e,a),t&4&&-1<WC.indexOf(e)){for(;r!==null;){var l=zl(r);if(l!==null)switch(l.tag){case 3:if(l=l.stateNode,l.current.memoizedState.isDehydrated){var i=Za(l.pendingLanes);if(i!==0){var o=l;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var c=1<<31-Tn(i);o.entanglements[1]|=c,i&=~c}$s(l),!(Fe&6)&&(mu=ks()+500,Ao(0))}}break;case 13:o=Ll(l,2),o!==null&&An(o,l,2),rd(),Rp(l,2)}if(l=em(a),l===null&&Mf(e,t,a,Nu,n),l===r)break;r=l}r!==null&&a.stopPropagation()}else Mf(e,t,a,null,n)}}function em(e){return e=Vm(e),Ep(e)}var Nu=null;function Ep(e){if(Nu=null,e=Fr(e),e!==null){var t=vo(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=aj(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 Nu=e,null}function O0(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(zS()){case oj:return 2;case cj:return 8;case Zc:case LS:return 32;case uj:return 268435456;default:return 32}default:return 32}}var tm=!1,Ma=null,$a=null,Oa=null,no=new Map,so=new Map,ja=[],WC="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 xv(e,t){switch(e){case"focusin":case"focusout":Ma=null;break;case"dragenter":case"dragleave":$a=null;break;case"mouseover":case"mouseout":Oa=null;break;case"pointerover":case"pointerout":no.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":so.delete(t.pointerId)}}function di(e,t,n,a,r,l){return e===null||e.nativeEvent!==l?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:l,targetContainers:[r]},t!==null&&(t=zl(t),t!==null&&$0(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function ZC(e,t,n,a,r){switch(t){case"focusin":return Ma=di(Ma,e,t,n,a,r),!0;case"dragenter":return $a=di($a,e,t,n,a,r),!0;case"mouseover":return Oa=di(Oa,e,t,n,a,r),!0;case"pointerover":var l=r.pointerId;return no.set(l,di(no.get(l)||null,e,t,n,a,r)),!0;case"gotpointercapture":return l=r.pointerId,so.set(l,di(so.get(l)||null,e,t,n,a,r)),!0}return!1}function D0(e){var t=Fr(e.target);if(t!==null){var n=vo(t);if(n!==null){if(t=n.tag,t===13){if(t=aj(n),t!==null){e.blockedOn=t,VS(e.priority,function(){if(n.tag===13){var a=En();a=Im(a);var r=Ll(n,a);r!==null&&An(r,n,a),Rp(n,a)}});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Hc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=em(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);vh=a,n.target.dispatchEvent(a),vh=null}else return t=zl(n),t!==null&&$0(t),e.blockedOn=n,!1;t.shift()}return!0}function gv(e,t,n){Hc(e)&&n.delete(t)}function JC(){tm=!1,Ma!==null&&Hc(Ma)&&(Ma=null),$a!==null&&Hc($a)&&($a=null),Oa!==null&&Hc(Oa)&&(Oa=null),no.forEach(gv),so.forEach(gv)}function oc(e,t){e.blockedOn===t&&(e.blockedOn=null,tm||(tm=!0,Dt.unstable_scheduleCallback(Dt.unstable_NormalPriority,JC)))}var cc=null;function vv(e){cc!==e&&(cc=e,Dt.unstable_scheduleCallback(Dt.unstable_NormalPriority,function(){cc===e&&(cc=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],r=e[t+2];if(typeof a!="function"){if(Ep(a||n)===null)continue;break}var l=zl(n);l!==null&&(e.splice(t,3),t-=3,Oh(l,{pending:!0,data:r,method:n.method,action:a},a,r))}}))}function ao(e){function t(c){return oc(c,e)}Ma!==null&&oc(Ma,e),$a!==null&&oc($a,e),Oa!==null&&oc(Oa,e),no.forEach(t),so.forEach(t);for(var n=0;n<ja.length;n++){var a=ja[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<ja.length&&(n=ja[0],n.blockedOn===null);)D0(n),n.blockedOn===null&&ja.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var r=n[a],l=n[a+1],i=r[fn]||null;if(typeof l=="function")i||vv(n);else if(i){var o=null;if(l&&l.hasAttribute("formAction")){if(r=l,i=l[fn]||null)o=i.formAction;else if(Ep(r)!==null)continue}else o=i.action;typeof o=="function"?n[a+1]=o:(n.splice(a,3),a-=3),vv(n)}}}function Ap(e){this._internalRoot=e}cd.prototype.render=Ap.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ee(409));var n=t.current,a=En();M0(n,a,e,t,null,null)};cd.prototype.unmount=Ap.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;M0(e.current,2,null,e,null,null),rd(),t[Dl]=null}};function cd(e){this._internalRoot=e}cd.prototype.unstable_scheduleHydration=function(e){if(e){var t=pj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ja.length&&t!==0&&t<ja[n].priority;n++);ja.splice(n,0,e),n===0&&D0(e)}};var yv=nj.version;if(yv!=="19.1.0")throw Error(ee(527,yv,"19.1.0"));Pe.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ee(188)):(e=Object.keys(e).join(","),Error(ee(268,e)));return e=TS(t),e=e!==null?rj(e):null,e=e===null?null:e.stateNode,e};var eR={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:Ne,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uc.isDisabled&&uc.supportsFiber)try{yo=uc.inject(eR),Rn=uc}catch{}}Fu.createRoot=function(e,t){if(!sj(e))throw Error(ee(299));var n=!1,a="",r=Eb,l=Ab,i=Mb,o=null;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(l=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(o=t.unstable_transitionCallbacks)),t=E0(e,1,!1,null,null,n,a,r,l,i,o,null),e[Dl]=t.current,kp(e),new Ap(t)};Fu.hydrateRoot=function(e,t,n){if(!sj(e))throw Error(ee(299));var a=!1,r="",l=Eb,i=Ab,o=Mb,c=null,d=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(l=n.onUncaughtError),n.onCaughtError!==void 0&&(i=n.onCaughtError),n.onRecoverableError!==void 0&&(o=n.onRecoverableError),n.unstable_transitionCallbacks!==void 0&&(c=n.unstable_transitionCallbacks),n.formState!==void 0&&(d=n.formState)),t=E0(e,1,!0,t,n??null,a,r,l,i,o,c,d),t.context=A0(null),n=t.current,a=En(),a=Im(a),r=Ra(a),r.callback=null,Ta(n,r,a),n=a,t.current.lanes=n,bo(t,n),$s(t),e[Dl]=t.current,kp(e),new cd(t)};Fu.version="19.1.0";function z0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(z0)}catch(e){console.error(e)}}z0(),Qy.exports=Fu;var tR=Qy.exports;const L0=u.createContext(null);function U0({data:e,router:t,identity:n,notify:a,children:r}){return s.jsx(L0.Provider,{value:{data:e,router:t,identity:n,notify:a},children:r})}function ud(){const e=u.useContext(L0);if(!e)throw new Error("A shared app page rendered outside AppUiProvider.");return e}const nR={success:()=>{},error:()=>{}},mn=()=>ud().data,Xe=()=>ud().router,dd=()=>ud().identity,Nr=()=>ud().notify??nR;function sR(){const{probe:e}=mn(),{href:t,Link:n}=Xe(),a=dd(),[r,l]=u.useState(null),[i,o]=u.useState(!1);return u.useEffect(()=>{let c=!0;if(!e){o(!0);return}return e.source().then(d=>c&&l(d.label),()=>c&&o(!0)),()=>{c=!1}},[e]),s.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:[s.jsx("h1",{className:"text-xl font-semibold",children:"Shared app UI"}),s.jsx("p",{"data-testid":"app-ui-probe-source",className:"text-sm text-muted-foreground",children:i?"Data source unavailable":r??"Loading…"}),s.jsxs("p",{"data-testid":"app-ui-probe-identity",className:"text-sm",children:[a.label," · ",a.can("tasks.write")?"can edit tasks":"read only"]}),s.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"})]})}/**
|
|
50
50
|
* @license lucide-react v0.511.0 - ISC
|
|
51
51
|
*
|
|
52
52
|
* This source code is licensed under the ISC license.
|
|
53
53
|
* See the LICENSE file in the root directory of this source tree.
|
|
54
|
-
*/const
|
|
54
|
+
*/const aR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rR=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),jv=e=>{const t=rR(e);return t.charAt(0).toUpperCase()+t.slice(1)},B0=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),lR=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
55
55
|
* @license lucide-react v0.511.0 - ISC
|
|
56
56
|
*
|
|
57
57
|
* This source code is licensed under the ISC license.
|
|
58
58
|
* See the LICENSE file in the root directory of this source tree.
|
|
59
|
-
*/var
|
|
59
|
+
*/var iR={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"};/**
|
|
60
60
|
* @license lucide-react v0.511.0 - ISC
|
|
61
61
|
*
|
|
62
62
|
* This source code is licensed under the ISC license.
|
|
63
63
|
* See the LICENSE file in the root directory of this source tree.
|
|
64
|
-
*/const
|
|
64
|
+
*/const oR=u.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:l,iconNode:i,...o},c)=>u.createElement("svg",{ref:c,...iR,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:B0("lucide",r),...!l&&!lR(o)&&{"aria-hidden":"true"},...o},[...i.map(([d,f])=>u.createElement(d,f)),...Array.isArray(l)?l:[l]]));/**
|
|
65
65
|
* @license lucide-react v0.511.0 - ISC
|
|
66
66
|
*
|
|
67
67
|
* This source code is licensed under the ISC license.
|
|
68
68
|
* See the LICENSE file in the root directory of this source tree.
|
|
69
|
-
*/const be=(e,t)=>{const n=u.forwardRef(({className:a,...r},l)=>u.createElement(
|
|
69
|
+
*/const be=(e,t)=>{const n=u.forwardRef(({className:a,...r},l)=>u.createElement(oR,{ref:l,iconNode:t,className:B0(`lucide-${aR(jv(e))}`,`lucide-${e}`,a),...r}));return n.displayName=jv(e),n};/**
|
|
70
70
|
* @license lucide-react v0.511.0 - ISC
|
|
71
71
|
*
|
|
72
72
|
* This source code is licensed under the ISC license.
|
|
73
73
|
* See the LICENSE file in the root directory of this source tree.
|
|
74
|
-
*/const
|
|
74
|
+
*/const cR=[["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"}]],uR=be("archive-restore",cR);/**
|
|
75
75
|
* @license lucide-react v0.511.0 - ISC
|
|
76
76
|
*
|
|
77
77
|
* This source code is licensed under the ISC license.
|
|
78
78
|
* See the LICENSE file in the root directory of this source tree.
|
|
79
|
-
*/const
|
|
79
|
+
*/const dR=[["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"}]],bv=be("archive",dR);/**
|
|
80
80
|
* @license lucide-react v0.511.0 - ISC
|
|
81
81
|
*
|
|
82
82
|
* This source code is licensed under the ISC license.
|
|
83
83
|
* See the LICENSE file in the root directory of this source tree.
|
|
84
|
-
*/const
|
|
84
|
+
*/const fR=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],hR=be("arrow-down",fR);/**
|
|
85
85
|
* @license lucide-react v0.511.0 - ISC
|
|
86
86
|
*
|
|
87
87
|
* This source code is licensed under the ISC license.
|
|
88
88
|
* See the LICENSE file in the root directory of this source tree.
|
|
89
|
-
*/const
|
|
89
|
+
*/const mR=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],H0=be("arrow-left",mR);/**
|
|
90
90
|
* @license lucide-react v0.511.0 - ISC
|
|
91
91
|
*
|
|
92
92
|
* This source code is licensed under the ISC license.
|
|
93
93
|
* See the LICENSE file in the root directory of this source tree.
|
|
94
|
-
*/const
|
|
94
|
+
*/const pR=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],xR=be("arrow-up",pR);/**
|
|
95
95
|
* @license lucide-react v0.511.0 - ISC
|
|
96
96
|
*
|
|
97
97
|
* This source code is licensed under the ISC license.
|
|
98
98
|
* See the LICENSE file in the root directory of this source tree.
|
|
99
|
-
*/const
|
|
99
|
+
*/const gR=[["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"}]],Mp=be("bot",gR);/**
|
|
100
100
|
* @license lucide-react v0.511.0 - ISC
|
|
101
101
|
*
|
|
102
102
|
* This source code is licensed under the ISC license.
|
|
103
103
|
* See the LICENSE file in the root directory of this source tree.
|
|
104
|
-
*/const
|
|
104
|
+
*/const vR=[["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"}]],yR=be("briefcase",vR);/**
|
|
105
105
|
* @license lucide-react v0.511.0 - ISC
|
|
106
106
|
*
|
|
107
107
|
* This source code is licensed under the ISC license.
|
|
108
108
|
* See the LICENSE file in the root directory of this source tree.
|
|
109
|
-
*/const
|
|
109
|
+
*/const jR=[["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"}]],bR=be("building-2",jR);/**
|
|
110
110
|
* @license lucide-react v0.511.0 - ISC
|
|
111
111
|
*
|
|
112
112
|
* This source code is licensed under the ISC license.
|
|
113
113
|
* See the LICENSE file in the root directory of this source tree.
|
|
114
|
-
*/const
|
|
114
|
+
*/const wR=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Il=be("check",wR);/**
|
|
115
115
|
* @license lucide-react v0.511.0 - ISC
|
|
116
116
|
*
|
|
117
117
|
* This source code is licensed under the ISC license.
|
|
118
118
|
* See the LICENSE file in the root directory of this source tree.
|
|
119
|
-
*/const
|
|
119
|
+
*/const _R=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$p=be("chevron-down",_R);/**
|
|
120
120
|
* @license lucide-react v0.511.0 - ISC
|
|
121
121
|
*
|
|
122
122
|
* This source code is licensed under the ISC license.
|
|
123
123
|
* See the LICENSE file in the root directory of this source tree.
|
|
124
|
-
*/const
|
|
124
|
+
*/const NR=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],fd=be("chevron-right",NR);/**
|
|
125
125
|
* @license lucide-react v0.511.0 - ISC
|
|
126
126
|
*
|
|
127
127
|
* This source code is licensed under the ISC license.
|
|
128
128
|
* See the LICENSE file in the root directory of this source tree.
|
|
129
|
-
*/const
|
|
129
|
+
*/const kR=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],SR=be("chevron-up",kR);/**
|
|
130
130
|
* @license lucide-react v0.511.0 - ISC
|
|
131
131
|
*
|
|
132
132
|
* This source code is licensed under the ISC license.
|
|
133
133
|
* See the LICENSE file in the root directory of this source tree.
|
|
134
|
-
*/const
|
|
134
|
+
*/const CR=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],I0=be("chevrons-up-down",CR);/**
|
|
135
135
|
* @license lucide-react v0.511.0 - ISC
|
|
136
136
|
*
|
|
137
137
|
* This source code is licensed under the ISC license.
|
|
138
138
|
* See the LICENSE file in the root directory of this source tree.
|
|
139
|
-
*/const
|
|
139
|
+
*/const RR=[["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"}]],et=be("circle-alert",RR);/**
|
|
140
140
|
* @license lucide-react v0.511.0 - ISC
|
|
141
141
|
*
|
|
142
142
|
* This source code is licensed under the ISC license.
|
|
143
143
|
* See the LICENSE file in the root directory of this source tree.
|
|
144
|
-
*/const
|
|
144
|
+
*/const TR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],hd=be("circle-check",TR);/**
|
|
145
145
|
* @license lucide-react v0.511.0 - ISC
|
|
146
146
|
*
|
|
147
147
|
* This source code is licensed under the ISC license.
|
|
148
148
|
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
-
*/const
|
|
149
|
+
*/const ER=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],AR=be("circle",ER);/**
|
|
150
150
|
* @license lucide-react v0.511.0 - ISC
|
|
151
151
|
*
|
|
152
152
|
* This source code is licensed under the ISC license.
|
|
153
153
|
* See the LICENSE file in the root directory of this source tree.
|
|
154
|
-
*/const
|
|
154
|
+
*/const MR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],$R=be("clock",MR);/**
|
|
155
155
|
* @license lucide-react v0.511.0 - ISC
|
|
156
156
|
*
|
|
157
157
|
* This source code is licensed under the ISC license.
|
|
158
158
|
* See the LICENSE file in the root directory of this source tree.
|
|
159
|
-
*/const
|
|
159
|
+
*/const OR=[["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"}]],DR=be("copy",OR);/**
|
|
160
160
|
* @license lucide-react v0.511.0 - ISC
|
|
161
161
|
*
|
|
162
162
|
* This source code is licensed under the ISC license.
|
|
163
163
|
* See the LICENSE file in the root directory of this source tree.
|
|
164
|
-
*/const
|
|
164
|
+
*/const zR=[["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"}]],Op=be("ellipsis",zR);/**
|
|
165
165
|
* @license lucide-react v0.511.0 - ISC
|
|
166
166
|
*
|
|
167
167
|
* This source code is licensed under the ISC license.
|
|
168
168
|
* See the LICENSE file in the root directory of this source tree.
|
|
169
|
-
*/const
|
|
169
|
+
*/const LR=[["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"}]],UR=be("eraser",LR);/**
|
|
170
170
|
* @license lucide-react v0.511.0 - ISC
|
|
171
171
|
*
|
|
172
172
|
* This source code is licensed under the ISC license.
|
|
173
173
|
* See the LICENSE file in the root directory of this source tree.
|
|
174
|
-
*/const
|
|
174
|
+
*/const BR=[["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"}]],Oo=be("eye",BR);/**
|
|
175
175
|
* @license lucide-react v0.511.0 - ISC
|
|
176
176
|
*
|
|
177
177
|
* This source code is licensed under the ISC license.
|
|
178
178
|
* See the LICENSE file in the root directory of this source tree.
|
|
179
|
-
*/const
|
|
179
|
+
*/const HR=[["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"}]],P0=be("folder-git-2",HR);/**
|
|
180
180
|
* @license lucide-react v0.511.0 - ISC
|
|
181
181
|
*
|
|
182
182
|
* This source code is licensed under the ISC license.
|
|
183
183
|
* See the LICENSE file in the root directory of this source tree.
|
|
184
|
-
*/const
|
|
184
|
+
*/const IR=[["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"}]],PR=be("folder-git",IR);/**
|
|
185
185
|
* @license lucide-react v0.511.0 - ISC
|
|
186
186
|
*
|
|
187
187
|
* This source code is licensed under the ISC license.
|
|
188
188
|
* See the LICENSE file in the root directory of this source tree.
|
|
189
|
-
*/const
|
|
189
|
+
*/const qR=[["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"}]],GR=be("git-fork",qR);/**
|
|
190
190
|
* @license lucide-react v0.511.0 - ISC
|
|
191
191
|
*
|
|
192
192
|
* This source code is licensed under the ISC license.
|
|
193
193
|
* See the LICENSE file in the root directory of this source tree.
|
|
194
|
-
*/const
|
|
194
|
+
*/const VR=[["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"}]],nm=be("git-pull-request-arrow",VR);/**
|
|
195
195
|
* @license lucide-react v0.511.0 - ISC
|
|
196
196
|
*
|
|
197
197
|
* This source code is licensed under the ISC license.
|
|
198
198
|
* See the LICENSE file in the root directory of this source tree.
|
|
199
|
-
*/const
|
|
199
|
+
*/const YR=[["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"}]],FR=be("hard-drive",YR);/**
|
|
200
200
|
* @license lucide-react v0.511.0 - ISC
|
|
201
201
|
*
|
|
202
202
|
* This source code is licensed under the ISC license.
|
|
203
203
|
* See the LICENSE file in the root directory of this source tree.
|
|
204
|
-
*/const
|
|
204
|
+
*/const KR=[["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"}]],XR=be("history",KR);/**
|
|
205
205
|
* @license lucide-react v0.511.0 - ISC
|
|
206
206
|
*
|
|
207
207
|
* This source code is licensed under the ISC license.
|
|
208
208
|
* See the LICENSE file in the root directory of this source tree.
|
|
209
|
-
*/const
|
|
209
|
+
*/const QR=[["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"}]],WR=be("house",QR);/**
|
|
210
210
|
* @license lucide-react v0.511.0 - ISC
|
|
211
211
|
*
|
|
212
212
|
* This source code is licensed under the ISC license.
|
|
213
213
|
* See the LICENSE file in the root directory of this source tree.
|
|
214
|
-
*/const
|
|
214
|
+
*/const ZR=[["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"}]],JR=be("inbox",ZR);/**
|
|
215
215
|
* @license lucide-react v0.511.0 - ISC
|
|
216
216
|
*
|
|
217
217
|
* This source code is licensed under the ISC license.
|
|
218
218
|
* See the LICENSE file in the root directory of this source tree.
|
|
219
|
-
*/const
|
|
219
|
+
*/const eT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Ts=be("info",eT);/**
|
|
220
220
|
* @license lucide-react v0.511.0 - ISC
|
|
221
221
|
*
|
|
222
222
|
* This source code is licensed under the ISC license.
|
|
223
223
|
* See the LICENSE file in the root directory of this source tree.
|
|
224
|
-
*/const
|
|
224
|
+
*/const tT=[["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"}]],nT=be("laptop",tT);/**
|
|
225
225
|
* @license lucide-react v0.511.0 - ISC
|
|
226
226
|
*
|
|
227
227
|
* This source code is licensed under the ISC license.
|
|
228
228
|
* See the LICENSE file in the root directory of this source tree.
|
|
229
|
-
*/const
|
|
229
|
+
*/const sT=[["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"}]],aT=be("life-buoy",sT);/**
|
|
230
230
|
* @license lucide-react v0.511.0 - ISC
|
|
231
231
|
*
|
|
232
232
|
* This source code is licensed under the ISC license.
|
|
233
233
|
* See the LICENSE file in the root directory of this source tree.
|
|
234
|
-
*/const
|
|
234
|
+
*/const rT=[["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"}]],q0=be("list-checks",rT);/**
|
|
235
235
|
* @license lucide-react v0.511.0 - ISC
|
|
236
236
|
*
|
|
237
237
|
* This source code is licensed under the ISC license.
|
|
238
238
|
* See the LICENSE file in the root directory of this source tree.
|
|
239
|
-
*/const
|
|
239
|
+
*/const lT=[["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"}]],G0=be("list-ordered",lT);/**
|
|
240
240
|
* @license lucide-react v0.511.0 - ISC
|
|
241
241
|
*
|
|
242
242
|
* This source code is licensed under the ISC license.
|
|
243
243
|
* See the LICENSE file in the root directory of this source tree.
|
|
244
|
-
*/const
|
|
244
|
+
*/const iT=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],oT=be("loader-circle",iT);/**
|
|
245
245
|
* @license lucide-react v0.511.0 - ISC
|
|
246
246
|
*
|
|
247
247
|
* This source code is licensed under the ISC license.
|
|
248
248
|
* See the LICENSE file in the root directory of this source tree.
|
|
249
|
-
*/const
|
|
249
|
+
*/const cT=[["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"}]],uT=be("lock",cT);/**
|
|
250
250
|
* @license lucide-react v0.511.0 - ISC
|
|
251
251
|
*
|
|
252
252
|
* This source code is licensed under the ISC license.
|
|
253
253
|
* See the LICENSE file in the root directory of this source tree.
|
|
254
|
-
*/const
|
|
254
|
+
*/const dT=[["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"}]],fT=be("messages-square",dT);/**
|
|
255
255
|
* @license lucide-react v0.511.0 - ISC
|
|
256
256
|
*
|
|
257
257
|
* This source code is licensed under the ISC license.
|
|
258
258
|
* See the LICENSE file in the root directory of this source tree.
|
|
259
|
-
*/const
|
|
259
|
+
*/const hT=[["path",{d:"M5 12h14",key:"1ays0h"}]],mT=be("minus",hT);/**
|
|
260
260
|
* @license lucide-react v0.511.0 - ISC
|
|
261
261
|
*
|
|
262
262
|
* This source code is licensed under the ISC license.
|
|
263
263
|
* See the LICENSE file in the root directory of this source tree.
|
|
264
|
-
*/const
|
|
264
|
+
*/const pT=[["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"}]],xT=be("network",pT);/**
|
|
265
265
|
* @license lucide-react v0.511.0 - ISC
|
|
266
266
|
*
|
|
267
267
|
* This source code is licensed under the ISC license.
|
|
268
268
|
* See the LICENSE file in the root directory of this source tree.
|
|
269
|
-
*/const
|
|
269
|
+
*/const gT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],vT=be("panel-left",gT);/**
|
|
270
270
|
* @license lucide-react v0.511.0 - ISC
|
|
271
271
|
*
|
|
272
272
|
* This source code is licensed under the ISC license.
|
|
273
273
|
* See the LICENSE file in the root directory of this source tree.
|
|
274
|
-
*/const
|
|
274
|
+
*/const yT=[["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"}]],V0=be("pause",yT);/**
|
|
275
275
|
* @license lucide-react v0.511.0 - ISC
|
|
276
276
|
*
|
|
277
277
|
* This source code is licensed under the ISC license.
|
|
278
278
|
* See the LICENSE file in the root directory of this source tree.
|
|
279
|
-
*/const
|
|
279
|
+
*/const jT=[["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"}]],md=be("pencil",jT);/**
|
|
280
280
|
* @license lucide-react v0.511.0 - ISC
|
|
281
281
|
*
|
|
282
282
|
* This source code is licensed under the ISC license.
|
|
283
283
|
* See the LICENSE file in the root directory of this source tree.
|
|
284
|
-
*/const
|
|
284
|
+
*/const bT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Tl=be("plus",bT);/**
|
|
285
285
|
* @license lucide-react v0.511.0 - ISC
|
|
286
286
|
*
|
|
287
287
|
* This source code is licensed under the ISC license.
|
|
288
288
|
* See the LICENSE file in the root directory of this source tree.
|
|
289
|
-
*/const
|
|
289
|
+
*/const wT=[["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"}]],kr=be("refresh-cw",wT);/**
|
|
290
290
|
* @license lucide-react v0.511.0 - ISC
|
|
291
291
|
*
|
|
292
292
|
* This source code is licensed under the ISC license.
|
|
293
293
|
* See the LICENSE file in the root directory of this source tree.
|
|
294
|
-
*/const
|
|
294
|
+
*/const _T=[["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"}]],NT=be("rotate-ccw",_T);/**
|
|
295
295
|
* @license lucide-react v0.511.0 - ISC
|
|
296
296
|
*
|
|
297
297
|
* This source code is licensed under the ISC license.
|
|
298
298
|
* See the LICENSE file in the root directory of this source tree.
|
|
299
|
-
*/const
|
|
299
|
+
*/const kT=[["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"}]],pd=be("search-x",kT);/**
|
|
300
300
|
* @license lucide-react v0.511.0 - ISC
|
|
301
301
|
*
|
|
302
302
|
* This source code is licensed under the ISC license.
|
|
303
303
|
* See the LICENSE file in the root directory of this source tree.
|
|
304
|
-
*/const
|
|
304
|
+
*/const ST=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],CT=be("search",ST);/**
|
|
305
305
|
* @license lucide-react v0.511.0 - ISC
|
|
306
306
|
*
|
|
307
307
|
* This source code is licensed under the ISC license.
|
|
308
308
|
* See the LICENSE file in the root directory of this source tree.
|
|
309
|
-
*/const
|
|
309
|
+
*/const RT=[["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"}]],TT=be("shield-alert",RT);/**
|
|
310
310
|
* @license lucide-react v0.511.0 - ISC
|
|
311
311
|
*
|
|
312
312
|
* This source code is licensed under the ISC license.
|
|
313
313
|
* See the LICENSE file in the root directory of this source tree.
|
|
314
|
-
*/const
|
|
314
|
+
*/const ET=[["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"}]],AT=be("snowflake",ET);/**
|
|
315
315
|
* @license lucide-react v0.511.0 - ISC
|
|
316
316
|
*
|
|
317
317
|
* This source code is licensed under the ISC license.
|
|
318
318
|
* See the LICENSE file in the root directory of this source tree.
|
|
319
|
-
*/const
|
|
319
|
+
*/const MT=[["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"}]],ku=be("tag",MT);/**
|
|
320
320
|
* @license lucide-react v0.511.0 - ISC
|
|
321
321
|
*
|
|
322
322
|
* This source code is licensed under the ISC license.
|
|
323
323
|
* See the LICENSE file in the root directory of this source tree.
|
|
324
|
-
*/const
|
|
324
|
+
*/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"}]],Qt=be("triangle-alert",$T);/**
|
|
325
325
|
* @license lucide-react v0.511.0 - ISC
|
|
326
326
|
*
|
|
327
327
|
* This source code is licensed under the ISC license.
|
|
328
328
|
* See the LICENSE file in the root directory of this source tree.
|
|
329
|
-
*/const
|
|
329
|
+
*/const OT=[["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"}]],DT=be("user-check",OT);/**
|
|
330
330
|
* @license lucide-react v0.511.0 - ISC
|
|
331
331
|
*
|
|
332
332
|
* This source code is licensed under the ISC license.
|
|
333
333
|
* See the LICENSE file in the root directory of this source tree.
|
|
334
|
-
*/const
|
|
334
|
+
*/const zT=[["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"}]],LT=be("user-cog",zT);/**
|
|
335
335
|
* @license lucide-react v0.511.0 - ISC
|
|
336
336
|
*
|
|
337
337
|
* This source code is licensed under the ISC license.
|
|
338
338
|
* See the LICENSE file in the root directory of this source tree.
|
|
339
|
-
*/const
|
|
339
|
+
*/const UT=[["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"}]],Dp=be("user",UT);/**
|
|
340
340
|
* @license lucide-react v0.511.0 - ISC
|
|
341
341
|
*
|
|
342
342
|
* This source code is licensed under the ISC license.
|
|
343
343
|
* See the LICENSE file in the root directory of this source tree.
|
|
344
|
-
*/const UT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xd=be("x",UT),BT="Local only · this machine · not connected to SoftwareDLC",HT="Checking sync state…",IT="Sync state unknown",PT="Projects are the repositories this viewer reads on this machine. Nothing is shared unless you connect to SoftwareDLC.",mr="Details are in the terminal running sdlc viewer.",qT="How to fix it is in the terminal running sdlc viewer.",gd="Loading…",Su="Not available";function GT(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 yi(e){return(typeof e=="string"?new Date(e):e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const VT={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 Vw(e,t){const n=t?` this list was read at ${yi(t)}.`:"";if(e.reason==="store_locked"){const a=e.store?VT[e.store]:"a local store",r=e.since?` since ${yi(e.since)}`:"";return`Another sdlc command has held ${a}${r};${n||" nothing was read yet."} ${mr}`}return e.status===0?`The viewer did not answer. Is sdlc viewer still running?${t?` This list was read at ${yi(t)}.`:""}`:`The read failed.${t?` This list was read at ${yi(t)}.`:""} ${mr}`}const YT=e=>e.status===409,FT={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 KT(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 r=e.folder?`the folder ${e.folder}`:"its folder";return{kind:"moved_member",cause:`This repository, ${t}, is not where ${r} 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?FT[e.reason]:void 0,a=n!==void 0&&e.reason!=="membership_invalid"&&e.reason!=="folder_invalid";return{kind:"other",cause:n??"This repository's folder cannot be read.",fix:a}}const wv=["tasks","issues","releases"],zp=u.createContext(null);function On(){const e=u.useContext(zp);if(!e)throw new Error("A shell page rendered outside the app shell.");return e}function XT(){var e;return(e=u.useContext(zp))==null?void 0:e.engine}const QT=10,WT=()=>new Date;function ZT({shell:e,now:t=WT,children:n}){var H;const[a,r]=u.useState(null),[l,i]=u.useState(null),[o,c]=u.useState(null),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,b]=u.useState(!0),[v,y]=u.useState(!1),[g,p]=u.useState(void 0),[j,w]=u.useState(!1),[N,C]=u.useState(wv),_=u.useRef(!1),S=u.useRef(!1),D=u.useRef(null),z=u.useRef(!0),P=u.useCallback(async(A=!1)=>{D.current&&clearTimeout(D.current),D.current=null,y(!0);const[M,R]=await Promise.all([e.organizations.list(),e.projects.list()]);if(!z.current)return;if(y(!1),b(!1),M.ok&&R.ok){if(_.current=!0,S.current=!1,m(null),f(t()),M.data.organizations.length===0){c("not_in_git"),r(null),i(null);return}c(null),r(M.data.organizations[0]),i(R.data.projects);return}const T=M.ok?R.ok?null:R.refusal:M.refusal;if(!T)return;if(YT(T)){S.current=!1,m(null),c(T),r(null),i(null);return}const k=_.current&&!S.current&&!A;S.current=!0;const O=T.retry_after??QT;m({refusal:T,shown:!k,retryInSeconds:k?O:null}),k&&(D.current=setTimeout(()=>void P(!0),O*1e3))},[e,t]);u.useEffect(()=>(z.current=!0,P(),e.about.about().then(A=>{z.current&&(A.ok?p(A.data):A.refusal.status===404?p(null):w(!0))}),Promise.all(wv.map(async A=>{var M;return[A,await((M=e[A])==null?void 0:M.access())]})).then(A=>{z.current&&C(A.filter(([,M])=>!(M!=null&&M.ok&&!M.data.can_view)).map(([M])=>M))}),()=>{z.current=!1,D.current&&clearTimeout(D.current)}),[e,P]);const F={loading:x,org:a,projects:l,none:o,readAt:d,failure:h,about:g,aboutFailed:j,engine:(g==null?void 0:g.engine)===null?null:(H=g==null?void 0:g.engine)==null?void 0:H.source,domains:N,reading:v,refresh:()=>void P()};return s.jsx(zp.Provider,{value:F,children:n})}const Yw=e=>`The ${e} page is not part of this sdlc install`,Pl="The sdlc engine here is too old for this page";function JT(e){return e==="checkout"?"Update the main checkout, then restart sdlc viewer.":"Update sdlc to its latest version, then restart sdlc viewer."}function ds(){return JT(XT())}function Fw(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Fw(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function Kw(){for(var e,t,n=0,a="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Fw(e))&&(a&&(a+=" "),a+=t);return a}const _v=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Nv=Kw,Do=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return Nv(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:l}=t,i=Object.keys(r).map(d=>{const f=n==null?void 0:n[d],h=l==null?void 0:l[d];if(f===null)return null;const m=_v(f)||_v(h);return r[d][m]}),o=n&&Object.entries(n).reduce((d,f)=>{let[h,m]=f;return m===void 0||(d[h]=m),d},{}),c=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((d,f)=>{let{class:h,className:m,...x}=f;return Object.entries(x).every(b=>{let[v,y]=b;return Array.isArray(y)?y.includes({...l,...o}[v]):{...l,...o}[v]===y})?[...d,h,m]:d},[]);return Nv(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},Lp="-",eE=e=>{const t=nE(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i=>{const o=i.split(Lp);return o[0]===""&&o.length!==1&&o.shift(),Xw(o,t)||tE(i)},getConflictingClassGroupIds:(i,o)=>{const c=n[i]||[];return o&&a[i]?[...c,...a[i]]:c}}},Xw=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],a=t.nextPart.get(n),r=a?Xw(e.slice(1),a):void 0;if(r)return r;if(t.validators.length===0)return;const l=e.join(Lp);return(i=t.validators.find(({validator:o})=>o(l)))==null?void 0:i.classGroupId},kv=/^\[(.+)\]$/,tE=e=>{if(kv.test(e)){const t=kv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},nE=e=>{const{theme:t,classGroups:n}=e,a={nextPart:new Map,validators:[]};for(const r in n)sm(n[r],a,r,t);return a},sm=(e,t,n,a)=>{e.forEach(r=>{if(typeof r=="string"){const l=r===""?t:Sv(t,r);l.classGroupId=n;return}if(typeof r=="function"){if(sE(r)){sm(r(a),t,n,a);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([l,i])=>{sm(i,Sv(t,l),n,a)})})},Sv=(e,t)=>{let n=e;return t.split(Lp).forEach(a=>{n.nextPart.has(a)||n.nextPart.set(a,{nextPart:new Map,validators:[]}),n=n.nextPart.get(a)}),n},sE=e=>e.isThemeGetter,aE=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,a=new Map;const r=(l,i)=>{n.set(l,i),t++,t>e&&(t=0,a=n,n=new Map)};return{get(l){let i=n.get(l);if(i!==void 0)return i;if((i=a.get(l))!==void 0)return r(l,i),i},set(l,i){n.has(l)?n.set(l,i):r(l,i)}}},am="!",rm=":",rE=rm.length,lE=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=r=>{const l=[];let i=0,o=0,c=0,d;for(let b=0;b<r.length;b++){let v=r[b];if(i===0&&o===0){if(v===rm){l.push(r.slice(c,b)),c=b+rE;continue}if(v==="/"){d=b;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=l.length===0?r:r.substring(c),h=iE(f),m=h!==f,x=d&&d>c?d-c:void 0;return{modifiers:l,hasImportantModifier:m,baseClassName:h,maybePostfixModifierPosition:x}};if(t){const r=t+rm,l=a;a=i=>i.startsWith(r)?l(i.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const r=a;a=l=>n({className:l,parseClassName:r})}return a},iE=e=>e.endsWith(am)?e.substring(0,e.length-1):e.startsWith(am)?e.substring(1):e,oE=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const r=[];let l=[];return a.forEach(i=>{i[0]==="["||t[i]?(r.push(...l.sort(),i),l=[]):l.push(i)}),r.push(...l.sort()),r}},cE=e=>({cache:aE(e.cacheSize),parseClassName:lE(e),sortModifiers:oE(e),...eE(e)}),uE=/\s+/,dE=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:r,sortModifiers:l}=t,i=[],o=e.trim().split(uE);let c="";for(let d=o.length-1;d>=0;d-=1){const f=o[d],{isExternal:h,modifiers:m,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:v}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let y=!!v,g=a(y?b.substring(0,v):b);if(!g){if(!y){c=f+(c.length>0?" "+c:c);continue}if(g=a(b),!g){c=f+(c.length>0?" "+c:c);continue}y=!1}const p=l(m).join(":"),j=x?p+am:p,w=j+g;if(i.includes(w))continue;i.push(w);const N=r(g,y);for(let C=0;C<N.length;++C){const _=N[C];i.push(j+_)}c=f+(c.length>0?" "+c:c)}return c};function fE(){let e=0,t,n,a="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Qw(t))&&(a&&(a+=" "),a+=n);return a}const Qw=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=Qw(e[a]))&&(n&&(n+=" "),n+=t);return n};function hE(e,...t){let n,a,r,l=i;function i(c){const d=t.reduce((f,h)=>h(f),e());return n=cE(d),a=n.cache.get,r=n.cache.set,l=o,o(c)}function o(c){const d=a(c);if(d)return d;const f=dE(c,n);return r(c,f),f}return function(){return l(fE.apply(null,arguments))}}const Mt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Ww=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Zw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mE=/^\d+\/\d+$/,pE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xE=/\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$/,gE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$r=e=>mE.test(e),Ee=e=>!!e&&!Number.isNaN(Number(e)),ua=e=>!!e&&Number.isInteger(Number(e)),Of=e=>e.endsWith("%")&&Ee(e.slice(0,-1)),Is=e=>pE.test(e),jE=()=>!0,bE=e=>xE.test(e)&&!gE.test(e),Jw=()=>!1,wE=e=>vE.test(e),_E=e=>yE.test(e),NE=e=>!me(e)&&!pe(e),kE=e=>ql(e,n0,Jw),me=e=>Ww.test(e),Wa=e=>ql(e,s0,bE),Df=e=>ql(e,EE,Ee),Cv=e=>ql(e,e0,Jw),SE=e=>ql(e,t0,_E),dc=e=>ql(e,a0,wE),pe=e=>Zw.test(e),di=e=>Gl(e,s0),CE=e=>Gl(e,AE),Rv=e=>Gl(e,e0),RE=e=>Gl(e,n0),TE=e=>Gl(e,t0),fc=e=>Gl(e,a0,!0),ql=(e,t,n)=>{const a=Ww.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Gl=(e,t,n=!1)=>{const a=Zw.exec(e);return a?a[1]?t(a[1]):n:!1},e0=e=>e==="position"||e==="percentage",t0=e=>e==="image"||e==="url",n0=e=>e==="length"||e==="size"||e==="bg-size",s0=e=>e==="length",EE=e=>e==="number",AE=e=>e==="family-name",a0=e=>e==="shadow",ME=()=>{const e=Mt("color"),t=Mt("font"),n=Mt("text"),a=Mt("font-weight"),r=Mt("tracking"),l=Mt("leading"),i=Mt("breakpoint"),o=Mt("container"),c=Mt("spacing"),d=Mt("radius"),f=Mt("shadow"),h=Mt("inset-shadow"),m=Mt("text-shadow"),x=Mt("drop-shadow"),b=Mt("blur"),v=Mt("perspective"),y=Mt("aspect"),g=Mt("ease"),p=Mt("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...w(),pe,me],C=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],S=()=>[pe,me,c],D=()=>[$r,"full","auto",...S()],z=()=>[ua,"none","subgrid",pe,me],P=()=>["auto",{span:["full",ua,pe,me]},ua,pe,me],F=()=>[ua,"auto",pe,me],H=()=>["auto","min","max","fr",pe,me],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...S()],T=()=>[$r,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],k=()=>[e,pe,me],O=()=>[...w(),Rv,Cv,{position:[pe,me]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],E=()=>["auto","cover","contain",RE,kE,{size:[pe,me]}],I=()=>[Of,di,Wa],Q=()=>["","none","full",d,pe,me],te=()=>["",Ee,di,Wa],ce=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>[Ee,Of,Rv,Cv],q=()=>["","none",b,pe,me],ne=()=>["none",Ee,pe,me],ae=()=>["none",Ee,pe,me],je=()=>[Ee,pe,me],re=()=>[$r,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Is],breakpoint:[Is],color:[jE],container:[Is],"drop-shadow":[Is],ease:["in","out","in-out"],font:[NE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Is],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Is],shadow:[Is],spacing:["px",Ee],text:[Is],"text-shadow":[Is],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$r,me,pe,y]}],container:["container"],columns:[{columns:[Ee,me,pe,o]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"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:N()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{start:D()}],end:[{end:D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[ua,"auto",pe,me]}],basis:[{basis:[$r,"full","auto",o,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ee,$r,"auto","initial","none",me]}],grow:[{grow:["",Ee,pe,me]}],shrink:[{shrink:["",Ee,pe,me]}],order:[{order:[ua,"first","last","none",pe,me]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":H()}],"auto-rows":[{"auto-rows":H()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...M(),"normal"]}],"justify-self":[{"justify-self":["auto",...M()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...M(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...M(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...M(),"baseline"]}],"place-self":[{"place-self":["auto",...M()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:T()}],w:[{w:[o,"screen",...T()]}],"min-w":[{"min-w":[o,"screen","none",...T()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",n,di,Wa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,pe,Df]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Of,me]}],"font-family":[{font:[CE,me,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:[r,pe,me]}],"line-clamp":[{"line-clamp":[Ee,"none",pe,Df]}],leading:[{leading:[l,...S()]}],"list-image":[{"list-image":["none",pe,me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",pe,me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ee,"from-font","auto",pe,Wa]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[Ee,"auto",pe,me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pe,me]}],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",pe,me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:O()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:E()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ua,pe,me],radial:["",pe,me],conic:[ua,pe,me]},TE,SE]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"hidden","none"]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ee,pe,me]}],"outline-w":[{outline:["",Ee,di,Wa]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","none",f,fc,dc]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",h,fc,dc]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[Ee,Wa]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",m,fc,dc]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[Ee,pe,me]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"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":[Ee]}],"mask-image-linear-from-pos":[{"mask-linear-from":L()}],"mask-image-linear-to-pos":[{"mask-linear-to":L()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":L()}],"mask-image-t-to-pos":[{"mask-t-to":L()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":L()}],"mask-image-r-to-pos":[{"mask-r-to":L()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":L()}],"mask-image-b-to-pos":[{"mask-b-to":L()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":L()}],"mask-image-l-to-pos":[{"mask-l-to":L()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":L()}],"mask-image-x-to-pos":[{"mask-x-to":L()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":L()}],"mask-image-y-to-pos":[{"mask-y-to":L()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[pe,me]}],"mask-image-radial-from-pos":[{"mask-radial-from":L()}],"mask-image-radial-to-pos":[{"mask-radial-to":L()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"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":w()}],"mask-image-conic-pos":[{"mask-conic":[Ee]}],"mask-image-conic-from-pos":[{"mask-conic-from":L()}],"mask-image-conic-to-pos":[{"mask-conic-to":L()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:E()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",pe,me]}],filter:[{filter:["","none",pe,me]}],blur:[{blur:q()}],brightness:[{brightness:[Ee,pe,me]}],contrast:[{contrast:[Ee,pe,me]}],"drop-shadow":[{"drop-shadow":["","none",x,fc,dc]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",Ee,pe,me]}],"hue-rotate":[{"hue-rotate":[Ee,pe,me]}],invert:[{invert:["",Ee,pe,me]}],saturate:[{saturate:[Ee,pe,me]}],sepia:[{sepia:["",Ee,pe,me]}],"backdrop-filter":[{"backdrop-filter":["","none",pe,me]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[Ee,pe,me]}],"backdrop-contrast":[{"backdrop-contrast":[Ee,pe,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ee,pe,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ee,pe,me]}],"backdrop-invert":[{"backdrop-invert":["",Ee,pe,me]}],"backdrop-opacity":[{"backdrop-opacity":[Ee,pe,me]}],"backdrop-saturate":[{"backdrop-saturate":[Ee,pe,me]}],"backdrop-sepia":[{"backdrop-sepia":["",Ee,pe,me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",pe,me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ee,"initial",pe,me]}],ease:[{ease:["linear","initial",g,pe,me]}],delay:[{delay:[Ee,pe,me]}],animate:[{animate:["none",p,pe,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,pe,me]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[pe,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"translate-none":["translate-none"],accent:[{accent:k()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:k()}],"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",pe,me]}],"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":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"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",pe,me]}],fill:[{fill:["none",...k()]}],"stroke-w":[{stroke:[Ee,di,Wa,Df]}],stroke:[{stroke:["none",...k()]}],"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"]}},$E=hE(ME);function ie(...e){return $E(Kw(e))}const OE=Do("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 he({className:e,variant:t,...n}){return s.jsx("div",{"data-slot":"alert",role:"alert",className:ie(OE({variant:t}),e),...n})}function ye({className:e,...t}){return s.jsx("div",{"data-slot":"alert-title",className:ie("col-start-2 min-h-4 font-medium tracking-tight",e),...t})}function xe({className:e,...t}){return s.jsx("div",{"data-slot":"alert-description",className:ie("col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function fe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Tv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function vd(...e){return t=>{let n=!1;const a=e.map(r=>{const l=Tv(r,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let r=0;r<a.length;r++){const l=a[r];typeof l=="function"?l():Tv(e[r],null)}}}}function Ve(...e){return u.useCallback(vd(...e),e)}function DE(e,t){const n=u.createContext(t),a=l=>{const{children:i,...o}=l,c=u.useMemo(()=>o,Object.values(o));return s.jsx(n.Provider,{value:c,children:i})};a.displayName=e+"Provider";function r(l){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[a,r]}function Os(e,t=[]){let n=[];function a(l,i){const o=u.createContext(i),c=n.length;n=[...n,i];const d=h=>{var g;const{scope:m,children:x,...b}=h,v=((g=m==null?void 0:m[e])==null?void 0:g[c])||o,y=u.useMemo(()=>b,Object.values(b));return s.jsx(v.Provider,{value:y,children:x})};d.displayName=l+"Provider";function f(h,m){var v;const x=((v=m==null?void 0:m[e])==null?void 0:v[c])||o,b=u.useContext(x);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${l}\``)}return[d,f]}const r=()=>{const l=n.map(i=>u.createContext(i));return function(o){const c=(o==null?void 0:o[e])||l;return u.useMemo(()=>({[`__scope${e}`]:{...o,[e]:c}}),[o,c])}};return r.scopeName=e,[a,zE(r,...t)]}function zE(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(l){const i=a.reduce((o,{useScope:c,scopeName:d})=>{const h=c(l)[`__scope${d}`];return{...o,...h}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Ft=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},LE=Ky[" useId ".trim().toString()]||(()=>{}),UE=0;function as(e){const[t,n]=u.useState(LE());return Ft(()=>{n(a=>a??String(UE++))},[e]),t?`radix-${t}`:""}var BE=Ky[" useInsertionEffect ".trim().toString()]||Ft;function Ba({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[r,l,i]=HE({defaultProp:t,onChange:n}),o=e!==void 0,c=o?e:r;{const f=u.useRef(e!==void 0);u.useEffect(()=>{const h=f.current;h!==o&&console.warn(`${a} is changing from ${h?"controlled":"uncontrolled"} to ${o?"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.`),f.current=o},[o,a])}const d=u.useCallback(f=>{var h;if(o){const m=IE(f)?f(e):f;m!==e&&((h=i.current)==null||h.call(i,m))}else l(f)},[o,e,l,i]);return[c,d]}function HE({defaultProp:e,onChange:t}){const[n,a]=u.useState(e),r=u.useRef(n),l=u.useRef(t);return BE(()=>{l.current=t},[t]),u.useEffect(()=>{var i;r.current!==n&&((i=l.current)==null||i.call(l,n),r.current=n)},[n,r]),[n,a,l]}function IE(e){return typeof e=="function"}function pr(e){const t=qE(e),n=u.forwardRef((a,r)=>{const{children:l,...i}=a,o=u.Children.toArray(l),c=o.find(VE);if(c){const d=c.props.children,f=o.map(h=>h===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:h);return s.jsx(t,{...i,ref:r,children:u.isValidElement(d)?u.cloneElement(d,void 0,f):null})}return s.jsx(t,{...i,ref:r,children:l})});return n.displayName=`${e}.Slot`,n}var PE=pr("Slot");function qE(e){const t=u.forwardRef((n,a)=>{const{children:r,...l}=n;if(u.isValidElement(r)){const i=FE(r),o=YE(l,r.props);return r.type!==u.Fragment&&(o.ref=a?vd(a,i):i),u.cloneElement(r,o)}return u.Children.count(r)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var r0=Symbol("radix.slottable");function GE(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=r0,t}function VE(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===r0}function YE(e,t){const n={...t};for(const a in t){const r=e[a],l=t[a];/^on[A-Z]/.test(a)?r&&l?n[a]=(...o)=>{const c=l(...o);return r(...o),c}:r&&(n[a]=r):a==="style"?n[a]={...r,...l}:a==="className"&&(n[a]=[r,l].filter(Boolean).join(" "))}return{...e,...n}}function FE(e){var a,r;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var KE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Se=KE.reduce((e,t)=>{const n=pr(`Primitive.${t}`),a=u.forwardRef((r,l)=>{const{asChild:i,...o}=r,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...o,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function l0(e,t){e&&Ol.flushSync(()=>e.dispatchEvent(t))}function Es(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function XE(e,t=globalThis==null?void 0:globalThis.document){const n=Es(e);u.useEffect(()=>{const a=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var QE="DismissableLayer",lm="dismissableLayer.update",WE="dismissableLayer.pointerDownOutside",ZE="dismissableLayer.focusOutside",Ev,i0=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zo=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:l,onInteractOutside:i,onDismiss:o,...c}=e,d=u.useContext(i0),[f,h]=u.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=u.useState({}),b=Ve(t,_=>h(_)),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(y),p=f?v.indexOf(f):-1,j=d.layersWithOutsidePointerEventsDisabled.size>0,w=p>=g,N=tA(_=>{const S=_.target,D=[...d.branches].some(z=>z.contains(S));!w||D||(r==null||r(_),i==null||i(_),_.defaultPrevented||o==null||o())},m),C=nA(_=>{const S=_.target;[...d.branches].some(z=>z.contains(S))||(l==null||l(_),i==null||i(_),_.defaultPrevented||o==null||o())},m);return XE(_=>{p===d.layers.size-1&&(a==null||a(_),!_.defaultPrevented&&o&&(_.preventDefault(),o()))},m),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Ev=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Av(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Ev)}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Av())},[f,d]),u.useEffect(()=>{const _=()=>x({});return document.addEventListener(lm,_),()=>document.removeEventListener(lm,_)},[]),s.jsx(Se.div,{...c,ref:b,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:fe(e.onFocusCapture,C.onFocusCapture),onBlurCapture:fe(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:fe(e.onPointerDownCapture,N.onPointerDownCapture)})});zo.displayName=QE;var JE="DismissableLayerBranch",eA=u.forwardRef((e,t)=>{const n=u.useContext(i0),a=u.useRef(null),r=Ve(t,a);return u.useEffect(()=>{const l=a.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),s.jsx(Se.div,{...e,ref:r})});eA.displayName=JE;function tA(e,t=globalThis==null?void 0:globalThis.document){const n=Es(e),a=u.useRef(!1),r=u.useRef(()=>{});return u.useEffect(()=>{const l=o=>{if(o.target&&!a.current){let c=function(){o0(WE,n,d,{discrete:!0})};const d={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=c,t.addEventListener("click",r.current,{once:!0})):c()}else t.removeEventListener("click",r.current);a.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",l),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function nA(e,t=globalThis==null?void 0:globalThis.document){const n=Es(e),a=u.useRef(!1);return u.useEffect(()=>{const r=l=>{l.target&&!a.current&&o0(ZE,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function Av(){const e=new CustomEvent(lm);document.dispatchEvent(e)}function o0(e,t,n,{discrete:a}){const r=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),a?l0(r,l):r.dispatchEvent(l)}var zf="focusScope.autoFocusOnMount",Lf="focusScope.autoFocusOnUnmount",Mv={bubbles:!1,cancelable:!0},sA="FocusScope",yd=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:r,onUnmountAutoFocus:l,...i}=e,[o,c]=u.useState(null),d=Es(r),f=Es(l),h=u.useRef(null),m=Ve(t,v=>c(v)),x=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(a){let v=function(j){if(x.paused||!o)return;const w=j.target;o.contains(w)?h.current=w:ma(h.current,{select:!0})},y=function(j){if(x.paused||!o)return;const w=j.relatedTarget;w!==null&&(o.contains(w)||ma(h.current,{select:!0}))},g=function(j){if(document.activeElement===document.body)for(const N of j)N.removedNodes.length>0&&ma(o)};document.addEventListener("focusin",v),document.addEventListener("focusout",y);const p=new MutationObserver(g);return o&&p.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),p.disconnect()}}},[a,o,x.paused]),u.useEffect(()=>{if(o){Ov.add(x);const v=document.activeElement;if(!o.contains(v)){const g=new CustomEvent(zf,Mv);o.addEventListener(zf,d),o.dispatchEvent(g),g.defaultPrevented||(aA(cA(c0(o)),{select:!0}),document.activeElement===v&&ma(o))}return()=>{o.removeEventListener(zf,d),setTimeout(()=>{const g=new CustomEvent(Lf,Mv);o.addEventListener(Lf,f),o.dispatchEvent(g),g.defaultPrevented||ma(v??document.body,{select:!0}),o.removeEventListener(Lf,f),Ov.remove(x)},0)}}},[o,d,f,x]);const b=u.useCallback(v=>{if(!n&&!a||x.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,g=document.activeElement;if(y&&g){const p=v.currentTarget,[j,w]=rA(p);j&&w?!v.shiftKey&&g===w?(v.preventDefault(),n&&ma(j,{select:!0})):v.shiftKey&&g===j&&(v.preventDefault(),n&&ma(w,{select:!0})):g===p&&v.preventDefault()}},[n,a,x.paused]);return s.jsx(Se.div,{tabIndex:-1,...i,ref:m,onKeyDown:b})});yd.displayName=sA;function aA(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(ma(a,{select:t}),document.activeElement!==n)return}function rA(e){const t=c0(e),n=$v(t,e),a=$v(t.reverse(),e);return[n,a]}function c0(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const r=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||r?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $v(e,t){for(const n of e)if(!lA(n,{upTo:t}))return n}function lA(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 iA(e){return e instanceof HTMLInputElement&&"select"in e}function ma(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&iA(e)&&t&&e.select()}}var Ov=oA();function oA(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Dv(e,t),e.unshift(t)},remove(t){var n;e=Dv(e,t),(n=e[0])==null||n.resume()}}}function Dv(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function cA(e){return e.filter(t=>t.tagName!=="A")}var uA="Portal",Lo=u.forwardRef((e,t)=>{var o;const{container:n,...a}=e,[r,l]=u.useState(!1);Ft(()=>l(!0),[]);const i=n||r&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return i?SS.createPortal(s.jsx(Se.div,{...a,ref:t}),i):null});Lo.displayName=uA;function dA(e,t){return u.useReducer((n,a)=>t[n][a]??n,e)}var Qn=e=>{const{present:t,children:n}=e,a=fA(t),r=typeof n=="function"?n({present:a.isPresent}):u.Children.only(n),l=Ve(a.ref,hA(r));return typeof n=="function"||a.isPresent?u.cloneElement(r,{ref:l}):null};Qn.displayName="Presence";function fA(e){const[t,n]=u.useState(),a=u.useRef(null),r=u.useRef(e),l=u.useRef("none"),i=e?"mounted":"unmounted",[o,c]=dA(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=hc(a.current);l.current=o==="mounted"?d:"none"},[o]),Ft(()=>{const d=a.current,f=r.current;if(f!==e){const m=l.current,x=hc(d);e?c("MOUNT"):x==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==x?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,c]),Ft(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=x=>{const v=hc(a.current).includes(x.animationName);if(x.target===t&&v&&(c("ANIMATION_END"),!r.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=x=>{x.target===t&&(l.current=hc(a.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:u.useCallback(d=>{a.current=d?getComputedStyle(d):null,n(d)},[])}}function hc(e){return(e==null?void 0:e.animationName)||"none"}function hA(e){var a,r;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Uf=0;function Up(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??zv()),document.body.insertAdjacentElement("beforeend",e[1]??zv()),Uf++,()=>{Uf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Uf--}},[])}function zv(){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 ys=function(){return ys=Object.assign||function(t){for(var n,a=1,r=arguments.length;a<r;a++){n=arguments[a];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},ys.apply(this,arguments)};function u0(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]]);return n}function mA(e,t,n){if(n||arguments.length===2)for(var a=0,r=t.length,l;a<r;a++)(l||!(a in t))&&(l||(l=Array.prototype.slice.call(t,0,a)),l[a]=t[a]);return e.concat(l||Array.prototype.slice.call(t))}var Ic="right-scroll-bar-position",Pc="width-before-scroll-bar",pA="with-scroll-bars-hidden",xA="--removed-body-scroll-bar-size";function Bf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function gA(e,t){var n=u.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var r=n.value;r!==a&&(n.value=a,n.callback(a,r))}}}})[0];return n.callback=t,n.facade}var vA=typeof window<"u"?u.useLayoutEffect:u.useEffect,Lv=new WeakMap;function yA(e,t){var n=gA(null,function(a){return e.forEach(function(r){return Bf(r,a)})});return vA(function(){var a=Lv.get(n);if(a){var r=new Set(a),l=new Set(e),i=n.current;r.forEach(function(o){l.has(o)||Bf(o,null)}),l.forEach(function(o){r.has(o)||Bf(o,i)})}Lv.set(n,e)},[e]),n}function jA(e){return e}function bA(e,t){t===void 0&&(t=jA);var n=[],a=!1,r={read:function(){if(a)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(l){var i=t(l,a);return n.push(i),function(){n=n.filter(function(o){return o!==i})}},assignSyncMedium:function(l){for(a=!0;n.length;){var i=n;n=[],i.forEach(l)}n={push:function(o){return l(o)},filter:function(){return n}}},assignMedium:function(l){a=!0;var i=[];if(n.length){var o=n;n=[],o.forEach(l),i=n}var c=function(){var f=i;i=[],f.forEach(l)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),n}}}};return r}function wA(e){e===void 0&&(e={});var t=bA(null);return t.options=ys({async:!0,ssr:!1},e),t}var d0=function(e){var t=e.sideCar,n=u0(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return u.createElement(a,ys({},n))};d0.isSideCarExport=!0;function _A(e,t){return e.useMedium(t),d0}var f0=wA(),Hf=function(){},jd=u.forwardRef(function(e,t){var n=u.useRef(null),a=u.useState({onScrollCapture:Hf,onWheelCapture:Hf,onTouchMoveCapture:Hf}),r=a[0],l=a[1],i=e.forwardProps,o=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,h=e.shards,m=e.sideCar,x=e.noRelative,b=e.noIsolation,v=e.inert,y=e.allowPinchZoom,g=e.as,p=g===void 0?"div":g,j=e.gapMode,w=u0(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,C=yA([n,t]),_=ys(ys({},w),r);return u.createElement(u.Fragment,null,f&&u.createElement(N,{sideCar:f0,removeScrollBar:d,shards:h,noRelative:x,noIsolation:b,inert:v,setCallbacks:l,allowPinchZoom:!!y,lockRef:n,gapMode:j}),i?u.cloneElement(u.Children.only(o),ys(ys({},_),{ref:C})):u.createElement(p,ys({},_,{className:c,ref:C}),o))});jd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};jd.classNames={fullWidth:Pc,zeroRight:Ic};var NA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function kA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=NA();return t&&e.setAttribute("nonce",t),e}function SA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function CA(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var RA=function(){var e=0,t=null;return{add:function(n){e==0&&(t=kA())&&(SA(t,n),CA(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},TA=function(){var e=RA();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},h0=function(){var e=TA(),t=function(n){var a=n.styles,r=n.dynamic;return e(a,r),null};return t},EA={left:0,top:0,right:0,gap:0},If=function(e){return parseInt(e||"",10)||0},AA=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[If(n),If(a),If(r)]},MA=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return EA;var t=AA(e),n=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-n+t[2]-t[0])}},$A=h0(),fl="data-scroll-locked",OA=function(e,t,n,a){var r=e.left,l=e.top,i=e.right,o=e.gap;return n===void 0&&(n="margin"),`
|
|
345
|
-
.`.concat(
|
|
344
|
+
*/const BT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xd=be("x",BT),HT="Local only · this machine · not connected to SoftwareDLC",IT="Checking sync state…",PT="Sync state unknown",qT="Projects are the repositories this viewer reads on this machine. Nothing is shared unless you connect to SoftwareDLC.",mr="Details are in the terminal running sdlc viewer.",GT="How to fix it is in the terminal running sdlc viewer.",gd="Loading…",Su="Not available";function VT(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 ji(e){return(typeof e=="string"?new Date(e):e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const YT={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 Y0(e,t){const n=t?` this list was read at ${ji(t)}.`:"";if(e.reason==="store_locked"){const a=e.store?YT[e.store]:"a local store",r=e.since?` since ${ji(e.since)}`:"";return`Another sdlc command has held ${a}${r};${n||" nothing was read yet."} ${mr}`}return e.status===0?`The viewer did not answer. Is sdlc viewer still running?${t?` This list was read at ${ji(t)}.`:""}`:`The read failed.${t?` This list was read at ${ji(t)}.`:""} ${mr}`}const FT=e=>e.status===409,KT={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 XT(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 r=e.folder?`the folder ${e.folder}`:"its folder";return{kind:"moved_member",cause:`This repository, ${t}, is not where ${r} 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?KT[e.reason]:void 0,a=n!==void 0&&e.reason!=="membership_invalid"&&e.reason!=="folder_invalid";return{kind:"other",cause:n??"This repository's folder cannot be read.",fix:a}}const wv=["tasks","issues","releases"],zp=u.createContext(null);function On(){const e=u.useContext(zp);if(!e)throw new Error("A shell page rendered outside the app shell.");return e}function QT(){var e;return(e=u.useContext(zp))==null?void 0:e.engine}const WT=10,ZT=()=>new Date;function JT({shell:e,now:t=ZT,children:n}){var H;const[a,r]=u.useState(null),[l,i]=u.useState(null),[o,c]=u.useState(null),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,b]=u.useState(!0),[v,y]=u.useState(!1),[g,p]=u.useState(void 0),[j,w]=u.useState(!1),[N,C]=u.useState(wv),_=u.useRef(!1),S=u.useRef(!1),D=u.useRef(null),z=u.useRef(!0),P=u.useCallback(async(A=!1)=>{D.current&&clearTimeout(D.current),D.current=null,y(!0);const[M,R]=await Promise.all([e.organizations.list(),e.projects.list()]);if(!z.current)return;if(y(!1),b(!1),M.ok&&R.ok){if(_.current=!0,S.current=!1,m(null),f(t()),M.data.organizations.length===0){c("not_in_git"),r(null),i(null);return}c(null),r(M.data.organizations[0]),i(R.data.projects);return}const T=M.ok?R.ok?null:R.refusal:M.refusal;if(!T)return;if(FT(T)){S.current=!1,m(null),c(T),r(null),i(null);return}const k=_.current&&!S.current&&!A;S.current=!0;const O=T.retry_after??WT;m({refusal:T,shown:!k,retryInSeconds:k?O:null}),k&&(D.current=setTimeout(()=>void P(!0),O*1e3))},[e,t]);u.useEffect(()=>(z.current=!0,P(),e.about.about().then(A=>{z.current&&(A.ok?p(A.data):A.refusal.status===404?p(null):w(!0))}),Promise.all(wv.map(async A=>{var M;return[A,await((M=e[A])==null?void 0:M.access())]})).then(A=>{z.current&&C(A.filter(([,M])=>!(M!=null&&M.ok&&!M.data.can_view)).map(([M])=>M))}),()=>{z.current=!1,D.current&&clearTimeout(D.current)}),[e,P]);const F={loading:x,org:a,projects:l,none:o,readAt:d,failure:h,about:g,aboutFailed:j,engine:(g==null?void 0:g.engine)===null?null:(H=g==null?void 0:g.engine)==null?void 0:H.source,domains:N,reading:v,refresh:()=>void P()};return s.jsx(zp.Provider,{value:F,children:n})}const F0=e=>`The ${e} page is not part of this sdlc install`,Pl="The sdlc engine here is too old for this page";function eE(e){return e==="checkout"?"Update the main checkout, then restart sdlc viewer.":"Update sdlc to its latest version, then restart sdlc viewer."}function ds(){return eE(QT())}function K0(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=K0(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function X0(){for(var e,t,n=0,a="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=K0(e))&&(a&&(a+=" "),a+=t);return a}const _v=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Nv=X0,Do=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return Nv(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:l}=t,i=Object.keys(r).map(d=>{const f=n==null?void 0:n[d],h=l==null?void 0:l[d];if(f===null)return null;const m=_v(f)||_v(h);return r[d][m]}),o=n&&Object.entries(n).reduce((d,f)=>{let[h,m]=f;return m===void 0||(d[h]=m),d},{}),c=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((d,f)=>{let{class:h,className:m,...x}=f;return Object.entries(x).every(b=>{let[v,y]=b;return Array.isArray(y)?y.includes({...l,...o}[v]):{...l,...o}[v]===y})?[...d,h,m]:d},[]);return Nv(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},Lp="-",tE=e=>{const t=sE(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i=>{const o=i.split(Lp);return o[0]===""&&o.length!==1&&o.shift(),Q0(o,t)||nE(i)},getConflictingClassGroupIds:(i,o)=>{const c=n[i]||[];return o&&a[i]?[...c,...a[i]]:c}}},Q0=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],a=t.nextPart.get(n),r=a?Q0(e.slice(1),a):void 0;if(r)return r;if(t.validators.length===0)return;const l=e.join(Lp);return(i=t.validators.find(({validator:o})=>o(l)))==null?void 0:i.classGroupId},kv=/^\[(.+)\]$/,nE=e=>{if(kv.test(e)){const t=kv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},sE=e=>{const{theme:t,classGroups:n}=e,a={nextPart:new Map,validators:[]};for(const r in n)sm(n[r],a,r,t);return a},sm=(e,t,n,a)=>{e.forEach(r=>{if(typeof r=="string"){const l=r===""?t:Sv(t,r);l.classGroupId=n;return}if(typeof r=="function"){if(aE(r)){sm(r(a),t,n,a);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([l,i])=>{sm(i,Sv(t,l),n,a)})})},Sv=(e,t)=>{let n=e;return t.split(Lp).forEach(a=>{n.nextPart.has(a)||n.nextPart.set(a,{nextPart:new Map,validators:[]}),n=n.nextPart.get(a)}),n},aE=e=>e.isThemeGetter,rE=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,a=new Map;const r=(l,i)=>{n.set(l,i),t++,t>e&&(t=0,a=n,n=new Map)};return{get(l){let i=n.get(l);if(i!==void 0)return i;if((i=a.get(l))!==void 0)return r(l,i),i},set(l,i){n.has(l)?n.set(l,i):r(l,i)}}},am="!",rm=":",lE=rm.length,iE=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=r=>{const l=[];let i=0,o=0,c=0,d;for(let b=0;b<r.length;b++){let v=r[b];if(i===0&&o===0){if(v===rm){l.push(r.slice(c,b)),c=b+lE;continue}if(v==="/"){d=b;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=l.length===0?r:r.substring(c),h=oE(f),m=h!==f,x=d&&d>c?d-c:void 0;return{modifiers:l,hasImportantModifier:m,baseClassName:h,maybePostfixModifierPosition:x}};if(t){const r=t+rm,l=a;a=i=>i.startsWith(r)?l(i.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const r=a;a=l=>n({className:l,parseClassName:r})}return a},oE=e=>e.endsWith(am)?e.substring(0,e.length-1):e.startsWith(am)?e.substring(1):e,cE=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const r=[];let l=[];return a.forEach(i=>{i[0]==="["||t[i]?(r.push(...l.sort(),i),l=[]):l.push(i)}),r.push(...l.sort()),r}},uE=e=>({cache:rE(e.cacheSize),parseClassName:iE(e),sortModifiers:cE(e),...tE(e)}),dE=/\s+/,fE=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:r,sortModifiers:l}=t,i=[],o=e.trim().split(dE);let c="";for(let d=o.length-1;d>=0;d-=1){const f=o[d],{isExternal:h,modifiers:m,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:v}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let y=!!v,g=a(y?b.substring(0,v):b);if(!g){if(!y){c=f+(c.length>0?" "+c:c);continue}if(g=a(b),!g){c=f+(c.length>0?" "+c:c);continue}y=!1}const p=l(m).join(":"),j=x?p+am:p,w=j+g;if(i.includes(w))continue;i.push(w);const N=r(g,y);for(let C=0;C<N.length;++C){const _=N[C];i.push(j+_)}c=f+(c.length>0?" "+c:c)}return c};function hE(){let e=0,t,n,a="";for(;e<arguments.length;)(t=arguments[e++])&&(n=W0(t))&&(a&&(a+=" "),a+=n);return a}const W0=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=W0(e[a]))&&(n&&(n+=" "),n+=t);return n};function mE(e,...t){let n,a,r,l=i;function i(c){const d=t.reduce((f,h)=>h(f),e());return n=uE(d),a=n.cache.get,r=n.cache.set,l=o,o(c)}function o(c){const d=a(c);if(d)return d;const f=fE(c,n);return r(c,f),f}return function(){return l(hE.apply(null,arguments))}}const Mt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Z0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,J0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pE=/^\d+\/\d+$/,xE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gE=/\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$/,vE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,yE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$r=e=>pE.test(e),Ee=e=>!!e&&!Number.isNaN(Number(e)),ua=e=>!!e&&Number.isInteger(Number(e)),Of=e=>e.endsWith("%")&&Ee(e.slice(0,-1)),Is=e=>xE.test(e),bE=()=>!0,wE=e=>gE.test(e)&&!vE.test(e),ew=()=>!1,_E=e=>yE.test(e),NE=e=>jE.test(e),kE=e=>!me(e)&&!pe(e),SE=e=>ql(e,sw,ew),me=e=>Z0.test(e),Wa=e=>ql(e,aw,wE),Df=e=>ql(e,AE,Ee),Cv=e=>ql(e,tw,ew),CE=e=>ql(e,nw,NE),dc=e=>ql(e,rw,_E),pe=e=>J0.test(e),fi=e=>Gl(e,aw),RE=e=>Gl(e,ME),Rv=e=>Gl(e,tw),TE=e=>Gl(e,sw),EE=e=>Gl(e,nw),fc=e=>Gl(e,rw,!0),ql=(e,t,n)=>{const a=Z0.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Gl=(e,t,n=!1)=>{const a=J0.exec(e);return a?a[1]?t(a[1]):n:!1},tw=e=>e==="position"||e==="percentage",nw=e=>e==="image"||e==="url",sw=e=>e==="length"||e==="size"||e==="bg-size",aw=e=>e==="length",AE=e=>e==="number",ME=e=>e==="family-name",rw=e=>e==="shadow",$E=()=>{const e=Mt("color"),t=Mt("font"),n=Mt("text"),a=Mt("font-weight"),r=Mt("tracking"),l=Mt("leading"),i=Mt("breakpoint"),o=Mt("container"),c=Mt("spacing"),d=Mt("radius"),f=Mt("shadow"),h=Mt("inset-shadow"),m=Mt("text-shadow"),x=Mt("drop-shadow"),b=Mt("blur"),v=Mt("perspective"),y=Mt("aspect"),g=Mt("ease"),p=Mt("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...w(),pe,me],C=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],S=()=>[pe,me,c],D=()=>[$r,"full","auto",...S()],z=()=>[ua,"none","subgrid",pe,me],P=()=>["auto",{span:["full",ua,pe,me]},ua,pe,me],F=()=>[ua,"auto",pe,me],H=()=>["auto","min","max","fr",pe,me],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...S()],T=()=>[$r,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],k=()=>[e,pe,me],O=()=>[...w(),Rv,Cv,{position:[pe,me]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],E=()=>["auto","cover","contain",TE,SE,{size:[pe,me]}],I=()=>[Of,fi,Wa],Q=()=>["","none","full",d,pe,me],te=()=>["",Ee,fi,Wa],ce=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>[Ee,Of,Rv,Cv],q=()=>["","none",b,pe,me],ne=()=>["none",Ee,pe,me],ae=()=>["none",Ee,pe,me],je=()=>[Ee,pe,me],re=()=>[$r,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Is],breakpoint:[Is],color:[bE],container:[Is],"drop-shadow":[Is],ease:["in","out","in-out"],font:[kE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Is],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Is],shadow:[Is],spacing:["px",Ee],text:[Is],"text-shadow":[Is],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$r,me,pe,y]}],container:["container"],columns:[{columns:[Ee,me,pe,o]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"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:N()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{start:D()}],end:[{end:D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[ua,"auto",pe,me]}],basis:[{basis:[$r,"full","auto",o,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ee,$r,"auto","initial","none",me]}],grow:[{grow:["",Ee,pe,me]}],shrink:[{shrink:["",Ee,pe,me]}],order:[{order:[ua,"first","last","none",pe,me]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":H()}],"auto-rows":[{"auto-rows":H()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...M(),"normal"]}],"justify-self":[{"justify-self":["auto",...M()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...M(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...M(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...M(),"baseline"]}],"place-self":[{"place-self":["auto",...M()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:T()}],w:[{w:[o,"screen",...T()]}],"min-w":[{"min-w":[o,"screen","none",...T()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",n,fi,Wa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,pe,Df]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Of,me]}],"font-family":[{font:[RE,me,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:[r,pe,me]}],"line-clamp":[{"line-clamp":[Ee,"none",pe,Df]}],leading:[{leading:[l,...S()]}],"list-image":[{"list-image":["none",pe,me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",pe,me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ee,"from-font","auto",pe,Wa]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[Ee,"auto",pe,me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pe,me]}],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",pe,me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:O()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:E()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ua,pe,me],radial:["",pe,me],conic:[ua,pe,me]},EE,CE]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"hidden","none"]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ee,pe,me]}],"outline-w":[{outline:["",Ee,fi,Wa]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","none",f,fc,dc]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",h,fc,dc]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[Ee,Wa]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",m,fc,dc]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[Ee,pe,me]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"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":[Ee]}],"mask-image-linear-from-pos":[{"mask-linear-from":L()}],"mask-image-linear-to-pos":[{"mask-linear-to":L()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":L()}],"mask-image-t-to-pos":[{"mask-t-to":L()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":L()}],"mask-image-r-to-pos":[{"mask-r-to":L()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":L()}],"mask-image-b-to-pos":[{"mask-b-to":L()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":L()}],"mask-image-l-to-pos":[{"mask-l-to":L()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":L()}],"mask-image-x-to-pos":[{"mask-x-to":L()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":L()}],"mask-image-y-to-pos":[{"mask-y-to":L()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[pe,me]}],"mask-image-radial-from-pos":[{"mask-radial-from":L()}],"mask-image-radial-to-pos":[{"mask-radial-to":L()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"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":w()}],"mask-image-conic-pos":[{"mask-conic":[Ee]}],"mask-image-conic-from-pos":[{"mask-conic-from":L()}],"mask-image-conic-to-pos":[{"mask-conic-to":L()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:E()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",pe,me]}],filter:[{filter:["","none",pe,me]}],blur:[{blur:q()}],brightness:[{brightness:[Ee,pe,me]}],contrast:[{contrast:[Ee,pe,me]}],"drop-shadow":[{"drop-shadow":["","none",x,fc,dc]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",Ee,pe,me]}],"hue-rotate":[{"hue-rotate":[Ee,pe,me]}],invert:[{invert:["",Ee,pe,me]}],saturate:[{saturate:[Ee,pe,me]}],sepia:[{sepia:["",Ee,pe,me]}],"backdrop-filter":[{"backdrop-filter":["","none",pe,me]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[Ee,pe,me]}],"backdrop-contrast":[{"backdrop-contrast":[Ee,pe,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ee,pe,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ee,pe,me]}],"backdrop-invert":[{"backdrop-invert":["",Ee,pe,me]}],"backdrop-opacity":[{"backdrop-opacity":[Ee,pe,me]}],"backdrop-saturate":[{"backdrop-saturate":[Ee,pe,me]}],"backdrop-sepia":[{"backdrop-sepia":["",Ee,pe,me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",pe,me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ee,"initial",pe,me]}],ease:[{ease:["linear","initial",g,pe,me]}],delay:[{delay:[Ee,pe,me]}],animate:[{animate:["none",p,pe,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,pe,me]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[pe,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"translate-none":["translate-none"],accent:[{accent:k()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:k()}],"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",pe,me]}],"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":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"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",pe,me]}],fill:[{fill:["none",...k()]}],"stroke-w":[{stroke:[Ee,fi,Wa,Df]}],stroke:[{stroke:["none",...k()]}],"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"]}},OE=mE($E);function ie(...e){return OE(X0(e))}const DE=Do("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 he({className:e,variant:t,...n}){return s.jsx("div",{"data-slot":"alert",role:"alert",className:ie(DE({variant:t}),e),...n})}function ye({className:e,...t}){return s.jsx("div",{"data-slot":"alert-title",className:ie("col-start-2 min-h-4 font-medium tracking-tight",e),...t})}function xe({className:e,...t}){return s.jsx("div",{"data-slot":"alert-description",className:ie("col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function fe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Tv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function vd(...e){return t=>{let n=!1;const a=e.map(r=>{const l=Tv(r,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let r=0;r<a.length;r++){const l=a[r];typeof l=="function"?l():Tv(e[r],null)}}}}function Ve(...e){return u.useCallback(vd(...e),e)}function zE(e,t){const n=u.createContext(t),a=l=>{const{children:i,...o}=l,c=u.useMemo(()=>o,Object.values(o));return s.jsx(n.Provider,{value:c,children:i})};a.displayName=e+"Provider";function r(l){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[a,r]}function Os(e,t=[]){let n=[];function a(l,i){const o=u.createContext(i),c=n.length;n=[...n,i];const d=h=>{var g;const{scope:m,children:x,...b}=h,v=((g=m==null?void 0:m[e])==null?void 0:g[c])||o,y=u.useMemo(()=>b,Object.values(b));return s.jsx(v.Provider,{value:y,children:x})};d.displayName=l+"Provider";function f(h,m){var v;const x=((v=m==null?void 0:m[e])==null?void 0:v[c])||o,b=u.useContext(x);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${l}\``)}return[d,f]}const r=()=>{const l=n.map(i=>u.createContext(i));return function(o){const c=(o==null?void 0:o[e])||l;return u.useMemo(()=>({[`__scope${e}`]:{...o,[e]:c}}),[o,c])}};return r.scopeName=e,[a,LE(r,...t)]}function LE(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(l){const i=a.reduce((o,{useScope:c,scopeName:d})=>{const h=c(l)[`__scope${d}`];return{...o,...h}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Ft=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},UE=Xy[" useId ".trim().toString()]||(()=>{}),BE=0;function as(e){const[t,n]=u.useState(UE());return Ft(()=>{n(a=>a??String(BE++))},[e]),t?`radix-${t}`:""}var HE=Xy[" useInsertionEffect ".trim().toString()]||Ft;function Ba({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[r,l,i]=IE({defaultProp:t,onChange:n}),o=e!==void 0,c=o?e:r;{const f=u.useRef(e!==void 0);u.useEffect(()=>{const h=f.current;h!==o&&console.warn(`${a} is changing from ${h?"controlled":"uncontrolled"} to ${o?"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.`),f.current=o},[o,a])}const d=u.useCallback(f=>{var h;if(o){const m=PE(f)?f(e):f;m!==e&&((h=i.current)==null||h.call(i,m))}else l(f)},[o,e,l,i]);return[c,d]}function IE({defaultProp:e,onChange:t}){const[n,a]=u.useState(e),r=u.useRef(n),l=u.useRef(t);return HE(()=>{l.current=t},[t]),u.useEffect(()=>{var i;r.current!==n&&((i=l.current)==null||i.call(l,n),r.current=n)},[n,r]),[n,a,l]}function PE(e){return typeof e=="function"}function pr(e){const t=GE(e),n=u.forwardRef((a,r)=>{const{children:l,...i}=a,o=u.Children.toArray(l),c=o.find(YE);if(c){const d=c.props.children,f=o.map(h=>h===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:h);return s.jsx(t,{...i,ref:r,children:u.isValidElement(d)?u.cloneElement(d,void 0,f):null})}return s.jsx(t,{...i,ref:r,children:l})});return n.displayName=`${e}.Slot`,n}var qE=pr("Slot");function GE(e){const t=u.forwardRef((n,a)=>{const{children:r,...l}=n;if(u.isValidElement(r)){const i=KE(r),o=FE(l,r.props);return r.type!==u.Fragment&&(o.ref=a?vd(a,i):i),u.cloneElement(r,o)}return u.Children.count(r)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var lw=Symbol("radix.slottable");function VE(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=lw,t}function YE(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lw}function FE(e,t){const n={...t};for(const a in t){const r=e[a],l=t[a];/^on[A-Z]/.test(a)?r&&l?n[a]=(...o)=>{const c=l(...o);return r(...o),c}:r&&(n[a]=r):a==="style"?n[a]={...r,...l}:a==="className"&&(n[a]=[r,l].filter(Boolean).join(" "))}return{...e,...n}}function KE(e){var a,r;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var XE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Se=XE.reduce((e,t)=>{const n=pr(`Primitive.${t}`),a=u.forwardRef((r,l)=>{const{asChild:i,...o}=r,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...o,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function iw(e,t){e&&Ol.flushSync(()=>e.dispatchEvent(t))}function Es(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function QE(e,t=globalThis==null?void 0:globalThis.document){const n=Es(e);u.useEffect(()=>{const a=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var WE="DismissableLayer",lm="dismissableLayer.update",ZE="dismissableLayer.pointerDownOutside",JE="dismissableLayer.focusOutside",Ev,ow=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zo=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:l,onInteractOutside:i,onDismiss:o,...c}=e,d=u.useContext(ow),[f,h]=u.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=u.useState({}),b=Ve(t,_=>h(_)),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(y),p=f?v.indexOf(f):-1,j=d.layersWithOutsidePointerEventsDisabled.size>0,w=p>=g,N=nA(_=>{const S=_.target,D=[...d.branches].some(z=>z.contains(S));!w||D||(r==null||r(_),i==null||i(_),_.defaultPrevented||o==null||o())},m),C=sA(_=>{const S=_.target;[...d.branches].some(z=>z.contains(S))||(l==null||l(_),i==null||i(_),_.defaultPrevented||o==null||o())},m);return QE(_=>{p===d.layers.size-1&&(a==null||a(_),!_.defaultPrevented&&o&&(_.preventDefault(),o()))},m),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Ev=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Av(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Ev)}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Av())},[f,d]),u.useEffect(()=>{const _=()=>x({});return document.addEventListener(lm,_),()=>document.removeEventListener(lm,_)},[]),s.jsx(Se.div,{...c,ref:b,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:fe(e.onFocusCapture,C.onFocusCapture),onBlurCapture:fe(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:fe(e.onPointerDownCapture,N.onPointerDownCapture)})});zo.displayName=WE;var eA="DismissableLayerBranch",tA=u.forwardRef((e,t)=>{const n=u.useContext(ow),a=u.useRef(null),r=Ve(t,a);return u.useEffect(()=>{const l=a.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),s.jsx(Se.div,{...e,ref:r})});tA.displayName=eA;function nA(e,t=globalThis==null?void 0:globalThis.document){const n=Es(e),a=u.useRef(!1),r=u.useRef(()=>{});return u.useEffect(()=>{const l=o=>{if(o.target&&!a.current){let c=function(){cw(ZE,n,d,{discrete:!0})};const d={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=c,t.addEventListener("click",r.current,{once:!0})):c()}else t.removeEventListener("click",r.current);a.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",l),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function sA(e,t=globalThis==null?void 0:globalThis.document){const n=Es(e),a=u.useRef(!1);return u.useEffect(()=>{const r=l=>{l.target&&!a.current&&cw(JE,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function Av(){const e=new CustomEvent(lm);document.dispatchEvent(e)}function cw(e,t,n,{discrete:a}){const r=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),a?iw(r,l):r.dispatchEvent(l)}var zf="focusScope.autoFocusOnMount",Lf="focusScope.autoFocusOnUnmount",Mv={bubbles:!1,cancelable:!0},aA="FocusScope",yd=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:r,onUnmountAutoFocus:l,...i}=e,[o,c]=u.useState(null),d=Es(r),f=Es(l),h=u.useRef(null),m=Ve(t,v=>c(v)),x=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(a){let v=function(j){if(x.paused||!o)return;const w=j.target;o.contains(w)?h.current=w:ma(h.current,{select:!0})},y=function(j){if(x.paused||!o)return;const w=j.relatedTarget;w!==null&&(o.contains(w)||ma(h.current,{select:!0}))},g=function(j){if(document.activeElement===document.body)for(const N of j)N.removedNodes.length>0&&ma(o)};document.addEventListener("focusin",v),document.addEventListener("focusout",y);const p=new MutationObserver(g);return o&&p.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),p.disconnect()}}},[a,o,x.paused]),u.useEffect(()=>{if(o){Ov.add(x);const v=document.activeElement;if(!o.contains(v)){const g=new CustomEvent(zf,Mv);o.addEventListener(zf,d),o.dispatchEvent(g),g.defaultPrevented||(rA(uA(uw(o)),{select:!0}),document.activeElement===v&&ma(o))}return()=>{o.removeEventListener(zf,d),setTimeout(()=>{const g=new CustomEvent(Lf,Mv);o.addEventListener(Lf,f),o.dispatchEvent(g),g.defaultPrevented||ma(v??document.body,{select:!0}),o.removeEventListener(Lf,f),Ov.remove(x)},0)}}},[o,d,f,x]);const b=u.useCallback(v=>{if(!n&&!a||x.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,g=document.activeElement;if(y&&g){const p=v.currentTarget,[j,w]=lA(p);j&&w?!v.shiftKey&&g===w?(v.preventDefault(),n&&ma(j,{select:!0})):v.shiftKey&&g===j&&(v.preventDefault(),n&&ma(w,{select:!0})):g===p&&v.preventDefault()}},[n,a,x.paused]);return s.jsx(Se.div,{tabIndex:-1,...i,ref:m,onKeyDown:b})});yd.displayName=aA;function rA(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(ma(a,{select:t}),document.activeElement!==n)return}function lA(e){const t=uw(e),n=$v(t,e),a=$v(t.reverse(),e);return[n,a]}function uw(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const r=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||r?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $v(e,t){for(const n of e)if(!iA(n,{upTo:t}))return n}function iA(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 oA(e){return e instanceof HTMLInputElement&&"select"in e}function ma(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&oA(e)&&t&&e.select()}}var Ov=cA();function cA(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Dv(e,t),e.unshift(t)},remove(t){var n;e=Dv(e,t),(n=e[0])==null||n.resume()}}}function Dv(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function uA(e){return e.filter(t=>t.tagName!=="A")}var dA="Portal",Lo=u.forwardRef((e,t)=>{var o;const{container:n,...a}=e,[r,l]=u.useState(!1);Ft(()=>l(!0),[]);const i=n||r&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return i?CS.createPortal(s.jsx(Se.div,{...a,ref:t}),i):null});Lo.displayName=dA;function fA(e,t){return u.useReducer((n,a)=>t[n][a]??n,e)}var Qn=e=>{const{present:t,children:n}=e,a=hA(t),r=typeof n=="function"?n({present:a.isPresent}):u.Children.only(n),l=Ve(a.ref,mA(r));return typeof n=="function"||a.isPresent?u.cloneElement(r,{ref:l}):null};Qn.displayName="Presence";function hA(e){const[t,n]=u.useState(),a=u.useRef(null),r=u.useRef(e),l=u.useRef("none"),i=e?"mounted":"unmounted",[o,c]=fA(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=hc(a.current);l.current=o==="mounted"?d:"none"},[o]),Ft(()=>{const d=a.current,f=r.current;if(f!==e){const m=l.current,x=hc(d);e?c("MOUNT"):x==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==x?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,c]),Ft(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=x=>{const v=hc(a.current).includes(x.animationName);if(x.target===t&&v&&(c("ANIMATION_END"),!r.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=x=>{x.target===t&&(l.current=hc(a.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:u.useCallback(d=>{a.current=d?getComputedStyle(d):null,n(d)},[])}}function hc(e){return(e==null?void 0:e.animationName)||"none"}function mA(e){var a,r;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Uf=0;function Up(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??zv()),document.body.insertAdjacentElement("beforeend",e[1]??zv()),Uf++,()=>{Uf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Uf--}},[])}function zv(){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 ys=function(){return ys=Object.assign||function(t){for(var n,a=1,r=arguments.length;a<r;a++){n=arguments[a];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},ys.apply(this,arguments)};function dw(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]]);return n}function pA(e,t,n){if(n||arguments.length===2)for(var a=0,r=t.length,l;a<r;a++)(l||!(a in t))&&(l||(l=Array.prototype.slice.call(t,0,a)),l[a]=t[a]);return e.concat(l||Array.prototype.slice.call(t))}var Ic="right-scroll-bar-position",Pc="width-before-scroll-bar",xA="with-scroll-bars-hidden",gA="--removed-body-scroll-bar-size";function Bf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function vA(e,t){var n=u.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var r=n.value;r!==a&&(n.value=a,n.callback(a,r))}}}})[0];return n.callback=t,n.facade}var yA=typeof window<"u"?u.useLayoutEffect:u.useEffect,Lv=new WeakMap;function jA(e,t){var n=vA(null,function(a){return e.forEach(function(r){return Bf(r,a)})});return yA(function(){var a=Lv.get(n);if(a){var r=new Set(a),l=new Set(e),i=n.current;r.forEach(function(o){l.has(o)||Bf(o,null)}),l.forEach(function(o){r.has(o)||Bf(o,i)})}Lv.set(n,e)},[e]),n}function bA(e){return e}function wA(e,t){t===void 0&&(t=bA);var n=[],a=!1,r={read:function(){if(a)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(l){var i=t(l,a);return n.push(i),function(){n=n.filter(function(o){return o!==i})}},assignSyncMedium:function(l){for(a=!0;n.length;){var i=n;n=[],i.forEach(l)}n={push:function(o){return l(o)},filter:function(){return n}}},assignMedium:function(l){a=!0;var i=[];if(n.length){var o=n;n=[],o.forEach(l),i=n}var c=function(){var f=i;i=[],f.forEach(l)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),n}}}};return r}function _A(e){e===void 0&&(e={});var t=wA(null);return t.options=ys({async:!0,ssr:!1},e),t}var fw=function(e){var t=e.sideCar,n=dw(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return u.createElement(a,ys({},n))};fw.isSideCarExport=!0;function NA(e,t){return e.useMedium(t),fw}var hw=_A(),Hf=function(){},jd=u.forwardRef(function(e,t){var n=u.useRef(null),a=u.useState({onScrollCapture:Hf,onWheelCapture:Hf,onTouchMoveCapture:Hf}),r=a[0],l=a[1],i=e.forwardProps,o=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,h=e.shards,m=e.sideCar,x=e.noRelative,b=e.noIsolation,v=e.inert,y=e.allowPinchZoom,g=e.as,p=g===void 0?"div":g,j=e.gapMode,w=dw(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,C=jA([n,t]),_=ys(ys({},w),r);return u.createElement(u.Fragment,null,f&&u.createElement(N,{sideCar:hw,removeScrollBar:d,shards:h,noRelative:x,noIsolation:b,inert:v,setCallbacks:l,allowPinchZoom:!!y,lockRef:n,gapMode:j}),i?u.cloneElement(u.Children.only(o),ys(ys({},_),{ref:C})):u.createElement(p,ys({},_,{className:c,ref:C}),o))});jd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};jd.classNames={fullWidth:Pc,zeroRight:Ic};var kA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=kA();return t&&e.setAttribute("nonce",t),e}function CA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function RA(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var TA=function(){var e=0,t=null;return{add:function(n){e==0&&(t=SA())&&(CA(t,n),RA(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},EA=function(){var e=TA();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},mw=function(){var e=EA(),t=function(n){var a=n.styles,r=n.dynamic;return e(a,r),null};return t},AA={left:0,top:0,right:0,gap:0},If=function(e){return parseInt(e||"",10)||0},MA=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[If(n),If(a),If(r)]},$A=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return AA;var t=MA(e),n=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-n+t[2]-t[0])}},OA=mw(),fl="data-scroll-locked",DA=function(e,t,n,a){var r=e.left,l=e.top,i=e.right,o=e.gap;return n===void 0&&(n="margin"),`
|
|
345
|
+
.`.concat(xA,` {
|
|
346
346
|
overflow: hidden `).concat(a,`;
|
|
347
347
|
padding-right: `).concat(o,"px ").concat(a,`;
|
|
348
348
|
}
|
|
@@ -376,19 +376,19 @@ Error generating stack: `+n.message+`
|
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
body[`).concat(fl,`] {
|
|
379
|
-
`).concat(
|
|
379
|
+
`).concat(gA,": ").concat(o,`px;
|
|
380
380
|
}
|
|
381
|
-
`)},Uv=function(){var e=parseInt(document.body.getAttribute(fl)||"0",10);return isFinite(e)?e:0},
|
|
381
|
+
`)},Uv=function(){var e=parseInt(document.body.getAttribute(fl)||"0",10);return isFinite(e)?e:0},zA=function(){u.useEffect(function(){return document.body.setAttribute(fl,(Uv()+1).toString()),function(){var e=Uv()-1;e<=0?document.body.removeAttribute(fl):document.body.setAttribute(fl,e.toString())}},[])},LA=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,r=a===void 0?"margin":a;zA();var l=u.useMemo(function(){return $A(r)},[r]);return u.createElement(OA,{styles:DA(l,!t,r,n?"":"!important")})},im=!1;if(typeof window<"u")try{var mc=Object.defineProperty({},"passive",{get:function(){return im=!0,!0}});window.addEventListener("test",mc,mc),window.removeEventListener("test",mc,mc)}catch{im=!1}var Or=im?{passive:!1}:!1,UA=function(e){return e.tagName==="TEXTAREA"},pw=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!UA(e)&&n[t]==="visible")},BA=function(e){return pw(e,"overflowY")},HA=function(e){return pw(e,"overflowX")},Bv=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var r=xw(e,a);if(r){var l=gw(e,a),i=l[1],o=l[2];if(i>o)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},IA=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},PA=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},xw=function(e,t){return e==="v"?BA(t):HA(t)},gw=function(e,t){return e==="v"?IA(t):PA(t)},qA=function(e,t){return e==="h"&&t==="rtl"?-1:1},GA=function(e,t,n,a,r){var l=qA(e,window.getComputedStyle(t).direction),i=l*a,o=n.target,c=t.contains(o),d=!1,f=i>0,h=0,m=0;do{if(!o)break;var x=gw(e,o),b=x[0],v=x[1],y=x[2],g=v-y-l*b;(b||g)&&xw(e,o)&&(h+=g,m+=b);var p=o.parentNode;o=p&&p.nodeType===Node.DOCUMENT_FRAGMENT_NODE?p.host:p}while(!c&&o!==document.body||c&&(t.contains(o)||t===o));return(f&&Math.abs(h)<1||!f&&Math.abs(m)<1)&&(d=!0),d},pc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Hv=function(e){return[e.deltaX,e.deltaY]},Iv=function(e){return e&&"current"in e?e.current:e},VA=function(e,t){return e[0]===t[0]&&e[1]===t[1]},YA=function(e){return`
|
|
382
382
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
383
383
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
384
|
-
`)},
|
|
384
|
+
`)},FA=0,Dr=[];function KA(e){var t=u.useRef([]),n=u.useRef([0,0]),a=u.useRef(),r=u.useState(FA++)[0],l=u.useState(mw)[0],i=u.useRef(e);u.useEffect(function(){i.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var v=pA([e.lockRef.current],(e.shards||[]).map(Iv),!0).filter(Boolean);return v.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),v.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var o=u.useCallback(function(v,y){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!i.current.allowPinchZoom;var g=pc(v),p=n.current,j="deltaX"in v?v.deltaX:p[0]-g[0],w="deltaY"in v?v.deltaY:p[1]-g[1],N,C=v.target,_=Math.abs(j)>Math.abs(w)?"h":"v";if("touches"in v&&_==="h"&&C.type==="range")return!1;var S=Bv(_,C);if(!S)return!0;if(S?N=_:(N=_==="v"?"h":"v",S=Bv(_,C)),!S)return!1;if(!a.current&&"changedTouches"in v&&(j||w)&&(a.current=N),!N)return!0;var D=a.current||N;return GA(D,y,v,D==="h"?j:w)},[]),c=u.useCallback(function(v){var y=v;if(!(!Dr.length||Dr[Dr.length-1]!==l)){var g="deltaY"in y?Hv(y):pc(y),p=t.current.filter(function(N){return N.name===y.type&&(N.target===y.target||y.target===N.shadowParent)&&VA(N.delta,g)})[0];if(p&&p.should){y.cancelable&&y.preventDefault();return}if(!p){var j=(i.current.shards||[]).map(Iv).filter(Boolean).filter(function(N){return N.contains(y.target)}),w=j.length>0?o(y,j[0]):!i.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),d=u.useCallback(function(v,y,g,p){var j={name:v,delta:y,target:g,should:p,shadowParent:XA(g)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(w){return w!==j})},1)},[]),f=u.useCallback(function(v){n.current=pc(v),a.current=void 0},[]),h=u.useCallback(function(v){d(v.type,Hv(v),v.target,o(v,e.lockRef.current))},[]),m=u.useCallback(function(v){d(v.type,pc(v),v.target,o(v,e.lockRef.current))},[]);u.useEffect(function(){return Dr.push(l),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Or),document.addEventListener("touchmove",c,Or),document.addEventListener("touchstart",f,Or),function(){Dr=Dr.filter(function(v){return v!==l}),document.removeEventListener("wheel",c,Or),document.removeEventListener("touchmove",c,Or),document.removeEventListener("touchstart",f,Or)}},[]);var x=e.removeScrollBar,b=e.inert;return u.createElement(u.Fragment,null,b?u.createElement(l,{styles:YA(r)}):null,x?u.createElement(LA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function XA(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const QA=NA(hw,KA);var bd=u.forwardRef(function(e,t){return u.createElement(jd,ys({},e,{ref:t,sideCar:QA}))});bd.classNames=jd.classNames;var WA=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},zr=new WeakMap,xc=new WeakMap,gc={},Pf=0,vw=function(e){return e&&(e.host||vw(e.parentNode))},ZA=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=vw(n);return a&&e.contains(a)?a:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},JA=function(e,t,n,a){var r=ZA(t,Array.isArray(e)?e:[e]);gc[n]||(gc[n]=new WeakMap);var l=gc[n],i=[],o=new Set,c=new Set(r),d=function(h){!h||o.has(h)||(o.add(h),d(h.parentNode))};r.forEach(d);var f=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(o.has(m))f(m);else try{var x=m.getAttribute(a),b=x!==null&&x!=="false",v=(zr.get(m)||0)+1,y=(l.get(m)||0)+1;zr.set(m,v),l.set(m,y),i.push(m),v===1&&b&&xc.set(m,!0),y===1&&m.setAttribute(n,"true"),b||m.setAttribute(a,"true")}catch(g){console.error("aria-hidden: cannot operate on ",m,g)}})};return f(t),o.clear(),Pf++,function(){i.forEach(function(h){var m=zr.get(h)-1,x=l.get(h)-1;zr.set(h,m),l.set(h,x),m||(xc.has(h)||h.removeAttribute(a),xc.delete(h)),x||h.removeAttribute(n)}),Pf--,Pf||(zr=new WeakMap,zr=new WeakMap,xc=new WeakMap,gc={})}},Bp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),r=WA(e);return r?(a.push.apply(a,Array.from(r.querySelectorAll("[aria-live], script"))),JA(a,r,n,"aria-hidden")):function(){return null}},wd="Dialog",[yw]=Os(wd),[eM,fs]=yw(wd),jw=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:r,onOpenChange:l,modal:i=!0}=e,o=u.useRef(null),c=u.useRef(null),[d,f]=Ba({prop:a,defaultProp:r??!1,onChange:l,caller:wd});return s.jsx(eM,{scope:t,triggerRef:o,contentRef:c,contentId:as(),titleId:as(),descriptionId:as(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(h=>!h),[f]),modal:i,children:n})};jw.displayName=wd;var bw="DialogTrigger",tM=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=fs(bw,n),l=Ve(t,r.triggerRef);return s.jsx(Se.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Pp(r.open),...a,ref:l,onClick:fe(e.onClick,r.onOpenToggle)})});tM.displayName=bw;var Hp="DialogPortal",[nM,ww]=yw(Hp,{forceMount:void 0}),_w=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:r}=e,l=fs(Hp,t);return s.jsx(nM,{scope:t,forceMount:n,children:u.Children.map(a,i=>s.jsx(Qn,{present:n||l.open,children:s.jsx(Lo,{asChild:!0,container:r,children:i})}))})};_w.displayName=Hp;var Cu="DialogOverlay",Nw=u.forwardRef((e,t)=>{const n=ww(Cu,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,l=fs(Cu,e.__scopeDialog);return l.modal?s.jsx(Qn,{present:a||l.open,children:s.jsx(aM,{...r,ref:t})}):null});Nw.displayName=Cu;var sM=pr("DialogOverlay.RemoveScroll"),aM=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=fs(Cu,n);return s.jsx(bd,{as:sM,allowPinchZoom:!0,shards:[r.contentRef],children:s.jsx(Se.div,{"data-state":Pp(r.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),xr="DialogContent",kw=u.forwardRef((e,t)=>{const n=ww(xr,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,l=fs(xr,e.__scopeDialog);return s.jsx(Qn,{present:a||l.open,children:l.modal?s.jsx(rM,{...r,ref:t}):s.jsx(lM,{...r,ref:t})})});kw.displayName=xr;var rM=u.forwardRef((e,t)=>{const n=fs(xr,e.__scopeDialog),a=u.useRef(null),r=Ve(t,n.contentRef,a);return u.useEffect(()=>{const l=a.current;if(l)return Bp(l)},[]),s.jsx(Sw,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fe(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:fe(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,o=i.button===0&&i.ctrlKey===!0;(i.button===2||o)&&l.preventDefault()}),onFocusOutside:fe(e.onFocusOutside,l=>l.preventDefault())})}),lM=u.forwardRef((e,t)=>{const n=fs(xr,e.__scopeDialog),a=u.useRef(!1),r=u.useRef(!1);return s.jsx(Sw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var i,o;(i=e.onCloseAutoFocus)==null||i.call(e,l),l.defaultPrevented||(a.current||(o=n.triggerRef.current)==null||o.focus(),l.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:l=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const i=l.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&r.current&&l.preventDefault()}})}),Sw=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:l,...i}=e,o=fs(xr,n),c=u.useRef(null),d=Ve(t,c);return Up(),s.jsxs(s.Fragment,{children:[s.jsx(yd,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:l,children:s.jsx(zo,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":Pp(o.open),...i,ref:d,onDismiss:()=>o.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(iM,{titleId:o.titleId}),s.jsx(cM,{contentRef:c,descriptionId:o.descriptionId})]})]})}),Ip="DialogTitle",Cw=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=fs(Ip,n);return s.jsx(Se.h2,{id:r.titleId,...a,ref:t})});Cw.displayName=Ip;var Rw="DialogDescription",Tw=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=fs(Rw,n);return s.jsx(Se.p,{id:r.descriptionId,...a,ref:t})});Tw.displayName=Rw;var Ew="DialogClose",Aw=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=fs(Ew,n);return s.jsx(Se.button,{type:"button",...a,ref:t,onClick:fe(e.onClick,()=>r.onOpenChange(!1))})});Aw.displayName=Ew;function Pp(e){return e?"open":"closed"}var Mw="DialogTitleWarning",[c8,$w]=zE(Mw,{contentName:xr,titleName:Ip,docsSlug:"dialog"}),iM=({titleId:e})=>{const t=$w(Mw),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
385
385
|
|
|
386
386
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
387
387
|
|
|
388
|
-
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},iM="DialogDescriptionWarning",oM=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${M0(iM).contentName}}.`;return u.useEffect(()=>{var l;const r=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},$0=y0,O0=w0,D0=_0,z0=N0,L0=S0,U0=R0,qp=E0;function Wt({className:e,...t}){return s.jsx(iT,{role:"status","aria-label":"Loading",className:ie("size-4 animate-spin",e),...t})}const hl="aria-pressed:border aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:text-accent-foreground",cM="border border-primary bg-accent text-accent-foreground hover:bg-accent",_d=Do("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"}}),V=u.forwardRef(({className:e,disabled:t,variant:n,size:a,asChild:r=!1,loading:l,children:i,...o},c)=>{const d=r?PE:"button",f=a==="icon"||a==="sm-icon"||a==="control-icon"||a==="xs-icon",h=s.jsx(Wt,{"aria-hidden":"true","aria-label":void 0,role:void 0,className:ie(!f&&"mr-2")}),m=r?i:l&&f?h:s.jsxs(s.Fragment,{children:[l?h:null,i]});return s.jsx(d,{className:ie(_d({variant:n,size:a,className:e})),ref:c,disabled:t||l,...o,children:m})});V.displayName="Button";const B0=u.createContext(null);function uM({container:e,children:t}){return s.jsx(B0.Provider,{value:e,children:t})}function Uo(){return u.useContext(B0)??void 0}function Gp(e){return s.jsx($0,{"data-slot":"alert-dialog",...e})}function dM({className:e,...t}){return s.jsx(D0,{"data-slot":"alert-dialog-overlay",className:ie("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 Vp({className:e,onOpenAutoFocus:t,onPointerDownOutside:n,onInteractOutside:a,...r}){return s.jsxs(O0,{container:Uo(),children:[s.jsx(dM,{}),s.jsx(z0,{"data-slot":"alert-dialog-content",role:"alertdialog",className:ie("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:l=>{if(t==null||t(l),l.defaultPrevented)return;const i=l.currentTarget,o=i instanceof HTMLElement?i.querySelector('[data-slot="alert-dialog-cancel"]'):null;o&&(l.preventDefault(),o.focus())},onPointerDownOutside:l=>{n==null||n(l),l.preventDefault()},onInteractOutside:l=>{a==null||a(l),l.preventDefault()},...r})]})}function Yp({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:ie("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Fp({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:ie("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Kp({className:e,...t}){return s.jsx(L0,{"data-slot":"alert-dialog-title",className:ie("text-lg font-semibold",e),...t})}function Xp({className:e,...t}){return s.jsx(U0,{"data-slot":"alert-dialog-description",className:ie("text-muted-foreground text-sm",e),...t})}function H0({className:e,variant:t,...n}){return s.jsx(qp,{"data-slot":"alert-dialog-action",className:ie(_d({variant:t}),e),...n})}function Qp({className:e,...t}){return s.jsx(qp,{"data-slot":"alert-dialog-cancel",className:ie(_d({variant:"outline"}),e),...t})}function fM(){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 hM(e,t){t!=null&&t.isConnected&&(e.preventDefault(),t.focus())}function Bo(){const[e,t]=u.useState(null),n=u.useRef(null),a=u.useRef(null),r=u.useCallback(o=>{var c;(c=n.current)==null||c.resolve(o),n.current=null,t(null)},[]),l=u.useCallback(o=>new Promise(c=>{var f;(f=n.current)==null||f.resolve(!1),a.current=fM();const d={...o,resolve:c};n.current=d,t(d)}),[]);u.useEffect(()=>()=>{var o;return(o=n.current)==null?void 0:o.resolve(!1)},[]);const i=s.jsx(Gp,{open:e!==null,onOpenChange:o=>{o||r(!1)},children:s.jsxs(Vp,{onCloseAutoFocus:o=>hM(o,a.current),children:[s.jsxs(Yp,{children:[s.jsx(Kp,{children:e==null?void 0:e.title}),s.jsx(Xp,{className:"whitespace-pre-line",children:e==null?void 0:e.description})]}),s.jsxs(Fp,{children:[s.jsx(Qp,{children:"Cancel"}),s.jsx(H0,{variant:e!=null&&e.destructive?"destructive":"default",onClick:()=>r(!0),children:e==null?void 0:e.action_label})]})]})});return{confirm:l,confirm_dialog:i}}const Ps="px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",mM=Do("inline-flex items-center rounded-md border transition-colors",{variants:{variant:{default:`${Ps} border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80`,secondary:`${Ps} border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`${Ps} border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80`,outline:`${Ps} text-foreground`,success:`${Ps} border-success/40 bg-success/10 text-success`,warning:`${Ps} border-warning/40 bg-warning/10 text-warning`,info:`${Ps} border-info/40 bg-info/10 text-info`,error:`${Ps} border-destructive/40 bg-destructive/10 text-destructive`,neutral:`${Ps} 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 ue({className:e,variant:t,size:n,...a}){return s.jsx("div",{className:ie(mM({variant:t,size:n}),e),...a})}function I0(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 P0(e){const[t,n]=u.useState(void 0);return Ft(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const l=r[0];let i,o;if("borderBoxSize"in l){const c=l.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,o=d.blockSize}else i=e.offsetWidth,o=e.offsetHeight;n({width:i,height:o})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else n(void 0)},[e]),t}var Nd="Checkbox",[pM]=Os(Nd),[xM,Wp]=pM(Nd);function gM(e){const{__scopeCheckbox:t,checked:n,children:a,defaultChecked:r,disabled:l,form:i,name:o,onCheckedChange:c,required:d,value:f="on",internal_do_not_use_render:h}=e,[m,x]=Ba({prop:n,defaultProp:r??!1,onChange:c,caller:Nd}),[b,v]=u.useState(null),[y,g]=u.useState(null),p=u.useRef(!1),j=b?!!i||!!b.closest("form"):!0,w={checked:m,disabled:l,setChecked:x,control:b,setControl:v,name:o,form:i,value:f,hasConsumerStoppedPropagationRef:p,required:d,defaultChecked:Da(r)?!1:r,isFormControl:j,bubbleInput:y,setBubbleInput:g};return s.jsx(xM,{scope:t,...w,children:vM(h)?h(w):a})}var q0="CheckboxTrigger",G0=u.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},r)=>{const{control:l,value:i,disabled:o,checked:c,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:x,bubbleInput:b}=Wp(q0,e),v=Ve(r,f),y=u.useRef(c);return u.useEffect(()=>{const g=l==null?void 0:l.form;if(g){const p=()=>h(y.current);return g.addEventListener("reset",p),()=>g.removeEventListener("reset",p)}},[l,h]),s.jsx(Se.button,{type:"button",role:"checkbox","aria-checked":Da(c)?"mixed":c,"aria-required":d,"data-state":X0(c),"data-disabled":o?"":void 0,disabled:o,value:i,...a,ref:v,onKeyDown:fe(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:fe(n,g=>{h(p=>Da(p)?!0:!p),b&&x&&(m.current=g.isPropagationStopped(),m.current||g.stopPropagation())})})});G0.displayName=q0;var Zp=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:a,checked:r,defaultChecked:l,required:i,disabled:o,value:c,onCheckedChange:d,form:f,...h}=e;return s.jsx(gM,{__scopeCheckbox:n,checked:r,defaultChecked:l,disabled:o,required:i,onCheckedChange:d,name:a,form:f,value:c,internal_do_not_use_render:({isFormControl:m})=>s.jsxs(s.Fragment,{children:[s.jsx(G0,{...h,ref:t,__scopeCheckbox:n}),m&&s.jsx(K0,{__scopeCheckbox:n})]})})});Zp.displayName=Nd;var V0="CheckboxIndicator",Y0=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...r}=e,l=Wp(V0,n);return s.jsx(Qn,{present:a||Da(l.checked)||l.checked===!0,children:s.jsx(Se.span,{"data-state":X0(l.checked),"data-disabled":l.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});Y0.displayName=V0;var F0="CheckboxBubbleInput",K0=u.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:a,hasConsumerStoppedPropagationRef:r,checked:l,defaultChecked:i,required:o,disabled:c,name:d,value:f,form:h,bubbleInput:m,setBubbleInput:x}=Wp(F0,e),b=Ve(n,x),v=I0(l),y=P0(a);u.useEffect(()=>{const p=m;if(!p)return;const j=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(j,"checked").set,C=!r.current;if(v!==l&&N){const _=new Event("click",{bubbles:C});p.indeterminate=Da(l),N.call(p,Da(l)?!1:l),p.dispatchEvent(_)}},[m,v,l,r]);const g=u.useRef(Da(l)?!1:l);return s.jsx(Se.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??g.current,required:o,disabled:c,name:d,value:f,form:h,...t,tabIndex:-1,ref:b,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});K0.displayName=F0;function vM(e){return typeof e=="function"}function Da(e){return e==="indeterminate"}function X0(e){return Da(e)?"indeterminate":e?"checked":"unchecked"}const Vl=u.forwardRef(({className:e,...t},n)=>s.jsx(Zp,{ref:n,className:ie("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:s.jsx(Y0,{className:ie("flex items-center justify-center text-current"),children:t.checked==="indeterminate"?s.jsx(hT,{className:"size-4","aria-hidden":"true"}):s.jsx(Il,{className:"size-4","aria-hidden":"true"})})}));Vl.displayName=Zp.displayName;const yM=Do("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 pn({...e}){return s.jsx($0,{"data-slot":"dialog",...e})}function jM({...e}){const t=Uo();return s.jsx(O0,{"data-slot":"dialog-portal",container:t,...e})}function bM({className:e,...t}){return s.jsx(D0,{"data-slot":"dialog-overlay",className:ie("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 xn({className:e,children:t,showCloseButton:n=!0,size:a,...r}){return s.jsxs(jM,{"data-slot":"dialog-portal",children:[s.jsx(bM,{}),s.jsxs(z0,{"data-slot":"dialog-content",className:ie(yM({size:a}),e),...r,children:[t,n&&s.jsxs(qp,{"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:[s.jsx(xd,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function gn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:ie("flex flex-col gap-2 text-center sm:text-left",e),...t})}function vn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:ie("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function yn({className:e,...t}){return s.jsx(L0,{"data-slot":"dialog-title",className:ie("text-lg leading-none font-semibold",e),...t})}function jn({className:e,...t}){return s.jsx(U0,{"data-slot":"dialog-description",className:ie("text-muted-foreground text-sm",e),...t})}function Jp(e){const t=e+"CollectionProvider",[n,a]=Os(t),[r,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=v=>{const{scope:y,children:g}=v,p=fa.useRef(null),j=fa.useRef(new Map).current;return s.jsx(r,{scope:y,itemMap:j,collectionRef:p,children:g})};i.displayName=t;const o=e+"CollectionSlot",c=pr(o),d=fa.forwardRef((v,y)=>{const{scope:g,children:p}=v,j=l(o,g),w=Ve(y,j.collectionRef);return s.jsx(c,{ref:w,children:p})});d.displayName=o;const f=e+"CollectionItemSlot",h="data-radix-collection-item",m=pr(f),x=fa.forwardRef((v,y)=>{const{scope:g,children:p,...j}=v,w=fa.useRef(null),N=Ve(y,w),C=l(f,g);return fa.useEffect(()=>(C.itemMap.set(w,{ref:w,...j}),()=>void C.itemMap.delete(w))),s.jsx(m,{[h]:"",ref:N,children:p})});x.displayName=f;function b(v){const y=l(e+"CollectionConsumer",v);return fa.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const j=Array.from(p.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((C,_)=>j.indexOf(C.ref.current)-j.indexOf(_.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},b,a]}var wM=u.createContext(void 0);function kd(e){const t=u.useContext(wM);return e||t||"ltr"}const _M=["top","right","bottom","left"],Ha=Math.min,Sn=Math.max,Ru=Math.round,vc=Math.floor,Cs=e=>({x:e,y:e}),NM={left:"right",right:"left",bottom:"top",top:"bottom"},kM={start:"end",end:"start"};function om(e,t,n){return Sn(e,Ha(t,n))}function sa(e,t){return typeof e=="function"?e(t):e}function aa(e){return e.split("-")[0]}function Yl(e){return e.split("-")[1]}function ex(e){return e==="x"?"y":"x"}function tx(e){return e==="y"?"height":"width"}function ws(e){return["top","bottom"].includes(aa(e))?"y":"x"}function nx(e){return ex(ws(e))}function SM(e,t,n){n===void 0&&(n=!1);const a=Yl(e),r=nx(e),l=tx(r);let i=r==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(i=Tu(i)),[i,Tu(i)]}function CM(e){const t=Tu(e);return[cm(e),t,cm(t)]}function cm(e){return e.replace(/start|end/g,t=>kM[t])}function RM(e,t,n){const a=["left","right"],r=["right","left"],l=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:a:t?a:r;case"left":case"right":return t?l:i;default:return[]}}function TM(e,t,n,a){const r=Yl(e);let l=RM(aa(e),n==="start",a);return r&&(l=l.map(i=>i+"-"+r),t&&(l=l.concat(l.map(cm)))),l}function Tu(e){return e.replace(/left|right|bottom|top/g,t=>NM[t])}function EM(e){return{top:0,right:0,bottom:0,left:0,...e}}function Q0(e){return typeof e!="number"?EM(e):{top:e,right:e,bottom:e,left:e}}function Eu(e){const{x:t,y:n,width:a,height:r}=e;return{width:a,height:r,top:n,left:t,right:t+a,bottom:n+r,x:t,y:n}}function Pv(e,t,n){let{reference:a,floating:r}=e;const l=ws(t),i=nx(t),o=tx(i),c=aa(t),d=l==="y",f=a.x+a.width/2-r.width/2,h=a.y+a.height/2-r.height/2,m=a[o]/2-r[o]/2;let x;switch(c){case"top":x={x:f,y:a.y-r.height};break;case"bottom":x={x:f,y:a.y+a.height};break;case"right":x={x:a.x+a.width,y:h};break;case"left":x={x:a.x-r.width,y:h};break;default:x={x:a.x,y:a.y}}switch(Yl(t)){case"start":x[i]-=m*(n&&d?-1:1);break;case"end":x[i]+=m*(n&&d?-1:1);break}return x}const AM=async(e,t,n)=>{const{placement:a="bottom",strategy:r="absolute",middleware:l=[],platform:i}=n,o=l.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:h}=Pv(d,a,c),m=a,x={},b=0;for(let v=0;v<o.length;v++){const{name:y,fn:g}=o[v],{x:p,y:j,data:w,reset:N}=await g({x:f,y:h,initialPlacement:a,placement:m,strategy:r,middlewareData:x,rects:d,platform:i,elements:{reference:e,floating:t}});f=p??f,h=j??h,x={...x,[y]:{...x[y],...w}},N&&b<=50&&(b++,typeof N=="object"&&(N.placement&&(m=N.placement),N.rects&&(d=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):N.rects),{x:f,y:h}=Pv(d,m,c)),v=-1)}return{x:f,y:h,placement:m,strategy:r,middlewareData:x}};async function ao(e,t){var n;t===void 0&&(t={});const{x:a,y:r,platform:l,rects:i,elements:o,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:x=0}=sa(t,e),b=Q0(x),y=o[m?h==="floating"?"reference":"floating":h],g=Eu(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(y)))==null||n?y:y.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(o.floating)),boundary:d,rootBoundary:f,strategy:c})),p=h==="floating"?{x:a,y:r,width:i.floating.width,height:i.floating.height}:i.reference,j=await(l.getOffsetParent==null?void 0:l.getOffsetParent(o.floating)),w=await(l.isElement==null?void 0:l.isElement(j))?await(l.getScale==null?void 0:l.getScale(j))||{x:1,y:1}:{x:1,y:1},N=Eu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:p,offsetParent:j,strategy:c}):p);return{top:(g.top-N.top+b.top)/w.y,bottom:(N.bottom-g.bottom+b.bottom)/w.y,left:(g.left-N.left+b.left)/w.x,right:(N.right-g.right+b.right)/w.x}}const MM=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:r,rects:l,platform:i,elements:o,middlewareData:c}=t,{element:d,padding:f=0}=sa(e,t)||{};if(d==null)return{};const h=Q0(f),m={x:n,y:a},x=nx(r),b=tx(x),v=await i.getDimensions(d),y=x==="y",g=y?"top":"left",p=y?"bottom":"right",j=y?"clientHeight":"clientWidth",w=l.reference[b]+l.reference[x]-m[x]-l.floating[b],N=m[x]-l.reference[x],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let _=C?C[j]:0;(!_||!await(i.isElement==null?void 0:i.isElement(C)))&&(_=o.floating[j]||l.floating[b]);const S=w/2-N/2,D=_/2-v[b]/2-1,z=Ha(h[g],D),P=Ha(h[p],D),F=z,H=_-v[b]-P,A=_/2-v[b]/2+S,M=om(F,A,H),R=!c.arrow&&Yl(r)!=null&&A!==M&&l.reference[b]/2-(A<F?z:P)-v[b]/2<0,T=R?A<F?A-F:A-H:0;return{[x]:m[x]+T,data:{[x]:M,centerOffset:A-M-T,...R&&{alignmentOffset:T}},reset:R}}}),$M=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:r,middlewareData:l,rects:i,initialPlacement:o,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...y}=sa(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const g=aa(r),p=ws(o),j=aa(o)===o,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=m||(j||!v?[Tu(o)]:CM(o)),C=b!=="none";!m&&C&&N.push(...TM(o,v,b,w));const _=[o,...N],S=await ao(t,y),D=[];let z=((a=l.flip)==null?void 0:a.overflows)||[];if(f&&D.push(S[g]),h){const A=SM(r,i,w);D.push(S[A[0]],S[A[1]])}if(z=[...z,{placement:r,overflows:D}],!D.every(A=>A<=0)){var P,F;const A=(((P=l.flip)==null?void 0:P.index)||0)+1,M=_[A];if(M&&(!(h==="alignment"?p!==ws(M):!1)||z.every(k=>k.overflows[0]>0&&ws(k.placement)===p)))return{data:{index:A,overflows:z},reset:{placement:M}};let R=(F=z.filter(T=>T.overflows[0]<=0).sort((T,k)=>T.overflows[1]-k.overflows[1])[0])==null?void 0:F.placement;if(!R)switch(x){case"bestFit":{var H;const T=(H=z.filter(k=>{if(C){const O=ws(k.placement);return O===p||O==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(O=>O>0).reduce((O,Y)=>O+Y,0)]).sort((k,O)=>k[1]-O[1])[0])==null?void 0:H[0];T&&(R=T);break}case"initialPlacement":R=o;break}if(r!==R)return{reset:{placement:R}}}return{}}}};function qv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Gv(e){return _M.some(t=>e[t]>=0)}const OM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...r}=sa(e,t);switch(a){case"referenceHidden":{const l=await ao(t,{...r,elementContext:"reference"}),i=qv(l,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Gv(i)}}}case"escaped":{const l=await ao(t,{...r,altBoundary:!0}),i=qv(l,n.floating);return{data:{escapedOffsets:i,escaped:Gv(i)}}}default:return{}}}}};async function DM(e,t){const{placement:n,platform:a,elements:r}=e,l=await(a.isRTL==null?void 0:a.isRTL(r.floating)),i=aa(n),o=Yl(n),c=ws(n)==="y",d=["left","top"].includes(i)?-1:1,f=l&&c?-1:1,h=sa(t,e);let{mainAxis:m,crossAxis:x,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof b=="number"&&(x=o==="end"?b*-1:b),c?{x:x*f,y:m*d}:{x:m*d,y:x*f}}const zM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:r,y:l,placement:i,middlewareData:o}=t,c=await DM(t,e);return i===((n=o.offset)==null?void 0:n.placement)&&(a=o.arrow)!=null&&a.alignmentOffset?{}:{x:r+c.x,y:l+c.y,data:{...c,placement:i}}}}},LM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:r}=t,{mainAxis:l=!0,crossAxis:i=!1,limiter:o={fn:y=>{let{x:g,y:p}=y;return{x:g,y:p}}},...c}=sa(e,t),d={x:n,y:a},f=await ao(t,c),h=ws(aa(r)),m=ex(h);let x=d[m],b=d[h];if(l){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",p=x+f[y],j=x-f[g];x=om(p,x,j)}if(i){const y=h==="y"?"top":"left",g=h==="y"?"bottom":"right",p=b+f[y],j=b-f[g];b=om(p,b,j)}const v=o.fn({...t,[m]:x,[h]:b});return{...v,data:{x:v.x-n,y:v.y-a,enabled:{[m]:l,[h]:i}}}}}},UM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:r,rects:l,middlewareData:i}=t,{offset:o=0,mainAxis:c=!0,crossAxis:d=!0}=sa(e,t),f={x:n,y:a},h=ws(r),m=ex(h);let x=f[m],b=f[h];const v=sa(o,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const j=m==="y"?"height":"width",w=l.reference[m]-l.floating[j]+y.mainAxis,N=l.reference[m]+l.reference[j]-y.mainAxis;x<w?x=w:x>N&&(x=N)}if(d){var g,p;const j=m==="y"?"width":"height",w=["top","left"].includes(aa(r)),N=l.reference[h]-l.floating[j]+(w&&((g=i.offset)==null?void 0:g[h])||0)+(w?0:y.crossAxis),C=l.reference[h]+l.reference[j]+(w?0:((p=i.offset)==null?void 0:p[h])||0)-(w?y.crossAxis:0);b<N?b=N:b>C&&(b=C)}return{[m]:x,[h]:b}}}},BM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:r,rects:l,platform:i,elements:o}=t,{apply:c=()=>{},...d}=sa(e,t),f=await ao(t,d),h=aa(r),m=Yl(r),x=ws(r)==="y",{width:b,height:v}=l.floating;let y,g;h==="top"||h==="bottom"?(y=h,g=m===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=h,y=m==="end"?"top":"bottom");const p=v-f.top-f.bottom,j=b-f.left-f.right,w=Ha(v-f[y],p),N=Ha(b-f[g],j),C=!t.middlewareData.shift;let _=w,S=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=j),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(_=p),C&&!m){const z=Sn(f.left,0),P=Sn(f.right,0),F=Sn(f.top,0),H=Sn(f.bottom,0);x?S=b-2*(z!==0||P!==0?z+P:Sn(f.left,f.right)):_=v-2*(F!==0||H!==0?F+H:Sn(f.top,f.bottom))}await c({...t,availableWidth:S,availableHeight:_});const D=await i.getDimensions(o.floating);return b!==D.width||v!==D.height?{reset:{rects:!0}}:{}}}};function Sd(){return typeof window<"u"}function Fl(e){return W0(e)?(e.nodeName||"").toLowerCase():"#document"}function Mn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ds(e){var t;return(t=(W0(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function W0(e){return Sd()?e instanceof Node||e instanceof Mn(e).Node:!1}function is(e){return Sd()?e instanceof Element||e instanceof Mn(e).Element:!1}function As(e){return Sd()?e instanceof HTMLElement||e instanceof Mn(e).HTMLElement:!1}function Vv(e){return!Sd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mn(e).ShadowRoot}function Ho(e){const{overflow:t,overflowX:n,overflowY:a,display:r}=os(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!["inline","contents"].includes(r)}function HM(e){return["table","td","th"].includes(Fl(e))}function Cd(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function sx(e){const t=ax(),n=is(e)?os(e):e;return["transform","translate","scale","rotate","perspective"].some(a=>n[a]?n[a]!=="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(a=>(n.willChange||"").includes(a))||["paint","layout","strict","content"].some(a=>(n.contain||"").includes(a))}function IM(e){let t=Ia(e);for(;As(t)&&!El(t);){if(sx(t))return t;if(Cd(t))return null;t=Ia(t)}return null}function ax(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function El(e){return["html","body","#document"].includes(Fl(e))}function os(e){return Mn(e).getComputedStyle(e)}function Rd(e){return is(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ia(e){if(Fl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Vv(e)&&e.host||Ds(e);return Vv(t)?t.host:t}function Z0(e){const t=Ia(e);return El(t)?e.ownerDocument?e.ownerDocument.body:e.body:As(t)&&Ho(t)?t:Z0(t)}function ro(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Z0(e),l=r===((a=e.ownerDocument)==null?void 0:a.body),i=Mn(r);if(l){const o=um(i);return t.concat(i,i.visualViewport||[],Ho(r)?r:[],o&&n?ro(o):[])}return t.concat(r,ro(r,[],n))}function um(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function J0(e){const t=os(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const r=As(e),l=r?e.offsetWidth:n,i=r?e.offsetHeight:a,o=Ru(n)!==l||Ru(a)!==i;return o&&(n=l,a=i),{width:n,height:a,$:o}}function rx(e){return is(e)?e:e.contextElement}function ml(e){const t=rx(e);if(!As(t))return Cs(1);const n=t.getBoundingClientRect(),{width:a,height:r,$:l}=J0(t);let i=(l?Ru(n.width):n.width)/a,o=(l?Ru(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!o||!Number.isFinite(o))&&(o=1),{x:i,y:o}}const PM=Cs(0);function e_(e){const t=Mn(e);return!ax()||!t.visualViewport?PM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qM(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mn(e)?!1:t}function gr(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),l=rx(e);let i=Cs(1);t&&(a?is(a)&&(i=ml(a)):i=ml(e));const o=qM(l,n,a)?e_(l):Cs(0);let c=(r.left+o.x)/i.x,d=(r.top+o.y)/i.y,f=r.width/i.x,h=r.height/i.y;if(l){const m=Mn(l),x=a&&is(a)?Mn(a):a;let b=m,v=um(b);for(;v&&a&&x!==b;){const y=ml(v),g=v.getBoundingClientRect(),p=os(v),j=g.left+(v.clientLeft+parseFloat(p.paddingLeft))*y.x,w=g.top+(v.clientTop+parseFloat(p.paddingTop))*y.y;c*=y.x,d*=y.y,f*=y.x,h*=y.y,c+=j,d+=w,b=Mn(v),v=um(b)}}return Eu({width:f,height:h,x:c,y:d})}function lx(e,t){const n=Rd(e).scrollLeft;return t?t.left+n:gr(Ds(e)).left+n}function t_(e,t,n){n===void 0&&(n=!1);const a=e.getBoundingClientRect(),r=a.left+t.scrollLeft-(n?0:lx(e,a)),l=a.top+t.scrollTop;return{x:r,y:l}}function GM(e){let{elements:t,rect:n,offsetParent:a,strategy:r}=e;const l=r==="fixed",i=Ds(a),o=t?Cd(t.floating):!1;if(a===i||o&&l)return n;let c={scrollLeft:0,scrollTop:0},d=Cs(1);const f=Cs(0),h=As(a);if((h||!h&&!l)&&((Fl(a)!=="body"||Ho(i))&&(c=Rd(a)),As(a))){const x=gr(a);d=ml(a),f.x=x.x+a.clientLeft,f.y=x.y+a.clientTop}const m=i&&!h&&!l?t_(i,c,!0):Cs(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function VM(e){return Array.from(e.getClientRects())}function YM(e){const t=Ds(e),n=Rd(e),a=e.ownerDocument.body,r=Sn(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=Sn(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-n.scrollLeft+lx(e);const o=-n.scrollTop;return os(a).direction==="rtl"&&(i+=Sn(t.clientWidth,a.clientWidth)-r),{width:r,height:l,x:i,y:o}}function FM(e,t){const n=Mn(e),a=Ds(e),r=n.visualViewport;let l=a.clientWidth,i=a.clientHeight,o=0,c=0;if(r){l=r.width,i=r.height;const d=ax();(!d||d&&t==="fixed")&&(o=r.offsetLeft,c=r.offsetTop)}return{width:l,height:i,x:o,y:c}}function KM(e,t){const n=gr(e,!0,t==="fixed"),a=n.top+e.clientTop,r=n.left+e.clientLeft,l=As(e)?ml(e):Cs(1),i=e.clientWidth*l.x,o=e.clientHeight*l.y,c=r*l.x,d=a*l.y;return{width:i,height:o,x:c,y:d}}function Yv(e,t,n){let a;if(t==="viewport")a=FM(e,n);else if(t==="document")a=YM(Ds(e));else if(is(t))a=KM(t,n);else{const r=e_(e);a={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Eu(a)}function n_(e,t){const n=Ia(e);return n===t||!is(n)||El(n)?!1:os(n).position==="fixed"||n_(n,t)}function XM(e,t){const n=t.get(e);if(n)return n;let a=ro(e,[],!1).filter(o=>is(o)&&Fl(o)!=="body"),r=null;const l=os(e).position==="fixed";let i=l?Ia(e):e;for(;is(i)&&!El(i);){const o=os(i),c=sx(i);!c&&o.position==="fixed"&&(r=null),(l?!c&&!r:!c&&o.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||Ho(i)&&!c&&n_(e,i))?a=a.filter(f=>f!==i):r=o,i=Ia(i)}return t.set(e,a),a}function QM(e){let{element:t,boundary:n,rootBoundary:a,strategy:r}=e;const i=[...n==="clippingAncestors"?Cd(t)?[]:XM(t,this._c):[].concat(n),a],o=i[0],c=i.reduce((d,f)=>{const h=Yv(t,f,r);return d.top=Sn(h.top,d.top),d.right=Ha(h.right,d.right),d.bottom=Ha(h.bottom,d.bottom),d.left=Sn(h.left,d.left),d},Yv(t,o,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function WM(e){const{width:t,height:n}=J0(e);return{width:t,height:n}}function ZM(e,t,n){const a=As(t),r=Ds(t),l=n==="fixed",i=gr(e,!0,l,t);let o={scrollLeft:0,scrollTop:0};const c=Cs(0);function d(){c.x=lx(r)}if(a||!a&&!l)if((Fl(t)!=="body"||Ho(r))&&(o=Rd(t)),a){const x=gr(t,!0,l,t);c.x=x.x+t.clientLeft,c.y=x.y+t.clientTop}else r&&d();l&&!a&&r&&d();const f=r&&!a&&!l?t_(r,o):Cs(0),h=i.left+o.scrollLeft-c.x-f.x,m=i.top+o.scrollTop-c.y-f.y;return{x:h,y:m,width:i.width,height:i.height}}function qf(e){return os(e).position==="static"}function Fv(e,t){if(!As(e)||os(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ds(e)===n&&(n=n.ownerDocument.body),n}function s_(e,t){const n=Mn(e);if(Cd(e))return n;if(!As(e)){let r=Ia(e);for(;r&&!El(r);){if(is(r)&&!qf(r))return r;r=Ia(r)}return n}let a=Fv(e,t);for(;a&&HM(a)&&qf(a);)a=Fv(a,t);return a&&El(a)&&qf(a)&&!sx(a)?n:a||IM(e)||n}const JM=async function(e){const t=this.getOffsetParent||s_,n=this.getDimensions,a=await n(e.floating);return{reference:ZM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function e$(e){return os(e).direction==="rtl"}const t$={convertOffsetParentRelativeRectToViewportRelativeRect:GM,getDocumentElement:Ds,getClippingRect:QM,getOffsetParent:s_,getElementRects:JM,getClientRects:VM,getDimensions:WM,getScale:ml,isElement:is,isRTL:e$};function a_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function n$(e,t){let n=null,a;const r=Ds(e);function l(){var o;clearTimeout(a),(o=n)==null||o.disconnect(),n=null}function i(o,c){o===void 0&&(o=!1),c===void 0&&(c=1),l();const d=e.getBoundingClientRect(),{left:f,top:h,width:m,height:x}=d;if(o||t(),!m||!x)return;const b=vc(h),v=vc(r.clientWidth-(f+m)),y=vc(r.clientHeight-(h+x)),g=vc(f),j={rootMargin:-b+"px "+-v+"px "+-y+"px "+-g+"px",threshold:Sn(0,Ha(1,c))||1};let w=!0;function N(C){const _=C[0].intersectionRatio;if(_!==c){if(!w)return i();_?i(!1,_):a=setTimeout(()=>{i(!1,1e-7)},1e3)}_===1&&!a_(d,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(N,{...j,root:r.ownerDocument})}catch{n=new IntersectionObserver(N,j)}n.observe(e)}return i(!0),l}function s$(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:r=!0,ancestorResize:l=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,d=rx(e),f=r||l?[...d?ro(d):[],...ro(t)]:[];f.forEach(g=>{r&&g.addEventListener("scroll",n,{passive:!0}),l&&g.addEventListener("resize",n)});const h=d&&o?n$(d,n):null;let m=-1,x=null;i&&(x=new ResizeObserver(g=>{let[p]=g;p&&p.target===d&&x&&(x.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var j;(j=x)==null||j.observe(t)})),n()}),d&&!c&&x.observe(d),x.observe(t));let b,v=c?gr(e):null;c&&y();function y(){const g=gr(e);v&&!a_(v,g)&&n(),v=g,b=requestAnimationFrame(y)}return n(),()=>{var g;f.forEach(p=>{r&&p.removeEventListener("scroll",n),l&&p.removeEventListener("resize",n)}),h==null||h(),(g=x)==null||g.disconnect(),x=null,c&&cancelAnimationFrame(b)}}const a$=zM,r$=LM,l$=$M,i$=BM,o$=OM,Kv=MM,c$=UM,u$=(e,t,n)=>{const a=new Map,r={platform:t$,...n},l={...r.platform,_c:a};return AM(e,t,{...r,platform:l})};var d$=typeof document<"u",f$=function(){},qc=d$?u.useLayoutEffect:f$;function Au(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,a,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(a=n;a--!==0;)if(!Au(e[a],t[a]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,r[a]))return!1;for(a=n;a--!==0;){const l=r[a];if(!(l==="_owner"&&e.$$typeof)&&!Au(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function r_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xv(e,t){const n=r_(e);return Math.round(t*n)/n}function Gf(e){const t=u.useRef(e);return qc(()=>{t.current=e}),t}function h$(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:r,elements:{reference:l,floating:i}={},transform:o=!0,whileElementsMounted:c,open:d}=e,[f,h]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,x]=u.useState(a);Au(m,a)||x(a);const[b,v]=u.useState(null),[y,g]=u.useState(null),p=u.useCallback(k=>{k!==C.current&&(C.current=k,v(k))},[]),j=u.useCallback(k=>{k!==_.current&&(_.current=k,g(k))},[]),w=l||b,N=i||y,C=u.useRef(null),_=u.useRef(null),S=u.useRef(f),D=c!=null,z=Gf(c),P=Gf(r),F=Gf(d),H=u.useCallback(()=>{if(!C.current||!_.current)return;const k={placement:t,strategy:n,middleware:m};P.current&&(k.platform=P.current),u$(C.current,_.current,k).then(O=>{const Y={...O,isPositioned:F.current!==!1};A.current&&!Au(S.current,Y)&&(S.current=Y,Ol.flushSync(()=>{h(Y)}))})},[m,t,n,P,F]);qc(()=>{d===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,h(k=>({...k,isPositioned:!1})))},[d]);const A=u.useRef(!1);qc(()=>(A.current=!0,()=>{A.current=!1}),[]),qc(()=>{if(w&&(C.current=w),N&&(_.current=N),w&&N){if(z.current)return z.current(w,N,H);H()}},[w,N,H,z,D]);const M=u.useMemo(()=>({reference:C,floating:_,setReference:p,setFloating:j}),[p,j]),R=u.useMemo(()=>({reference:w,floating:N}),[w,N]),T=u.useMemo(()=>{const k={position:n,left:0,top:0};if(!R.floating)return k;const O=Xv(R.floating,f.x),Y=Xv(R.floating,f.y);return o?{...k,transform:"translate("+O+"px, "+Y+"px)",...r_(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:Y}},[n,o,R.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:H,refs:M,elements:R,floatingStyles:T}),[f,H,M,R,T])}const m$=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:a,padding:r}=typeof e=="function"?e(n):e;return a&&t(a)?a.current!=null?Kv({element:a.current,padding:r}).fn(n):{}:a?Kv({element:a,padding:r}).fn(n):{}}}},p$=(e,t)=>({...a$(e),options:[e,t]}),x$=(e,t)=>({...r$(e),options:[e,t]}),g$=(e,t)=>({...c$(e),options:[e,t]}),v$=(e,t)=>({...l$(e),options:[e,t]}),y$=(e,t)=>({...i$(e),options:[e,t]}),j$=(e,t)=>({...o$(e),options:[e,t]}),b$=(e,t)=>({...m$(e),options:[e,t]});var w$="Arrow",l_=u.forwardRef((e,t)=>{const{children:n,width:a=10,height:r=5,...l}=e;return s.jsx(Se.svg,{...l,ref:t,width:a,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});l_.displayName=w$;var _$=l_,ix="Popper",[i_,Kl]=Os(ix),[N$,o_]=i_(ix),c_=e=>{const{__scopePopper:t,children:n}=e,[a,r]=u.useState(null);return s.jsx(N$,{scope:t,anchor:a,onAnchorChange:r,children:n})};c_.displayName=ix;var u_="PopperAnchor",d_=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...r}=e,l=o_(u_,n),i=u.useRef(null),o=Ve(t,i);return u.useEffect(()=>{l.onAnchorChange((a==null?void 0:a.current)||i.current)}),a?null:s.jsx(Se.div,{...r,ref:o})});d_.displayName=u_;var ox="PopperContent",[k$,S$]=i_(ox),f_=u.forwardRef((e,t)=>{var L,q,ne,ae,je,re;const{__scopePopper:n,side:a="bottom",sideOffset:r=0,align:l="center",alignOffset:i=0,arrowPadding:o=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:x="optimized",onPlaced:b,...v}=e,y=o_(ox,n),[g,p]=u.useState(null),j=Ve(t,we=>p(we)),[w,N]=u.useState(null),C=P0(w),_=(C==null?void 0:C.width)??0,S=(C==null?void 0:C.height)??0,D=a+(l!=="center"?"-"+l:""),z=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},P=Array.isArray(d)?d:[d],F=P.length>0,H={padding:z,boundary:P.filter(R$),altBoundary:F},{refs:A,floatingStyles:M,placement:R,isPositioned:T,middlewareData:k}=h$({strategy:"fixed",placement:D,whileElementsMounted:(...we)=>s$(...we,{animationFrame:x==="always"}),elements:{reference:y.anchor},middleware:[p$({mainAxis:r+S,alignmentAxis:i}),c&&x$({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?g$():void 0,...H}),c&&v$({...H}),y$({...H,apply:({elements:we,rects:se,availableWidth:tt,availableHeight:ge})=>{const{width:He,height:J}=se.reference,ke=we.floating.style;ke.setProperty("--radix-popper-available-width",`${tt}px`),ke.setProperty("--radix-popper-available-height",`${ge}px`),ke.setProperty("--radix-popper-anchor-width",`${He}px`),ke.setProperty("--radix-popper-anchor-height",`${J}px`)}}),w&&b$({element:w,padding:o}),T$({arrowWidth:_,arrowHeight:S}),m&&j$({strategy:"referenceHidden",...H})]}),[O,Y]=p_(R),E=Es(b);Ft(()=>{T&&(E==null||E())},[T,E]);const I=(L=k.arrow)==null?void 0:L.x,Q=(q=k.arrow)==null?void 0:q.y,te=((ne=k.arrow)==null?void 0:ne.centerOffset)!==0,[ce,X]=u.useState();return Ft(()=>{g&&X(window.getComputedStyle(g).zIndex)},[g]),s.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:T?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(ae=k.transformOrigin)==null?void 0:ae.x,(je=k.transformOrigin)==null?void 0:je.y].join(" "),...((re=k.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(k$,{scope:n,placedSide:O,onArrowChange:N,arrowX:I,arrowY:Q,shouldHideArrow:te,children:s.jsx(Se.div,{"data-side":O,"data-align":Y,...v,ref:j,style:{...v.style,animation:T?void 0:"none"}})})})});f_.displayName=ox;var h_="PopperArrow",C$={top:"bottom",right:"left",bottom:"top",left:"right"},m_=u.forwardRef(function(t,n){const{__scopePopper:a,...r}=t,l=S$(h_,a),i=C$[l.placedSide];return s.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:s.jsx(_$,{...r,ref:n,style:{...r.style,display:"block"}})})});m_.displayName=h_;function R$(e){return e!==null}var T$=e=>({name:"transformOrigin",options:e,fn(t){var y,g,p;const{placement:n,rects:a,middlewareData:r}=t,i=((y=r.arrow)==null?void 0:y.centerOffset)!==0,o=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=p_(n),h={start:"0%",center:"50%",end:"100%"}[f],m=(((g=r.arrow)==null?void 0:g.x)??0)+o/2,x=(((p=r.arrow)==null?void 0:p.y)??0)+c/2;let b="",v="";return d==="bottom"?(b=i?h:`${m}px`,v=`${-c}px`):d==="top"?(b=i?h:`${m}px`,v=`${a.floating.height+c}px`):d==="right"?(b=`${-c}px`,v=i?h:`${x}px`):d==="left"&&(b=`${a.floating.width+c}px`,v=i?h:`${x}px`),{data:{x:b,y:v}}}});function p_(e){const[t,n="center"]=e.split("-");return[t,n]}var cx=c_,ux=d_,dx=f_,fx=m_,Vf="rovingFocusGroup.onEntryFocus",E$={bubbles:!1,cancelable:!0},Io="RovingFocusGroup",[dm,x_,A$]=Jp(Io),[M$,Td]=Os(Io,[A$]),[$$,O$]=M$(Io),g_=u.forwardRef((e,t)=>s.jsx(dm.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(dm.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(D$,{...e,ref:t})})}));g_.displayName=Io;var D$=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:r=!1,dir:l,currentTabStopId:i,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,m=u.useRef(null),x=Ve(t,m),b=kd(l),[v,y]=Ba({prop:i,defaultProp:o??null,onChange:c,caller:Io}),[g,p]=u.useState(!1),j=Es(d),w=x_(n),N=u.useRef(!1),[C,_]=u.useState(0);return u.useEffect(()=>{const S=m.current;if(S)return S.addEventListener(Vf,j),()=>S.removeEventListener(Vf,j)},[j]),s.jsx($$,{scope:n,orientation:a,dir:b,loop:r,currentTabStopId:v,onItemFocus:u.useCallback(S=>y(S),[y]),onItemShiftTab:u.useCallback(()=>p(!0),[]),onFocusableItemAdd:u.useCallback(()=>_(S=>S+1),[]),onFocusableItemRemove:u.useCallback(()=>_(S=>S-1),[]),children:s.jsx(Se.div,{tabIndex:g||C===0?-1:0,"data-orientation":a,...h,ref:x,style:{outline:"none",...e.style},onMouseDown:fe(e.onMouseDown,()=>{N.current=!0}),onFocus:fe(e.onFocus,S=>{const D=!N.current;if(S.target===S.currentTarget&&D&&!g){const z=new CustomEvent(Vf,E$);if(S.currentTarget.dispatchEvent(z),!z.defaultPrevented){const P=w().filter(R=>R.focusable),F=P.find(R=>R.active),H=P.find(R=>R.id===v),M=[F,H,...P].filter(Boolean).map(R=>R.ref.current);j_(M,f)}}N.current=!1}),onBlur:fe(e.onBlur,()=>p(!1))})})}),v_="RovingFocusGroupItem",y_=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:r=!1,tabStopId:l,children:i,...o}=e,c=as(),d=l||c,f=O$(v_,n),h=f.currentTabStopId===d,m=x_(n),{onFocusableItemAdd:x,onFocusableItemRemove:b,currentTabStopId:v}=f;return u.useEffect(()=>{if(a)return x(),()=>b()},[a,x,b]),s.jsx(dm.ItemSlot,{scope:n,id:d,focusable:a,active:r,children:s.jsx(Se.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...o,ref:t,onMouseDown:fe(e.onMouseDown,y=>{a?f.onItemFocus(d):y.preventDefault()}),onFocus:fe(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:fe(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=U$(y,f.orientation,f.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let j=m().filter(w=>w.focusable).map(w=>w.ref.current);if(g==="last")j.reverse();else if(g==="prev"||g==="next"){g==="prev"&&j.reverse();const w=j.indexOf(y.currentTarget);j=f.loop?B$(j,w+1):j.slice(w+1)}setTimeout(()=>j_(j))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:v!=null}):i})})});y_.displayName=v_;var z$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function L$(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function U$(e,t,n){const a=L$(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return z$[a]}function j_(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function B$(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var b_=g_,w_=y_,fm=["Enter"," "],H$=["ArrowDown","PageUp","Home"],__=["ArrowUp","PageDown","End"],I$=[...H$,...__],P$={ltr:[...fm,"ArrowRight"],rtl:[...fm,"ArrowLeft"]},q$={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Po="Menu",[lo,G$,V$]=Jp(Po),[Sr,N_]=Os(Po,[V$,Kl,Td]),Ed=Kl(),k_=Td(),[Y$,Cr]=Sr(Po),[F$,qo]=Sr(Po),S_=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:r,onOpenChange:l,modal:i=!0}=e,o=Ed(t),[c,d]=u.useState(null),f=u.useRef(!1),h=Es(l),m=kd(r);return u.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),s.jsx(cx,{...o,children:s.jsx(Y$,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:s.jsx(F$,{scope:t,onClose:u.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:m,modal:i,children:a})})})};S_.displayName=Po;var K$="MenuAnchor",hx=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Ed(n);return s.jsx(ux,{...r,...a,ref:t})});hx.displayName=K$;var mx="MenuPortal",[X$,C_]=Sr(mx,{forceMount:void 0}),R_=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:r}=e,l=Cr(mx,t);return s.jsx(X$,{scope:t,forceMount:n,children:s.jsx(Qn,{present:n||l.open,children:s.jsx(Lo,{asChild:!0,container:r,children:a})})})};R_.displayName=mx;var Vn="MenuContent",[Q$,px]=Sr(Vn),T_=u.forwardRef((e,t)=>{const n=C_(Vn,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,l=Cr(Vn,e.__scopeMenu),i=qo(Vn,e.__scopeMenu);return s.jsx(lo.Provider,{scope:e.__scopeMenu,children:s.jsx(Qn,{present:a||l.open,children:s.jsx(lo.Slot,{scope:e.__scopeMenu,children:i.modal?s.jsx(W$,{...r,ref:t}):s.jsx(Z$,{...r,ref:t})})})})}),W$=u.forwardRef((e,t)=>{const n=Cr(Vn,e.__scopeMenu),a=u.useRef(null),r=Ve(t,a);return u.useEffect(()=>{const l=a.current;if(l)return Bp(l)},[]),s.jsx(xx,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:fe(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Z$=u.forwardRef((e,t)=>{const n=Cr(Vn,e.__scopeMenu);return s.jsx(xx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),J$=pr("MenuContent.ScrollLock"),xx=u.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:r,onOpenAutoFocus:l,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,disableOutsideScroll:b,...v}=e,y=Cr(Vn,n),g=qo(Vn,n),p=Ed(n),j=k_(n),w=G$(n),[N,C]=u.useState(null),_=u.useRef(null),S=Ve(t,_,y.onContentChange),D=u.useRef(0),z=u.useRef(""),P=u.useRef(0),F=u.useRef(null),H=u.useRef("right"),A=u.useRef(0),M=b?bd:u.Fragment,R=b?{as:J$,allowPinchZoom:!0}:void 0,T=O=>{var L,q;const Y=z.current+O,E=w().filter(ne=>!ne.disabled),I=document.activeElement,Q=(L=E.find(ne=>ne.ref.current===I))==null?void 0:L.textValue,te=E.map(ne=>ne.textValue),ce=dO(te,Y,Q),X=(q=E.find(ne=>ne.textValue===ce))==null?void 0:q.ref.current;(function ne(ae){z.current=ae,window.clearTimeout(D.current),ae!==""&&(D.current=window.setTimeout(()=>ne(""),1e3))})(Y),X&&setTimeout(()=>X.focus())};u.useEffect(()=>()=>window.clearTimeout(D.current),[]),Up();const k=u.useCallback(O=>{var E,I;return H.current===((E=F.current)==null?void 0:E.side)&&hO(O,(I=F.current)==null?void 0:I.area)},[]);return s.jsx(Q$,{scope:n,searchRef:z,onItemEnter:u.useCallback(O=>{k(O)&&O.preventDefault()},[k]),onItemLeave:u.useCallback(O=>{var Y;k(O)||((Y=_.current)==null||Y.focus(),C(null))},[k]),onTriggerLeave:u.useCallback(O=>{k(O)&&O.preventDefault()},[k]),pointerGraceTimerRef:P,onPointerGraceIntentChange:u.useCallback(O=>{F.current=O},[]),children:s.jsx(M,{...R,children:s.jsx(yd,{asChild:!0,trapped:r,onMountAutoFocus:fe(l,O=>{var Y;O.preventDefault(),(Y=_.current)==null||Y.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:s.jsx(zo,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,children:s.jsx(b_,{asChild:!0,...j,dir:g.dir,orientation:"vertical",loop:a,currentTabStopId:N,onCurrentTabStopIdChange:C,onEntryFocus:fe(c,O=>{g.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(dx,{role:"menu","aria-orientation":"vertical","data-state":V_(y.open),"data-radix-menu-content":"",dir:g.dir,...p,...v,ref:S,style:{outline:"none",...v.style},onKeyDown:fe(v.onKeyDown,O=>{const E=O.target.closest("[data-radix-menu-content]")===O.currentTarget,I=O.ctrlKey||O.altKey||O.metaKey,Q=O.key.length===1;E&&(O.key==="Tab"&&O.preventDefault(),!I&&Q&&T(O.key));const te=_.current;if(O.target!==te||!I$.includes(O.key))return;O.preventDefault();const X=w().filter(L=>!L.disabled).map(L=>L.ref.current);__.includes(O.key)&&X.reverse(),cO(X)}),onBlur:fe(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(D.current),z.current="")}),onPointerMove:fe(e.onPointerMove,io(O=>{const Y=O.target,E=A.current!==O.clientX;if(O.currentTarget.contains(Y)&&E){const I=O.clientX>A.current?"right":"left";H.current=I,A.current=O.clientX}}))})})})})})})});T_.displayName=Vn;var eO="MenuGroup",gx=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Se.div,{role:"group",...a,ref:t})});gx.displayName=eO;var tO="MenuLabel",E_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Se.div,{...a,ref:t})});E_.displayName=tO;var Mu="MenuItem",Qv="menu.itemSelect",Ad=u.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...r}=e,l=u.useRef(null),i=qo(Mu,e.__scopeMenu),o=px(Mu,e.__scopeMenu),c=Ve(t,l),d=u.useRef(!1),f=()=>{const h=l.current;if(!n&&h){const m=new CustomEvent(Qv,{bubbles:!0,cancelable:!0});h.addEventListener(Qv,x=>a==null?void 0:a(x),{once:!0}),l0(h,m),m.defaultPrevented?d.current=!1:i.onClose()}};return s.jsx(A_,{...r,ref:c,disabled:n,onClick:fe(e.onClick,f),onPointerDown:h=>{var m;(m=e.onPointerDown)==null||m.call(e,h),d.current=!0},onPointerUp:fe(e.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:fe(e.onKeyDown,h=>{const m=o.searchRef.current!=="";n||m&&h.key===" "||fm.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Ad.displayName=Mu;var A_=u.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:r,...l}=e,i=px(Mu,n),o=k_(n),c=u.useRef(null),d=Ve(t,c),[f,h]=u.useState(!1),[m,x]=u.useState("");return u.useEffect(()=>{const b=c.current;b&&x((b.textContent??"").trim())},[l.children]),s.jsx(lo.ItemSlot,{scope:n,disabled:a,textValue:r??m,children:s.jsx(w_,{asChild:!0,...o,focusable:!a,children:s.jsx(Se.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...l,ref:d,onPointerMove:fe(e.onPointerMove,io(b=>{a?i.onItemLeave(b):(i.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:fe(e.onPointerLeave,io(b=>i.onItemLeave(b))),onFocus:fe(e.onFocus,()=>h(!0)),onBlur:fe(e.onBlur,()=>h(!1))})})})}),nO="MenuCheckboxItem",M_=u.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...r}=e;return s.jsx(L_,{scope:e.__scopeMenu,checked:n,children:s.jsx(Ad,{role:"menuitemcheckbox","aria-checked":$u(n)?"mixed":n,...r,ref:t,"data-state":yx(n),onSelect:fe(r.onSelect,()=>a==null?void 0:a($u(n)?!0:!n),{checkForDefaultPrevented:!1})})})});M_.displayName=nO;var $_="MenuRadioGroup",[sO,aO]=Sr($_,{value:void 0,onValueChange:()=>{}}),O_=u.forwardRef((e,t)=>{const{value:n,onValueChange:a,...r}=e,l=Es(a);return s.jsx(sO,{scope:e.__scopeMenu,value:n,onValueChange:l,children:s.jsx(gx,{...r,ref:t})})});O_.displayName=$_;var D_="MenuRadioItem",z_=u.forwardRef((e,t)=>{const{value:n,...a}=e,r=aO(D_,e.__scopeMenu),l=n===r.value;return s.jsx(L_,{scope:e.__scopeMenu,checked:l,children:s.jsx(Ad,{role:"menuitemradio","aria-checked":l,...a,ref:t,"data-state":yx(l),onSelect:fe(a.onSelect,()=>{var i;return(i=r.onValueChange)==null?void 0:i.call(r,n)},{checkForDefaultPrevented:!1})})})});z_.displayName=D_;var vx="MenuItemIndicator",[L_,rO]=Sr(vx,{checked:!1}),U_=u.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...r}=e,l=rO(vx,n);return s.jsx(Qn,{present:a||$u(l.checked)||l.checked===!0,children:s.jsx(Se.span,{...r,ref:t,"data-state":yx(l.checked)})})});U_.displayName=vx;var lO="MenuSeparator",B_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Se.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});B_.displayName=lO;var iO="MenuArrow",H_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Ed(n);return s.jsx(fx,{...r,...a,ref:t})});H_.displayName=iO;var oO="MenuSub",[o8,I_]=Sr(oO),ji="MenuSubTrigger",P_=u.forwardRef((e,t)=>{const n=Cr(ji,e.__scopeMenu),a=qo(ji,e.__scopeMenu),r=I_(ji,e.__scopeMenu),l=px(ji,e.__scopeMenu),i=u.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:c}=l,d={__scopeMenu:e.__scopeMenu},f=u.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return u.useEffect(()=>f,[f]),u.useEffect(()=>{const h=o.current;return()=>{window.clearTimeout(h),c(null)}},[o,c]),s.jsx(hx,{asChild:!0,...d,children:s.jsx(A_,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":V_(n.open),...e,ref:vd(t,r.onTriggerChange),onClick:h=>{var m;(m=e.onClick)==null||m.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:fe(e.onPointerMove,io(h=>{l.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(l.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:fe(e.onPointerLeave,io(h=>{var x,b;f();const m=(x=n.content)==null?void 0:x.getBoundingClientRect();if(m){const v=(b=n.content)==null?void 0:b.dataset.side,y=v==="right",g=y?-5:5,p=m[y?"left":"right"],j=m[y?"right":"left"];l.onPointerGraceIntentChange({area:[{x:h.clientX+g,y:h.clientY},{x:p,y:m.top},{x:j,y:m.top},{x:j,y:m.bottom},{x:p,y:m.bottom}],side:v}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(h),h.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:fe(e.onKeyDown,h=>{var x;const m=l.searchRef.current!=="";e.disabled||m&&h.key===" "||P$[a.dir].includes(h.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),h.preventDefault())})})})});P_.displayName=ji;var q_="MenuSubContent",G_=u.forwardRef((e,t)=>{const n=C_(Vn,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,l=Cr(Vn,e.__scopeMenu),i=qo(Vn,e.__scopeMenu),o=I_(q_,e.__scopeMenu),c=u.useRef(null),d=Ve(t,c);return s.jsx(lo.Provider,{scope:e.__scopeMenu,children:s.jsx(Qn,{present:a||l.open,children:s.jsx(lo.Slot,{scope:e.__scopeMenu,children:s.jsx(xx,{id:o.contentId,"aria-labelledby":o.triggerId,...r,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;i.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:fe(e.onFocusOutside,f=>{f.target!==o.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:fe(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:fe(e.onKeyDown,f=>{var x;const h=f.currentTarget.contains(f.target),m=q$[i.dir].includes(f.key);h&&m&&(l.onOpenChange(!1),(x=o.trigger)==null||x.focus(),f.preventDefault())})})})})})});G_.displayName=q_;function V_(e){return e?"open":"closed"}function $u(e){return e==="indeterminate"}function yx(e){return $u(e)?"indeterminate":e?"checked":"unchecked"}function cO(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function uO(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function dO(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let i=uO(e,Math.max(l,0));r.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function fO(e,t){const{x:n,y:a}=e;let r=!1;for(let l=0,i=t.length-1;l<t.length;i=l++){const o=t[l],c=t[i],d=o.x,f=o.y,h=c.x,m=c.y;f>a!=m>a&&n<(h-d)*(a-f)/(m-f)+d&&(r=!r)}return r}function hO(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return fO(n,t)}function io(e){return t=>t.pointerType==="mouse"?e(t):void 0}var mO=S_,pO=hx,xO=R_,gO=T_,vO=gx,yO=E_,jO=Ad,bO=M_,wO=O_,_O=z_,NO=U_,kO=B_,SO=H_,CO=P_,RO=G_,Md="DropdownMenu",[TO]=Os(Md,[N_]),Jt=N_(),[EO,Y_]=TO(Md),F_=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:r,defaultOpen:l,onOpenChange:i,modal:o=!0}=e,c=Jt(t),d=u.useRef(null),[f,h]=Ba({prop:r,defaultProp:l??!1,onChange:i,caller:Md});return s.jsx(EO,{scope:t,triggerId:as(),triggerRef:d,contentId:as(),open:f,onOpenChange:h,onOpenToggle:u.useCallback(()=>h(m=>!m),[h]),modal:o,children:s.jsx(mO,{...c,open:f,onOpenChange:h,dir:a,modal:o,children:n})})};F_.displayName=Md;var K_="DropdownMenuTrigger",X_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...r}=e,l=Y_(K_,n),i=Jt(n);return s.jsx(pO,{asChild:!0,...i,children:s.jsx(Se.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...r,ref:vd(t,l.triggerRef),onPointerDown:fe(e.onPointerDown,o=>{!a&&o.button===0&&o.ctrlKey===!1&&(l.onOpenToggle(),l.open||o.preventDefault())}),onKeyDown:fe(e.onKeyDown,o=>{a||(["Enter"," "].includes(o.key)&&l.onOpenToggle(),o.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});X_.displayName=K_;var AO="DropdownMenuPortal",Q_=e=>{const{__scopeDropdownMenu:t,...n}=e,a=Jt(t);return s.jsx(xO,{...a,...n})};Q_.displayName=AO;var W_="DropdownMenuContent",Z_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Y_(W_,n),l=Jt(n),i=u.useRef(!1);return s.jsx(gO,{id:r.contentId,"aria-labelledby":r.triggerId,...l,...a,ref:t,onCloseAutoFocus:fe(e.onCloseAutoFocus,o=>{var c;i.current||(c=r.triggerRef.current)==null||c.focus(),i.current=!1,o.preventDefault()}),onInteractOutside:fe(e.onInteractOutside,o=>{const c=o.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!r.modal||f)&&(i.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)"}})});Z_.displayName=W_;var MO="DropdownMenuGroup",$O=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(vO,{...r,...a,ref:t})});$O.displayName=MO;var OO="DropdownMenuLabel",J_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(yO,{...r,...a,ref:t})});J_.displayName=OO;var DO="DropdownMenuItem",eN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(jO,{...r,...a,ref:t})});eN.displayName=DO;var zO="DropdownMenuCheckboxItem",tN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(bO,{...r,...a,ref:t})});tN.displayName=zO;var LO="DropdownMenuRadioGroup",UO=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(wO,{...r,...a,ref:t})});UO.displayName=LO;var BO="DropdownMenuRadioItem",nN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(_O,{...r,...a,ref:t})});nN.displayName=BO;var HO="DropdownMenuItemIndicator",sN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(NO,{...r,...a,ref:t})});sN.displayName=HO;var IO="DropdownMenuSeparator",aN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(kO,{...r,...a,ref:t})});aN.displayName=IO;var PO="DropdownMenuArrow",qO=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(SO,{...r,...a,ref:t})});qO.displayName=PO;var GO="DropdownMenuSubTrigger",rN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(CO,{...r,...a,ref:t})});rN.displayName=GO;var VO="DropdownMenuSubContent",lN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(RO,{...r,...a,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)"}})});lN.displayName=VO;var YO=F_,FO=X_,KO=Q_,iN=Z_,oN=J_,cN=eN,uN=tN,dN=nN,fN=sN,hN=aN,mN=rN,pN=lN;const $d=YO,Od=FO,XO=u.forwardRef(({className:e,inset:t,children:n,...a},r)=>s.jsxs(mN,{ref:r,className:ie("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),...a,children:[n,s.jsx(fd,{className:"ml-auto"})]}));XO.displayName=mN.displayName;const QO=u.forwardRef(({className:e,...t},n)=>s.jsx(pN,{ref:n,className:ie("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}));QO.displayName=pN.displayName;const Go=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>s.jsx(KO,{container:Uo(),children:s.jsx(iN,{ref:a,sideOffset:t,className:ie("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})}));Go.displayName=iN.displayName;const Al=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(cN,{ref:a,className:ie("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}));Al.displayName=cN.displayName;const WO=u.forwardRef(({className:e,children:t,checked:n,...a},r)=>s.jsxs(uN,{ref:r,className:ie("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,...a,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(fN,{children:s.jsx(Il,{className:"h-4 w-4"})})}),t]}));WO.displayName=uN.displayName;const ZO=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(dN,{ref:a,className:ie("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:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(fN,{children:s.jsx(ER,{className:"h-2 w-2 fill-current"})})}),t]}));ZO.displayName=dN.displayName;const JO=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(oN,{ref:a,className:ie("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));JO.displayName=oN.displayName;const e4=u.forwardRef(({className:e,...t},n)=>s.jsx(hN,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));e4.displayName=hN.displayName;const t4={default:"h-9 px-3 py-1 text-sm",control:"h-7 px-2 py-1 text-xs"},bt=u.forwardRef(({className:e,type:t,inputSize:n="default",...a},r)=>s.jsx("input",{type:t,className:ie("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",t4[n],e),ref:r,...a}));bt.displayName="Input";var n4="Label",xN=u.forwardRef((e,t)=>s.jsx(Se.label,{...e,ref:t,onMouseDown:n=>{var r;n.target.closest("button, input, select, textarea")||((r=e.onMouseDown)==null||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));xN.displayName=n4;var gN=xN;const s4=Do("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),$e=u.forwardRef(({className:e,...t},n)=>s.jsx(gN,{ref:n,className:ie(s4(),e),...t}));$e.displayName=gN.displayName;function Ga({title:e,description:t,backHref:n,backLabel:a,className:r,icon:l,link:i}){const o=s.jsx(V,{asChild:!0,variant:"outline",size:"sm",className:"mt-4 no-underline",children:s.jsx(i,{href:n,children:a})});return l?s.jsx("div",{className:ie("flex-1 px-4 py-8 sm:px-6 lg:px-8",r),children:s.jsxs("section",{className:"mx-auto flex max-w-xl flex-col items-center text-center","data-testid":"not-found-state",children:[s.jsx("div",{className:"text-foreground mb-2 [&_svg]:size-8",children:l}),s.jsx("h1",{className:"m-0 text-xl font-semibold tracking-tight",children:e}),s.jsx("div",{className:"text-muted-foreground mt-2 space-y-2 text-sm",children:t}),o]})}):s.jsx("div",{className:ie("flex-1 px-4 py-8 sm:px-6 lg:px-8",r),children:s.jsxs("section",{className:"border-border bg-card mx-auto max-w-xl rounded-xl border p-6",children:[s.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:e}),s.jsx("div",{className:"text-muted-foreground mt-2 space-y-2 text-sm",children:t}),o]})})}function en({title:e,description:t,actions:n,className:a,children:r,...l}){return s.jsxs("header",{"data-slot":"page-header",className:ie("flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",a),...l,children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("h1",{className:"text-foreground text-2xl font-semibold tracking-tight",children:e}),t?s.jsx("p",{className:"text-muted-foreground text-sm",children:t}):null,r]}),n?s.jsx("div",{"data-slot":"page-header-actions",className:"flex shrink-0 items-center gap-2",children:n}):null]})}function ot({as:e="div",className:t,...n}){return s.jsx(e,{className:ie("rounded-lg border",t),...n})}function Wv(e,[t,n]){return Math.min(n,Math.max(t,e))}var vN=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"}),a4="VisuallyHidden",yN=u.forwardRef((e,t)=>s.jsx(Se.span,{...e,ref:t,style:{...vN,...e.style}}));yN.displayName=a4;var r4=yN,l4=[" ","Enter","ArrowUp","ArrowDown"],i4=[" ","Enter"],vr="Select",[Dd,zd,o4]=Jp(vr),[Xl]=Os(vr,[o4,Kl]),Ld=Kl(),[c4,Va]=Xl(vr),[u4,d4]=Xl(vr),jN=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:r,onOpenChange:l,value:i,defaultValue:o,onValueChange:c,dir:d,name:f,autoComplete:h,disabled:m,required:x,form:b}=e,v=Ld(t),[y,g]=u.useState(null),[p,j]=u.useState(null),[w,N]=u.useState(!1),C=kd(d),[_,S]=Ba({prop:a,defaultProp:r??!1,onChange:l,caller:vr}),[D,z]=Ba({prop:i,defaultProp:o,onChange:c,caller:vr}),P=u.useRef(null),F=y?b||!!y.closest("form"):!0,[H,A]=u.useState(new Set),M=Array.from(H).map(R=>R.props.value).join(";");return s.jsx(cx,{...v,children:s.jsxs(c4,{required:x,scope:t,trigger:y,onTriggerChange:g,valueNode:p,onValueNodeChange:j,valueNodeHasChildren:w,onValueNodeHasChildrenChange:N,contentId:as(),value:D,onValueChange:z,open:_,onOpenChange:S,dir:C,triggerPointerDownPosRef:P,disabled:m,children:[s.jsx(Dd.Provider,{scope:t,children:s.jsx(u4,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(R=>{A(T=>new Set(T).add(R))},[]),onNativeOptionRemove:u.useCallback(R=>{A(T=>{const k=new Set(T);return k.delete(R),k})},[]),children:n})}),F?s.jsxs(GN,{"aria-hidden":!0,required:x,tabIndex:-1,name:f,autoComplete:h,value:D,onChange:R=>z(R.target.value),disabled:m,form:b,children:[D===void 0?s.jsx("option",{value:""}):null,Array.from(H)]},M):null]})})};jN.displayName=vr;var bN="SelectTrigger",wN=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...r}=e,l=Ld(n),i=Va(bN,n),o=i.disabled||a,c=Ve(t,i.onTriggerChange),d=zd(n),f=u.useRef("touch"),[h,m,x]=YN(v=>{const y=d().filter(j=>!j.disabled),g=y.find(j=>j.value===i.value),p=FN(y,v,g);p!==void 0&&i.onValueChange(p.value)}),b=v=>{o||(i.onOpenChange(!0),x()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return s.jsx(ux,{asChild:!0,...l,children:s.jsx(Se.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":VN(i.value)?"":void 0,...r,ref:c,onClick:fe(r.onClick,v=>{v.currentTarget.focus(),f.current!=="mouse"&&b(v)}),onPointerDown:fe(r.onPointerDown,v=>{f.current=v.pointerType;const y=v.target;y.hasPointerCapture(v.pointerId)&&y.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(b(v),v.preventDefault())}),onKeyDown:fe(r.onKeyDown,v=>{const y=h.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(y&&v.key===" ")&&l4.includes(v.key)&&(b(),v.preventDefault())})})})});wN.displayName=bN;var _N="SelectValue",NN=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:r,children:l,placeholder:i="",...o}=e,c=Va(_N,n),{onValueNodeHasChildrenChange:d}=c,f=l!==void 0,h=Ve(t,c.onValueNodeChange);return Ft(()=>{d(f)},[d,f]),s.jsx(Se.span,{...o,ref:h,style:{pointerEvents:"none"},children:VN(c.value)?s.jsx(s.Fragment,{children:i}):l})});NN.displayName=_N;var f4="SelectIcon",kN=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...r}=e;return s.jsx(Se.span,{"aria-hidden":!0,...r,ref:t,children:a||"▼"})});kN.displayName=f4;var h4="SelectPortal",SN=e=>s.jsx(Lo,{asChild:!0,...e});SN.displayName=h4;var yr="SelectContent",CN=u.forwardRef((e,t)=>{const n=Va(yr,e.__scopeSelect),[a,r]=u.useState();if(Ft(()=>{r(new DocumentFragment)},[]),!n.open){const l=a;return l?Ol.createPortal(s.jsx(RN,{scope:e.__scopeSelect,children:s.jsx(Dd.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),l):null}return s.jsx(TN,{...e,ref:t})});CN.displayName=yr;var Zn=10,[RN,Ya]=Xl(yr),m4="SelectContentImpl",p4=pr("SelectContent.RemoveScroll"),TN=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:l,onPointerDownOutside:i,side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:v,avoidCollisions:y,...g}=e,p=Va(yr,n),[j,w]=u.useState(null),[N,C]=u.useState(null),_=Ve(t,L=>w(L)),[S,D]=u.useState(null),[z,P]=u.useState(null),F=zd(n),[H,A]=u.useState(!1),M=u.useRef(!1);u.useEffect(()=>{if(j)return Bp(j)},[j]),Up();const R=u.useCallback(L=>{const[q,...ne]=F().map(re=>re.ref.current),[ae]=ne.slice(-1),je=document.activeElement;for(const re of L)if(re===je||(re==null||re.scrollIntoView({block:"nearest"}),re===q&&N&&(N.scrollTop=0),re===ae&&N&&(N.scrollTop=N.scrollHeight),re==null||re.focus(),document.activeElement!==je))return},[F,N]),T=u.useCallback(()=>R([S,j]),[R,S,j]);u.useEffect(()=>{H&&T()},[H,T]);const{onOpenChange:k,triggerPointerDownPosRef:O}=p;u.useEffect(()=>{if(j){let L={x:0,y:0};const q=ae=>{var je,re;L={x:Math.abs(Math.round(ae.pageX)-(((je=O.current)==null?void 0:je.x)??0)),y:Math.abs(Math.round(ae.pageY)-(((re=O.current)==null?void 0:re.y)??0))}},ne=ae=>{L.x<=10&&L.y<=10?ae.preventDefault():j.contains(ae.target)||k(!1),document.removeEventListener("pointermove",q),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",q),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",q),document.removeEventListener("pointerup",ne,{capture:!0})}}},[j,k,O]),u.useEffect(()=>{const L=()=>k(!1);return window.addEventListener("blur",L),window.addEventListener("resize",L),()=>{window.removeEventListener("blur",L),window.removeEventListener("resize",L)}},[k]);const[Y,E]=YN(L=>{const q=F().filter(je=>!je.disabled),ne=q.find(je=>je.ref.current===document.activeElement),ae=FN(q,L,ne);ae&&setTimeout(()=>ae.ref.current.focus())}),I=u.useCallback((L,q,ne)=>{const ae=!M.current&&!ne;(p.value!==void 0&&p.value===q||ae)&&(D(L),ae&&(M.current=!0))},[p.value]),Q=u.useCallback(()=>j==null?void 0:j.focus(),[j]),te=u.useCallback((L,q,ne)=>{const ae=!M.current&&!ne;(p.value!==void 0&&p.value===q||ae)&&P(L)},[p.value]),ce=a==="popper"?hm:EN,X=ce===hm?{side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:v,avoidCollisions:y}:{};return s.jsx(RN,{scope:n,content:j,viewport:N,onViewportChange:C,itemRefCallback:I,selectedItem:S,onItemLeave:Q,itemTextRefCallback:te,focusSelectedItem:T,selectedItemText:z,position:a,isPositioned:H,searchRef:Y,children:s.jsx(bd,{as:p4,allowPinchZoom:!0,children:s.jsx(yd,{asChild:!0,trapped:p.open,onMountAutoFocus:L=>{L.preventDefault()},onUnmountAutoFocus:fe(r,L=>{var q;(q=p.trigger)==null||q.focus({preventScroll:!0}),L.preventDefault()}),children:s.jsx(zo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:i,onFocusOutside:L=>L.preventDefault(),onDismiss:()=>p.onOpenChange(!1),children:s.jsx(ce,{role:"listbox",id:p.contentId,"data-state":p.open?"open":"closed",dir:p.dir,onContextMenu:L=>L.preventDefault(),...g,...X,onPlaced:()=>A(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:fe(g.onKeyDown,L=>{const q=L.ctrlKey||L.altKey||L.metaKey;if(L.key==="Tab"&&L.preventDefault(),!q&&L.key.length===1&&E(L.key),["ArrowUp","ArrowDown","Home","End"].includes(L.key)){let ae=F().filter(je=>!je.disabled).map(je=>je.ref.current);if(["ArrowUp","End"].includes(L.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(L.key)){const je=L.target,re=ae.indexOf(je);ae=ae.slice(re+1)}setTimeout(()=>R(ae)),L.preventDefault()}})})})})})})});TN.displayName=m4;var x4="SelectItemAlignedPosition",EN=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...r}=e,l=Va(yr,n),i=Ya(yr,n),[o,c]=u.useState(null),[d,f]=u.useState(null),h=Ve(t,_=>f(_)),m=zd(n),x=u.useRef(!1),b=u.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:g,focusSelectedItem:p}=i,j=u.useCallback(()=>{if(l.trigger&&l.valueNode&&o&&d&&v&&y&&g){const _=l.trigger.getBoundingClientRect(),S=d.getBoundingClientRect(),D=l.valueNode.getBoundingClientRect(),z=g.getBoundingClientRect();if(l.dir!=="rtl"){const je=z.left-S.left,re=D.left-je,we=_.left-re,se=_.width+we,tt=Math.max(se,S.width),ge=window.innerWidth-Zn,He=Wv(re,[Zn,Math.max(Zn,ge-tt)]);o.style.minWidth=se+"px",o.style.left=He+"px"}else{const je=S.right-z.right,re=window.innerWidth-D.right-je,we=window.innerWidth-_.right-re,se=_.width+we,tt=Math.max(se,S.width),ge=window.innerWidth-Zn,He=Wv(re,[Zn,Math.max(Zn,ge-tt)]);o.style.minWidth=se+"px",o.style.right=He+"px"}const P=m(),F=window.innerHeight-Zn*2,H=v.scrollHeight,A=window.getComputedStyle(d),M=parseInt(A.borderTopWidth,10),R=parseInt(A.paddingTop,10),T=parseInt(A.borderBottomWidth,10),k=parseInt(A.paddingBottom,10),O=M+R+H+k+T,Y=Math.min(y.offsetHeight*5,O),E=window.getComputedStyle(v),I=parseInt(E.paddingTop,10),Q=parseInt(E.paddingBottom,10),te=_.top+_.height/2-Zn,ce=F-te,X=y.offsetHeight/2,L=y.offsetTop+X,q=M+R+L,ne=O-q;if(q<=te){const je=P.length>0&&y===P[P.length-1].ref.current;o.style.bottom="0px";const re=d.clientHeight-v.offsetTop-v.offsetHeight,we=Math.max(ce,X+(je?Q:0)+re+T),se=q+we;o.style.height=se+"px"}else{const je=P.length>0&&y===P[0].ref.current;o.style.top="0px";const we=Math.max(te,M+v.offsetTop+(je?I:0)+X)+ne;o.style.height=we+"px",v.scrollTop=q-te+v.offsetTop}o.style.margin=`${Zn}px 0`,o.style.minHeight=Y+"px",o.style.maxHeight=F+"px",a==null||a(),requestAnimationFrame(()=>x.current=!0)}},[m,l.trigger,l.valueNode,o,d,v,y,g,l.dir,a]);Ft(()=>j(),[j]);const[w,N]=u.useState();Ft(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const C=u.useCallback(_=>{_&&b.current===!0&&(j(),p==null||p(),b.current=!1)},[j,p]);return s.jsx(v4,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:x,onScrollButtonChange:C,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:s.jsx(Se.div,{...r,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});EN.displayName=x4;var g4="SelectPopperPosition",hm=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:r=Zn,...l}=e,i=Ld(n);return s.jsx(dx,{...i,...l,ref:t,align:a,collisionPadding:r,style:{boxSizing:"border-box",...l.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)"}})});hm.displayName=g4;var[v4,jx]=Xl(yr,{}),mm="SelectViewport",AN=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...r}=e,l=Ya(mm,n),i=jx(mm,n),o=Ve(t,l.onViewportChange),c=u.useRef(0);return s.jsxs(s.Fragment,{children:[s.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:a}),s.jsx(Dd.Slot,{scope:n,children:s.jsx(Se.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:fe(r.onScroll,d=>{const f=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&h){const x=Math.abs(c.current-f.scrollTop);if(x>0){const b=window.innerHeight-Zn*2,v=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),g=Math.max(v,y);if(g<b){const p=g+x,j=Math.min(b,p),w=p-j;h.style.height=j+"px",h.style.bottom==="0px"&&(f.scrollTop=w>0?w:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});AN.displayName=mm;var MN="SelectGroup",[y4,j4]=Xl(MN),b4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=as();return s.jsx(y4,{scope:n,id:r,children:s.jsx(Se.div,{role:"group","aria-labelledby":r,...a,ref:t})})});b4.displayName=MN;var $N="SelectLabel",ON=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=j4($N,n);return s.jsx(Se.div,{id:r.id,...a,ref:t})});ON.displayName=$N;var Ou="SelectItem",[w4,DN]=Xl(Ou),zN=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:r=!1,textValue:l,...i}=e,o=Va(Ou,n),c=Ya(Ou,n),d=o.value===a,[f,h]=u.useState(l??""),[m,x]=u.useState(!1),b=Ve(t,p=>{var j;return(j=c.itemRefCallback)==null?void 0:j.call(c,p,a,r)}),v=as(),y=u.useRef("touch"),g=()=>{r||(o.onValueChange(a),o.onOpenChange(!1))};if(a==="")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 s.jsx(w4,{scope:n,value:a,disabled:r,textId:v,isSelected:d,onItemTextChange:u.useCallback(p=>{h(j=>j||((p==null?void 0:p.textContent)??"").trim())},[]),children:s.jsx(Dd.ItemSlot,{scope:n,value:a,disabled:r,textValue:f,children:s.jsx(Se.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...i,ref:b,onFocus:fe(i.onFocus,()=>x(!0)),onBlur:fe(i.onBlur,()=>x(!1)),onClick:fe(i.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:fe(i.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:fe(i.onPointerDown,p=>{y.current=p.pointerType}),onPointerMove:fe(i.onPointerMove,p=>{var j;y.current=p.pointerType,r?(j=c.onItemLeave)==null||j.call(c):y.current==="mouse"&&p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:fe(i.onPointerLeave,p=>{var j;p.currentTarget===document.activeElement&&((j=c.onItemLeave)==null||j.call(c))}),onKeyDown:fe(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(i4.includes(p.key)&&g(),p.key===" "&&p.preventDefault())})})})})});zN.displayName=Ou;var bi="SelectItemText",LN=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:r,...l}=e,i=Va(bi,n),o=Ya(bi,n),c=DN(bi,n),d=d4(bi,n),[f,h]=u.useState(null),m=Ve(t,g=>h(g),c.onItemTextChange,g=>{var p;return(p=o.itemTextRefCallback)==null?void 0:p.call(o,g,c.value,c.disabled)}),x=f==null?void 0:f.textContent,b=u.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=d;return Ft(()=>(v(b),()=>y(b)),[v,y,b]),s.jsxs(s.Fragment,{children:[s.jsx(Se.span,{id:c.textId,...l,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ol.createPortal(l.children,i.valueNode):null]})});LN.displayName=bi;var UN="SelectItemIndicator",BN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return DN(UN,n).isSelected?s.jsx(Se.span,{"aria-hidden":!0,...a,ref:t}):null});BN.displayName=UN;var pm="SelectScrollUpButton",HN=u.forwardRef((e,t)=>{const n=Ya(pm,e.__scopeSelect),a=jx(pm,e.__scopeSelect),[r,l]=u.useState(!1),i=Ve(t,a.onScrollButtonChange);return Ft(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollTop>0;l(d)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),r?s.jsx(PN,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop-c.offsetHeight)}}):null});HN.displayName=pm;var xm="SelectScrollDownButton",IN=u.forwardRef((e,t)=>{const n=Ya(xm,e.__scopeSelect),a=jx(xm,e.__scopeSelect),[r,l]=u.useState(!1),i=Ve(t,a.onScrollButtonChange);return Ft(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;l(f)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),r?s.jsx(PN,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop+c.offsetHeight)}}):null});IN.displayName=xm;var PN=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...r}=e,l=Ya("SelectScrollButton",n),i=u.useRef(null),o=zd(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),Ft(()=>{var f;const d=o().find(h=>h.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[o]),s.jsx(Se.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:fe(r.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:fe(r.onPointerMove,()=>{var d;(d=l.onItemLeave)==null||d.call(l),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:fe(r.onPointerLeave,()=>{c()})})}),_4="SelectSeparator",qN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return s.jsx(Se.div,{"aria-hidden":!0,...a,ref:t})});qN.displayName=_4;var gm="SelectArrow",N4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=Ld(n),l=Va(gm,n),i=Ya(gm,n);return l.open&&i.position==="popper"?s.jsx(fx,{...r,...a,ref:t}):null});N4.displayName=gm;var k4="SelectBubbleInput",GN=u.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const r=u.useRef(null),l=Ve(a,r),i=I0(t);return u.useEffect(()=>{const o=r.current;if(!o)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const h=new Event("change",{bubbles:!0});f.call(o,t),o.dispatchEvent(h)}},[i,t]),s.jsx(Se.select,{...n,style:{...vN,...n.style},ref:l,defaultValue:t})});GN.displayName=k4;function VN(e){return e===""||e===void 0}function YN(e){const t=Es(e),n=u.useRef(""),a=u.useRef(0),r=u.useCallback(i=>{const o=n.current+i;t(o),function c(d){n.current=d,window.clearTimeout(a.current),d!==""&&(a.current=window.setTimeout(()=>c(""),1e3))}(o)},[t]),l=u.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,r,l]}function FN(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let i=S4(e,Math.max(l,0));r.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function S4(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var C4=jN,KN=wN,R4=NN,T4=kN,E4=SN,XN=CN,A4=AN,QN=ON,WN=zN,M4=LN,$4=BN,ZN=HN,JN=IN,ek=qN;const O4={default:"h-9 px-3 py-2 text-sm",control:"h-7 px-2 py-1 text-xs"},pt=C4,xt=R4,ut=u.forwardRef(({className:e,children:t,triggerSize:n="default",...a},r)=>s.jsxs(KN,{ref:r,className:ie("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",O4[n],e),...a,children:[t,s.jsx(T4,{asChild:!0,children:s.jsx(Hw,{className:"text-muted-foreground size-4","aria-hidden":"true"})})]}));ut.displayName=KN.displayName;const tk=u.forwardRef(({className:e,...t},n)=>s.jsx(ZN,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(kR,{className:"size-4","aria-hidden":"true"})}));tk.displayName=ZN.displayName;const nk=u.forwardRef(({className:e,...t},n)=>s.jsx(JN,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx($p,{className:"size-4","aria-hidden":"true"})}));nk.displayName=JN.displayName;const dt=u.forwardRef(({className:e,children:t,position:n="popper",...a},r)=>s.jsx(E4,{container:Uo(),children:s.jsxs(XN,{ref:r,className:ie("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,...a,children:[s.jsx(tk,{}),s.jsx(A4,{className:ie("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(nk,{})]})}));dt.displayName=XN.displayName;const D4=u.forwardRef(({className:e,...t},n)=>s.jsx(QN,{ref:n,className:ie("px-2 py-1.5 text-sm font-semibold",e),...t}));D4.displayName=QN.displayName;const Re=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(WN,{ref:a,className:ie("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:[s.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx($4,{children:s.jsx(Il,{className:"size-4","aria-hidden":"true"})})}),s.jsx(M4,{children:t})]}));Re.displayName=WN.displayName;const z4=u.forwardRef(({className:e,...t},n)=>s.jsx(ek,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));z4.displayName=ek.displayName;function jt({className:e,...t}){return s.jsx("div",{className:ie("animate-pulse rounded-md bg-primary/10",e),...t})}const qe=u.forwardRef(({className:e,containerClassName:t,containerRef:n,containerTabIndex:a,containerAriaLabel:r,...l},i)=>s.jsx("div",{ref:n,tabIndex:a,"aria-label":r,className:ie("relative w-full overflow-auto",t),children:s.jsx("table",{ref:i,className:ie("w-full caption-bottom text-sm",e),...l})}));qe.displayName="Table";const Ke=u.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));Ke.displayName="TableHeader";const Ge=u.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));Ge.displayName="TableBody";const L4=u.forwardRef(({className:e,...t},n)=>s.jsx("tfoot",{ref:n,className:ie("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));L4.displayName="TableFooter";const de=u.forwardRef(({className:e,...t},n)=>s.jsx("tr",{ref:n,className:ie("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));de.displayName="TableRow";const Z=u.forwardRef(({className:e,...t},n)=>s.jsx("th",{ref:n,className:ie("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}));Z.displayName="TableHead";const K=u.forwardRef(({className:e,...t},n)=>s.jsx("td",{ref:n,className:ie("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));K.displayName="TableCell";const U4=u.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:ie("text-muted-foreground mt-4 text-sm",e),...t}));U4.displayName="TableCaption";var Ud="Tabs",[B4]=Os(Ud,[Td]),sk=Td(),[H4,bx]=B4(Ud),ak=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:r,defaultValue:l,orientation:i="horizontal",dir:o,activationMode:c="automatic",...d}=e,f=kd(o),[h,m]=Ba({prop:a,onChange:r,defaultProp:l??"",caller:Ud});return s.jsx(H4,{scope:n,baseId:as(),value:h,onValueChange:m,orientation:i,dir:f,activationMode:c,children:s.jsx(Se.div,{dir:f,"data-orientation":i,...d,ref:t})})});ak.displayName=Ud;var rk="TabsList",lk=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...r}=e,l=bx(rk,n),i=sk(n);return s.jsx(b_,{asChild:!0,...i,orientation:l.orientation,dir:l.dir,loop:a,children:s.jsx(Se.div,{role:"tablist","aria-orientation":l.orientation,...r,ref:t})})});lk.displayName=rk;var ik="TabsTrigger",ok=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:r=!1,...l}=e,i=bx(ik,n),o=sk(n),c=dk(i.baseId,a),d=fk(i.baseId,a),f=a===i.value;return s.jsx(w_,{asChild:!0,...o,focusable:!r,active:f,children:s.jsx(Se.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...l,ref:t,onMouseDown:fe(e.onMouseDown,h=>{!r&&h.button===0&&h.ctrlKey===!1?i.onValueChange(a):h.preventDefault()}),onKeyDown:fe(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(a)}),onFocus:fe(e.onFocus,()=>{const h=i.activationMode!=="manual";!f&&!r&&h&&i.onValueChange(a)})})})});ok.displayName=ik;var ck="TabsContent",uk=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:r,children:l,...i}=e,o=bx(ck,n),c=dk(o.baseId,a),d=fk(o.baseId,a),f=a===o.value,h=u.useRef(f);return u.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),s.jsx(Qn,{present:r||f,children:({present:m})=>s.jsx(Se.div,{"data-state":f?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&l})})});uk.displayName=ck;function dk(e,t){return`${e}-trigger-${t}`}function fk(e,t){return`${e}-content-${t}`}var I4=ak,hk=lk,mk=ok,pk=uk;const P4=I4,xk=u.forwardRef(({className:e,...t},n)=>s.jsx(hk,{ref:n,className:ie("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));xk.displayName=hk.displayName;const vm=u.forwardRef(({className:e,...t},n)=>s.jsx(mk,{ref:n,className:ie("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}));vm.displayName=mk.displayName;const q4=u.forwardRef(({className:e,...t},n)=>s.jsx(pk,{ref:n,className:ie("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));q4.displayName=pk.displayName;const Dn=u.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:ie("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}));Dn.displayName="Textarea";var[Bd]=Os("Tooltip",[Kl]),Hd=Kl(),gk="TooltipProvider",G4=700,ym="tooltip.open",[V4,wx]=Bd(gk),vk=e=>{const{__scopeTooltip:t,delayDuration:n=G4,skipDelayDuration:a=300,disableHoverableContent:r=!1,children:l}=e,i=u.useRef(!0),o=u.useRef(!1),c=u.useRef(0);return u.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),s.jsx(V4,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:u.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,a)},[a]),isPointerInTransitRef:o,onPointerInTransitChange:u.useCallback(d=>{o.current=d},[]),disableHoverableContent:r,children:l})};vk.displayName=gk;var oo="Tooltip",[Y4,Vo]=Bd(oo),yk=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:r,onOpenChange:l,disableHoverableContent:i,delayDuration:o}=e,c=wx(oo,e.__scopeTooltip),d=Hd(t),[f,h]=u.useState(null),m=as(),x=u.useRef(0),b=i??c.disableHoverableContent,v=o??c.delayDuration,y=u.useRef(!1),[g,p]=Ba({prop:a,defaultProp:r??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),l==null||l(_)},caller:oo}),j=u.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),w=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,y.current=!1,p(!0)},[p]),N=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,p(!1)},[p]),C=u.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{y.current=!0,p(!0),x.current=0},v)},[v,p]);return u.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),s.jsx(cx,{...d,children:s.jsx(Y4,{scope:t,contentId:m,open:g,stateAttribute:j,trigger:f,onTriggerChange:h,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?C():w()},[c.isOpenDelayedRef,C,w]),onTriggerLeave:u.useCallback(()=>{b?N():(window.clearTimeout(x.current),x.current=0)},[N,b]),onOpen:w,onClose:N,disableHoverableContent:b,children:n})})};yk.displayName=oo;var jm="TooltipTrigger",jk=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Vo(jm,n),l=wx(jm,n),i=Hd(n),o=u.useRef(null),c=Ve(t,o,r.onTriggerChange),d=u.useRef(!1),f=u.useRef(!1),h=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx(ux,{asChild:!0,...i,children:s.jsx(Se.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:c,onPointerMove:fe(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!l.isPointerInTransitRef.current&&(r.onTriggerEnter(),f.current=!0)}),onPointerLeave:fe(e.onPointerLeave,()=>{r.onTriggerLeave(),f.current=!1}),onPointerDown:fe(e.onPointerDown,()=>{r.open&&r.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:fe(e.onFocus,()=>{d.current||r.onOpen()}),onBlur:fe(e.onBlur,r.onClose),onClick:fe(e.onClick,r.onClose)})})});jk.displayName=jm;var _x="TooltipPortal",[F4,K4]=Bd(_x,{forceMount:void 0}),bk=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:r}=e,l=Vo(_x,t);return s.jsx(F4,{scope:t,forceMount:n,children:s.jsx(Qn,{present:n||l.open,children:s.jsx(Lo,{asChild:!0,container:r,children:a})})})};bk.displayName=_x;var Ml="TooltipContent",wk=u.forwardRef((e,t)=>{const n=K4(Ml,e.__scopeTooltip),{forceMount:a=n.forceMount,side:r="top",...l}=e,i=Vo(Ml,e.__scopeTooltip);return s.jsx(Qn,{present:a||i.open,children:i.disableHoverableContent?s.jsx(_k,{side:r,...l,ref:t}):s.jsx(X4,{side:r,...l,ref:t})})}),X4=u.forwardRef((e,t)=>{const n=Vo(Ml,e.__scopeTooltip),a=wx(Ml,e.__scopeTooltip),r=u.useRef(null),l=Ve(t,r),[i,o]=u.useState(null),{trigger:c,onClose:d}=n,f=r.current,{onPointerInTransitChange:h}=a,m=u.useCallback(()=>{o(null),h(!1)},[h]),x=u.useCallback((b,v)=>{const y=b.currentTarget,g={x:b.clientX,y:b.clientY},p=eD(g,y.getBoundingClientRect()),j=tD(g,p),w=nD(v.getBoundingClientRect()),N=aD([...j,...w]);o(N),h(!0)},[h]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&f){const b=y=>x(y,f),v=y=>x(y,c);return c.addEventListener("pointerleave",b),f.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",b),f.removeEventListener("pointerleave",v)}}},[c,f,x,m]),u.useEffect(()=>{if(i){const b=v=>{const y=v.target,g={x:v.clientX,y:v.clientY},p=(c==null?void 0:c.contains(y))||(f==null?void 0:f.contains(y)),j=!sD(g,i);p?m():j&&(m(),d())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,f,i,d,m]),s.jsx(_k,{...e,ref:l})}),[Q4,W4]=Bd(oo,{isInside:!1}),Z4=GE("TooltipContent"),_k=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":r,onEscapeKeyDown:l,onPointerDownOutside:i,...o}=e,c=Vo(Ml,n),d=Hd(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(ym,f),()=>document.removeEventListener(ym,f)),[f]),u.useEffect(()=>{if(c.trigger){const h=m=>{const x=m.target;x!=null&&x.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),s.jsx(zo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:s.jsxs(dx,{"data-state":c.stateAttribute,...d,...o,ref:t,style:{...o.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:[s.jsx(Z4,{children:a}),s.jsx(Q4,{scope:n,isInside:!0,children:s.jsx(r4,{id:c.contentId,role:"tooltip",children:r||a})})]})})});wk.displayName=Ml;var Nk="TooltipArrow",J4=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Hd(n);return W4(Nk,n).isInside?null:s.jsx(fx,{...r,...a,ref:t})});J4.displayName=Nk;function eD(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,a,r,l)){case l:return"left";case r:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function tD(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function nD(e){const{top:t,right:n,bottom:a,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:a},{x:r,y:a}]}function sD(e,t){const{x:n,y:a}=e;let r=!1;for(let l=0,i=t.length-1;l<t.length;i=l++){const o=t[l],c=t[i],d=o.x,f=o.y,h=c.x,m=c.y;f>a!=m>a&&n<(h-d)*(a-f)/(m-f)+d&&(r=!r)}return r}function aD(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),rD(t)}function rD(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const r=e[a];for(;t.length>=2;){const l=t[t.length-1],i=t[t.length-2];if((l.x-i.x)*(r.y-i.y)>=(l.y-i.y)*(r.x-i.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const r=e[a];for(;n.length>=2;){const l=n[n.length-1],i=n[n.length-2];if((l.x-i.x)*(r.y-i.y)>=(l.y-i.y)*(r.x-i.x))n.pop();else break}n.push(r)}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 lD=vk,iD=yk,oD=jk,cD=bk,kk=wk;const Sk=lD,Ck=iD,Rk=oD,Nx=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>{const r=Uo(),l=s.jsx(kk,{ref:a,sideOffset:t,className:ie("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 r?s.jsx(cD,{container:r,children:l}):l});Nx.displayName=kk.displayName;function la({page:e,header:t}){return s.jsxs(s.Fragment,{children:[t??s.jsx(en,{title:e}),s.jsx(uD,{page:e})]})}function uD({page:e}){return s.jsxs(he,{variant:"info",role:"status",className:"mt-6","data-testid":"not-installed",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Yw(e)})]})}const Zv=["none","read","comment","write","manage","admin"];function Du(e,t){return Zv.indexOf(e??"none")>=Zv.indexOf(t)}function kx(e){return e==="api_key"?"API key":e==="sdlc_login"?"sdlc login":null}function Yf(e,t){const n=kx(e);return e==="sdlc_login"&&t?`${n} on ${Tk(t)}`:n}const dD=String.fromCodePoint(8296),fD=String.fromCodePoint(8297);function Tk(e){return`${dD}${e}${fD}`}const co={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"}},hD={backlog:"neutral",planned:"neutral",in_progress:"info",completed:"success",canceled:"neutral"};function Ek(e){return e.name==="Blocked"?"warning":hD[e.category]}const Jv=1800;function cs(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 Sx(e){return`${Yn(e)}, ${rs(e)}`}function fi(e){return e<90?`${Math.round(e)} s`:e<5400?`${Math.round(e/60)} min`:`${(e/3600).toFixed(1).replace(/\.0$/,"")} h`}function Yn(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Ak(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function mD(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 pD(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 da="not_set";function xD({open:e,commands:t,list_id:n,list_revision:a,default_status_id:r,statuses:l,priorities:i,members:o,on_close:c,on_created:d}){var F;const f=Nr(),[h,m]=u.useState(""),[x,b]=u.useState(""),[v,y]=u.useState(r??((F=l[0])==null?void 0:F.id)??""),[g,p]=u.useState(da),[j,w]=u.useState(da),[N,C]=u.useState(!1),[_,S]=u.useState(null),[D,z]=u.useState(!1);u.useEffect(()=>{var H;e&&(m(""),b(""),y(r??((H=l[0])==null?void 0:H.id)??""),p(da),w(da),C(!1),S(null))},[e,r,l]);const P=async H=>{if(H.preventDefault(),!h.trim()){C(!0);return}z(!0),S(null);try{const A=await t.run("create_task",{list_id:n,expected_list_revision:a,title:h.trim(),description:x.trim()||null,status_id:v||null,priority_id:g===da?null:g,primary_user_id:j===da?null:j});if(!A.ok){S(A.refusal.message);return}f.success("Task created."),await d()}finally{z(!1)}};return s.jsx(pn,{open:e,onOpenChange:H=>H?null:c(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:H=>void P(H),noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"New task"}),s.jsx(jn,{children:"Add a task to this List."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[_&&s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(xe,{children:_})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"new-task-title",children:"Title"}),s.jsx(bt,{id:"new-task-title",placeholder:"What needs doing",value:h,required:!0,"aria-invalid":N,"aria-describedby":N?"new-task-title-error":void 0,onChange:H=>{m(H.target.value),C(!1)}}),N&&s.jsx("p",{id:"new-task-title-error",className:"text-destructive text-xs",children:"Give the task a title."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"new-task-description",children:"Description (optional)"}),s.jsx(Dn,{id:"new-task-description",rows:4,value:x,onChange:H=>b(H.target.value)})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"new-task-status",children:"Status"}),s.jsxs(pt,{value:v,onValueChange:y,children:[s.jsx(ut,{id:"new-task-status",children:s.jsx(xt,{})}),s.jsx(dt,{children:l.map(H=>s.jsx(Re,{value:H.id,children:H.name},H.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"new-task-priority",children:"Priority"}),s.jsxs(pt,{value:g,onValueChange:p,children:[s.jsx(ut,{id:"new-task-priority",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:da,children:"Not set"}),i.map(H=>s.jsx(Re,{value:H.id,children:H.name},H.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"new-task-primary",children:"Primary"}),s.jsxs(pt,{value:j,onValueChange:w,children:[s.jsx(ut,{id:"new-task-primary",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:da,children:"Not set"}),o.map(H=>s.jsx(Re,{value:H.user_id,children:H.label},H.user_id))]})]})]})]})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),s.jsx(V,{type:"submit",disabled:D,children:D?"Creating…":"Create task"})]})]})})})}const gD="Your organization's work, in queue order. Claim a task to show you are working on it.",wi="any",Mk="none",vD=1,yD=250;function Cx(){const e=mn().tasks;if(!e)throw new Error("The Tasks page rendered without the tasks seam.");return e}function jD({org:e}){var b,v;const t=Cx(),{href:n,Link:a}=Xe(),[r,l]=u.useState({state:"loading"}),[i,o]=u.useState([]),[c,d]=u.useState(null),f=u.useRef(0),h=u.useCallback(async y=>{const g=f.current+=1;y&&l({state:"loading"});const p=await t.availability({fresh:y});g===f.current&&l(p)},[t.availability]);u.useEffect(()=>{h(!1)},[h]);const m=u.useCallback(()=>void h(!0),[h]);if(u.useEffect(()=>{let y=!0;return t.members().then(g=>{y&&g.ok&&o(g.data)}),()=>{y=!1}},[t.members]),u.useEffect(()=>{if(!t.access)return;let y=!0;return t.access().then(g=>{y&&g.ok&&d(g.data)}),()=>{y=!1}},[t.access]),r.state==="off"&&((b=r.refusal)==null?void 0:b.reason)!=="engine_missing")return s.jsx(Ga,{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:a});const x=(c==null?void 0:c.read_only_reason)??gD;return s.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:r.state==="active"?s.jsx(wD,{active:r,org:e,members:i,description:x,read_only_reason:c==null?void 0:c.read_only_reason,reload_configuration:m}):r.state==="off"&&((v=r.refusal)==null?void 0:v.reason)==="engine_missing"?s.jsx(la,{page:"Tasks"}):s.jsxs(s.Fragment,{children:[s.jsx(en,{title:"Tasks",description:x}),r.state==="loading"&&s.jsx($k,{}),(r.state==="error"||r.state==="off")&&s.jsx(Ok,{refusal:r.refusal,on_retry:m}),r.state==="available"&&s.jsx(bD,{on_done:m})]})})}function $k(){return s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading tasks",children:Array.from({length:6},(e,t)=>s.jsx(jt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function Ok({refusal:e,on_retry:t}){const n=ds();return(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(he,{variant:"warning",className:"mt-6",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsx(xe,{children:n})]}):s.jsxs(he,{variant:"destructive",className:"mt-6",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Tasks could not be loaded"}),s.jsxs(xe,{children:[s.jsx("p",{children:e!=null&&e.reason?e.message:"Check your connection and try again."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function bD({on_done:e}){const{commands:t}=Cx(),n=Nr(),[a,r]=u.useState(!1),l=t==null?void 0:t.activate,i=async()=>{if(!l)return;r(!0);const o=await l();if(r(!1),!o.ok){n.error(o.refusal.message);return}n.success("Tasks are on."),e()};return s.jsxs(he,{variant:"info",className:"mt-6",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Tasks are not on for this organization"}),s.jsxs(xe,{children:[s.jsx("p",{children:"Turning them on creates one List with the default workflow. Members then see tasks as their access allows. It needs two-factor sign-in."}),l?s.jsx(V,{type:"button",size:"sm",className:"mt-2",disabled:a,onClick:()=>void i(),children:"Turn on Tasks"}):null]})]})}const Ff=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function wD({active:e,org:t,members:n,description:a,read_only_reason:r,reload_configuration:l}){var Fx;const{commands:i,listTasks:o,waitingOnYou:c,hierarchyRevision:d}=Cx(),{href:f,Link:h}=Xe(),{self_id:m}=dd(),x=Nr(),{list:b,workspace:v}=e,y=b.offers,g=y!==void 0,p=u.useMemo(()=>{var G;return((G=v.workflows.find(oe=>oe.id===b.workflow_id))==null?void 0:G.statuses)??[]},[v,b]),j=v.priorities,w=!!i&&Du(b.permission,"write"),N=w&&Du(b.permission,"manage"),C=u.useMemo(()=>new Map(n.map(G=>[G.user_id,G])),[n]),_=G=>{var oe;return G?G===m?"You":((oe=C.get(G))==null?void 0:oe.label)??"A member":""},[S,D]=u.useState("active"),[z,P]=u.useState(!1),[F,H]=u.useState(""),[A,M]=u.useState("");u.useEffect(()=>{const G=setTimeout(()=>M(F),yD);return()=>clearTimeout(G)},[F]);const[R,T]=u.useState(null),[k,O]=u.useState(wi),[Y,E]=u.useState(!1),[I,Q]=u.useState(!1),[te,ce]=u.useState({}),[X,L]=u.useState([]),[q,ne]=u.useState(null),[ae,je]=u.useState([]),[re,we]=u.useState(null),[se,tt]=u.useState(0),[ge,He]=u.useState(!1),[J,ke]=u.useState(null),[Ue,ft]=u.useState(null),_e=ds(),[Ht,wt]=u.useState(!1),[Et,tn]=u.useState(null),[_t,Nt]=u.useState({}),[bn,Gt]=u.useState(""),{confirm:le,confirm_dialog:Me}=Bo(),Ce=u.useRef(null),nn=u.useRef(null),sn=u.useRef(null),zn=u.useRef(null),[st,hs]=u.useState(void 0),Wn=!!(A.trim()||R||k!==wi||Y||I),ms=u.useRef(0),ps=u.useRef(0),U=u.useCallback(async(G,oe=!1)=>{if(oe&&ps.current>0)return;const Be=G?ms.current:ms.current+=1,at={state:S,assigned_to_me:z||void 0,cursor:G,search:A.trim()||void 0,group:R??void 0,owner:k===wi?void 0:k===Mk?"":k,urgent:Y||void 0,over_estimate:I||void 0,..._D(te,X)},rn=ln=>o(b.id,{...at,cursor:ln});G||(ps.current+=1);let gt=await rn(G).finally(()=>{G||(ps.current-=1)}),At=!!G;if(!gt.ok&>.refusal.code==="cursor_stale"&&(gt=await rn(),At=!1),Be!==ms.current)return;if(!gt.ok){we(gt.refusal),tt(ln=>ln+1);return}const kt=gt.data;we(null),tt(0),!(oe&&Ff(kt,sn.current))&&(sn.current=kt,ne(kt),kt.facets&&hs(kt.facets),je(ln=>At?[...ln,...kt.tasks]:kt.tasks))},[o,b.id,S,z,A,R,k,Y,I,te,X]),$=u.useCallback(async()=>{const G=await c();if(ft(Be=>G.ok?null:Ff(Be,G.refusal)?Be:G.refusal),!G.ok&&g)return;const oe=G.ok?G.data:null;Ff(oe,zn.current)||(zn.current=oe,ke(oe))},[c,g]);u.useEffect(()=>{sn.current=null,ne(null)},[S,z]),u.useEffect(()=>{U()},[U]),u.useEffect(()=>{$()},[$]);const B=u.useCallback(async()=>{await Promise.all([U(),$()])},[U,$]),W=u.useRef(B);W.current=B;const ve=y==null?void 0:y.refresh_ms;u.useEffect(()=>{if(!ve)return;const G=setInterval(()=>{U(void 0,!0),$()},ve);return()=>clearInterval(G)},[ve,U,$]);const Oe=u.useCallback(async(G,oe,Be)=>{if(!i)return;const at=await i.run(G,oe);at.ok?Be&&x.success(Be):(x.error(at.refusal.message),at.refusal.code==="revision_conflict"&&l()),await B()},[i,x,B,l]),an=p.find(G=>G.category==="completed"),Xa=async(G,oe,Be)=>{const at=oe+Be,rn=ae[at];if(!rn||!q||!i)return;const gt=async(At,kt)=>{const ln=await i.run(At,kt);if(!ln.ok)throw ln.refusal;return ln.data};try{let At=q.list.order_revision,kt=G.revision;if(rn.queue_rank===null){const ln=ae.findIndex(Ls=>Ls.queue_rank===null);for(const Ls of ae.slice(ln,at+1)){const Kx=await gt("reorder",{task_id:Ls.id,expected_revision:Ls.revision,expected_order_revision:At,placement:"end"});At=Kx.list.order_revision,Ls.id===G.id&&(kt=Kx.task.revision)}}await gt("reorder",{task_id:G.id,expected_revision:kt,expected_order_revision:At,placement:Be<0?"before":"after",anchor_task_id:rn.id})}catch(At){x.error(At.message)}await B()},Tr=G=>{an&&Oe("update_task",{task_id:G.id,expected_revision:G.revision,changes:{status_id:an.id}},`${G.title} completed.`)},ti=async G=>{if(!q||!await le({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[Be,at]=await Promise.all([o(b.id,{limit:1}),d(v.id)]);if(!Be.ok||!at.ok){x.error(Be.ok?at.ok?"":at.refusal.message:Be.refusal.message);return}await Oe("archive_task",{task_id:G.id,expected_revision:G.revision,expected_order_revision:Be.data.list.order_revision,expected_hierarchy_revision:at.data},`${G.title} archived.`)},ni=async G=>{await Oe("release_hold",{hold_id:G},"Hold released.")},xs=async(G,oe,Be,at)=>{if(!(i!=null&&i.complete)||!await le({title:`Mark ${oe} done?`,description:Be.reason?`“${Be.reason}”
|
|
388
|
+
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},oM="DialogDescriptionWarning",cM=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$w(oM).contentName}}.`;return u.useEffect(()=>{var l;const r=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},Ow=jw,Dw=_w,zw=Nw,Lw=kw,Uw=Cw,Bw=Tw,qp=Aw;function Wt({className:e,...t}){return s.jsx(oT,{role:"status","aria-label":"Loading",className:ie("size-4 animate-spin",e),...t})}const hl="aria-pressed:border aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:text-accent-foreground",uM="border border-primary bg-accent text-accent-foreground hover:bg-accent",_d=Do("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"}}),V=u.forwardRef(({className:e,disabled:t,variant:n,size:a,asChild:r=!1,loading:l,children:i,...o},c)=>{const d=r?qE:"button",f=a==="icon"||a==="sm-icon"||a==="control-icon"||a==="xs-icon",h=s.jsx(Wt,{"aria-hidden":"true","aria-label":void 0,role:void 0,className:ie(!f&&"mr-2")}),m=r?i:l&&f?h:s.jsxs(s.Fragment,{children:[l?h:null,i]});return s.jsx(d,{className:ie(_d({variant:n,size:a,className:e})),ref:c,disabled:t||l,...o,children:m})});V.displayName="Button";const Hw=u.createContext(null);function dM({container:e,children:t}){return s.jsx(Hw.Provider,{value:e,children:t})}function Uo(){return u.useContext(Hw)??void 0}function Gp(e){return s.jsx(Ow,{"data-slot":"alert-dialog",...e})}function fM({className:e,...t}){return s.jsx(zw,{"data-slot":"alert-dialog-overlay",className:ie("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 Vp({className:e,onOpenAutoFocus:t,onPointerDownOutside:n,onInteractOutside:a,...r}){return s.jsxs(Dw,{container:Uo(),children:[s.jsx(fM,{}),s.jsx(Lw,{"data-slot":"alert-dialog-content",role:"alertdialog",className:ie("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:l=>{if(t==null||t(l),l.defaultPrevented)return;const i=l.currentTarget,o=i instanceof HTMLElement?i.querySelector('[data-slot="alert-dialog-cancel"]'):null;o&&(l.preventDefault(),o.focus())},onPointerDownOutside:l=>{n==null||n(l),l.preventDefault()},onInteractOutside:l=>{a==null||a(l),l.preventDefault()},...r})]})}function Yp({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:ie("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Fp({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:ie("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Kp({className:e,...t}){return s.jsx(Uw,{"data-slot":"alert-dialog-title",className:ie("text-lg font-semibold",e),...t})}function Xp({className:e,...t}){return s.jsx(Bw,{"data-slot":"alert-dialog-description",className:ie("text-muted-foreground text-sm",e),...t})}function Iw({className:e,variant:t,...n}){return s.jsx(qp,{"data-slot":"alert-dialog-action",className:ie(_d({variant:t}),e),...n})}function Qp({className:e,...t}){return s.jsx(qp,{"data-slot":"alert-dialog-cancel",className:ie(_d({variant:"outline"}),e),...t})}function hM(){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 mM(e,t){t!=null&&t.isConnected&&(e.preventDefault(),t.focus())}function Bo(){const[e,t]=u.useState(null),n=u.useRef(null),a=u.useRef(null),r=u.useCallback(o=>{var c;(c=n.current)==null||c.resolve(o),n.current=null,t(null)},[]),l=u.useCallback(o=>new Promise(c=>{var f;(f=n.current)==null||f.resolve(!1),a.current=hM();const d={...o,resolve:c};n.current=d,t(d)}),[]);u.useEffect(()=>()=>{var o;return(o=n.current)==null?void 0:o.resolve(!1)},[]);const i=s.jsx(Gp,{open:e!==null,onOpenChange:o=>{o||r(!1)},children:s.jsxs(Vp,{onCloseAutoFocus:o=>mM(o,a.current),children:[s.jsxs(Yp,{children:[s.jsx(Kp,{children:e==null?void 0:e.title}),s.jsx(Xp,{className:"whitespace-pre-line",children:e==null?void 0:e.description})]}),s.jsxs(Fp,{children:[s.jsx(Qp,{children:"Cancel"}),s.jsx(Iw,{variant:e!=null&&e.destructive?"destructive":"default",onClick:()=>r(!0),children:e==null?void 0:e.action_label})]})]})});return{confirm:l,confirm_dialog:i}}const Ps="px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",pM=Do("inline-flex items-center rounded-md border transition-colors",{variants:{variant:{default:`${Ps} border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80`,secondary:`${Ps} border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`${Ps} border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80`,outline:`${Ps} text-foreground`,success:`${Ps} border-success/40 bg-success/10 text-success`,warning:`${Ps} border-warning/40 bg-warning/10 text-warning`,info:`${Ps} border-info/40 bg-info/10 text-info`,error:`${Ps} border-destructive/40 bg-destructive/10 text-destructive`,neutral:`${Ps} 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 ue({className:e,variant:t,size:n,...a}){return s.jsx("div",{className:ie(pM({variant:t,size:n}),e),...a})}function Pw(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 qw(e){const[t,n]=u.useState(void 0);return Ft(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const l=r[0];let i,o;if("borderBoxSize"in l){const c=l.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,o=d.blockSize}else i=e.offsetWidth,o=e.offsetHeight;n({width:i,height:o})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else n(void 0)},[e]),t}var Nd="Checkbox",[xM]=Os(Nd),[gM,Wp]=xM(Nd);function vM(e){const{__scopeCheckbox:t,checked:n,children:a,defaultChecked:r,disabled:l,form:i,name:o,onCheckedChange:c,required:d,value:f="on",internal_do_not_use_render:h}=e,[m,x]=Ba({prop:n,defaultProp:r??!1,onChange:c,caller:Nd}),[b,v]=u.useState(null),[y,g]=u.useState(null),p=u.useRef(!1),j=b?!!i||!!b.closest("form"):!0,w={checked:m,disabled:l,setChecked:x,control:b,setControl:v,name:o,form:i,value:f,hasConsumerStoppedPropagationRef:p,required:d,defaultChecked:Da(r)?!1:r,isFormControl:j,bubbleInput:y,setBubbleInput:g};return s.jsx(gM,{scope:t,...w,children:yM(h)?h(w):a})}var Gw="CheckboxTrigger",Vw=u.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},r)=>{const{control:l,value:i,disabled:o,checked:c,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:x,bubbleInput:b}=Wp(Gw,e),v=Ve(r,f),y=u.useRef(c);return u.useEffect(()=>{const g=l==null?void 0:l.form;if(g){const p=()=>h(y.current);return g.addEventListener("reset",p),()=>g.removeEventListener("reset",p)}},[l,h]),s.jsx(Se.button,{type:"button",role:"checkbox","aria-checked":Da(c)?"mixed":c,"aria-required":d,"data-state":Qw(c),"data-disabled":o?"":void 0,disabled:o,value:i,...a,ref:v,onKeyDown:fe(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:fe(n,g=>{h(p=>Da(p)?!0:!p),b&&x&&(m.current=g.isPropagationStopped(),m.current||g.stopPropagation())})})});Vw.displayName=Gw;var Zp=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:a,checked:r,defaultChecked:l,required:i,disabled:o,value:c,onCheckedChange:d,form:f,...h}=e;return s.jsx(vM,{__scopeCheckbox:n,checked:r,defaultChecked:l,disabled:o,required:i,onCheckedChange:d,name:a,form:f,value:c,internal_do_not_use_render:({isFormControl:m})=>s.jsxs(s.Fragment,{children:[s.jsx(Vw,{...h,ref:t,__scopeCheckbox:n}),m&&s.jsx(Xw,{__scopeCheckbox:n})]})})});Zp.displayName=Nd;var Yw="CheckboxIndicator",Fw=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...r}=e,l=Wp(Yw,n);return s.jsx(Qn,{present:a||Da(l.checked)||l.checked===!0,children:s.jsx(Se.span,{"data-state":Qw(l.checked),"data-disabled":l.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});Fw.displayName=Yw;var Kw="CheckboxBubbleInput",Xw=u.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:a,hasConsumerStoppedPropagationRef:r,checked:l,defaultChecked:i,required:o,disabled:c,name:d,value:f,form:h,bubbleInput:m,setBubbleInput:x}=Wp(Kw,e),b=Ve(n,x),v=Pw(l),y=qw(a);u.useEffect(()=>{const p=m;if(!p)return;const j=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(j,"checked").set,C=!r.current;if(v!==l&&N){const _=new Event("click",{bubbles:C});p.indeterminate=Da(l),N.call(p,Da(l)?!1:l),p.dispatchEvent(_)}},[m,v,l,r]);const g=u.useRef(Da(l)?!1:l);return s.jsx(Se.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??g.current,required:o,disabled:c,name:d,value:f,form:h,...t,tabIndex:-1,ref:b,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Xw.displayName=Kw;function yM(e){return typeof e=="function"}function Da(e){return e==="indeterminate"}function Qw(e){return Da(e)?"indeterminate":e?"checked":"unchecked"}const Vl=u.forwardRef(({className:e,...t},n)=>s.jsx(Zp,{ref:n,className:ie("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:s.jsx(Fw,{className:ie("flex items-center justify-center text-current"),children:t.checked==="indeterminate"?s.jsx(mT,{className:"size-4","aria-hidden":"true"}):s.jsx(Il,{className:"size-4","aria-hidden":"true"})})}));Vl.displayName=Zp.displayName;const jM=Do("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 pn({...e}){return s.jsx(Ow,{"data-slot":"dialog",...e})}function bM({...e}){const t=Uo();return s.jsx(Dw,{"data-slot":"dialog-portal",container:t,...e})}function wM({className:e,...t}){return s.jsx(zw,{"data-slot":"dialog-overlay",className:ie("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 xn({className:e,children:t,showCloseButton:n=!0,size:a,...r}){return s.jsxs(bM,{"data-slot":"dialog-portal",children:[s.jsx(wM,{}),s.jsxs(Lw,{"data-slot":"dialog-content",className:ie(jM({size:a}),e),...r,children:[t,n&&s.jsxs(qp,{"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:[s.jsx(xd,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function gn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:ie("flex flex-col gap-2 text-center sm:text-left",e),...t})}function vn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:ie("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function yn({className:e,...t}){return s.jsx(Uw,{"data-slot":"dialog-title",className:ie("text-lg leading-none font-semibold",e),...t})}function jn({className:e,...t}){return s.jsx(Bw,{"data-slot":"dialog-description",className:ie("text-muted-foreground text-sm",e),...t})}function Jp(e){const t=e+"CollectionProvider",[n,a]=Os(t),[r,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=v=>{const{scope:y,children:g}=v,p=fa.useRef(null),j=fa.useRef(new Map).current;return s.jsx(r,{scope:y,itemMap:j,collectionRef:p,children:g})};i.displayName=t;const o=e+"CollectionSlot",c=pr(o),d=fa.forwardRef((v,y)=>{const{scope:g,children:p}=v,j=l(o,g),w=Ve(y,j.collectionRef);return s.jsx(c,{ref:w,children:p})});d.displayName=o;const f=e+"CollectionItemSlot",h="data-radix-collection-item",m=pr(f),x=fa.forwardRef((v,y)=>{const{scope:g,children:p,...j}=v,w=fa.useRef(null),N=Ve(y,w),C=l(f,g);return fa.useEffect(()=>(C.itemMap.set(w,{ref:w,...j}),()=>void C.itemMap.delete(w))),s.jsx(m,{[h]:"",ref:N,children:p})});x.displayName=f;function b(v){const y=l(e+"CollectionConsumer",v);return fa.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const j=Array.from(p.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((C,_)=>j.indexOf(C.ref.current)-j.indexOf(_.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},b,a]}var _M=u.createContext(void 0);function kd(e){const t=u.useContext(_M);return e||t||"ltr"}const NM=["top","right","bottom","left"],Ha=Math.min,Sn=Math.max,Ru=Math.round,vc=Math.floor,Cs=e=>({x:e,y:e}),kM={left:"right",right:"left",bottom:"top",top:"bottom"},SM={start:"end",end:"start"};function om(e,t,n){return Sn(e,Ha(t,n))}function sa(e,t){return typeof e=="function"?e(t):e}function aa(e){return e.split("-")[0]}function Yl(e){return e.split("-")[1]}function ex(e){return e==="x"?"y":"x"}function tx(e){return e==="y"?"height":"width"}function ws(e){return["top","bottom"].includes(aa(e))?"y":"x"}function nx(e){return ex(ws(e))}function CM(e,t,n){n===void 0&&(n=!1);const a=Yl(e),r=nx(e),l=tx(r);let i=r==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(i=Tu(i)),[i,Tu(i)]}function RM(e){const t=Tu(e);return[cm(e),t,cm(t)]}function cm(e){return e.replace(/start|end/g,t=>SM[t])}function TM(e,t,n){const a=["left","right"],r=["right","left"],l=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:a:t?a:r;case"left":case"right":return t?l:i;default:return[]}}function EM(e,t,n,a){const r=Yl(e);let l=TM(aa(e),n==="start",a);return r&&(l=l.map(i=>i+"-"+r),t&&(l=l.concat(l.map(cm)))),l}function Tu(e){return e.replace(/left|right|bottom|top/g,t=>kM[t])}function AM(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ww(e){return typeof e!="number"?AM(e):{top:e,right:e,bottom:e,left:e}}function Eu(e){const{x:t,y:n,width:a,height:r}=e;return{width:a,height:r,top:n,left:t,right:t+a,bottom:n+r,x:t,y:n}}function Pv(e,t,n){let{reference:a,floating:r}=e;const l=ws(t),i=nx(t),o=tx(i),c=aa(t),d=l==="y",f=a.x+a.width/2-r.width/2,h=a.y+a.height/2-r.height/2,m=a[o]/2-r[o]/2;let x;switch(c){case"top":x={x:f,y:a.y-r.height};break;case"bottom":x={x:f,y:a.y+a.height};break;case"right":x={x:a.x+a.width,y:h};break;case"left":x={x:a.x-r.width,y:h};break;default:x={x:a.x,y:a.y}}switch(Yl(t)){case"start":x[i]-=m*(n&&d?-1:1);break;case"end":x[i]+=m*(n&&d?-1:1);break}return x}const MM=async(e,t,n)=>{const{placement:a="bottom",strategy:r="absolute",middleware:l=[],platform:i}=n,o=l.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:h}=Pv(d,a,c),m=a,x={},b=0;for(let v=0;v<o.length;v++){const{name:y,fn:g}=o[v],{x:p,y:j,data:w,reset:N}=await g({x:f,y:h,initialPlacement:a,placement:m,strategy:r,middlewareData:x,rects:d,platform:i,elements:{reference:e,floating:t}});f=p??f,h=j??h,x={...x,[y]:{...x[y],...w}},N&&b<=50&&(b++,typeof N=="object"&&(N.placement&&(m=N.placement),N.rects&&(d=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):N.rects),{x:f,y:h}=Pv(d,m,c)),v=-1)}return{x:f,y:h,placement:m,strategy:r,middlewareData:x}};async function ro(e,t){var n;t===void 0&&(t={});const{x:a,y:r,platform:l,rects:i,elements:o,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:x=0}=sa(t,e),b=Ww(x),y=o[m?h==="floating"?"reference":"floating":h],g=Eu(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(y)))==null||n?y:y.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(o.floating)),boundary:d,rootBoundary:f,strategy:c})),p=h==="floating"?{x:a,y:r,width:i.floating.width,height:i.floating.height}:i.reference,j=await(l.getOffsetParent==null?void 0:l.getOffsetParent(o.floating)),w=await(l.isElement==null?void 0:l.isElement(j))?await(l.getScale==null?void 0:l.getScale(j))||{x:1,y:1}:{x:1,y:1},N=Eu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:p,offsetParent:j,strategy:c}):p);return{top:(g.top-N.top+b.top)/w.y,bottom:(N.bottom-g.bottom+b.bottom)/w.y,left:(g.left-N.left+b.left)/w.x,right:(N.right-g.right+b.right)/w.x}}const $M=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:r,rects:l,platform:i,elements:o,middlewareData:c}=t,{element:d,padding:f=0}=sa(e,t)||{};if(d==null)return{};const h=Ww(f),m={x:n,y:a},x=nx(r),b=tx(x),v=await i.getDimensions(d),y=x==="y",g=y?"top":"left",p=y?"bottom":"right",j=y?"clientHeight":"clientWidth",w=l.reference[b]+l.reference[x]-m[x]-l.floating[b],N=m[x]-l.reference[x],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let _=C?C[j]:0;(!_||!await(i.isElement==null?void 0:i.isElement(C)))&&(_=o.floating[j]||l.floating[b]);const S=w/2-N/2,D=_/2-v[b]/2-1,z=Ha(h[g],D),P=Ha(h[p],D),F=z,H=_-v[b]-P,A=_/2-v[b]/2+S,M=om(F,A,H),R=!c.arrow&&Yl(r)!=null&&A!==M&&l.reference[b]/2-(A<F?z:P)-v[b]/2<0,T=R?A<F?A-F:A-H:0;return{[x]:m[x]+T,data:{[x]:M,centerOffset:A-M-T,...R&&{alignmentOffset:T}},reset:R}}}),OM=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:r,middlewareData:l,rects:i,initialPlacement:o,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...y}=sa(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const g=aa(r),p=ws(o),j=aa(o)===o,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=m||(j||!v?[Tu(o)]:RM(o)),C=b!=="none";!m&&C&&N.push(...EM(o,v,b,w));const _=[o,...N],S=await ro(t,y),D=[];let z=((a=l.flip)==null?void 0:a.overflows)||[];if(f&&D.push(S[g]),h){const A=CM(r,i,w);D.push(S[A[0]],S[A[1]])}if(z=[...z,{placement:r,overflows:D}],!D.every(A=>A<=0)){var P,F;const A=(((P=l.flip)==null?void 0:P.index)||0)+1,M=_[A];if(M&&(!(h==="alignment"?p!==ws(M):!1)||z.every(k=>k.overflows[0]>0&&ws(k.placement)===p)))return{data:{index:A,overflows:z},reset:{placement:M}};let R=(F=z.filter(T=>T.overflows[0]<=0).sort((T,k)=>T.overflows[1]-k.overflows[1])[0])==null?void 0:F.placement;if(!R)switch(x){case"bestFit":{var H;const T=(H=z.filter(k=>{if(C){const O=ws(k.placement);return O===p||O==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(O=>O>0).reduce((O,Y)=>O+Y,0)]).sort((k,O)=>k[1]-O[1])[0])==null?void 0:H[0];T&&(R=T);break}case"initialPlacement":R=o;break}if(r!==R)return{reset:{placement:R}}}return{}}}};function qv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Gv(e){return NM.some(t=>e[t]>=0)}const DM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...r}=sa(e,t);switch(a){case"referenceHidden":{const l=await ro(t,{...r,elementContext:"reference"}),i=qv(l,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Gv(i)}}}case"escaped":{const l=await ro(t,{...r,altBoundary:!0}),i=qv(l,n.floating);return{data:{escapedOffsets:i,escaped:Gv(i)}}}default:return{}}}}};async function zM(e,t){const{placement:n,platform:a,elements:r}=e,l=await(a.isRTL==null?void 0:a.isRTL(r.floating)),i=aa(n),o=Yl(n),c=ws(n)==="y",d=["left","top"].includes(i)?-1:1,f=l&&c?-1:1,h=sa(t,e);let{mainAxis:m,crossAxis:x,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof b=="number"&&(x=o==="end"?b*-1:b),c?{x:x*f,y:m*d}:{x:m*d,y:x*f}}const LM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:r,y:l,placement:i,middlewareData:o}=t,c=await zM(t,e);return i===((n=o.offset)==null?void 0:n.placement)&&(a=o.arrow)!=null&&a.alignmentOffset?{}:{x:r+c.x,y:l+c.y,data:{...c,placement:i}}}}},UM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:r}=t,{mainAxis:l=!0,crossAxis:i=!1,limiter:o={fn:y=>{let{x:g,y:p}=y;return{x:g,y:p}}},...c}=sa(e,t),d={x:n,y:a},f=await ro(t,c),h=ws(aa(r)),m=ex(h);let x=d[m],b=d[h];if(l){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",p=x+f[y],j=x-f[g];x=om(p,x,j)}if(i){const y=h==="y"?"top":"left",g=h==="y"?"bottom":"right",p=b+f[y],j=b-f[g];b=om(p,b,j)}const v=o.fn({...t,[m]:x,[h]:b});return{...v,data:{x:v.x-n,y:v.y-a,enabled:{[m]:l,[h]:i}}}}}},BM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:r,rects:l,middlewareData:i}=t,{offset:o=0,mainAxis:c=!0,crossAxis:d=!0}=sa(e,t),f={x:n,y:a},h=ws(r),m=ex(h);let x=f[m],b=f[h];const v=sa(o,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const j=m==="y"?"height":"width",w=l.reference[m]-l.floating[j]+y.mainAxis,N=l.reference[m]+l.reference[j]-y.mainAxis;x<w?x=w:x>N&&(x=N)}if(d){var g,p;const j=m==="y"?"width":"height",w=["top","left"].includes(aa(r)),N=l.reference[h]-l.floating[j]+(w&&((g=i.offset)==null?void 0:g[h])||0)+(w?0:y.crossAxis),C=l.reference[h]+l.reference[j]+(w?0:((p=i.offset)==null?void 0:p[h])||0)-(w?y.crossAxis:0);b<N?b=N:b>C&&(b=C)}return{[m]:x,[h]:b}}}},HM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:r,rects:l,platform:i,elements:o}=t,{apply:c=()=>{},...d}=sa(e,t),f=await ro(t,d),h=aa(r),m=Yl(r),x=ws(r)==="y",{width:b,height:v}=l.floating;let y,g;h==="top"||h==="bottom"?(y=h,g=m===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=h,y=m==="end"?"top":"bottom");const p=v-f.top-f.bottom,j=b-f.left-f.right,w=Ha(v-f[y],p),N=Ha(b-f[g],j),C=!t.middlewareData.shift;let _=w,S=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=j),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(_=p),C&&!m){const z=Sn(f.left,0),P=Sn(f.right,0),F=Sn(f.top,0),H=Sn(f.bottom,0);x?S=b-2*(z!==0||P!==0?z+P:Sn(f.left,f.right)):_=v-2*(F!==0||H!==0?F+H:Sn(f.top,f.bottom))}await c({...t,availableWidth:S,availableHeight:_});const D=await i.getDimensions(o.floating);return b!==D.width||v!==D.height?{reset:{rects:!0}}:{}}}};function Sd(){return typeof window<"u"}function Fl(e){return Zw(e)?(e.nodeName||"").toLowerCase():"#document"}function Mn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ds(e){var t;return(t=(Zw(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Zw(e){return Sd()?e instanceof Node||e instanceof Mn(e).Node:!1}function is(e){return Sd()?e instanceof Element||e instanceof Mn(e).Element:!1}function As(e){return Sd()?e instanceof HTMLElement||e instanceof Mn(e).HTMLElement:!1}function Vv(e){return!Sd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mn(e).ShadowRoot}function Ho(e){const{overflow:t,overflowX:n,overflowY:a,display:r}=os(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!["inline","contents"].includes(r)}function IM(e){return["table","td","th"].includes(Fl(e))}function Cd(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function sx(e){const t=ax(),n=is(e)?os(e):e;return["transform","translate","scale","rotate","perspective"].some(a=>n[a]?n[a]!=="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(a=>(n.willChange||"").includes(a))||["paint","layout","strict","content"].some(a=>(n.contain||"").includes(a))}function PM(e){let t=Ia(e);for(;As(t)&&!El(t);){if(sx(t))return t;if(Cd(t))return null;t=Ia(t)}return null}function ax(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function El(e){return["html","body","#document"].includes(Fl(e))}function os(e){return Mn(e).getComputedStyle(e)}function Rd(e){return is(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ia(e){if(Fl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Vv(e)&&e.host||Ds(e);return Vv(t)?t.host:t}function Jw(e){const t=Ia(e);return El(t)?e.ownerDocument?e.ownerDocument.body:e.body:As(t)&&Ho(t)?t:Jw(t)}function lo(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Jw(e),l=r===((a=e.ownerDocument)==null?void 0:a.body),i=Mn(r);if(l){const o=um(i);return t.concat(i,i.visualViewport||[],Ho(r)?r:[],o&&n?lo(o):[])}return t.concat(r,lo(r,[],n))}function um(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function e_(e){const t=os(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const r=As(e),l=r?e.offsetWidth:n,i=r?e.offsetHeight:a,o=Ru(n)!==l||Ru(a)!==i;return o&&(n=l,a=i),{width:n,height:a,$:o}}function rx(e){return is(e)?e:e.contextElement}function ml(e){const t=rx(e);if(!As(t))return Cs(1);const n=t.getBoundingClientRect(),{width:a,height:r,$:l}=e_(t);let i=(l?Ru(n.width):n.width)/a,o=(l?Ru(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!o||!Number.isFinite(o))&&(o=1),{x:i,y:o}}const qM=Cs(0);function t_(e){const t=Mn(e);return!ax()||!t.visualViewport?qM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function GM(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mn(e)?!1:t}function gr(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),l=rx(e);let i=Cs(1);t&&(a?is(a)&&(i=ml(a)):i=ml(e));const o=GM(l,n,a)?t_(l):Cs(0);let c=(r.left+o.x)/i.x,d=(r.top+o.y)/i.y,f=r.width/i.x,h=r.height/i.y;if(l){const m=Mn(l),x=a&&is(a)?Mn(a):a;let b=m,v=um(b);for(;v&&a&&x!==b;){const y=ml(v),g=v.getBoundingClientRect(),p=os(v),j=g.left+(v.clientLeft+parseFloat(p.paddingLeft))*y.x,w=g.top+(v.clientTop+parseFloat(p.paddingTop))*y.y;c*=y.x,d*=y.y,f*=y.x,h*=y.y,c+=j,d+=w,b=Mn(v),v=um(b)}}return Eu({width:f,height:h,x:c,y:d})}function lx(e,t){const n=Rd(e).scrollLeft;return t?t.left+n:gr(Ds(e)).left+n}function n_(e,t,n){n===void 0&&(n=!1);const a=e.getBoundingClientRect(),r=a.left+t.scrollLeft-(n?0:lx(e,a)),l=a.top+t.scrollTop;return{x:r,y:l}}function VM(e){let{elements:t,rect:n,offsetParent:a,strategy:r}=e;const l=r==="fixed",i=Ds(a),o=t?Cd(t.floating):!1;if(a===i||o&&l)return n;let c={scrollLeft:0,scrollTop:0},d=Cs(1);const f=Cs(0),h=As(a);if((h||!h&&!l)&&((Fl(a)!=="body"||Ho(i))&&(c=Rd(a)),As(a))){const x=gr(a);d=ml(a),f.x=x.x+a.clientLeft,f.y=x.y+a.clientTop}const m=i&&!h&&!l?n_(i,c,!0):Cs(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function YM(e){return Array.from(e.getClientRects())}function FM(e){const t=Ds(e),n=Rd(e),a=e.ownerDocument.body,r=Sn(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=Sn(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-n.scrollLeft+lx(e);const o=-n.scrollTop;return os(a).direction==="rtl"&&(i+=Sn(t.clientWidth,a.clientWidth)-r),{width:r,height:l,x:i,y:o}}function KM(e,t){const n=Mn(e),a=Ds(e),r=n.visualViewport;let l=a.clientWidth,i=a.clientHeight,o=0,c=0;if(r){l=r.width,i=r.height;const d=ax();(!d||d&&t==="fixed")&&(o=r.offsetLeft,c=r.offsetTop)}return{width:l,height:i,x:o,y:c}}function XM(e,t){const n=gr(e,!0,t==="fixed"),a=n.top+e.clientTop,r=n.left+e.clientLeft,l=As(e)?ml(e):Cs(1),i=e.clientWidth*l.x,o=e.clientHeight*l.y,c=r*l.x,d=a*l.y;return{width:i,height:o,x:c,y:d}}function Yv(e,t,n){let a;if(t==="viewport")a=KM(e,n);else if(t==="document")a=FM(Ds(e));else if(is(t))a=XM(t,n);else{const r=t_(e);a={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Eu(a)}function s_(e,t){const n=Ia(e);return n===t||!is(n)||El(n)?!1:os(n).position==="fixed"||s_(n,t)}function QM(e,t){const n=t.get(e);if(n)return n;let a=lo(e,[],!1).filter(o=>is(o)&&Fl(o)!=="body"),r=null;const l=os(e).position==="fixed";let i=l?Ia(e):e;for(;is(i)&&!El(i);){const o=os(i),c=sx(i);!c&&o.position==="fixed"&&(r=null),(l?!c&&!r:!c&&o.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||Ho(i)&&!c&&s_(e,i))?a=a.filter(f=>f!==i):r=o,i=Ia(i)}return t.set(e,a),a}function WM(e){let{element:t,boundary:n,rootBoundary:a,strategy:r}=e;const i=[...n==="clippingAncestors"?Cd(t)?[]:QM(t,this._c):[].concat(n),a],o=i[0],c=i.reduce((d,f)=>{const h=Yv(t,f,r);return d.top=Sn(h.top,d.top),d.right=Ha(h.right,d.right),d.bottom=Ha(h.bottom,d.bottom),d.left=Sn(h.left,d.left),d},Yv(t,o,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function ZM(e){const{width:t,height:n}=e_(e);return{width:t,height:n}}function JM(e,t,n){const a=As(t),r=Ds(t),l=n==="fixed",i=gr(e,!0,l,t);let o={scrollLeft:0,scrollTop:0};const c=Cs(0);function d(){c.x=lx(r)}if(a||!a&&!l)if((Fl(t)!=="body"||Ho(r))&&(o=Rd(t)),a){const x=gr(t,!0,l,t);c.x=x.x+t.clientLeft,c.y=x.y+t.clientTop}else r&&d();l&&!a&&r&&d();const f=r&&!a&&!l?n_(r,o):Cs(0),h=i.left+o.scrollLeft-c.x-f.x,m=i.top+o.scrollTop-c.y-f.y;return{x:h,y:m,width:i.width,height:i.height}}function qf(e){return os(e).position==="static"}function Fv(e,t){if(!As(e)||os(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ds(e)===n&&(n=n.ownerDocument.body),n}function a_(e,t){const n=Mn(e);if(Cd(e))return n;if(!As(e)){let r=Ia(e);for(;r&&!El(r);){if(is(r)&&!qf(r))return r;r=Ia(r)}return n}let a=Fv(e,t);for(;a&&IM(a)&&qf(a);)a=Fv(a,t);return a&&El(a)&&qf(a)&&!sx(a)?n:a||PM(e)||n}const e$=async function(e){const t=this.getOffsetParent||a_,n=this.getDimensions,a=await n(e.floating);return{reference:JM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function t$(e){return os(e).direction==="rtl"}const n$={convertOffsetParentRelativeRectToViewportRelativeRect:VM,getDocumentElement:Ds,getClippingRect:WM,getOffsetParent:a_,getElementRects:e$,getClientRects:YM,getDimensions:ZM,getScale:ml,isElement:is,isRTL:t$};function r_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function s$(e,t){let n=null,a;const r=Ds(e);function l(){var o;clearTimeout(a),(o=n)==null||o.disconnect(),n=null}function i(o,c){o===void 0&&(o=!1),c===void 0&&(c=1),l();const d=e.getBoundingClientRect(),{left:f,top:h,width:m,height:x}=d;if(o||t(),!m||!x)return;const b=vc(h),v=vc(r.clientWidth-(f+m)),y=vc(r.clientHeight-(h+x)),g=vc(f),j={rootMargin:-b+"px "+-v+"px "+-y+"px "+-g+"px",threshold:Sn(0,Ha(1,c))||1};let w=!0;function N(C){const _=C[0].intersectionRatio;if(_!==c){if(!w)return i();_?i(!1,_):a=setTimeout(()=>{i(!1,1e-7)},1e3)}_===1&&!r_(d,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(N,{...j,root:r.ownerDocument})}catch{n=new IntersectionObserver(N,j)}n.observe(e)}return i(!0),l}function a$(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:r=!0,ancestorResize:l=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,d=rx(e),f=r||l?[...d?lo(d):[],...lo(t)]:[];f.forEach(g=>{r&&g.addEventListener("scroll",n,{passive:!0}),l&&g.addEventListener("resize",n)});const h=d&&o?s$(d,n):null;let m=-1,x=null;i&&(x=new ResizeObserver(g=>{let[p]=g;p&&p.target===d&&x&&(x.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var j;(j=x)==null||j.observe(t)})),n()}),d&&!c&&x.observe(d),x.observe(t));let b,v=c?gr(e):null;c&&y();function y(){const g=gr(e);v&&!r_(v,g)&&n(),v=g,b=requestAnimationFrame(y)}return n(),()=>{var g;f.forEach(p=>{r&&p.removeEventListener("scroll",n),l&&p.removeEventListener("resize",n)}),h==null||h(),(g=x)==null||g.disconnect(),x=null,c&&cancelAnimationFrame(b)}}const r$=LM,l$=UM,i$=OM,o$=HM,c$=DM,Kv=$M,u$=BM,d$=(e,t,n)=>{const a=new Map,r={platform:n$,...n},l={...r.platform,_c:a};return MM(e,t,{...r,platform:l})};var f$=typeof document<"u",h$=function(){},qc=f$?u.useLayoutEffect:h$;function Au(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,a,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(a=n;a--!==0;)if(!Au(e[a],t[a]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,r[a]))return!1;for(a=n;a--!==0;){const l=r[a];if(!(l==="_owner"&&e.$$typeof)&&!Au(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function l_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xv(e,t){const n=l_(e);return Math.round(t*n)/n}function Gf(e){const t=u.useRef(e);return qc(()=>{t.current=e}),t}function m$(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:r,elements:{reference:l,floating:i}={},transform:o=!0,whileElementsMounted:c,open:d}=e,[f,h]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,x]=u.useState(a);Au(m,a)||x(a);const[b,v]=u.useState(null),[y,g]=u.useState(null),p=u.useCallback(k=>{k!==C.current&&(C.current=k,v(k))},[]),j=u.useCallback(k=>{k!==_.current&&(_.current=k,g(k))},[]),w=l||b,N=i||y,C=u.useRef(null),_=u.useRef(null),S=u.useRef(f),D=c!=null,z=Gf(c),P=Gf(r),F=Gf(d),H=u.useCallback(()=>{if(!C.current||!_.current)return;const k={placement:t,strategy:n,middleware:m};P.current&&(k.platform=P.current),d$(C.current,_.current,k).then(O=>{const Y={...O,isPositioned:F.current!==!1};A.current&&!Au(S.current,Y)&&(S.current=Y,Ol.flushSync(()=>{h(Y)}))})},[m,t,n,P,F]);qc(()=>{d===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,h(k=>({...k,isPositioned:!1})))},[d]);const A=u.useRef(!1);qc(()=>(A.current=!0,()=>{A.current=!1}),[]),qc(()=>{if(w&&(C.current=w),N&&(_.current=N),w&&N){if(z.current)return z.current(w,N,H);H()}},[w,N,H,z,D]);const M=u.useMemo(()=>({reference:C,floating:_,setReference:p,setFloating:j}),[p,j]),R=u.useMemo(()=>({reference:w,floating:N}),[w,N]),T=u.useMemo(()=>{const k={position:n,left:0,top:0};if(!R.floating)return k;const O=Xv(R.floating,f.x),Y=Xv(R.floating,f.y);return o?{...k,transform:"translate("+O+"px, "+Y+"px)",...l_(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:Y}},[n,o,R.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:H,refs:M,elements:R,floatingStyles:T}),[f,H,M,R,T])}const p$=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:a,padding:r}=typeof e=="function"?e(n):e;return a&&t(a)?a.current!=null?Kv({element:a.current,padding:r}).fn(n):{}:a?Kv({element:a,padding:r}).fn(n):{}}}},x$=(e,t)=>({...r$(e),options:[e,t]}),g$=(e,t)=>({...l$(e),options:[e,t]}),v$=(e,t)=>({...u$(e),options:[e,t]}),y$=(e,t)=>({...i$(e),options:[e,t]}),j$=(e,t)=>({...o$(e),options:[e,t]}),b$=(e,t)=>({...c$(e),options:[e,t]}),w$=(e,t)=>({...p$(e),options:[e,t]});var _$="Arrow",i_=u.forwardRef((e,t)=>{const{children:n,width:a=10,height:r=5,...l}=e;return s.jsx(Se.svg,{...l,ref:t,width:a,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});i_.displayName=_$;var N$=i_,ix="Popper",[o_,Kl]=Os(ix),[k$,c_]=o_(ix),u_=e=>{const{__scopePopper:t,children:n}=e,[a,r]=u.useState(null);return s.jsx(k$,{scope:t,anchor:a,onAnchorChange:r,children:n})};u_.displayName=ix;var d_="PopperAnchor",f_=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...r}=e,l=c_(d_,n),i=u.useRef(null),o=Ve(t,i);return u.useEffect(()=>{l.onAnchorChange((a==null?void 0:a.current)||i.current)}),a?null:s.jsx(Se.div,{...r,ref:o})});f_.displayName=d_;var ox="PopperContent",[S$,C$]=o_(ox),h_=u.forwardRef((e,t)=>{var L,q,ne,ae,je,re;const{__scopePopper:n,side:a="bottom",sideOffset:r=0,align:l="center",alignOffset:i=0,arrowPadding:o=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:x="optimized",onPlaced:b,...v}=e,y=c_(ox,n),[g,p]=u.useState(null),j=Ve(t,we=>p(we)),[w,N]=u.useState(null),C=qw(w),_=(C==null?void 0:C.width)??0,S=(C==null?void 0:C.height)??0,D=a+(l!=="center"?"-"+l:""),z=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},P=Array.isArray(d)?d:[d],F=P.length>0,H={padding:z,boundary:P.filter(T$),altBoundary:F},{refs:A,floatingStyles:M,placement:R,isPositioned:T,middlewareData:k}=m$({strategy:"fixed",placement:D,whileElementsMounted:(...we)=>a$(...we,{animationFrame:x==="always"}),elements:{reference:y.anchor},middleware:[x$({mainAxis:r+S,alignmentAxis:i}),c&&g$({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?v$():void 0,...H}),c&&y$({...H}),j$({...H,apply:({elements:we,rects:se,availableWidth:tt,availableHeight:ge})=>{const{width:He,height:J}=se.reference,ke=we.floating.style;ke.setProperty("--radix-popper-available-width",`${tt}px`),ke.setProperty("--radix-popper-available-height",`${ge}px`),ke.setProperty("--radix-popper-anchor-width",`${He}px`),ke.setProperty("--radix-popper-anchor-height",`${J}px`)}}),w&&w$({element:w,padding:o}),E$({arrowWidth:_,arrowHeight:S}),m&&b$({strategy:"referenceHidden",...H})]}),[O,Y]=x_(R),E=Es(b);Ft(()=>{T&&(E==null||E())},[T,E]);const I=(L=k.arrow)==null?void 0:L.x,Q=(q=k.arrow)==null?void 0:q.y,te=((ne=k.arrow)==null?void 0:ne.centerOffset)!==0,[ce,X]=u.useState();return Ft(()=>{g&&X(window.getComputedStyle(g).zIndex)},[g]),s.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:T?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(ae=k.transformOrigin)==null?void 0:ae.x,(je=k.transformOrigin)==null?void 0:je.y].join(" "),...((re=k.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(S$,{scope:n,placedSide:O,onArrowChange:N,arrowX:I,arrowY:Q,shouldHideArrow:te,children:s.jsx(Se.div,{"data-side":O,"data-align":Y,...v,ref:j,style:{...v.style,animation:T?void 0:"none"}})})})});h_.displayName=ox;var m_="PopperArrow",R$={top:"bottom",right:"left",bottom:"top",left:"right"},p_=u.forwardRef(function(t,n){const{__scopePopper:a,...r}=t,l=C$(m_,a),i=R$[l.placedSide];return s.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:s.jsx(N$,{...r,ref:n,style:{...r.style,display:"block"}})})});p_.displayName=m_;function T$(e){return e!==null}var E$=e=>({name:"transformOrigin",options:e,fn(t){var y,g,p;const{placement:n,rects:a,middlewareData:r}=t,i=((y=r.arrow)==null?void 0:y.centerOffset)!==0,o=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=x_(n),h={start:"0%",center:"50%",end:"100%"}[f],m=(((g=r.arrow)==null?void 0:g.x)??0)+o/2,x=(((p=r.arrow)==null?void 0:p.y)??0)+c/2;let b="",v="";return d==="bottom"?(b=i?h:`${m}px`,v=`${-c}px`):d==="top"?(b=i?h:`${m}px`,v=`${a.floating.height+c}px`):d==="right"?(b=`${-c}px`,v=i?h:`${x}px`):d==="left"&&(b=`${a.floating.width+c}px`,v=i?h:`${x}px`),{data:{x:b,y:v}}}});function x_(e){const[t,n="center"]=e.split("-");return[t,n]}var cx=u_,ux=f_,dx=h_,fx=p_,Vf="rovingFocusGroup.onEntryFocus",A$={bubbles:!1,cancelable:!0},Io="RovingFocusGroup",[dm,g_,M$]=Jp(Io),[$$,Td]=Os(Io,[M$]),[O$,D$]=$$(Io),v_=u.forwardRef((e,t)=>s.jsx(dm.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(dm.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(z$,{...e,ref:t})})}));v_.displayName=Io;var z$=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:r=!1,dir:l,currentTabStopId:i,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,m=u.useRef(null),x=Ve(t,m),b=kd(l),[v,y]=Ba({prop:i,defaultProp:o??null,onChange:c,caller:Io}),[g,p]=u.useState(!1),j=Es(d),w=g_(n),N=u.useRef(!1),[C,_]=u.useState(0);return u.useEffect(()=>{const S=m.current;if(S)return S.addEventListener(Vf,j),()=>S.removeEventListener(Vf,j)},[j]),s.jsx(O$,{scope:n,orientation:a,dir:b,loop:r,currentTabStopId:v,onItemFocus:u.useCallback(S=>y(S),[y]),onItemShiftTab:u.useCallback(()=>p(!0),[]),onFocusableItemAdd:u.useCallback(()=>_(S=>S+1),[]),onFocusableItemRemove:u.useCallback(()=>_(S=>S-1),[]),children:s.jsx(Se.div,{tabIndex:g||C===0?-1:0,"data-orientation":a,...h,ref:x,style:{outline:"none",...e.style},onMouseDown:fe(e.onMouseDown,()=>{N.current=!0}),onFocus:fe(e.onFocus,S=>{const D=!N.current;if(S.target===S.currentTarget&&D&&!g){const z=new CustomEvent(Vf,A$);if(S.currentTarget.dispatchEvent(z),!z.defaultPrevented){const P=w().filter(R=>R.focusable),F=P.find(R=>R.active),H=P.find(R=>R.id===v),M=[F,H,...P].filter(Boolean).map(R=>R.ref.current);b_(M,f)}}N.current=!1}),onBlur:fe(e.onBlur,()=>p(!1))})})}),y_="RovingFocusGroupItem",j_=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:r=!1,tabStopId:l,children:i,...o}=e,c=as(),d=l||c,f=D$(y_,n),h=f.currentTabStopId===d,m=g_(n),{onFocusableItemAdd:x,onFocusableItemRemove:b,currentTabStopId:v}=f;return u.useEffect(()=>{if(a)return x(),()=>b()},[a,x,b]),s.jsx(dm.ItemSlot,{scope:n,id:d,focusable:a,active:r,children:s.jsx(Se.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...o,ref:t,onMouseDown:fe(e.onMouseDown,y=>{a?f.onItemFocus(d):y.preventDefault()}),onFocus:fe(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:fe(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=B$(y,f.orientation,f.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let j=m().filter(w=>w.focusable).map(w=>w.ref.current);if(g==="last")j.reverse();else if(g==="prev"||g==="next"){g==="prev"&&j.reverse();const w=j.indexOf(y.currentTarget);j=f.loop?H$(j,w+1):j.slice(w+1)}setTimeout(()=>b_(j))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:v!=null}):i})})});j_.displayName=y_;var L$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function U$(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function B$(e,t,n){const a=U$(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return L$[a]}function b_(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function H$(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var w_=v_,__=j_,fm=["Enter"," "],I$=["ArrowDown","PageUp","Home"],N_=["ArrowUp","PageDown","End"],P$=[...I$,...N_],q$={ltr:[...fm,"ArrowRight"],rtl:[...fm,"ArrowLeft"]},G$={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Po="Menu",[io,V$,Y$]=Jp(Po),[Sr,k_]=Os(Po,[Y$,Kl,Td]),Ed=Kl(),S_=Td(),[F$,Cr]=Sr(Po),[K$,qo]=Sr(Po),C_=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:r,onOpenChange:l,modal:i=!0}=e,o=Ed(t),[c,d]=u.useState(null),f=u.useRef(!1),h=Es(l),m=kd(r);return u.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),s.jsx(cx,{...o,children:s.jsx(F$,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:s.jsx(K$,{scope:t,onClose:u.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:m,modal:i,children:a})})})};C_.displayName=Po;var X$="MenuAnchor",hx=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Ed(n);return s.jsx(ux,{...r,...a,ref:t})});hx.displayName=X$;var mx="MenuPortal",[Q$,R_]=Sr(mx,{forceMount:void 0}),T_=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:r}=e,l=Cr(mx,t);return s.jsx(Q$,{scope:t,forceMount:n,children:s.jsx(Qn,{present:n||l.open,children:s.jsx(Lo,{asChild:!0,container:r,children:a})})})};T_.displayName=mx;var Vn="MenuContent",[W$,px]=Sr(Vn),E_=u.forwardRef((e,t)=>{const n=R_(Vn,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,l=Cr(Vn,e.__scopeMenu),i=qo(Vn,e.__scopeMenu);return s.jsx(io.Provider,{scope:e.__scopeMenu,children:s.jsx(Qn,{present:a||l.open,children:s.jsx(io.Slot,{scope:e.__scopeMenu,children:i.modal?s.jsx(Z$,{...r,ref:t}):s.jsx(J$,{...r,ref:t})})})})}),Z$=u.forwardRef((e,t)=>{const n=Cr(Vn,e.__scopeMenu),a=u.useRef(null),r=Ve(t,a);return u.useEffect(()=>{const l=a.current;if(l)return Bp(l)},[]),s.jsx(xx,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:fe(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),J$=u.forwardRef((e,t)=>{const n=Cr(Vn,e.__scopeMenu);return s.jsx(xx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),eO=pr("MenuContent.ScrollLock"),xx=u.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:r,onOpenAutoFocus:l,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,disableOutsideScroll:b,...v}=e,y=Cr(Vn,n),g=qo(Vn,n),p=Ed(n),j=S_(n),w=V$(n),[N,C]=u.useState(null),_=u.useRef(null),S=Ve(t,_,y.onContentChange),D=u.useRef(0),z=u.useRef(""),P=u.useRef(0),F=u.useRef(null),H=u.useRef("right"),A=u.useRef(0),M=b?bd:u.Fragment,R=b?{as:eO,allowPinchZoom:!0}:void 0,T=O=>{var L,q;const Y=z.current+O,E=w().filter(ne=>!ne.disabled),I=document.activeElement,Q=(L=E.find(ne=>ne.ref.current===I))==null?void 0:L.textValue,te=E.map(ne=>ne.textValue),ce=fO(te,Y,Q),X=(q=E.find(ne=>ne.textValue===ce))==null?void 0:q.ref.current;(function ne(ae){z.current=ae,window.clearTimeout(D.current),ae!==""&&(D.current=window.setTimeout(()=>ne(""),1e3))})(Y),X&&setTimeout(()=>X.focus())};u.useEffect(()=>()=>window.clearTimeout(D.current),[]),Up();const k=u.useCallback(O=>{var E,I;return H.current===((E=F.current)==null?void 0:E.side)&&mO(O,(I=F.current)==null?void 0:I.area)},[]);return s.jsx(W$,{scope:n,searchRef:z,onItemEnter:u.useCallback(O=>{k(O)&&O.preventDefault()},[k]),onItemLeave:u.useCallback(O=>{var Y;k(O)||((Y=_.current)==null||Y.focus(),C(null))},[k]),onTriggerLeave:u.useCallback(O=>{k(O)&&O.preventDefault()},[k]),pointerGraceTimerRef:P,onPointerGraceIntentChange:u.useCallback(O=>{F.current=O},[]),children:s.jsx(M,{...R,children:s.jsx(yd,{asChild:!0,trapped:r,onMountAutoFocus:fe(l,O=>{var Y;O.preventDefault(),(Y=_.current)==null||Y.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:s.jsx(zo,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,children:s.jsx(w_,{asChild:!0,...j,dir:g.dir,orientation:"vertical",loop:a,currentTabStopId:N,onCurrentTabStopIdChange:C,onEntryFocus:fe(c,O=>{g.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(dx,{role:"menu","aria-orientation":"vertical","data-state":Y_(y.open),"data-radix-menu-content":"",dir:g.dir,...p,...v,ref:S,style:{outline:"none",...v.style},onKeyDown:fe(v.onKeyDown,O=>{const E=O.target.closest("[data-radix-menu-content]")===O.currentTarget,I=O.ctrlKey||O.altKey||O.metaKey,Q=O.key.length===1;E&&(O.key==="Tab"&&O.preventDefault(),!I&&Q&&T(O.key));const te=_.current;if(O.target!==te||!P$.includes(O.key))return;O.preventDefault();const X=w().filter(L=>!L.disabled).map(L=>L.ref.current);N_.includes(O.key)&&X.reverse(),uO(X)}),onBlur:fe(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(D.current),z.current="")}),onPointerMove:fe(e.onPointerMove,oo(O=>{const Y=O.target,E=A.current!==O.clientX;if(O.currentTarget.contains(Y)&&E){const I=O.clientX>A.current?"right":"left";H.current=I,A.current=O.clientX}}))})})})})})})});E_.displayName=Vn;var tO="MenuGroup",gx=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Se.div,{role:"group",...a,ref:t})});gx.displayName=tO;var nO="MenuLabel",A_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Se.div,{...a,ref:t})});A_.displayName=nO;var Mu="MenuItem",Qv="menu.itemSelect",Ad=u.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...r}=e,l=u.useRef(null),i=qo(Mu,e.__scopeMenu),o=px(Mu,e.__scopeMenu),c=Ve(t,l),d=u.useRef(!1),f=()=>{const h=l.current;if(!n&&h){const m=new CustomEvent(Qv,{bubbles:!0,cancelable:!0});h.addEventListener(Qv,x=>a==null?void 0:a(x),{once:!0}),iw(h,m),m.defaultPrevented?d.current=!1:i.onClose()}};return s.jsx(M_,{...r,ref:c,disabled:n,onClick:fe(e.onClick,f),onPointerDown:h=>{var m;(m=e.onPointerDown)==null||m.call(e,h),d.current=!0},onPointerUp:fe(e.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:fe(e.onKeyDown,h=>{const m=o.searchRef.current!=="";n||m&&h.key===" "||fm.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Ad.displayName=Mu;var M_=u.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:r,...l}=e,i=px(Mu,n),o=S_(n),c=u.useRef(null),d=Ve(t,c),[f,h]=u.useState(!1),[m,x]=u.useState("");return u.useEffect(()=>{const b=c.current;b&&x((b.textContent??"").trim())},[l.children]),s.jsx(io.ItemSlot,{scope:n,disabled:a,textValue:r??m,children:s.jsx(__,{asChild:!0,...o,focusable:!a,children:s.jsx(Se.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...l,ref:d,onPointerMove:fe(e.onPointerMove,oo(b=>{a?i.onItemLeave(b):(i.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:fe(e.onPointerLeave,oo(b=>i.onItemLeave(b))),onFocus:fe(e.onFocus,()=>h(!0)),onBlur:fe(e.onBlur,()=>h(!1))})})})}),sO="MenuCheckboxItem",$_=u.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...r}=e;return s.jsx(U_,{scope:e.__scopeMenu,checked:n,children:s.jsx(Ad,{role:"menuitemcheckbox","aria-checked":$u(n)?"mixed":n,...r,ref:t,"data-state":yx(n),onSelect:fe(r.onSelect,()=>a==null?void 0:a($u(n)?!0:!n),{checkForDefaultPrevented:!1})})})});$_.displayName=sO;var O_="MenuRadioGroup",[aO,rO]=Sr(O_,{value:void 0,onValueChange:()=>{}}),D_=u.forwardRef((e,t)=>{const{value:n,onValueChange:a,...r}=e,l=Es(a);return s.jsx(aO,{scope:e.__scopeMenu,value:n,onValueChange:l,children:s.jsx(gx,{...r,ref:t})})});D_.displayName=O_;var z_="MenuRadioItem",L_=u.forwardRef((e,t)=>{const{value:n,...a}=e,r=rO(z_,e.__scopeMenu),l=n===r.value;return s.jsx(U_,{scope:e.__scopeMenu,checked:l,children:s.jsx(Ad,{role:"menuitemradio","aria-checked":l,...a,ref:t,"data-state":yx(l),onSelect:fe(a.onSelect,()=>{var i;return(i=r.onValueChange)==null?void 0:i.call(r,n)},{checkForDefaultPrevented:!1})})})});L_.displayName=z_;var vx="MenuItemIndicator",[U_,lO]=Sr(vx,{checked:!1}),B_=u.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...r}=e,l=lO(vx,n);return s.jsx(Qn,{present:a||$u(l.checked)||l.checked===!0,children:s.jsx(Se.span,{...r,ref:t,"data-state":yx(l.checked)})})});B_.displayName=vx;var iO="MenuSeparator",H_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Se.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});H_.displayName=iO;var oO="MenuArrow",I_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Ed(n);return s.jsx(fx,{...r,...a,ref:t})});I_.displayName=oO;var cO="MenuSub",[u8,P_]=Sr(cO),bi="MenuSubTrigger",q_=u.forwardRef((e,t)=>{const n=Cr(bi,e.__scopeMenu),a=qo(bi,e.__scopeMenu),r=P_(bi,e.__scopeMenu),l=px(bi,e.__scopeMenu),i=u.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:c}=l,d={__scopeMenu:e.__scopeMenu},f=u.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return u.useEffect(()=>f,[f]),u.useEffect(()=>{const h=o.current;return()=>{window.clearTimeout(h),c(null)}},[o,c]),s.jsx(hx,{asChild:!0,...d,children:s.jsx(M_,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Y_(n.open),...e,ref:vd(t,r.onTriggerChange),onClick:h=>{var m;(m=e.onClick)==null||m.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:fe(e.onPointerMove,oo(h=>{l.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(l.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:fe(e.onPointerLeave,oo(h=>{var x,b;f();const m=(x=n.content)==null?void 0:x.getBoundingClientRect();if(m){const v=(b=n.content)==null?void 0:b.dataset.side,y=v==="right",g=y?-5:5,p=m[y?"left":"right"],j=m[y?"right":"left"];l.onPointerGraceIntentChange({area:[{x:h.clientX+g,y:h.clientY},{x:p,y:m.top},{x:j,y:m.top},{x:j,y:m.bottom},{x:p,y:m.bottom}],side:v}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(h),h.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:fe(e.onKeyDown,h=>{var x;const m=l.searchRef.current!=="";e.disabled||m&&h.key===" "||q$[a.dir].includes(h.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),h.preventDefault())})})})});q_.displayName=bi;var G_="MenuSubContent",V_=u.forwardRef((e,t)=>{const n=R_(Vn,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,l=Cr(Vn,e.__scopeMenu),i=qo(Vn,e.__scopeMenu),o=P_(G_,e.__scopeMenu),c=u.useRef(null),d=Ve(t,c);return s.jsx(io.Provider,{scope:e.__scopeMenu,children:s.jsx(Qn,{present:a||l.open,children:s.jsx(io.Slot,{scope:e.__scopeMenu,children:s.jsx(xx,{id:o.contentId,"aria-labelledby":o.triggerId,...r,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;i.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:fe(e.onFocusOutside,f=>{f.target!==o.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:fe(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:fe(e.onKeyDown,f=>{var x;const h=f.currentTarget.contains(f.target),m=G$[i.dir].includes(f.key);h&&m&&(l.onOpenChange(!1),(x=o.trigger)==null||x.focus(),f.preventDefault())})})})})})});V_.displayName=G_;function Y_(e){return e?"open":"closed"}function $u(e){return e==="indeterminate"}function yx(e){return $u(e)?"indeterminate":e?"checked":"unchecked"}function uO(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function dO(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function fO(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let i=dO(e,Math.max(l,0));r.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function hO(e,t){const{x:n,y:a}=e;let r=!1;for(let l=0,i=t.length-1;l<t.length;i=l++){const o=t[l],c=t[i],d=o.x,f=o.y,h=c.x,m=c.y;f>a!=m>a&&n<(h-d)*(a-f)/(m-f)+d&&(r=!r)}return r}function mO(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return hO(n,t)}function oo(e){return t=>t.pointerType==="mouse"?e(t):void 0}var pO=C_,xO=hx,gO=T_,vO=E_,yO=gx,jO=A_,bO=Ad,wO=$_,_O=D_,NO=L_,kO=B_,SO=H_,CO=I_,RO=q_,TO=V_,Md="DropdownMenu",[EO]=Os(Md,[k_]),Jt=k_(),[AO,F_]=EO(Md),K_=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:r,defaultOpen:l,onOpenChange:i,modal:o=!0}=e,c=Jt(t),d=u.useRef(null),[f,h]=Ba({prop:r,defaultProp:l??!1,onChange:i,caller:Md});return s.jsx(AO,{scope:t,triggerId:as(),triggerRef:d,contentId:as(),open:f,onOpenChange:h,onOpenToggle:u.useCallback(()=>h(m=>!m),[h]),modal:o,children:s.jsx(pO,{...c,open:f,onOpenChange:h,dir:a,modal:o,children:n})})};K_.displayName=Md;var X_="DropdownMenuTrigger",Q_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...r}=e,l=F_(X_,n),i=Jt(n);return s.jsx(xO,{asChild:!0,...i,children:s.jsx(Se.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...r,ref:vd(t,l.triggerRef),onPointerDown:fe(e.onPointerDown,o=>{!a&&o.button===0&&o.ctrlKey===!1&&(l.onOpenToggle(),l.open||o.preventDefault())}),onKeyDown:fe(e.onKeyDown,o=>{a||(["Enter"," "].includes(o.key)&&l.onOpenToggle(),o.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});Q_.displayName=X_;var MO="DropdownMenuPortal",W_=e=>{const{__scopeDropdownMenu:t,...n}=e,a=Jt(t);return s.jsx(gO,{...a,...n})};W_.displayName=MO;var Z_="DropdownMenuContent",J_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=F_(Z_,n),l=Jt(n),i=u.useRef(!1);return s.jsx(vO,{id:r.contentId,"aria-labelledby":r.triggerId,...l,...a,ref:t,onCloseAutoFocus:fe(e.onCloseAutoFocus,o=>{var c;i.current||(c=r.triggerRef.current)==null||c.focus(),i.current=!1,o.preventDefault()}),onInteractOutside:fe(e.onInteractOutside,o=>{const c=o.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!r.modal||f)&&(i.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)"}})});J_.displayName=Z_;var $O="DropdownMenuGroup",OO=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(yO,{...r,...a,ref:t})});OO.displayName=$O;var DO="DropdownMenuLabel",eN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(jO,{...r,...a,ref:t})});eN.displayName=DO;var zO="DropdownMenuItem",tN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(bO,{...r,...a,ref:t})});tN.displayName=zO;var LO="DropdownMenuCheckboxItem",nN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(wO,{...r,...a,ref:t})});nN.displayName=LO;var UO="DropdownMenuRadioGroup",BO=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(_O,{...r,...a,ref:t})});BO.displayName=UO;var HO="DropdownMenuRadioItem",sN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(NO,{...r,...a,ref:t})});sN.displayName=HO;var IO="DropdownMenuItemIndicator",aN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(kO,{...r,...a,ref:t})});aN.displayName=IO;var PO="DropdownMenuSeparator",rN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(SO,{...r,...a,ref:t})});rN.displayName=PO;var qO="DropdownMenuArrow",GO=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(CO,{...r,...a,ref:t})});GO.displayName=qO;var VO="DropdownMenuSubTrigger",lN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(RO,{...r,...a,ref:t})});lN.displayName=VO;var YO="DropdownMenuSubContent",iN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Jt(n);return s.jsx(TO,{...r,...a,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)"}})});iN.displayName=YO;var FO=K_,KO=Q_,XO=W_,oN=J_,cN=eN,uN=tN,dN=nN,fN=sN,hN=aN,mN=rN,pN=lN,xN=iN;const $d=FO,Od=KO,QO=u.forwardRef(({className:e,inset:t,children:n,...a},r)=>s.jsxs(pN,{ref:r,className:ie("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),...a,children:[n,s.jsx(fd,{className:"ml-auto"})]}));QO.displayName=pN.displayName;const WO=u.forwardRef(({className:e,...t},n)=>s.jsx(xN,{ref:n,className:ie("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}));WO.displayName=xN.displayName;const Go=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>s.jsx(XO,{container:Uo(),children:s.jsx(oN,{ref:a,sideOffset:t,className:ie("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})}));Go.displayName=oN.displayName;const Al=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(uN,{ref:a,className:ie("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}));Al.displayName=uN.displayName;const ZO=u.forwardRef(({className:e,children:t,checked:n,...a},r)=>s.jsxs(dN,{ref:r,className:ie("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,...a,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(hN,{children:s.jsx(Il,{className:"h-4 w-4"})})}),t]}));ZO.displayName=dN.displayName;const JO=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(fN,{ref:a,className:ie("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:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(hN,{children:s.jsx(AR,{className:"h-2 w-2 fill-current"})})}),t]}));JO.displayName=fN.displayName;const e4=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(cN,{ref:a,className:ie("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));e4.displayName=cN.displayName;const t4=u.forwardRef(({className:e,...t},n)=>s.jsx(mN,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));t4.displayName=mN.displayName;const n4={default:"h-9 px-3 py-1 text-sm",control:"h-7 px-2 py-1 text-xs"},bt=u.forwardRef(({className:e,type:t,inputSize:n="default",...a},r)=>s.jsx("input",{type:t,className:ie("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",n4[n],e),ref:r,...a}));bt.displayName="Input";var s4="Label",gN=u.forwardRef((e,t)=>s.jsx(Se.label,{...e,ref:t,onMouseDown:n=>{var r;n.target.closest("button, input, select, textarea")||((r=e.onMouseDown)==null||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));gN.displayName=s4;var vN=gN;const a4=Do("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),$e=u.forwardRef(({className:e,...t},n)=>s.jsx(vN,{ref:n,className:ie(a4(),e),...t}));$e.displayName=vN.displayName;function Ga({title:e,description:t,backHref:n,backLabel:a,className:r,icon:l,link:i}){const o=s.jsx(V,{asChild:!0,variant:"outline",size:"sm",className:"mt-4 no-underline",children:s.jsx(i,{href:n,children:a})});return l?s.jsx("div",{className:ie("flex-1 px-4 py-8 sm:px-6 lg:px-8",r),children:s.jsxs("section",{className:"mx-auto flex max-w-xl flex-col items-center text-center","data-testid":"not-found-state",children:[s.jsx("div",{className:"text-foreground mb-2 [&_svg]:size-8",children:l}),s.jsx("h1",{className:"m-0 text-xl font-semibold tracking-tight",children:e}),s.jsx("div",{className:"text-muted-foreground mt-2 space-y-2 text-sm",children:t}),o]})}):s.jsx("div",{className:ie("flex-1 px-4 py-8 sm:px-6 lg:px-8",r),children:s.jsxs("section",{className:"border-border bg-card mx-auto max-w-xl rounded-xl border p-6",children:[s.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:e}),s.jsx("div",{className:"text-muted-foreground mt-2 space-y-2 text-sm",children:t}),o]})})}function en({title:e,description:t,actions:n,className:a,children:r,...l}){return s.jsxs("header",{"data-slot":"page-header",className:ie("flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",a),...l,children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("h1",{className:"text-foreground text-2xl font-semibold tracking-tight",children:e}),t?s.jsx("p",{className:"text-muted-foreground text-sm",children:t}):null,r]}),n?s.jsx("div",{"data-slot":"page-header-actions",className:"flex shrink-0 items-center gap-2",children:n}):null]})}function ot({as:e="div",className:t,...n}){return s.jsx(e,{className:ie("rounded-lg border",t),...n})}function Wv(e,[t,n]){return Math.min(n,Math.max(t,e))}var yN=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"}),r4="VisuallyHidden",jN=u.forwardRef((e,t)=>s.jsx(Se.span,{...e,ref:t,style:{...yN,...e.style}}));jN.displayName=r4;var l4=jN,i4=[" ","Enter","ArrowUp","ArrowDown"],o4=[" ","Enter"],vr="Select",[Dd,zd,c4]=Jp(vr),[Xl]=Os(vr,[c4,Kl]),Ld=Kl(),[u4,Va]=Xl(vr),[d4,f4]=Xl(vr),bN=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:r,onOpenChange:l,value:i,defaultValue:o,onValueChange:c,dir:d,name:f,autoComplete:h,disabled:m,required:x,form:b}=e,v=Ld(t),[y,g]=u.useState(null),[p,j]=u.useState(null),[w,N]=u.useState(!1),C=kd(d),[_,S]=Ba({prop:a,defaultProp:r??!1,onChange:l,caller:vr}),[D,z]=Ba({prop:i,defaultProp:o,onChange:c,caller:vr}),P=u.useRef(null),F=y?b||!!y.closest("form"):!0,[H,A]=u.useState(new Set),M=Array.from(H).map(R=>R.props.value).join(";");return s.jsx(cx,{...v,children:s.jsxs(u4,{required:x,scope:t,trigger:y,onTriggerChange:g,valueNode:p,onValueNodeChange:j,valueNodeHasChildren:w,onValueNodeHasChildrenChange:N,contentId:as(),value:D,onValueChange:z,open:_,onOpenChange:S,dir:C,triggerPointerDownPosRef:P,disabled:m,children:[s.jsx(Dd.Provider,{scope:t,children:s.jsx(d4,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(R=>{A(T=>new Set(T).add(R))},[]),onNativeOptionRemove:u.useCallback(R=>{A(T=>{const k=new Set(T);return k.delete(R),k})},[]),children:n})}),F?s.jsxs(VN,{"aria-hidden":!0,required:x,tabIndex:-1,name:f,autoComplete:h,value:D,onChange:R=>z(R.target.value),disabled:m,form:b,children:[D===void 0?s.jsx("option",{value:""}):null,Array.from(H)]},M):null]})})};bN.displayName=vr;var wN="SelectTrigger",_N=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...r}=e,l=Ld(n),i=Va(wN,n),o=i.disabled||a,c=Ve(t,i.onTriggerChange),d=zd(n),f=u.useRef("touch"),[h,m,x]=FN(v=>{const y=d().filter(j=>!j.disabled),g=y.find(j=>j.value===i.value),p=KN(y,v,g);p!==void 0&&i.onValueChange(p.value)}),b=v=>{o||(i.onOpenChange(!0),x()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return s.jsx(ux,{asChild:!0,...l,children:s.jsx(Se.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":YN(i.value)?"":void 0,...r,ref:c,onClick:fe(r.onClick,v=>{v.currentTarget.focus(),f.current!=="mouse"&&b(v)}),onPointerDown:fe(r.onPointerDown,v=>{f.current=v.pointerType;const y=v.target;y.hasPointerCapture(v.pointerId)&&y.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(b(v),v.preventDefault())}),onKeyDown:fe(r.onKeyDown,v=>{const y=h.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(y&&v.key===" ")&&i4.includes(v.key)&&(b(),v.preventDefault())})})})});_N.displayName=wN;var NN="SelectValue",kN=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:r,children:l,placeholder:i="",...o}=e,c=Va(NN,n),{onValueNodeHasChildrenChange:d}=c,f=l!==void 0,h=Ve(t,c.onValueNodeChange);return Ft(()=>{d(f)},[d,f]),s.jsx(Se.span,{...o,ref:h,style:{pointerEvents:"none"},children:YN(c.value)?s.jsx(s.Fragment,{children:i}):l})});kN.displayName=NN;var h4="SelectIcon",SN=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...r}=e;return s.jsx(Se.span,{"aria-hidden":!0,...r,ref:t,children:a||"▼"})});SN.displayName=h4;var m4="SelectPortal",CN=e=>s.jsx(Lo,{asChild:!0,...e});CN.displayName=m4;var yr="SelectContent",RN=u.forwardRef((e,t)=>{const n=Va(yr,e.__scopeSelect),[a,r]=u.useState();if(Ft(()=>{r(new DocumentFragment)},[]),!n.open){const l=a;return l?Ol.createPortal(s.jsx(TN,{scope:e.__scopeSelect,children:s.jsx(Dd.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),l):null}return s.jsx(EN,{...e,ref:t})});RN.displayName=yr;var Zn=10,[TN,Ya]=Xl(yr),p4="SelectContentImpl",x4=pr("SelectContent.RemoveScroll"),EN=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:l,onPointerDownOutside:i,side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:v,avoidCollisions:y,...g}=e,p=Va(yr,n),[j,w]=u.useState(null),[N,C]=u.useState(null),_=Ve(t,L=>w(L)),[S,D]=u.useState(null),[z,P]=u.useState(null),F=zd(n),[H,A]=u.useState(!1),M=u.useRef(!1);u.useEffect(()=>{if(j)return Bp(j)},[j]),Up();const R=u.useCallback(L=>{const[q,...ne]=F().map(re=>re.ref.current),[ae]=ne.slice(-1),je=document.activeElement;for(const re of L)if(re===je||(re==null||re.scrollIntoView({block:"nearest"}),re===q&&N&&(N.scrollTop=0),re===ae&&N&&(N.scrollTop=N.scrollHeight),re==null||re.focus(),document.activeElement!==je))return},[F,N]),T=u.useCallback(()=>R([S,j]),[R,S,j]);u.useEffect(()=>{H&&T()},[H,T]);const{onOpenChange:k,triggerPointerDownPosRef:O}=p;u.useEffect(()=>{if(j){let L={x:0,y:0};const q=ae=>{var je,re;L={x:Math.abs(Math.round(ae.pageX)-(((je=O.current)==null?void 0:je.x)??0)),y:Math.abs(Math.round(ae.pageY)-(((re=O.current)==null?void 0:re.y)??0))}},ne=ae=>{L.x<=10&&L.y<=10?ae.preventDefault():j.contains(ae.target)||k(!1),document.removeEventListener("pointermove",q),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",q),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",q),document.removeEventListener("pointerup",ne,{capture:!0})}}},[j,k,O]),u.useEffect(()=>{const L=()=>k(!1);return window.addEventListener("blur",L),window.addEventListener("resize",L),()=>{window.removeEventListener("blur",L),window.removeEventListener("resize",L)}},[k]);const[Y,E]=FN(L=>{const q=F().filter(je=>!je.disabled),ne=q.find(je=>je.ref.current===document.activeElement),ae=KN(q,L,ne);ae&&setTimeout(()=>ae.ref.current.focus())}),I=u.useCallback((L,q,ne)=>{const ae=!M.current&&!ne;(p.value!==void 0&&p.value===q||ae)&&(D(L),ae&&(M.current=!0))},[p.value]),Q=u.useCallback(()=>j==null?void 0:j.focus(),[j]),te=u.useCallback((L,q,ne)=>{const ae=!M.current&&!ne;(p.value!==void 0&&p.value===q||ae)&&P(L)},[p.value]),ce=a==="popper"?hm:AN,X=ce===hm?{side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:v,avoidCollisions:y}:{};return s.jsx(TN,{scope:n,content:j,viewport:N,onViewportChange:C,itemRefCallback:I,selectedItem:S,onItemLeave:Q,itemTextRefCallback:te,focusSelectedItem:T,selectedItemText:z,position:a,isPositioned:H,searchRef:Y,children:s.jsx(bd,{as:x4,allowPinchZoom:!0,children:s.jsx(yd,{asChild:!0,trapped:p.open,onMountAutoFocus:L=>{L.preventDefault()},onUnmountAutoFocus:fe(r,L=>{var q;(q=p.trigger)==null||q.focus({preventScroll:!0}),L.preventDefault()}),children:s.jsx(zo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:i,onFocusOutside:L=>L.preventDefault(),onDismiss:()=>p.onOpenChange(!1),children:s.jsx(ce,{role:"listbox",id:p.contentId,"data-state":p.open?"open":"closed",dir:p.dir,onContextMenu:L=>L.preventDefault(),...g,...X,onPlaced:()=>A(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:fe(g.onKeyDown,L=>{const q=L.ctrlKey||L.altKey||L.metaKey;if(L.key==="Tab"&&L.preventDefault(),!q&&L.key.length===1&&E(L.key),["ArrowUp","ArrowDown","Home","End"].includes(L.key)){let ae=F().filter(je=>!je.disabled).map(je=>je.ref.current);if(["ArrowUp","End"].includes(L.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(L.key)){const je=L.target,re=ae.indexOf(je);ae=ae.slice(re+1)}setTimeout(()=>R(ae)),L.preventDefault()}})})})})})})});EN.displayName=p4;var g4="SelectItemAlignedPosition",AN=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...r}=e,l=Va(yr,n),i=Ya(yr,n),[o,c]=u.useState(null),[d,f]=u.useState(null),h=Ve(t,_=>f(_)),m=zd(n),x=u.useRef(!1),b=u.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:g,focusSelectedItem:p}=i,j=u.useCallback(()=>{if(l.trigger&&l.valueNode&&o&&d&&v&&y&&g){const _=l.trigger.getBoundingClientRect(),S=d.getBoundingClientRect(),D=l.valueNode.getBoundingClientRect(),z=g.getBoundingClientRect();if(l.dir!=="rtl"){const je=z.left-S.left,re=D.left-je,we=_.left-re,se=_.width+we,tt=Math.max(se,S.width),ge=window.innerWidth-Zn,He=Wv(re,[Zn,Math.max(Zn,ge-tt)]);o.style.minWidth=se+"px",o.style.left=He+"px"}else{const je=S.right-z.right,re=window.innerWidth-D.right-je,we=window.innerWidth-_.right-re,se=_.width+we,tt=Math.max(se,S.width),ge=window.innerWidth-Zn,He=Wv(re,[Zn,Math.max(Zn,ge-tt)]);o.style.minWidth=se+"px",o.style.right=He+"px"}const P=m(),F=window.innerHeight-Zn*2,H=v.scrollHeight,A=window.getComputedStyle(d),M=parseInt(A.borderTopWidth,10),R=parseInt(A.paddingTop,10),T=parseInt(A.borderBottomWidth,10),k=parseInt(A.paddingBottom,10),O=M+R+H+k+T,Y=Math.min(y.offsetHeight*5,O),E=window.getComputedStyle(v),I=parseInt(E.paddingTop,10),Q=parseInt(E.paddingBottom,10),te=_.top+_.height/2-Zn,ce=F-te,X=y.offsetHeight/2,L=y.offsetTop+X,q=M+R+L,ne=O-q;if(q<=te){const je=P.length>0&&y===P[P.length-1].ref.current;o.style.bottom="0px";const re=d.clientHeight-v.offsetTop-v.offsetHeight,we=Math.max(ce,X+(je?Q:0)+re+T),se=q+we;o.style.height=se+"px"}else{const je=P.length>0&&y===P[0].ref.current;o.style.top="0px";const we=Math.max(te,M+v.offsetTop+(je?I:0)+X)+ne;o.style.height=we+"px",v.scrollTop=q-te+v.offsetTop}o.style.margin=`${Zn}px 0`,o.style.minHeight=Y+"px",o.style.maxHeight=F+"px",a==null||a(),requestAnimationFrame(()=>x.current=!0)}},[m,l.trigger,l.valueNode,o,d,v,y,g,l.dir,a]);Ft(()=>j(),[j]);const[w,N]=u.useState();Ft(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const C=u.useCallback(_=>{_&&b.current===!0&&(j(),p==null||p(),b.current=!1)},[j,p]);return s.jsx(y4,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:x,onScrollButtonChange:C,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:s.jsx(Se.div,{...r,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});AN.displayName=g4;var v4="SelectPopperPosition",hm=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:r=Zn,...l}=e,i=Ld(n);return s.jsx(dx,{...i,...l,ref:t,align:a,collisionPadding:r,style:{boxSizing:"border-box",...l.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)"}})});hm.displayName=v4;var[y4,jx]=Xl(yr,{}),mm="SelectViewport",MN=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...r}=e,l=Ya(mm,n),i=jx(mm,n),o=Ve(t,l.onViewportChange),c=u.useRef(0);return s.jsxs(s.Fragment,{children:[s.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:a}),s.jsx(Dd.Slot,{scope:n,children:s.jsx(Se.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:fe(r.onScroll,d=>{const f=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&h){const x=Math.abs(c.current-f.scrollTop);if(x>0){const b=window.innerHeight-Zn*2,v=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),g=Math.max(v,y);if(g<b){const p=g+x,j=Math.min(b,p),w=p-j;h.style.height=j+"px",h.style.bottom==="0px"&&(f.scrollTop=w>0?w:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});MN.displayName=mm;var $N="SelectGroup",[j4,b4]=Xl($N),w4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=as();return s.jsx(j4,{scope:n,id:r,children:s.jsx(Se.div,{role:"group","aria-labelledby":r,...a,ref:t})})});w4.displayName=$N;var ON="SelectLabel",DN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=b4(ON,n);return s.jsx(Se.div,{id:r.id,...a,ref:t})});DN.displayName=ON;var Ou="SelectItem",[_4,zN]=Xl(Ou),LN=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:r=!1,textValue:l,...i}=e,o=Va(Ou,n),c=Ya(Ou,n),d=o.value===a,[f,h]=u.useState(l??""),[m,x]=u.useState(!1),b=Ve(t,p=>{var j;return(j=c.itemRefCallback)==null?void 0:j.call(c,p,a,r)}),v=as(),y=u.useRef("touch"),g=()=>{r||(o.onValueChange(a),o.onOpenChange(!1))};if(a==="")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 s.jsx(_4,{scope:n,value:a,disabled:r,textId:v,isSelected:d,onItemTextChange:u.useCallback(p=>{h(j=>j||((p==null?void 0:p.textContent)??"").trim())},[]),children:s.jsx(Dd.ItemSlot,{scope:n,value:a,disabled:r,textValue:f,children:s.jsx(Se.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...i,ref:b,onFocus:fe(i.onFocus,()=>x(!0)),onBlur:fe(i.onBlur,()=>x(!1)),onClick:fe(i.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:fe(i.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:fe(i.onPointerDown,p=>{y.current=p.pointerType}),onPointerMove:fe(i.onPointerMove,p=>{var j;y.current=p.pointerType,r?(j=c.onItemLeave)==null||j.call(c):y.current==="mouse"&&p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:fe(i.onPointerLeave,p=>{var j;p.currentTarget===document.activeElement&&((j=c.onItemLeave)==null||j.call(c))}),onKeyDown:fe(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(o4.includes(p.key)&&g(),p.key===" "&&p.preventDefault())})})})})});LN.displayName=Ou;var wi="SelectItemText",UN=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:r,...l}=e,i=Va(wi,n),o=Ya(wi,n),c=zN(wi,n),d=f4(wi,n),[f,h]=u.useState(null),m=Ve(t,g=>h(g),c.onItemTextChange,g=>{var p;return(p=o.itemTextRefCallback)==null?void 0:p.call(o,g,c.value,c.disabled)}),x=f==null?void 0:f.textContent,b=u.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=d;return Ft(()=>(v(b),()=>y(b)),[v,y,b]),s.jsxs(s.Fragment,{children:[s.jsx(Se.span,{id:c.textId,...l,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ol.createPortal(l.children,i.valueNode):null]})});UN.displayName=wi;var BN="SelectItemIndicator",HN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return zN(BN,n).isSelected?s.jsx(Se.span,{"aria-hidden":!0,...a,ref:t}):null});HN.displayName=BN;var pm="SelectScrollUpButton",IN=u.forwardRef((e,t)=>{const n=Ya(pm,e.__scopeSelect),a=jx(pm,e.__scopeSelect),[r,l]=u.useState(!1),i=Ve(t,a.onScrollButtonChange);return Ft(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollTop>0;l(d)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),r?s.jsx(qN,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop-c.offsetHeight)}}):null});IN.displayName=pm;var xm="SelectScrollDownButton",PN=u.forwardRef((e,t)=>{const n=Ya(xm,e.__scopeSelect),a=jx(xm,e.__scopeSelect),[r,l]=u.useState(!1),i=Ve(t,a.onScrollButtonChange);return Ft(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;l(f)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),r?s.jsx(qN,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop+c.offsetHeight)}}):null});PN.displayName=xm;var qN=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...r}=e,l=Ya("SelectScrollButton",n),i=u.useRef(null),o=zd(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),Ft(()=>{var f;const d=o().find(h=>h.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[o]),s.jsx(Se.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:fe(r.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:fe(r.onPointerMove,()=>{var d;(d=l.onItemLeave)==null||d.call(l),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:fe(r.onPointerLeave,()=>{c()})})}),N4="SelectSeparator",GN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return s.jsx(Se.div,{"aria-hidden":!0,...a,ref:t})});GN.displayName=N4;var gm="SelectArrow",k4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=Ld(n),l=Va(gm,n),i=Ya(gm,n);return l.open&&i.position==="popper"?s.jsx(fx,{...r,...a,ref:t}):null});k4.displayName=gm;var S4="SelectBubbleInput",VN=u.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const r=u.useRef(null),l=Ve(a,r),i=Pw(t);return u.useEffect(()=>{const o=r.current;if(!o)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const h=new Event("change",{bubbles:!0});f.call(o,t),o.dispatchEvent(h)}},[i,t]),s.jsx(Se.select,{...n,style:{...yN,...n.style},ref:l,defaultValue:t})});VN.displayName=S4;function YN(e){return e===""||e===void 0}function FN(e){const t=Es(e),n=u.useRef(""),a=u.useRef(0),r=u.useCallback(i=>{const o=n.current+i;t(o),function c(d){n.current=d,window.clearTimeout(a.current),d!==""&&(a.current=window.setTimeout(()=>c(""),1e3))}(o)},[t]),l=u.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,r,l]}function KN(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let i=C4(e,Math.max(l,0));r.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function C4(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var R4=bN,XN=_N,T4=kN,E4=SN,A4=CN,QN=RN,M4=MN,WN=DN,ZN=LN,$4=UN,O4=HN,JN=IN,ek=PN,tk=GN;const D4={default:"h-9 px-3 py-2 text-sm",control:"h-7 px-2 py-1 text-xs"},pt=R4,xt=T4,ut=u.forwardRef(({className:e,children:t,triggerSize:n="default",...a},r)=>s.jsxs(XN,{ref:r,className:ie("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",D4[n],e),...a,children:[t,s.jsx(E4,{asChild:!0,children:s.jsx(I0,{className:"text-muted-foreground size-4","aria-hidden":"true"})})]}));ut.displayName=XN.displayName;const nk=u.forwardRef(({className:e,...t},n)=>s.jsx(JN,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(SR,{className:"size-4","aria-hidden":"true"})}));nk.displayName=JN.displayName;const sk=u.forwardRef(({className:e,...t},n)=>s.jsx(ek,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx($p,{className:"size-4","aria-hidden":"true"})}));sk.displayName=ek.displayName;const dt=u.forwardRef(({className:e,children:t,position:n="popper",...a},r)=>s.jsx(A4,{container:Uo(),children:s.jsxs(QN,{ref:r,className:ie("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,...a,children:[s.jsx(nk,{}),s.jsx(M4,{className:ie("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(sk,{})]})}));dt.displayName=QN.displayName;const z4=u.forwardRef(({className:e,...t},n)=>s.jsx(WN,{ref:n,className:ie("px-2 py-1.5 text-sm font-semibold",e),...t}));z4.displayName=WN.displayName;const Re=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(ZN,{ref:a,className:ie("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:[s.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(O4,{children:s.jsx(Il,{className:"size-4","aria-hidden":"true"})})}),s.jsx($4,{children:t})]}));Re.displayName=ZN.displayName;const L4=u.forwardRef(({className:e,...t},n)=>s.jsx(tk,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));L4.displayName=tk.displayName;function jt({className:e,...t}){return s.jsx("div",{className:ie("animate-pulse rounded-md bg-primary/10",e),...t})}const qe=u.forwardRef(({className:e,containerClassName:t,containerRef:n,containerTabIndex:a,containerAriaLabel:r,...l},i)=>s.jsx("div",{ref:n,tabIndex:a,"aria-label":r,className:ie("relative w-full overflow-auto",t),children:s.jsx("table",{ref:i,className:ie("w-full caption-bottom text-sm",e),...l})}));qe.displayName="Table";const Ke=u.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));Ke.displayName="TableHeader";const Ge=u.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));Ge.displayName="TableBody";const U4=u.forwardRef(({className:e,...t},n)=>s.jsx("tfoot",{ref:n,className:ie("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));U4.displayName="TableFooter";const de=u.forwardRef(({className:e,...t},n)=>s.jsx("tr",{ref:n,className:ie("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));de.displayName="TableRow";const Z=u.forwardRef(({className:e,...t},n)=>s.jsx("th",{ref:n,className:ie("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}));Z.displayName="TableHead";const K=u.forwardRef(({className:e,...t},n)=>s.jsx("td",{ref:n,className:ie("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));K.displayName="TableCell";const B4=u.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:ie("text-muted-foreground mt-4 text-sm",e),...t}));B4.displayName="TableCaption";var Ud="Tabs",[H4]=Os(Ud,[Td]),ak=Td(),[I4,bx]=H4(Ud),rk=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:r,defaultValue:l,orientation:i="horizontal",dir:o,activationMode:c="automatic",...d}=e,f=kd(o),[h,m]=Ba({prop:a,onChange:r,defaultProp:l??"",caller:Ud});return s.jsx(I4,{scope:n,baseId:as(),value:h,onValueChange:m,orientation:i,dir:f,activationMode:c,children:s.jsx(Se.div,{dir:f,"data-orientation":i,...d,ref:t})})});rk.displayName=Ud;var lk="TabsList",ik=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...r}=e,l=bx(lk,n),i=ak(n);return s.jsx(w_,{asChild:!0,...i,orientation:l.orientation,dir:l.dir,loop:a,children:s.jsx(Se.div,{role:"tablist","aria-orientation":l.orientation,...r,ref:t})})});ik.displayName=lk;var ok="TabsTrigger",ck=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:r=!1,...l}=e,i=bx(ok,n),o=ak(n),c=fk(i.baseId,a),d=hk(i.baseId,a),f=a===i.value;return s.jsx(__,{asChild:!0,...o,focusable:!r,active:f,children:s.jsx(Se.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...l,ref:t,onMouseDown:fe(e.onMouseDown,h=>{!r&&h.button===0&&h.ctrlKey===!1?i.onValueChange(a):h.preventDefault()}),onKeyDown:fe(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(a)}),onFocus:fe(e.onFocus,()=>{const h=i.activationMode!=="manual";!f&&!r&&h&&i.onValueChange(a)})})})});ck.displayName=ok;var uk="TabsContent",dk=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:r,children:l,...i}=e,o=bx(uk,n),c=fk(o.baseId,a),d=hk(o.baseId,a),f=a===o.value,h=u.useRef(f);return u.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),s.jsx(Qn,{present:r||f,children:({present:m})=>s.jsx(Se.div,{"data-state":f?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&l})})});dk.displayName=uk;function fk(e,t){return`${e}-trigger-${t}`}function hk(e,t){return`${e}-content-${t}`}var P4=rk,mk=ik,pk=ck,xk=dk;const q4=P4,gk=u.forwardRef(({className:e,...t},n)=>s.jsx(mk,{ref:n,className:ie("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));gk.displayName=mk.displayName;const vm=u.forwardRef(({className:e,...t},n)=>s.jsx(pk,{ref:n,className:ie("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}));vm.displayName=pk.displayName;const G4=u.forwardRef(({className:e,...t},n)=>s.jsx(xk,{ref:n,className:ie("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));G4.displayName=xk.displayName;const Dn=u.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:ie("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}));Dn.displayName="Textarea";var[Bd]=Os("Tooltip",[Kl]),Hd=Kl(),vk="TooltipProvider",V4=700,ym="tooltip.open",[Y4,wx]=Bd(vk),yk=e=>{const{__scopeTooltip:t,delayDuration:n=V4,skipDelayDuration:a=300,disableHoverableContent:r=!1,children:l}=e,i=u.useRef(!0),o=u.useRef(!1),c=u.useRef(0);return u.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),s.jsx(Y4,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:u.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,a)},[a]),isPointerInTransitRef:o,onPointerInTransitChange:u.useCallback(d=>{o.current=d},[]),disableHoverableContent:r,children:l})};yk.displayName=vk;var co="Tooltip",[F4,Vo]=Bd(co),jk=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:r,onOpenChange:l,disableHoverableContent:i,delayDuration:o}=e,c=wx(co,e.__scopeTooltip),d=Hd(t),[f,h]=u.useState(null),m=as(),x=u.useRef(0),b=i??c.disableHoverableContent,v=o??c.delayDuration,y=u.useRef(!1),[g,p]=Ba({prop:a,defaultProp:r??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),l==null||l(_)},caller:co}),j=u.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),w=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,y.current=!1,p(!0)},[p]),N=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,p(!1)},[p]),C=u.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{y.current=!0,p(!0),x.current=0},v)},[v,p]);return u.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),s.jsx(cx,{...d,children:s.jsx(F4,{scope:t,contentId:m,open:g,stateAttribute:j,trigger:f,onTriggerChange:h,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?C():w()},[c.isOpenDelayedRef,C,w]),onTriggerLeave:u.useCallback(()=>{b?N():(window.clearTimeout(x.current),x.current=0)},[N,b]),onOpen:w,onClose:N,disableHoverableContent:b,children:n})})};jk.displayName=co;var jm="TooltipTrigger",bk=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Vo(jm,n),l=wx(jm,n),i=Hd(n),o=u.useRef(null),c=Ve(t,o,r.onTriggerChange),d=u.useRef(!1),f=u.useRef(!1),h=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx(ux,{asChild:!0,...i,children:s.jsx(Se.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:c,onPointerMove:fe(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!l.isPointerInTransitRef.current&&(r.onTriggerEnter(),f.current=!0)}),onPointerLeave:fe(e.onPointerLeave,()=>{r.onTriggerLeave(),f.current=!1}),onPointerDown:fe(e.onPointerDown,()=>{r.open&&r.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:fe(e.onFocus,()=>{d.current||r.onOpen()}),onBlur:fe(e.onBlur,r.onClose),onClick:fe(e.onClick,r.onClose)})})});bk.displayName=jm;var _x="TooltipPortal",[K4,X4]=Bd(_x,{forceMount:void 0}),wk=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:r}=e,l=Vo(_x,t);return s.jsx(K4,{scope:t,forceMount:n,children:s.jsx(Qn,{present:n||l.open,children:s.jsx(Lo,{asChild:!0,container:r,children:a})})})};wk.displayName=_x;var Ml="TooltipContent",_k=u.forwardRef((e,t)=>{const n=X4(Ml,e.__scopeTooltip),{forceMount:a=n.forceMount,side:r="top",...l}=e,i=Vo(Ml,e.__scopeTooltip);return s.jsx(Qn,{present:a||i.open,children:i.disableHoverableContent?s.jsx(Nk,{side:r,...l,ref:t}):s.jsx(Q4,{side:r,...l,ref:t})})}),Q4=u.forwardRef((e,t)=>{const n=Vo(Ml,e.__scopeTooltip),a=wx(Ml,e.__scopeTooltip),r=u.useRef(null),l=Ve(t,r),[i,o]=u.useState(null),{trigger:c,onClose:d}=n,f=r.current,{onPointerInTransitChange:h}=a,m=u.useCallback(()=>{o(null),h(!1)},[h]),x=u.useCallback((b,v)=>{const y=b.currentTarget,g={x:b.clientX,y:b.clientY},p=tD(g,y.getBoundingClientRect()),j=nD(g,p),w=sD(v.getBoundingClientRect()),N=rD([...j,...w]);o(N),h(!0)},[h]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&f){const b=y=>x(y,f),v=y=>x(y,c);return c.addEventListener("pointerleave",b),f.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",b),f.removeEventListener("pointerleave",v)}}},[c,f,x,m]),u.useEffect(()=>{if(i){const b=v=>{const y=v.target,g={x:v.clientX,y:v.clientY},p=(c==null?void 0:c.contains(y))||(f==null?void 0:f.contains(y)),j=!aD(g,i);p?m():j&&(m(),d())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,f,i,d,m]),s.jsx(Nk,{...e,ref:l})}),[W4,Z4]=Bd(co,{isInside:!1}),J4=VE("TooltipContent"),Nk=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":r,onEscapeKeyDown:l,onPointerDownOutside:i,...o}=e,c=Vo(Ml,n),d=Hd(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(ym,f),()=>document.removeEventListener(ym,f)),[f]),u.useEffect(()=>{if(c.trigger){const h=m=>{const x=m.target;x!=null&&x.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),s.jsx(zo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:s.jsxs(dx,{"data-state":c.stateAttribute,...d,...o,ref:t,style:{...o.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:[s.jsx(J4,{children:a}),s.jsx(W4,{scope:n,isInside:!0,children:s.jsx(l4,{id:c.contentId,role:"tooltip",children:r||a})})]})})});_k.displayName=Ml;var kk="TooltipArrow",eD=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Hd(n);return Z4(kk,n).isInside?null:s.jsx(fx,{...r,...a,ref:t})});eD.displayName=kk;function tD(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,a,r,l)){case l:return"left";case r:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function nD(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function sD(e){const{top:t,right:n,bottom:a,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:a},{x:r,y:a}]}function aD(e,t){const{x:n,y:a}=e;let r=!1;for(let l=0,i=t.length-1;l<t.length;i=l++){const o=t[l],c=t[i],d=o.x,f=o.y,h=c.x,m=c.y;f>a!=m>a&&n<(h-d)*(a-f)/(m-f)+d&&(r=!r)}return r}function rD(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),lD(t)}function lD(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const r=e[a];for(;t.length>=2;){const l=t[t.length-1],i=t[t.length-2];if((l.x-i.x)*(r.y-i.y)>=(l.y-i.y)*(r.x-i.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const r=e[a];for(;n.length>=2;){const l=n[n.length-1],i=n[n.length-2];if((l.x-i.x)*(r.y-i.y)>=(l.y-i.y)*(r.x-i.x))n.pop();else break}n.push(r)}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 iD=yk,oD=jk,cD=bk,uD=wk,Sk=_k;const Ck=iD,Rk=oD,Tk=cD,Nx=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>{const r=Uo(),l=s.jsx(Sk,{ref:a,sideOffset:t,className:ie("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 r?s.jsx(uD,{container:r,children:l}):l});Nx.displayName=Sk.displayName;function la({page:e,header:t}){return s.jsxs(s.Fragment,{children:[t??s.jsx(en,{title:e}),s.jsx(dD,{page:e})]})}function dD({page:e}){return s.jsxs(he,{variant:"info",role:"status",className:"mt-6","data-testid":"not-installed",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:F0(e)})]})}const Zv=["none","read","comment","write","manage","admin"];function Du(e,t){return Zv.indexOf(e??"none")>=Zv.indexOf(t)}function kx(e){return e==="api_key"?"API key":e==="sdlc_login"?"sdlc login":null}function Yf(e,t){const n=kx(e);return e==="sdlc_login"&&t?`${n} on ${Ek(t)}`:n}const fD=String.fromCodePoint(8296),hD=String.fromCodePoint(8297);function Ek(e){return`${fD}${e}${hD}`}const uo={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"}},mD={backlog:"neutral",planned:"neutral",in_progress:"info",completed:"success",canceled:"neutral"};function Ak(e){return e.name==="Blocked"?"warning":mD[e.category]}const Jv=1800;function cs(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 Sx(e){return`${Yn(e)}, ${rs(e)}`}function hi(e){return e<90?`${Math.round(e)} s`:e<5400?`${Math.round(e/60)} min`:`${(e/3600).toFixed(1).replace(/\.0$/,"")} h`}function Yn(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Mk(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function pD(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 xD(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 da="not_set";function gD({open:e,commands:t,list_id:n,list_revision:a,default_status_id:r,statuses:l,priorities:i,members:o,on_close:c,on_created:d}){var F;const f=Nr(),[h,m]=u.useState(""),[x,b]=u.useState(""),[v,y]=u.useState(r??((F=l[0])==null?void 0:F.id)??""),[g,p]=u.useState(da),[j,w]=u.useState(da),[N,C]=u.useState(!1),[_,S]=u.useState(null),[D,z]=u.useState(!1);u.useEffect(()=>{var H;e&&(m(""),b(""),y(r??((H=l[0])==null?void 0:H.id)??""),p(da),w(da),C(!1),S(null))},[e,r,l]);const P=async H=>{if(H.preventDefault(),!h.trim()){C(!0);return}z(!0),S(null);try{const A=await t.run("create_task",{list_id:n,expected_list_revision:a,title:h.trim(),description:x.trim()||null,status_id:v||null,priority_id:g===da?null:g,primary_user_id:j===da?null:j});if(!A.ok){S(A.refusal.message);return}f.success("Task created."),await d()}finally{z(!1)}};return s.jsx(pn,{open:e,onOpenChange:H=>H?null:c(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:H=>void P(H),noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"New task"}),s.jsx(jn,{children:"Add a task to this List."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[_&&s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(xe,{children:_})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"new-task-title",children:"Title"}),s.jsx(bt,{id:"new-task-title",placeholder:"What needs doing",value:h,required:!0,"aria-invalid":N,"aria-describedby":N?"new-task-title-error":void 0,onChange:H=>{m(H.target.value),C(!1)}}),N&&s.jsx("p",{id:"new-task-title-error",className:"text-destructive text-xs",children:"Give the task a title."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"new-task-description",children:"Description (optional)"}),s.jsx(Dn,{id:"new-task-description",rows:4,value:x,onChange:H=>b(H.target.value)})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"new-task-status",children:"Status"}),s.jsxs(pt,{value:v,onValueChange:y,children:[s.jsx(ut,{id:"new-task-status",children:s.jsx(xt,{})}),s.jsx(dt,{children:l.map(H=>s.jsx(Re,{value:H.id,children:H.name},H.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"new-task-priority",children:"Priority"}),s.jsxs(pt,{value:g,onValueChange:p,children:[s.jsx(ut,{id:"new-task-priority",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:da,children:"Not set"}),i.map(H=>s.jsx(Re,{value:H.id,children:H.name},H.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"new-task-primary",children:"Primary"}),s.jsxs(pt,{value:j,onValueChange:w,children:[s.jsx(ut,{id:"new-task-primary",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:da,children:"Not set"}),o.map(H=>s.jsx(Re,{value:H.user_id,children:H.label},H.user_id))]})]})]})]})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),s.jsx(V,{type:"submit",disabled:D,children:D?"Creating…":"Create task"})]})]})})})}const vD="Your organization's work, in queue order. Claim a task to show you are working on it.",_i="any",$k="none",yD=1,jD=250;function Cx(){const e=mn().tasks;if(!e)throw new Error("The Tasks page rendered without the tasks seam.");return e}function bD({org:e}){var b,v;const t=Cx(),{href:n,Link:a}=Xe(),[r,l]=u.useState({state:"loading"}),[i,o]=u.useState([]),[c,d]=u.useState(null),f=u.useRef(0),h=u.useCallback(async y=>{const g=f.current+=1;y&&l({state:"loading"});const p=await t.availability({fresh:y});g===f.current&&l(p)},[t.availability]);u.useEffect(()=>{h(!1)},[h]);const m=u.useCallback(()=>void h(!0),[h]);if(u.useEffect(()=>{let y=!0;return t.members().then(g=>{y&&g.ok&&o(g.data)}),()=>{y=!1}},[t.members]),u.useEffect(()=>{if(!t.access)return;let y=!0;return t.access().then(g=>{y&&g.ok&&d(g.data)}),()=>{y=!1}},[t.access]),r.state==="off"&&((b=r.refusal)==null?void 0:b.reason)!=="engine_missing")return s.jsx(Ga,{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:a});const x=(c==null?void 0:c.read_only_reason)??vD;return s.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:r.state==="active"?s.jsx(_D,{active:r,org:e,members:i,description:x,read_only_reason:c==null?void 0:c.read_only_reason,reload_configuration:m}):r.state==="off"&&((v=r.refusal)==null?void 0:v.reason)==="engine_missing"?s.jsx(la,{page:"Tasks"}):s.jsxs(s.Fragment,{children:[s.jsx(en,{title:"Tasks",description:x}),r.state==="loading"&&s.jsx(Ok,{}),(r.state==="error"||r.state==="off")&&s.jsx(Dk,{refusal:r.refusal,on_retry:m}),r.state==="available"&&s.jsx(wD,{on_done:m})]})})}function Ok(){return s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading tasks",children:Array.from({length:6},(e,t)=>s.jsx(jt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function Dk({refusal:e,on_retry:t}){const n=ds();return(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(he,{variant:"warning",className:"mt-6",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsx(xe,{children:n})]}):s.jsxs(he,{variant:"destructive",className:"mt-6",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Tasks could not be loaded"}),s.jsxs(xe,{children:[s.jsx("p",{children:e!=null&&e.reason?e.message:"Check your connection and try again."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function wD({on_done:e}){const{commands:t}=Cx(),n=Nr(),[a,r]=u.useState(!1),l=t==null?void 0:t.activate,i=async()=>{if(!l)return;r(!0);const o=await l();if(r(!1),!o.ok){n.error(o.refusal.message);return}n.success("Tasks are on."),e()};return s.jsxs(he,{variant:"info",className:"mt-6",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Tasks are not on for this organization"}),s.jsxs(xe,{children:[s.jsx("p",{children:"Turning them on creates one List with the default workflow. Members then see tasks as their access allows. It needs two-factor sign-in."}),l?s.jsx(V,{type:"button",size:"sm",className:"mt-2",disabled:a,onClick:()=>void i(),children:"Turn on Tasks"}):null]})]})}const Ff=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function _D({active:e,org:t,members:n,description:a,read_only_reason:r,reload_configuration:l}){var Fx;const{commands:i,listTasks:o,waitingOnYou:c,hierarchyRevision:d}=Cx(),{href:f,Link:h}=Xe(),{self_id:m}=dd(),x=Nr(),{list:b,workspace:v}=e,y=b.offers,g=y!==void 0,p=u.useMemo(()=>{var G;return((G=v.workflows.find(oe=>oe.id===b.workflow_id))==null?void 0:G.statuses)??[]},[v,b]),j=v.priorities,w=!!i&&Du(b.permission,"write"),N=w&&Du(b.permission,"manage"),C=u.useMemo(()=>new Map(n.map(G=>[G.user_id,G])),[n]),_=G=>{var oe;return G?G===m?"You":((oe=C.get(G))==null?void 0:oe.label)??"A member":""},[S,D]=u.useState("active"),[z,P]=u.useState(!1),[F,H]=u.useState(""),[A,M]=u.useState("");u.useEffect(()=>{const G=setTimeout(()=>M(F),jD);return()=>clearTimeout(G)},[F]);const[R,T]=u.useState(null),[k,O]=u.useState(_i),[Y,E]=u.useState(!1),[I,Q]=u.useState(!1),[te,ce]=u.useState({}),[X,L]=u.useState([]),[q,ne]=u.useState(null),[ae,je]=u.useState([]),[re,we]=u.useState(null),[se,tt]=u.useState(0),[ge,He]=u.useState(!1),[J,ke]=u.useState(null),[Ue,ft]=u.useState(null),_e=ds(),[Ht,wt]=u.useState(!1),[Et,tn]=u.useState(null),[_t,Nt]=u.useState({}),[bn,Gt]=u.useState(""),{confirm:le,confirm_dialog:Me}=Bo(),Ce=u.useRef(null),nn=u.useRef(null),sn=u.useRef(null),zn=u.useRef(null),[st,hs]=u.useState(void 0),Wn=!!(A.trim()||R||k!==_i||Y||I),ms=u.useRef(0),ps=u.useRef(0),U=u.useCallback(async(G,oe=!1)=>{if(oe&&ps.current>0)return;const Be=G?ms.current:ms.current+=1,at={state:S,assigned_to_me:z||void 0,cursor:G,search:A.trim()||void 0,group:R??void 0,owner:k===_i?void 0:k===$k?"":k,urgent:Y||void 0,over_estimate:I||void 0,...ND(te,X)},rn=ln=>o(b.id,{...at,cursor:ln});G||(ps.current+=1);let gt=await rn(G).finally(()=>{G||(ps.current-=1)}),At=!!G;if(!gt.ok&>.refusal.code==="cursor_stale"&&(gt=await rn(),At=!1),Be!==ms.current)return;if(!gt.ok){we(gt.refusal),tt(ln=>ln+1);return}const kt=gt.data;we(null),tt(0),!(oe&&Ff(kt,sn.current))&&(sn.current=kt,ne(kt),kt.facets&&hs(kt.facets),je(ln=>At?[...ln,...kt.tasks]:kt.tasks))},[o,b.id,S,z,A,R,k,Y,I,te,X]),$=u.useCallback(async()=>{const G=await c();if(ft(Be=>G.ok?null:Ff(Be,G.refusal)?Be:G.refusal),!G.ok&&g)return;const oe=G.ok?G.data:null;Ff(oe,zn.current)||(zn.current=oe,ke(oe))},[c,g]);u.useEffect(()=>{sn.current=null,ne(null)},[S,z]),u.useEffect(()=>{U()},[U]),u.useEffect(()=>{$()},[$]);const B=u.useCallback(async()=>{await Promise.all([U(),$()])},[U,$]),W=u.useRef(B);W.current=B;const ve=y==null?void 0:y.refresh_ms;u.useEffect(()=>{if(!ve)return;const G=setInterval(()=>{U(void 0,!0),$()},ve);return()=>clearInterval(G)},[ve,U,$]);const Oe=u.useCallback(async(G,oe,Be)=>{if(!i)return;const at=await i.run(G,oe);at.ok?Be&&x.success(Be):(x.error(at.refusal.message),at.refusal.code==="revision_conflict"&&l()),await B()},[i,x,B,l]),an=p.find(G=>G.category==="completed"),Xa=async(G,oe,Be)=>{const at=oe+Be,rn=ae[at];if(!rn||!q||!i)return;const gt=async(At,kt)=>{const ln=await i.run(At,kt);if(!ln.ok)throw ln.refusal;return ln.data};try{let At=q.list.order_revision,kt=G.revision;if(rn.queue_rank===null){const ln=ae.findIndex(Ls=>Ls.queue_rank===null);for(const Ls of ae.slice(ln,at+1)){const Kx=await gt("reorder",{task_id:Ls.id,expected_revision:Ls.revision,expected_order_revision:At,placement:"end"});At=Kx.list.order_revision,Ls.id===G.id&&(kt=Kx.task.revision)}}await gt("reorder",{task_id:G.id,expected_revision:kt,expected_order_revision:At,placement:Be<0?"before":"after",anchor_task_id:rn.id})}catch(At){x.error(At.message)}await B()},Tr=G=>{an&&Oe("update_task",{task_id:G.id,expected_revision:G.revision,changes:{status_id:an.id}},`${G.title} completed.`)},ni=async G=>{if(!q||!await le({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[Be,at]=await Promise.all([o(b.id,{limit:1}),d(v.id)]);if(!Be.ok||!at.ok){x.error(Be.ok?at.ok?"":at.refusal.message:Be.refusal.message);return}await Oe("archive_task",{task_id:G.id,expected_revision:G.revision,expected_order_revision:Be.data.list.order_revision,expected_hierarchy_revision:at.data},`${G.title} archived.`)},si=async G=>{await Oe("release_hold",{hold_id:G},"Hold released.")},xs=async(G,oe,Be,at)=>{if(!(i!=null&&i.complete)||!await le({title:`Mark ${oe} done?`,description:Be.reason?`“${Be.reason}”
|
|
389
389
|
|
|
390
|
-
It leaves the open tasks.`:"It leaves the open tasks.",action_label:"Mark done"}))return;tn(G);const gt=await i.complete(Be);if(tn(null),!gt.ok){Nt(At=>({...At,[G]:gt.refusal.message}));return}Nt(({[G]:At,...kt})=>kt),Gt(`${oe} marked done.`),await W.current(),Er({next:at})},[zs,Er]=u.useState(null);u.useEffect(()=>{var at;if(!zs)return;Er(null);const G=nn.current,oe=typeof zs.next=="function"?zs.next():zs.next;(at=(oe?(G==null?void 0:G.querySelector(`[data-done-key="${CSS.escape(oe)}"]`))??(G==null?void 0:G.querySelector(`[data-title-key="${CSS.escape(oe)}"] a`)):null)??Ce.current)==null||at.focus()},[zs]);const ia=()=>{var G;H(""),M(""),T(null),O(wi),E(!1),Q(!1),(G=Ce.current)==null||G.focus()},X1=new Map(p.map(G=>[G.id,G])),Q1=new Map(j.map(G=>[G.id,G])),Yd=new Map(ae.map(G=>[G.id,G.title])),Fd=w&&S==="active",W1=ae.some(G=>G.local_done),Kd=Fd||W1,Xd=!g||j.length>0,Z1=!z&&!Wn,Qd=5+(Xd?1:0)+(Kd?1:0),J1=re!==null&&(re.reason==="store_locked"||re.reason==="engine_failed")&&se<=vD,Ko=(J==null?void 0:J.holds)??[],Wd=q==null?void 0:q.groups,eS=ND(ae,Wd,te,(q==null?void 0:q.matched)===void 0?X:[]),Xo=Wd?Wd.length===0:ae.length===0,tS=(G,oe)=>ce(Be=>({...Be,[G]:!oe})),nS=G=>L(oe=>oe.includes(G)?oe.filter(Be=>Be!==G):[...oe,G]),sS=Ko.map(G=>G.id);return s.jsxs("div",{ref:nn,className:"contents",children:[s.jsx(en,{title:"Tasks",description:a,actions:w?s.jsxs(V,{type:"button",onClick:()=>wt(!0),children:[s.jsx(Tl,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]}):null}),g&&(q!=null&&q.open)?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[q.open," open"]}):null,ve?s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",role:"status",children:re?`Not reading · trying again every ${Math.round(ve/1e3)}s`:q?`Live · refreshes every ${Math.round(ve/1e3)}s`:"Connecting…"}):null,g?s.jsx("p",{className:"sr-only",role:"status",children:bn}):null,(g||Ko.length>0)&&s.jsxs(ot,{as:"section","aria-labelledby":"waiting-title",className:"mt-4 p-4","data-testid":"tasks-waiting",children:[s.jsx("h2",{id:"waiting-title",className:"text-lg font-semibold",children:"Waiting on you"}),Ko.length>0?s.jsx("ul",{className:"mt-2 divide-y","aria-labelledby":"waiting-title",children:Ko.map((G,oe)=>{var gt,At;const Be=co[G.hold_type],at=G.target.kind==="task"?`Because you claim ${Yd.get(G.target.task_id)??"the task it waits on"} · `:"",rn=G.local_done;return s.jsxs("li",{id:`waiting-${G.id}`,"data-title-key":G.id,className:"flex flex-wrap items-center gap-3 py-2",children:[G.task?s.jsx(h,{className:"text-primary min-w-40 flex-1 hover:underline",href:f(`/org/${t}/tasks/${G.task.id}`),children:G.task.title}):s.jsx("span",{className:"min-w-40 flex-1",children:G.reason}),s.jsx(ue,{variant:Be.tone,children:G.local_label??Be.label}),s.jsxs("div",{className:"min-w-48 flex-2",children:[G.task?s.jsx("div",{className:"text-sm",children:G.reason}):null,s.jsxs("div",{className:"text-muted-foreground text-xs",children:[at,"From ",_(G.opened_by)," · ",Yn(G.opened_at)]}),(gt=G.local_threads)!=null&>.length?s.jsxs("div",{className:"text-muted-foreground text-xs",children:["Answer it in"," ",s.jsx(h,{className:"text-primary hover:underline",href:f(`/org/${t}/threads`),children:"Threads"}),": ",G.local_threads.join(" · ")]}):null,_t[G.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:_t[G.id]}):null]}),rn&&(i!=null&&i.complete)?s.jsx(V,{type:"button",variant:"outline",size:"sm","data-done-key":G.id,"aria-label":`Mark ${((At=G.task)==null?void 0:At.title)??G.reason} done`,loading:Et===G.id,onClick:()=>{var kt;return void xs(G.id,((kt=G.task)==null?void 0:kt.title)??G.reason,rn,sS[oe+1]??null)},children:"Done"}):null,g?null:s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void ni(G.id),children:"Release"})]},G.id)})}):J?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Nothing in this checkout waits on you."}):null,g&&Ue?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status",children:Ue.reason==="view_outdated"?`Waiting on you is not read here. ${_e}`:"Waiting on you could not be read. It is read again with the list."}):null,s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:g?"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."})]}),!w&&!r&&s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(Oo,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"You can view these tasks"}),s.jsx(xe,{children:"Ask an organization admin for write access to change them."})]}),s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-4",children:[(y==null?void 0:y.archived)!==!1?s.jsx(P4,{value:S,onValueChange:G=>D(G),children:s.jsxs(xk,{"aria-label":"Which tasks",children:[s.jsx(vm,{value:"active",children:"Active"}),s.jsx(vm,{value:"archived",children:"Archived"})]})}):null,(y==null?void 0:y.assigned_to_me)!==!1?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vl,{id:"tasks-mine",checked:z,onCheckedChange:G=>P(G===!0)}),s.jsx($e,{htmlFor:"tasks-mine",children:"Assigned to me"})]}):null,y!=null&&y.search?s.jsx(bt,{ref:Ce,type:"search",className:"w-64","aria-label":"Search tasks",placeholder:"Search title, ID or detail",value:F,onChange:G=>H(G.target.value)}):null,st!=null&&st.owners?s.jsx(TD,{owners:st.owners,no_owner:st.no_owner,value:k,on_change:O}):null]}),(Fx=st==null?void 0:st.groups)!=null&&Fx.length?s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Status",children:[st.groups.map(G=>s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":R===G.id,onClick:()=>T(oe=>oe===G.id?null:G.id),children:[G.label," ",G.count]},G.id)),st.marks?s.jsxs(s.Fragment,{children:[s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":Y,onClick:()=>E(G=>!G),children:["Urgent ",st.marks.urgent]}),s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":I,onClick:()=>Q(G=>!G),children:["Over estimate ",st.marks.over_estimate]})]}):null]}):null,Wn&&(q==null?void 0:q.matched)!==void 0&&q.total!==void 0?s.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:[q.matched," of ",q.total," match ·"," ",s.jsx(V,{type:"button",variant:"link",size:"inline-sm",onClick:ia,children:"Clear"})]}):null,J1?s.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:"Tasks are busy. Reading them again…"}):re?s.jsx(Ok,{refusal:re,on_retry:()=>void U()}):null,!q&&!re&&s.jsx($k,{}),q&&Xo&&Wn?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(pd,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No tasks match"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing open matches these filters."}),s.jsx(V,{type:"button",variant:"outline",onClick:ia,children:"Clear filters"})]}):q&&Xo&&S==="active"&&!z&&g?s.jsx("p",{className:"text-muted-foreground mt-6 text-sm",children:"No tasks recorded yet."}):q&&Xo&&S==="active"&&!z?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(Pw,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No tasks yet"}),s.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."}),w&&s.jsxs(V,{type:"button",onClick:()=>wt(!0),children:[s.jsx(Tl,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]})]}):q?s.jsxs(s.Fragment,{children:[s.jsx(ot,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Tasks",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Title"}),s.jsx(Z,{children:"Status"}),Xd?s.jsx(Z,{className:"hidden md:table-cell",children:"Priority"}):null,s.jsx(Z,{className:"hidden md:table-cell",children:"Primary"}),s.jsx(Z,{className:"hidden md:table-cell",children:"Holds"}),s.jsx(Z,{children:"Claimed by"}),Kd?s.jsx(Z,{className:"text-right",children:"Actions"}):null]})}),s.jsxs(Ge,{children:[eS.map(G=>{var At,kt;if(G.kind==="group")return s.jsx(SD,{group:G.group,open:G.open,columns:Qd,on_toggle:()=>tS(G.group.id,G.open)},`group:${G.group.id}`);if(G.kind==="more")return s.jsx(CD,{group:G.group,whole:X.includes(G.group.id),columns:Qd,on_toggle:()=>nS(G.group.id)},`more:${G.group.id}`);const{row:oe,index:Be}=G,at=X1.get(oe.status_id),rn=mD(oe),gt=oe.local_done;return s.jsxs(de,{"data-testid":"tasks-row",children:[s.jsxs(K,{"data-title-key":oe.id,children:[oe.no_page?s.jsx("span",{children:oe.title}):s.jsx(h,{className:"text-primary hover:underline",href:f(`/org/${t}/tasks/${oe.id}`),children:oe.title}),oe.parent_task_id&&Yd.get(oe.parent_task_id)?s.jsx("div",{className:"text-muted-foreground text-xs",children:Yd.get(oe.parent_task_id)}):null,g?s.jsx(RD,{row:oe}):null,_t[oe.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:_t[oe.id]}):null]}),s.jsx(K,{children:at?s.jsx(ue,{variant:Ek(at),children:at.name}):null}),Xd?s.jsx(K,{className:"hidden md:table-cell",children:oe.priority_id?((At=Q1.get(oe.priority_id))==null?void 0:At.name)??"":s.jsx("span",{className:"text-muted-foreground",children:"Not set"})}):null,s.jsx(K,{className:"hidden md:table-cell",children:oe.owner_title?oe.owner_title:oe.primary_user_id?_(oe.primary_user_id):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}),s.jsx(K,{className:"hidden md:table-cell",children:rn?s.jsx(ue,{variant:rn.tone,children:rn.label}):s.jsx("span",{className:"text-muted-foreground",children:"None"})}),s.jsx(K,{"data-testid":"tasks-claim",children:s.jsx(ED,{row:oe,holder:_((kt=oe.claim)==null?void 0:kt.user_id)})}),Kd?s.jsx(K,{className:"text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[gt&&"hold"in gt?s.jsx("a",{className:"text-primary text-sm hover:underline",href:`#waiting-${gt.hold}`,children:"In Waiting on you"}):gt&&(i!=null&&i.complete)?s.jsx(V,{type:"button",variant:"outline",size:"sm","data-done-key":oe.id,"aria-label":`Mark ${oe.title} done`,loading:Et===oe.id,onClick:()=>void xs(oe.id,oe.title,gt,()=>{var ln;return(((ln=sn.current)==null?void 0:ln.tasks)??[]).map(Ls=>Ls.id).filter(Ls=>Ls!==oe.id)[Be]??null}),children:"Done"}):null,Fd&&Z1?s.jsxs(s.Fragment,{children:[s.jsx(V,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${oe.title} up`,disabled:Be===0,onClick:()=>void Xa(oe,Be,-1),children:s.jsx(pR,{className:"size-4","aria-hidden":"true"})}),s.jsx(V,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${oe.title} down`,disabled:Be===ae.length-1,onClick:()=>void Xa(oe,Be,1),children:s.jsx(fR,{className:"size-4","aria-hidden":"true"})})]}):null,Fd?s.jsxs($d,{children:[s.jsx(Od,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon","aria-label":`More actions for ${oe.title}`,children:s.jsx(Op,{className:"size-4","aria-hidden":"true"})})}),s.jsxs(Go,{align:"end",children:[an&&oe.status_id!==an.id?s.jsx(Al,{onSelect:()=>Tr(oe),children:"Complete"}):null,N?s.jsx(Al,{className:"text-destructive focus:text-destructive",onSelect:()=>void ti(oe),children:"Archive"}):null]})]}):null]})}):null]},oe.id)}),Xo&&s.jsx(de,{children:s.jsx(K,{colSpan:Qd,className:"text-muted-foreground h-24 text-center",children:S==="archived"?"No archived tasks.":"No tasks are assigned to you."})})]})]})}),q.next_cursor?s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2 self-start",disabled:ge,onClick:async()=>{He(!0),await U(q.next_cursor??void 0),He(!1)},children:"Load more"}):null]}):null,w&&i&&s.jsx(xD,{open:Ht,commands:i,list_id:b.id,list_revision:(q==null?void 0:q.list.revision)??b.revision,default_status_id:b.default_status_id,statuses:p,priorities:j,members:n,on_close:()=>wt(!1),on_created:async()=>{wt(!1),await B()}}),Me]})}function _D(e,t){const n=Object.keys(e).filter(r=>e[r]),a=Object.keys(e).filter(r=>!e[r]);return{...n.length?{opened_groups:n}:{},...a.length?{closed_groups:a}:{},...t.length?{all_groups:t}:{}}}function ND(e,t,n,a){if(!t)return e.map((l,i)=>({kind:"row",row:l,index:i}));const r=[];for(const l of t){const i=n[l.id]??l.open;if(r.push({kind:"group",group:l,open:i}),!i||!l.open)continue;let o=0;e.forEach((c,d)=>{c.local_state===l.id&&(r.push({kind:"row",row:c,index:d}),o+=1)}),(l.hidden>0||a.includes(l.id)&&o>kD)&&r.push({kind:"more",group:l})}return r}const kD=10;function SD({group:e,open:t,columns:n,on_toggle:a}){const r=t?$p:fd;return s.jsx(de,{"data-testid":"tasks-group",children:s.jsx(K,{colSpan:n,className:"p-1",children:s.jsxs(V,{type:"button",variant:"ghost",size:"sm",className:"w-full justify-start font-semibold","aria-expanded":t,onClick:a,children:[s.jsx(r,{className:"size-4","aria-hidden":"true"}),e.label," ",e.count]})})})}function CD({group:e,whole:t,columns:n,on_toggle:a}){return s.jsx(de,{"data-testid":"tasks-group-more",children:s.jsx(K,{colSpan:n,children:s.jsx(V,{type:"button",variant:"link",size:"sm",className:"px-0","aria-expanded":t,onClick:a,children:t?"Show fewer":`Show all ${e.count}`})})})}function RD({row:e}){var n;const t=[e.local_after,e.local_detail].filter(Boolean).join(" · ");return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-muted-foreground font-mono text-xs",children:[e.id,e.match?` · matched in ${e.match}`:""]}),t?s.jsx("div",{className:"text-muted-foreground text-xs",children:t}):null,(n=e.local_marks)!=null&&n.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.local_marks.map(a=>s.jsx(ue,{variant:a.tone??"neutral",children:a.label},a.label))}):null]})}function TD({owners:e,no_owner:t,value:n,on_change:a}){return s.jsxs(pt,{value:n,onValueChange:a,children:[s.jsx(ut,{className:"w-56","aria-label":"Owner",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:wi,children:"Any owner"}),e.map(r=>s.jsxs(Re,{value:r.id,children:[r.label," (",r.count,")"]},r.id)),t!==void 0?s.jsxs(Re,{value:Mk,children:["No owner (",t,")"]}):null]})]})}function ED({row:e,holder:t}){const n=e.claim;if(!n)return s.jsx("span",{className:"text-muted-foreground",children:"Nobody"});if(n.lapsed){const a=new Date(n.lease_expires_at)<=new Date;return s.jsxs("div",{children:[s.jsxs("div",{className:"text-warning",children:["Lapsed · ",t]}),s.jsx("div",{className:"text-muted-foreground text-xs",children:a?`Ran out at ${cs(n.lease_expires_at)}`:"Can no longer edit it"})]})}return s.jsxs("div",{className:"max-w-64",children:[s.jsxs("div",{children:[t,n.via?` · ${kx(n.via)}`:""]}),s.jsxs("div",{className:"text-muted-foreground truncate text-xs",title:n.via==="sdlc_login"&&n.via_device?Tk(n.via_device):void 0,children:["Until ",cs(n.lease_expires_at),n.via==="sdlc_login"&&n.via_device?s.jsxs(s.Fragment,{children:[" · ",s.jsx("bdi",{children:n.via_device})]}):null]})]})}const AD={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 MD({open:e,members:t,tasks:n,holds_my_web_claim:a,on_close:r,on_submit:l}){const[i,o]=u.useState("waiting_for_user"),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(!1),[b,v]=u.useState({}),[y,g]=u.useState(null),[p,j]=u.useState(!1);u.useEffect(()=>{e&&(o("waiting_for_user"),d(""),h(""),x(!1),v({}),g(null))},[e]);const w=AD[i],N=async C=>{C.preventDefault();const _={target:w!==null&&!c.trim(),reason:!f.trim()};if(v(_),_.target||_.reason)return;j(!0);const S={hold_type:i,reason:f.trim(),release_claim:m};i==="waiting_for_user"&&(S.target_user_id=c),i==="blocked"&&(S.target_task_id=c),i==="waiting_for_external"&&(S.target_label=c.trim());const D=await l(S);j(!1),g(D)};return s.jsx(pn,{open:e,onOpenChange:C=>C?null:r(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:C=>void N(C),noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Add hold"}),s.jsx(jn,{children:"Say what this task is waiting for."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y&&s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(xe,{children:y})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"hold-type",children:"Type"}),s.jsxs(pt,{value:i,onValueChange:C=>{o(C),d(""),v({})},children:[s.jsx(ut,{id:"hold-type",children:s.jsx(xt,{})}),s.jsx(dt,{children:Object.keys(co).map(C=>s.jsx(Re,{value:C,children:co[C].label},C))})]})]}),w?s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"hold-target",children:w.label}),i==="waiting_for_external"?s.jsx(bt,{id:"hold-target",value:c,"aria-invalid":b.target,onChange:C=>d(C.target.value)}):s.jsxs(pt,{value:c,onValueChange:d,children:[s.jsx(ut,{id:"hold-target","aria-invalid":b.target,children:s.jsx(xt,{placeholder:i==="blocked"?"Choose a task":"Choose a member"})}),s.jsx(dt,{children:i==="blocked"?n.map(C=>s.jsx(Re,{value:C.id,children:C.title},C.id)):t.map(C=>s.jsx(Re,{value:C.user_id,children:C.label},C.user_id))})]}),s.jsx("p",{className:b.target?"text-destructive text-xs":"text-muted-foreground text-xs",children:b.target?"Choose what it waits for.":w.help})]}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"You resume it yourself."}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"hold-reason",children:"Reason"}),s.jsx(Dn,{id:"hold-reason",rows:3,placeholder:"What the task is waiting for",value:f,"aria-invalid":b.reason,onChange:C=>h(C.target.value)}),b.reason&&s.jsx("p",{className:"text-destructive text-xs",children:"Give a reason."})]}),a&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vl,{id:"hold-release-claim",checked:m,onCheckedChange:C=>x(C===!0)}),s.jsx($e,{htmlFor:"hold-release-claim",children:"Also release my claim"})]})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),s.jsx(V,{type:"submit",disabled:p,children:p?"Adding…":"Add hold"})]})]})})})}function Yo(){const e=mn().tasks;if(!e)throw new Error("The Task page rendered without the tasks seam.");return e}function Rx(){return s.jsxs("div",{className:"grid gap-3",role:"status","aria-label":"Loading task",children:[s.jsx(jt,{className:"h-8 w-1/2"}),Array.from({length:7},(e,t)=>s.jsx(jt,{className:t===6?"h-6 w-2/3":"h-6 w-full"},t))]})}function zu({back:e,description:t}){const{href:n,Link:a}=Xe();return s.jsx(Ga,{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:a})}const Lr="not_set",$D=10*60*1e3,ey=20;function OD(){const{members:e}=Yo(),[t,n]=u.useState([]);u.useEffect(()=>{let l=!0;return e().then(i=>{l&&i.ok&&n(i.data)}),()=>{l=!1}},[e]);const a=u.useMemo(()=>new Map(t.map(l=>[l.user_id,l])),[t]),r=u.useCallback((l,i)=>{var o;return l?l===i?"You":((o=a.get(l))==null?void 0:o.label)??"A member":""},[a]);return{members:t,name:r}}function DD({active:e,task_id:t,back:n}){const a=Yo(),{task:r,activity:l,listTasks:i,hierarchyRevision:o,commands:c}=a,{href:d,Link:f}=Xe(),h=Nr(),{self_id:m}=dd(),{members:x,name:b}=OD(),{workspace:v}=e,{confirm:y,confirm_dialog:g}=Bo(),[p,j]=u.useState(null),[w,N]=u.useState(!1),[C,_]=u.useState(!1),[S,D]=u.useState(null),[z,P]=u.useState([]),[F,H]=u.useState(ey),[A,M]=u.useState([]),[R,T]=u.useState(!1),[k,O]=u.useState(null),[Y,E]=u.useState(null),[I,Q]=u.useState(""),[te,ce]=u.useState(null),X=u.useCallback(async()=>{if(!r)return;const U=await r(t);U.ok?(j(U.data),_(!1)):U.refusal.status===404||U.refusal.status===400?N(!0):_(!0)},[r,t]),L=u.useRef(0),q=u.useCallback(async()=>{if(!l)return;const U=L.current+=1;let $=[],B;for(;;){const W=await l(t,B);if(U!==L.current||!W.ok)return;if($=[...$,...W.data.events].slice(-1e3),!W.data.more||!W.data.next_cursor)break;B=W.data.next_cursor}U===L.current&&P($.reverse())},[l,t]);u.useEffect(()=>{X(),q()},[X,q]);const ne=p?v.lists.find(U=>U.id===p.task.list_id):void 0,ae=u.useMemo(()=>{var U;return((U=v.workflows.find($=>$.id===(p==null?void 0:p.task.workflow_id)))==null?void 0:U.statuses)??[]},[v,p==null?void 0:p.task.workflow_id]);u.useEffect(()=>{if(!p)return;let U=!0;return i(p.task.list_id,{limit:100}).then($=>{U&&M($.ok?$.data.tasks.filter(B=>B.id!==p.task.id).map(B=>({id:B.id,title:B.title})):[])}),()=>{U=!1}},[i,p==null?void 0:p.task.list_id,p==null?void 0:p.task.id,p]);const je=u.useCallback(async()=>{await Promise.all([X(),q()])},[X,q]),re=u.useCallback((U,$)=>c?c.run(U,$):Promise.resolve({ok:!1,refusal:{status:0,message:"This page cannot change tasks."}}),[c]),we=u.useCallback(async(U,$,B)=>{const W=await re(U,$);return W.ok?(B&&h.success(B),await je(),W.data):(W.refusal.code==="revision_conflict"?D({tone:"warning",title:"This task changed while you were editing",body:"We reloaded it. Check the change, then save again."}):W.refusal.code==="claim_held"?(await X(),D({tone:"destructive",title:"Someone else claimed this task first",body:"Their claim is shown below. You can take it over if it lapses."})):h.error(W.refusal.message),await je(),null)},[re,h,je,X]),se=(p==null?void 0:p.claim)??null,tt=se!==null&&se.id===te&&!se.lapsed&&!se.via?se.id:null;if(u.useEffect(()=>{if(!tt)return;const U=window.setInterval(()=>{re("renew_claim",{claim_id:tt,lease_seconds:Jv}).then(()=>X())},$D);return()=>window.clearInterval(U)},[tt,re,X]),w)return s.jsx(zu,{back:n});if(C&&!p)return s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This task could not be loaded"}),s.jsxs(xe,{children:[s.jsx("p",{children:"Check your connection and try again."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void X(),children:"Retry"})]})]});if(!p)return s.jsx(Rx,{});const{task:ge}=p,He=ge.archived_at!==null,J=Du(p.permission,"write")&&!He,ke=Du(p.permission,"manage"),Ue=ae.find(U=>U.id===ge.status_id),ft=ae.find(U=>U.category==="completed"),_e=v.priorities.find(U=>U.id===ge.priority_id),Ht=p.contributors.map(U=>U.user_id),wt=se!==null&&se.user_id===m,Et=se!==null&&!se.lapsed,tn=p.checklist.filter(U=>U.is_complete).length,_t=async()=>{const[U,$]=await Promise.all([i(ge.list_id,{limit:1}),o(v.id)]);return U.ok?$.ok?{ok:!0,data:{task_id:ge.id,expected_revision:ge.revision,expected_order_revision:U.data.list.order_revision,expected_hierarchy_revision:$.data}}:$:U},Nt=(U,$)=>we("update_task",{task_id:ge.id,expected_revision:ge.revision,changes:U},$),bn=U=>y(U.via==="sdlc_login"?{title:"Release this claim?",description:`You claimed it via ${Yf(U.via,U.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}),Gt=async()=>{if(!ft)return;if(Et&&(!wt||se.via)){const $=se.via==="api_key"?`${wt?"Your":`${b(se.user_id)}'s`} agent is still working on it.`:se.via==="sdlc_login"?`${wt?"You are":`${b(se.user_id)} is`} still working on it via ${Yf(se.via,se.via_device)}.`:`${b(se.user_id)} is still working on it.`;if(!await y({title:"Complete this task?",description:$,action_label:"Mark complete"}))return}await Nt({status_id:ft.id},"Task completed.")!==null&&se&&wt&&Et&&await we("end_claim",{claim_id:se.id,outcome:"completed"})},le=async(U,$)=>{const B=await _t();if(!B.ok){h.error(B.refusal.message);return}await we(U,B.data,$)},Me=async()=>{await y({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 le("archive_task","Task archived.")},Ce=async()=>{await le("restore_task","Task restored.")},nn=async()=>{var W;const U=se,$=await we("claim_task",{task_id:ge.id,lease_seconds:Jv}),B=(W=$==null?void 0:$.claim)==null?void 0:W.id;B&&!(U&&U.id===B&&U.via)&&ce(B)},sn=async()=>{se&&(se.via&&!await bn(se)||(await we("end_claim",{claim_id:se.id,outcome:"released"},"Claim released."),ce(null)))},zn=async()=>{se&&await we("end_claim",{claim_id:se.id,outcome:"expired"},"Claim cleared.")},st=async U=>{U.hold_type==="paused"&&m&&(U={...U,target_user_id:m});const $=await re("open_hold",{task_id:ge.id,hold_type:U.hold_type,reason:U.reason,...U.target_user_id?{target_user_id:U.target_user_id}:{},...U.target_task_id?{target_task_id:U.target_task_id}:{},...U.target_label?{target_label:U.target_label}:{}});return $.ok?(T(!1),h.success("Hold added."),U.release_claim&&se&&wt&&!se.via&&(await we("end_claim",{claim_id:se.id,outcome:"released"}),ce(null)),await je(),null):$.refusal.message},hs=U=>we("checklist",{task_id:ge.id,expected_revision:ge.revision,...U}),Wn=async U=>{for(const $ of U.filter(B=>!Ht.includes(B)))await we("set_contributor",{task_id:ge.id,expected_revision:ge.revision,user_id:$,action:"add"});for(const $ of p.contributors.filter(B=>!U.includes(B.user_id)))await we("set_contributor",{task_id:ge.id,expected_revision:ge.revision,user_id:$.user_id,action:"remove",expected_contributor_revision:$.revision})},ms=U=>{var B;if(U.target.kind==="user")return b(U.target.user_id,m);if(U.target.kind==="external")return U.target.label;if(U.target.hidden||!U.target.task_id)return"A task you cannot see";const $=U.target.task_id;return s.jsx(f,{className:"text-primary hover:underline",href:d(`${n}/${$}`),children:((B=A.find(W=>W.id===$))==null?void 0:B.title)??"Another task"})},ps=U=>U.target.kind==="user"&&U.target.user_id===m&&!U.released_at?s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void we("release_hold",{hold_id:U.id},"Hold released."),children:"Release"}):J?s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void we("resolve_hold",{hold_id:U.id},"Hold resolved."),children:"Resolve"}):null;return s.jsxs(s.Fragment,{children:[s.jsx(en,{title:ge.title,description:`Created ${Yn(ge.created_at)} by ${b(ge.created_by,m)}`,actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[J&&s.jsxs(s.Fragment,{children:[s.jsxs(V,{type:"button",variant:"outline",onClick:()=>O(ge.title),children:[s.jsx(md,{className:"mr-2 size-4","aria-hidden":"true"}),"Edit title"]}),ft&&ge.status_id!==ft.id&&s.jsxs(V,{type:"button",variant:"outline",onClick:()=>void Gt(),children:[s.jsx(Il,{className:"mr-2 size-4","aria-hidden":"true"}),"Mark complete"]})]}),ke&&!He&&s.jsxs(V,{type:"button",variant:"outline",onClick:()=>void Me(),children:[s.jsx(bv,{className:"mr-2 size-4","aria-hidden":"true"}),"Archive"]})]}),children:k!==null?s.jsxs("form",{className:"flex flex-wrap items-center gap-2 pt-1",onSubmit:async U=>{U.preventDefault(),k.trim()&&await Nt({title:k.trim()})!==null&&O(null)},children:[s.jsx($e,{htmlFor:"task-title",className:"sr-only",children:"Title"}),s.jsx(bt,{id:"task-title",className:"max-w-xl",value:k,onChange:U=>O(U.target.value)}),s.jsx(V,{type:"submit",size:"sm",children:"Save"}),s.jsx(V,{type:"button",size:"sm",variant:"outline",onClick:()=>O(null),children:"Cancel"})]}):null}),S&&s.jsxs(he,{variant:S.tone,className:"mt-4","data-testid":"task-notice",children:[S.tone==="warning"?s.jsx(kr,{className:"size-4","aria-hidden":"true"}):s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:S.title}),s.jsx(xe,{children:S.body})]}),He?s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(bv,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This task is archived"}),s.jsx(xe,{children:ke?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"It is out of the queue and cannot be claimed. Restore it to work on it again."}),s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void Ce(),children:[s.jsx(cR,{className:"mr-2 size-4","aria-hidden":"true"}),"Restore"]})]}):s.jsx("p",{children:"It is out of the queue and cannot be claimed. A manager can restore it."})})]}):J?null:s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(Oo,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"You can view this task"}),s.jsx(xe,{children:"Ask an organization admin for write access to change it."})]}),J?s.jsxs("div",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"task-status",children:"Status"}),s.jsxs(pt,{value:ge.status_id,onValueChange:U=>void Nt({status_id:U}),children:[s.jsx(ut,{id:"task-status",children:s.jsx(xt,{})}),s.jsx(dt,{children:ae.map(U=>s.jsx(Re,{value:U.id,children:U.name},U.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"task-priority",children:"Priority"}),s.jsxs(pt,{value:ge.priority_id??Lr,onValueChange:U=>void Nt({priority_id:U===Lr?null:U}),children:[s.jsx(ut,{id:"task-priority",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Lr,children:"Not set"}),v.priorities.map(U=>s.jsx(Re,{value:U.id,children:U.name},U.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"task-primary",children:"Primary"}),s.jsxs(pt,{value:ge.primary_user_id??Lr,onValueChange:U=>void Nt({primary_user_id:U===Lr?null:U}),children:[s.jsx(ut,{id:"task-primary",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Lr,children:"Not set"}),x.map(U=>s.jsx(Re,{value:U.user_id,children:U.label},U.user_id))]})]})]}),s.jsx(zD,{members:x,selected:Ht,on_change:U=>void Wn(U)})]}):s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(yc,{label:"Status",value:(Ue==null?void 0:Ue.name)??""}),s.jsx(yc,{label:"Priority",value:(_e==null?void 0:_e.name)??"Not set"}),s.jsx(yc,{label:"Primary",value:ge.primary_user_id?b(ge.primary_user_id,m):"Not set"}),s.jsx(yc,{label:"Contributors",value:Ht.map(U=>b(U,m)).join(", ")||"None"})]}),!He&&s.jsx(LD,{claim:se,mine:wt,holder:se?b(se.user_id):"",own:se!==null&&se.id===te,can_write:J,on_claim:()=>void nn(),on_release:()=>void sn(),on_clear:()=>void zn()}),s.jsxs("section",{className:"mt-6","aria-labelledby":"task-description-title",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("h2",{id:"task-description-title",className:"text-lg font-semibold",children:"Description"}),J&&Y===null&&s.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(ge.description??""),children:"Edit description"})]}),Y!==null?s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async U=>{U.preventDefault(),await Nt({description:Y})!==null&&E(null)},children:[s.jsx($e,{htmlFor:"task-description",className:"sr-only",children:"Description"}),s.jsx(Dn,{id:"task-description",rows:5,value:Y,onChange:U=>E(U.target.value)}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(V,{type:"submit",size:"sm",children:"Save"}),s.jsx(V,{type:"button",size:"sm",variant:"outline",onClick:()=>E(null),children:"Cancel"})]})]}):s.jsx("p",{className:"mt-2 text-sm whitespace-pre-wrap",children:ge.description||s.jsx("span",{className:"text-muted-foreground",children:"No description."})})]}),s.jsxs("section",{className:"mt-6","aria-labelledby":"task-checklist-title",children:[s.jsxs("h2",{id:"task-checklist-title",className:"text-lg font-semibold",children:["Checklist",p.checklist.length>0?` · ${tn} of ${p.checklist.length} done`:""]}),s.jsx("ul",{className:"mt-2 grid gap-1",children:p.checklist.map(U=>s.jsxs("li",{className:"flex items-center justify-between gap-2 py-1","data-testid":"task-checklist-item",children:[J?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vl,{id:`check-${U.id}`,checked:U.is_complete,onCheckedChange:$=>void hs({action:"toggle",item_id:U.id,expected_item_revision:U.revision,is_complete:$===!0})}),s.jsx($e,{htmlFor:`check-${U.id}`,className:"font-normal",children:U.label})]}):s.jsxs("span",{className:"text-sm",children:[U.is_complete?"Done: ":"To do: ",U.label]}),J&&s.jsxs($d,{children:[s.jsx(Od,{asChild:!0,children:s.jsx(V,{type:"button",variant:"ghost",size:"icon","aria-label":`Item actions for ${U.label}`,children:s.jsx(Op,{className:"size-4","aria-hidden":"true"})})}),s.jsx(Go,{align:"end",children:s.jsx(Al,{className:"text-destructive focus:text-destructive",onSelect:()=>void hs({action:"archive",item_id:U.id,expected_item_revision:U.revision}),children:"Remove"})})]})]},U.id))}),p.checklist.length===0&&!J&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"No checklist items."}),J&&s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async U=>{U.preventDefault(),I.trim()&&await hs({action:"add",label:I.trim()})!==null&&Q("")},children:[s.jsx($e,{htmlFor:"task-new-item",children:"Add an item"}),s.jsx(bt,{id:"task-new-item",placeholder:"Add an item and press Enter",value:I,onChange:U=>Q(U.target.value)})]})]}),s.jsxs("section",{className:"mt-6","aria-labelledby":"task-holds-title",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("h2",{id:"task-holds-title",className:"text-lg font-semibold",children:"Holds"}),J&&s.jsxs(V,{type:"button",variant:"outline",size:"sm",onClick:()=>T(!0),children:[s.jsx(Gw,{className:"mr-2 size-4","aria-hidden":"true"}),"Add hold"]})]}),s.jsx("div",{className:"mt-2 shrink-0 overflow-x-auto rounded-lg border",children:s.jsxs(qe,{containerAriaLabel:"Holds",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Type"}),s.jsx(Z,{children:"Reason"}),s.jsx(Z,{children:"Waiting on"}),s.jsx(Z,{className:"text-right",children:"Actions"})]})}),s.jsxs(Ge,{children:[p.holds.map(U=>{const $=co[U.hold_type];return s.jsxs(de,{"data-testid":"task-hold",children:[s.jsx(K,{children:s.jsx(ue,{variant:$.tone,children:$.label})}),s.jsxs(K,{children:[s.jsx("div",{children:U.reason}),s.jsx("div",{className:"text-muted-foreground text-xs",children:U.released_at?`Released by ${b(U.released_by,m)} · ${Yn(U.released_at)} · Ready to resolve`:`Opened by ${b(U.opened_by,m)} · ${Yn(U.opened_at)} · Open`})]}),s.jsx(K,{children:ms(U)}),s.jsx(K,{className:"text-right",children:ps(U)})]},U.id)}),p.holds.length===0&&s.jsx(de,{children:s.jsx(K,{colSpan:4,className:"text-muted-foreground h-16 text-center",children:"Nothing is holding this task."})})]})]})}),s.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."})]}),s.jsxs("section",{className:"mt-6 pb-8","aria-labelledby":"task-activity-title",children:[s.jsx("h2",{id:"task-activity-title",className:"text-lg font-semibold",children:"Activity"}),s.jsxs("ul",{className:"mt-2 divide-y rounded-lg border",children:[z.slice(0,F).map(U=>s.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:[s.jsx("span",{children:pD(U)}),s.jsxs("span",{className:"min-w-0 text-right sm:text-left",children:[s.jsx("span",{children:U.actor_id?b(U.actor_id,m):"The system"}),U.via?s.jsxs("span",{className:"text-muted-foreground block max-w-64 truncate text-xs sm:max-w-none",title:`via ${Yf(U.via,U.via_device)}`,children:["via ",kx(U.via),s.jsx(Dk,{via:U.via,device:U.via_device})]}):null]}),s.jsx("span",{className:"text-muted-foreground col-span-2 sm:col-span-1 sm:text-right",children:Ak(U.created_at)})]},U.id)),z.length===0&&s.jsx("li",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No activity yet."})]}),z.length>F&&s.jsx(V,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>H(U=>U+ey),children:"Load more"})]}),J&&ne&&s.jsx(MD,{open:R,members:x,tasks:A,holds_my_web_claim:wt&&Et&&!(se!=null&&se.via),on_close:()=>T(!1),on_submit:st}),g]})}function yc({label:e,value:t}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("dt",{className:"text-muted-foreground text-xs",children:e}),s.jsx("dd",{className:"text-sm",children:t})]})}function zD({members:e,selected:t,on_change:n}){return s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"task-contributors",children:"Contributors"}),s.jsxs($d,{children:[s.jsx(Od,{asChild:!0,children:s.jsxs(V,{id:"task-contributors",type:"button",variant:"outline",className:"justify-between font-normal",children:[t.length===0?s.jsx("span",{className:"text-muted-foreground",children:"Add a contributor"}):s.jsx("span",{className:"truncate",children:e.filter(a=>t.includes(a.user_id)).map(a=>a.label).join(", ")}),s.jsx(Hw,{className:"text-muted-foreground size-4","aria-hidden":"true"})]})}),s.jsx(Go,{align:"start",children:e.map(a=>{const r=t.includes(a.user_id);return s.jsxs(Al,{onSelect:()=>n(r?t.filter(l=>l!==a.user_id):[...t,a.user_id]),children:[r?s.jsx(Il,{className:"mr-2 size-4","aria-hidden":"true"}):s.jsx("span",{className:"mr-2 size-4"}),a.label]},a.user_id)})})]})]})}function Dk({via:e,device:t}){return e!=="sdlc_login"||!t?null:s.jsxs(s.Fragment,{children:[" on ",s.jsx("bdi",{children:t})]})}function LD({claim:e,mine:t,holder:n,own:a,can_write:r,on_claim:l,on_release:i,on_clear:o}){let c=s.jsx(Dp,{className:"size-4","aria-hidden":"true"}),d="Nobody is working on this",f=r?"Claim it to show others you are.":"",h=r?s.jsx(V,{type:"button",size:"sm",onClick:l,children:"Claim"}):null;if(e&&e.lapsed){const m=new Date(e.lease_expires_at)<=new Date;c=s.jsx(MR,{className:"size-4","aria-hidden":"true"}),d=m?`${t?"Your":`${n}'s`} claim lapsed at ${cs(e.lease_expires_at)}`:`${t?"Your":`${n}'s`} claim lapsed`,f=m?"Its time ran out.":`${n} can no longer edit this task.`,r&&(f+=" Take it over to work on it yourself, or clear it so anyone can claim it."),h=r?s.jsxs(s.Fragment,{children:[s.jsx(V,{type:"button",size:"sm",variant:"outline",onClick:o,children:"Clear claim"}),s.jsx(V,{type:"button",size:"sm",onClick:l,children:"Take over"})]}):null}else if(e){const m=cs(e.lease_expires_at);c=e.via==="api_key"?s.jsx(Mp,{className:"size-4","aria-hidden":"true"}):e.via==="sdlc_login"?s.jsx(tT,{className:"size-4","aria-hidden":"true"}):s.jsx(OT,{className:"size-4","aria-hidden":"true"});const x=s.jsxs(s.Fragment,{children:["Claimed via sdlc login",s.jsx(Dk,{via:e.via,device:e.via_device}),"."]});t&&e.via==="api_key"?(d=`Your agent is working on this until ${m}`,f="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}`,f=s.jsxs(s.Fragment,{children:[x," 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}`,f=x):t?(d=`You are working on this until ${m}`,f=a?"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}`,f="Claimed through an API key."):(d=`${n} is working on this until ${m}`,f=r?"Claimed on the web. You can take it over if the claim lapses.":"Claimed on the web."),h=t?s.jsx(V,{type:"button",size:"sm",variant:"outline",onClick:i,children:"Release claim"}):null}return s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 rounded-lg border p-3","data-testid":"task-claim",children:[c,s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm font-medium",children:d}),f?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:f}):null]}),h?s.jsx("div",{className:"flex items-center gap-2",children:h}):null]})}const UD=10,zk=5,BD=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Lk="Not available",HD={added:"Added",changed:"Changed",removed:"Removed"},ID={thread:"Thread",task:"Task",issue:"Issue",release:"Release",test:"Test"},ty=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;function PD(e,t){const n=t!=null&&t.startsWith("task:")?t.slice(5):null;if(n&&BD.test(n))return{label:n,path:`/org/${e}/tasks/${n}`};const a=t!=null&&t.startsWith("issue:")?t.slice(6):null;if(a&&/^iss-\d{1,9}$/.test(a))return{label:a,path:`/org/${e}/issues/${a}`};const r=t!=null&&t.startsWith("release:")?t.slice(8):null;if(r&&ty.test(r))return{label:r==="candidate"?"Candidate":`Release ${r}`,path:`/releases?release=${r}`};const l=t!=null&&t.startsWith("planned:")?t.slice(8):null;return l&&ty.test(l)?{label:`Planned Release ${l}`,path:`/releases?planned=${l}`}:{label:"Tasks",path:`/org/${e}/tasks`}}const Uk=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function qD({org:e,task_id:t,from:n}){var Gt;const a=Yo(),{href:r,Link:l}=Xe(),{confirm:i,confirm_dialog:o}=Bo(),c=PD(e,n),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState([]),[x,b]=u.useState([]),[v,y]=u.useState(null),[g,p]=u.useState(null),[j,w]=u.useState({state:"loading"}),[N,C]=u.useState({state:"loading"}),[_,S]=u.useState(null),[D,z]=u.useState(null),[P,F]=u.useState(!1),H=u.useRef(null),A=ds(),M=u.useRef(null),R=u.useRef(null),T=u.useRef(null),k=u.useRef(null),O=u.useRef(!1),Y=u.useRef(0),E=u.useRef(0),I=u.useCallback(async()=>{if(!a.taskSections)return;w({state:"loading"});const le=await a.taskSections(t);w(le.ok?{state:"ok",data:le.data}:{state:"failed",refusal:le.refusal})},[a.taskSections,t]),Q=u.useCallback(async()=>{if(!a.taskRelated)return;C({state:"loading"});const le=await a.taskRelated(t);C(le.ok?{state:"ok",data:le.data}:{state:"failed",refusal:le.refusal})},[a.taskRelated,t]),te=u.useCallback(async()=>{var sn,zn;const le=E.current+=1;p(null),I(),Q();const[Me,Ce]=await Promise.all([a.availability(),a.task?a.task(t):Promise.resolve(null)]);if(le!==E.current)return;Me.state==="active"&&m(((sn=Me.workspace.workflows.find(st=>st.id===Me.list.workflow_id))==null?void 0:sn.statuses)??[]);const nn=Me.state==="off"&&((zn=Me.refusal)==null?void 0:zn.reason)==="engine_missing"?Me.refusal:null;if(!Ce||!Ce.ok&&Ce.refusal.reason==="engine_missing"||nn){f({state:"engine_missing",refusal:nn??(Ce&&!Ce.ok?Ce.refusal:{status:0,message:""})});return}if(Ce.ok){Y.current=0,y(null),z(null),f({state:"ok",detail:Ce.data,at:new Date().toISOString()});return}if(Ce.refusal.status===404||Ce.refusal.reason==="not_found"){f({state:"missing"});return}if(Y.current+=1,Y.current===1&&Uk(Ce.refusal)){p(Ce.refusal.retry_after??UD);return}y(Ce.refusal),f(st=>st.state==="loading"?{state:"loading"}:st)},[a,t,I,Q]);u.useEffect(()=>{te()},[te]),u.useEffect(()=>{if(g===null)return;const le=setTimeout(()=>void te(),g*1e3);return()=>clearTimeout(le)},[g,te]),u.useEffect(()=>{let le=!0;return a.members().then(Me=>{le&&Me.ok&&b(Me.data)}),()=>{le=!1}},[a.members]),u.useEffect(()=>{var Me;if(O.current||d.state!=="ok")return;O.current=!0;const le=(Me=H.current)==null?void 0:Me.querySelector("h1");le&&(le.tabIndex=-1,le.focus())},[d.state]),u.useEffect(()=>{var le;_&&((le=R.current)==null||le.focus())},[_]),u.useEffect(()=>{if(D===null)return;const le=setTimeout(()=>{var Me;return(Me=M.current)==null?void 0:Me.focus()},0);return()=>clearTimeout(le)},[D]);const ce=u.useMemo(()=>new Map(x.map(le=>[le.user_id,le.label])),[x]),X=le=>le?ce.get(le)??le:"",L=()=>{S(null),te()},q=u.useRef(null),ne=le=>(q.current=le,le==="graph"?I():Q());if(u.useEffect(()=>{var Ce;const le=q.current;if(le===null||(le==="graph"?j:N).state==="loading")return;q.current=null;const Me=(le==="graph"?T:k).current??((Ce=H.current)==null?void 0:Ce.querySelector("h1"));Me==null||Me.focus()},[j,N]),d.state==="missing")return s.jsx(ka,{children:s.jsx(zu,{back:`/org/${e}/tasks`,description:`No task ${t} in this checkout. It may have finished and been archived, or never been recorded.`})});const ae=s.jsx(V,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(l,{href:r(c.path),children:[s.jsx(Bw,{className:"size-4","aria-hidden":"true"}),c.label]})});if(d.state==="engine_missing")return s.jsx(ka,{children:s.jsx("div",{ref:H,className:"contents",children:s.jsx(la,{page:"Task",header:s.jsx(Ii,{back:ae,id:null,title:t})})})});const je=v?s.jsxs(he,{variant:"destructive",className:"mt-4",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not read this task"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[v.message,v.since?` Since ${rs(v.since)}.`:"",d.state==="ok"?` This page was read at ${rs(d.at)}.`:""," See the sdlc viewer terminal for more."]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:L,children:"Retry"})]})]}):null,re=g!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(Wt,{"aria-hidden":"true"}),"Could not read this task. Trying again in ",g," seconds."]}):null,we=s.jsx("div",{role:"status","aria-live":"polite",children:re});if(d.state==="loading")return s.jsxs(ka,{children:[we,je,!v&&g===null?s.jsx(Rx,{}):null]});const{detail:se,at:tt}=d,{task:ge}=se,He=h.find(le=>le.id===ge.status_id),J=se.local_done&&"task"in se.local_done?se.local_done:null,ke=se.local_waits??[],Ue=J?ke[0]??null:null,ft=Ue?X(Ue.opened_by):se.owner_title??X(se.thread),_e=j.state==="ok"?j.data:null,Ht=(_e==null?void 0:_e.lifecycle)==="finished",wt=Ht&&(_e==null?void 0:_e.outcome)==="cancelled",Et=Ht&&(_e==null?void 0:_e.outcome)==="complete",tn=!!ge.created_at,_t=se.acceptance??[],Nt=async()=>{var Ce;if(!J||!((Ce=a.commands)!=null&&Ce.complete)||!await i({title:`Mark ${ge.title} done?`,description:Ue?`This answers ${ft}'s ask, “${Ue.reason}”, closes that wait, and tells ${ft} to check and continue.`:`This tells ${ft||"its thread"} to check and continue.`,action_label:"Mark done"}))return;F(!0);const Me=await a.commands.complete(J);if(F(!1),!Me.ok){z(Me.refusal.message);return}await te(),S({title:ge.title,asker:ft||"Its thread"})},bn=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[J&&!_?s.jsxs(s.Fragment,{children:[s.jsxs(V,{ref:M,type:"button",variant:"outline",disabled:P,"aria-disabled":D!==null?!0:void 0,"aria-describedby":D!==null?"task-done-why":void 0,onClick:()=>{D===null&&Nt()},children:[s.jsx(Il,{className:"mr-2 size-4","aria-hidden":"true"}),"Done"]}),D!==null?s.jsx("span",{id:"task-done-why",className:"text-muted-foreground text-xs",children:"Read again first"}):null]}):null,s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",rs(tt)]}),s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:L,children:[s.jsx(kr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsxs(ka,{children:[s.jsxs("div",{ref:H,className:"contents",children:[s.jsx(Ii,{back:ae,id:ge.id,badge:He?s.jsx(ue,{variant:Ek(He),children:He.name}):null,title:ge.title,created:tn?`Created ${Yn(ge.created_at)}${ft||se.owner_title?` by ${se.owner_title??ft}`:""}`:null,actions:bn}),we,je,_?s.jsx("div",{ref:R,tabIndex:-1,role:"status","aria-live":"polite",className:"outline-none",children:s.jsxs(he,{variant:"success",className:"mt-4",children:[s.jsx(hd,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:["Marked ",_.title," done"]}),s.jsxs(xe,{children:[_.asker," is told to check and continue."]})]})}):null,D!==null?s.jsxs(he,{variant:"destructive",className:"mt-4",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Done was not recorded"}),s.jsxs(xe,{children:[D," Read again to see the task as it is now."]})]}):null,Ue&&!_?s.jsxs(he,{variant:"warning",className:"mt-4",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:[ft," asks: ",Ue.reason]}),s.jsxs(xe,{children:["Waiting on you since ",Sx(Ue.opened_at),". Done answers it and tells ",ft," to check and continue."]})]}):null,se.view_outdated?s.jsxs(he,{variant:"warning",className:"mt-4",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsxs(xe,{children:[A," Until then this page cannot read the claim and holds."]})]}):null,s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(_s,{label:"Owner thread",value:se.owner_title??(X(se.thread)||"None")}),s.jsx(_s,{label:"Release",value:se.release??"None"}),s.jsx(_s,{label:"Session",value:j.state==="loading"?"Loading…":j.state==="failed"?"Not available":_e!=null&&_e.session?s.jsxs(s.Fragment,{children:[_e.session.provider," ",s.jsx("span",{className:"font-mono break-all",children:_e.session.id})]}):"None"}),s.jsx(_s,{label:"Now",value:se.local_detail??(He==null?void 0:He.name)??""})]}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Local tasks have no priority or contributors."}),s.jsx(GD,{detail:se,holder:X((Gt=se.claim)==null?void 0:Gt.user_id),finished_at:Ht?(_e==null?void 0:_e.finished_at)??null:null,read_at:tt}),s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(Oo,{className:"text-info size-4","aria-hidden":"true"}),J?s.jsxs(s.Fragment,{children:[s.jsx(ye,{children:"Done is the one change this page makes"}),s.jsx(xe,{children:"Everything else about this task changes through its thread."})]}):s.jsxs(s.Fragment,{children:[s.jsx(ye,{children:"This page only reads tasks"}),s.jsx(xe,{children:"A task changes through the agent thread working on it."})]})]}),tn?_e!=null&&_e.record?s.jsxs("p",{className:"mt-4 text-sm",children:["Record ",s.jsx("span",{className:"font-mono break-all",children:_e.record})]}):null:s.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."}),J?s.jsx(Ct,{id:"task-done-needs",title:"What Done needs",children:_t.length>0?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The task's acceptance; ",ft||"its thread"," checks these after Done."]}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:_t.map(le=>s.jsx("li",{children:le},le))})]}):s.jsxs("p",{className:"text-sm",children:["Its thread gave no acceptance. Ask ",ft||"its thread"," what Done needs before marking it."]})}):_t.length>0?s.jsxs(Ct,{id:"task-acceptance",title:"Acceptance",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:Et?"All met: the task finished complete":wt&&(_e!=null&&_e.finished_at)?`Cancelled ${Yn(_e.finished_at)}`:"Met when the task finishes complete"}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:_t.map(le=>s.jsx("li",{children:Et?`Met: ${le}`:le},le))})]}):null,s.jsx(VD,{detail:se,waits:ke,given:J!==null,threadName:X,threadsLink:s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/threads`),children:"Threads"})}),j.state==="loading"?s.jsxs("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading the task's sections",children:[s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-2/3"})]}):null,_e?s.jsx(Ct,{id:"task-stands",title:"Where it stands",children:s.jsxs("p",{className:"text-sm",children:[(He==null?void 0:He.name)??ge.status_id,se.local_detail?` · ${se.local_detail}`:""]})}):null,_e!=null&&_e.time?s.jsx(YD,{time:_e.time}):null,s.jsx(FD,{sections:j,heading_ref:T,on_retry:()=>void ne("graph"),taskLink:le=>s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/tasks/${le}?from=task:${ge.id}`),children:le})}),_e!=null&&_e.files?s.jsx(KD,{files:_e.files,finished:Ht}):null,_e!=null&&_e.proof?s.jsx(XD,{proof:_e.proof,finished_at:_e.finished_at,who:se.owner_title??null}):null,_e&&_e.history.length>0?s.jsx(QD,{history:_e.history}):null,s.jsx(Bk,{related:N,heading_ref:k,on_retry:()=>void ne("related"),link:le=>{const Me=le.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(le.id)}`:le.kind==="task"?`/org/${e}/tasks/${le.id}?from=task:${ge.id}`:le.kind==="issue"?`/org/${e}/issues/${encodeURIComponent(le.id)}?from=task:${ge.id}`:le.kind==="release"?`/releases?${le.planned?"planned":"release"}=${encodeURIComponent(le.id)}`:null;return Me?s.jsx(l,{className:ie("text-primary hover:underline",le.kind!=="thread"&&le.label===le.id&&"font-mono"),href:r(Me),children:le.label}):le.label}})]}),o]})}function ka({children:e}){return s.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 Ii({back:e,id:t,badge:n,title:a,created:r,actions:l}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("div",{children:e}),t?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx("span",{className:"font-mono",children:t}),n]}):null,s.jsx(en,{title:a,description:r??void 0,actions:l})]})}function _s({label:e,value:t}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("dt",{className:"text-muted-foreground text-xs",children:e}),s.jsx("dd",{className:"m-0 text-sm break-words",children:t})]})}function Ct({id:e,title:t,aside:n,heading_ref:a,children:r}){return s.jsxs("section",{className:"mt-6","aria-labelledby":`${e}-title`,children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[s.jsx("h2",{id:`${e}-title`,ref:a,tabIndex:a?-1:void 0,className:"text-lg font-semibold outline-none",children:t}),n?s.jsx("span",{className:"text-muted-foreground text-sm",children:n}):null]}),s.jsx("div",{className:"mt-2",children:r})]})}function GD({detail:e,holder:t,finished_at:n,read_at:a}){const r=e.claim,[,l]=u.useReducer(f=>f+1,0),i=r&&!e.view_outdated?new Date(r.lease_expires_at).getTime():null;u.useEffect(()=>{if(i===null||!Number.isFinite(i))return;const f=i-Date.now();if(f<=0)return;const h=setTimeout(l,Math.min(f+50,2147483647));return()=>clearTimeout(h)},[i]);let o=s.jsx(Dp,{className:"size-4","aria-hidden":"true"}),c="Nobody is working on this",d=null;if(e.view_outdated)c=`Claimed by: ${Lk}`;else if(r){const f=new Date(r.lease_expires_at)<=new Date(Math.max(Date.now(),new Date(a).getTime()));o=s.jsx(Mp,{className:"size-4","aria-hidden":"true"}),c=`${t} is working on this until ${rs(r.lease_expires_at)}${f||r.lapsed?" · passed":""}`,d="Claimed in the coordination registry; its thread renews the claim."}else n&&(o=s.jsx(hd,{className:"size-4","aria-hidden":"true"}),d=`Finished ${Yn(n)}. Its claim ended when it finished.`);return s.jsxs(ot,{className:"mt-4 flex flex-wrap items-center gap-3 p-3","data-testid":"task-claim",children:[o,s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm font-medium",children:c}),d?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:d}):null]})]})}function VD({detail:e,waits:t,given:n,threadName:a,threadsLink:r}){if(e.view_outdated)return s.jsx(Ct,{id:"task-holds",title:"Holds",children:s.jsx("p",{className:"text-sm",children:Lk})});if(e.holds.length===0)return null;const l=new Map(t.map(i=>[i.id,i]));return s.jsxs(Ct,{id:"task-holds",title:`Holds · ${e.holds.length} open`,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"A hold does not change the task's status."}),s.jsx(ot,{className:"mt-2 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Holds",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Type"}),s.jsx(Z,{children:"Reason"}),s.jsx(Z,{children:"Waiting on"}),s.jsx(Z,{children:"Opened"})]})}),s.jsx(Ge,{children:e.holds.map(i=>{var f;const o=l.get(i.id),c=co[i.hold_type],d=n?"Done above answers it":o!=null&&o.local_done?"In Waiting on you":(f=o==null?void 0:o.local_threads)!=null&&f.length?s.jsxs(s.Fragment,{children:["Answer it in ",r,": ",o.local_threads.join(" · ")]}):null;return s.jsxs(de,{"data-testid":"task-hold",children:[s.jsx(K,{children:s.jsx(ue,{variant:c.tone,children:(o==null?void 0:o.local_label)??c.label})}),s.jsxs(K,{children:[s.jsx("div",{children:i.reason}),s.jsxs("div",{className:"text-muted-foreground text-xs",children:["Opened by ",a(i.opened_by)]})]}),s.jsxs(K,{children:[s.jsx("div",{children:i.target.kind==="user"?"You":i.target.kind==="external"?i.target.label:"Another task"}),d?s.jsx("div",{className:"text-muted-foreground text-xs",children:d}):null]}),s.jsx(K,{children:Sx(i.opened_at)})]},i.id)})})]})})]})}function YD({time:e}){return s.jsx(Ct,{id:"task-time",title:"Time",children:s.jsxs("dl",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsx(_s,{label:"Estimate",value:e.estimate?`${fi(e.estimate.low)}–${fi(e.estimate.high)}`:e.unknown_reason??"None"}),s.jsx(_s,{label:"Time taken",value:e.elapsed!==null?`${fi(e.elapsed)}${e.over_estimate?" · over estimate":""}`:"Not started"}),e.forecast?s.jsx(_s,{label:"Reforecast",value:s.jsxs("span",{className:"text-muted-foreground",children:[fi(e.forecast.low),"–",fi(e.forecast.high)," left",e.forecast.reason?` · ${e.forecast.reason}`:""]})}):null]})})}function Tx({what:e,again:t,refusal:n,on_retry:a}){return s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:["Could not read ",e]}),s.jsxs(xe,{children:[s.jsx("p",{children:n.message}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:t})]})]})}function FD({sections:e,heading_ref:t,on_retry:n,taskLink:a}){const[r,l]=u.useState(!1);if(e.state==="loading")return null;const i=e.state==="failed"?e.refusal:e.data.graph.ok?null:e.data.graph.refusal;if(i)return s.jsx(Ct,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsx(Tx,{what:"graph changes",again:"Read graph changes again",refusal:i,on_retry:n})});const o=e.state==="ok"&&e.data.graph.ok?e.data.graph.data:null;if(!o)return null;if(o.exempt)return s.jsx(Ct,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsxs("p",{className:"text-sm",children:["This task changes no modeled design. Its plan says why: ",o.exempt,"."]})});if(o.changes.length===0)return null;const c=r?o.changes:o.changes.slice(0,zk),d=o.changes.length-c.length;return s.jsxs(Ct,{id:"task-graph",title:"Graph changes",aside:o.document,heading_ref:t,children:[s.jsx(ot,{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Graph changes",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Change"}),s.jsx(Z,{children:"Kind of change"}),s.jsx(Z,{children:"Also in"}),s.jsx(Z,{children:"In the plan"})]})}),s.jsx(Ge,{children:c.map(f=>s.jsxs(de,{children:[s.jsxs(K,{children:[s.jsx("div",{children:f.label}),s.jsx("div",{className:"text-muted-foreground text-xs",children:f.type})]}),s.jsx(K,{children:HD[f.change]}),s.jsx(K,{children:f.also_in.length===0?"No other task":f.also_in.map((h,m)=>s.jsxs(u.Fragment,{children:[m>0?", ":null,a(h.id)]},h.id))}),s.jsx(K,{children:f.planned?"Yes":s.jsx(ue,{variant:"warning",children:"No longer planned"})})]},`${f.id}:${f.planned}`))})]})}),d>0?s.jsxs("p",{className:"mt-2 flex flex-wrap items-center gap-2 text-sm",children:[d," more changes in this task's plan slice.",s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:()=>l(!0),children:["Show all ",o.changes.length]})]}):null]})}function KD({files:e,finished:t}){const[n,a]=u.useState(!1),r=n?e.paths:e.paths.slice(0,zk);return s.jsxs(Ct,{id:"task-files",title:"Files",children:[r.length>0?s.jsx("ul",{className:"grid gap-1 text-sm",children:r.map(l=>s.jsx("li",{children:s.jsx("span",{className:"font-mono break-all",children:l})},l))}):null,e.paths.length>r.length?s.jsxs(V,{type:"button",variant:"ghost",size:"sm",className:"mt-1",onClick:()=>a(!0),children:["Show all ",e.paths.length]}):null,e.landed?s.jsxs("p",{className:"mt-2 text-sm",children:["Landed ",s.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 XD({proof:e,finished_at:t,who:n}){return s.jsxs(Ct,{id:"task-proof",title:"Evidence and proof",children:[e.evidence?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:e.evidence}):null,e.no_code?s.jsxs("p",{className:"mt-2 text-sm",children:["No code: ",e.no_code]}):e.commit?s.jsxs("p",{className:"mt-2 text-sm",children:["Proof ",s.jsx("span",{className:"font-mono",children:e.commit.slice(0,10)})," ·"," ",e.on_main?"on main":"not yet on main"]}):null,t?s.jsxs("p",{className:"text-muted-foreground mt-2 text-xs",children:["Finished ",Yn(t),n?` by ${n}`:""]}):null]})}function QD({history:e}){return s.jsxs(Ct,{id:"task-history",title:"History",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"From the task record, newest first"}),s.jsx(ot,{className:"mt-2 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"History",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"What"}),s.jsx(Z,{children:"Who"}),s.jsx(Z,{children:"When"})]})}),s.jsx(Ge,{children:e.map((t,n)=>s.jsxs(de,{children:[s.jsx(K,{children:t.what}),s.jsx(K,{children:t.who??"Its thread"}),s.jsx(K,{children:Sx(t.at)})]},`${t.at}:${n}`))})]})})]})}function Bk({id:e="task-related",related:t,heading_ref:n,on_retry:a,link:r,fixed:l=!1}){return t.state==="ok"&&t.data.length===0?null:s.jsx(Ct,{id:e,title:"Related",heading_ref:n,children:t.state==="loading"?s.jsxs("div",{className:"grid gap-2",role:"status","aria-label":"Loading related work",children:[s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-2/3"})]}):t.state==="failed"?s.jsx(Tx,{what:"related work",again:"Read related work again",refusal:t.refusal,on_retry:a}):s.jsx(ot,{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Related",className:l?"table-fixed":void 0,children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{className:l?"w-[14%]":void 0,children:"Kind"}),s.jsx(Z,{className:l?"w-[45%]":void 0,children:"Item"}),s.jsx(Z,{className:l?"w-[41%]":void 0,children:"How it relates"})]})}),s.jsx(Ge,{children:t.data.map(i=>s.jsxs(de,{children:[s.jsx(K,{children:ID[i.kind]}),s.jsx(K,{className:l?"break-words":void 0,children:r(i)}),s.jsx(K,{className:l?"break-words":void 0,children:i.relation})]},`${i.kind}:${i.planned?"planned:":""}${i.id}`))})]})})})}function WD({org:e,task_id:t,from:n}){const a=Yo(),r=`/org/${e}/tasks`;return a.taskSections?s.jsx(qD,{org:e,task_id:t,from:n??null}):s.jsx(ZD,{task_id:t,back:r})}function ZD({task_id:e,back:t}){const{availability:n}=Yo(),[a,r]=u.useState({state:"loading"});return u.useEffect(()=>{let l=!0;return n().then(i=>{l&&r(i)}),()=>{l=!1}},[n]),a.state==="off"?s.jsx(zu,{back:t}):s.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"?s.jsx(DD,{active:a,task_id:e,back:t}):a.state==="error"?s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This task could not be loaded"}),s.jsx(xe,{children:"Check your connection and try again."})]}):a.state==="available"?s.jsx(zu,{back:t}):s.jsx(Rx,{})})}function ns({children:e}){return s.jsx("p",{role:"alert",className:"text-destructive text-sm",children:e})}const JD=["open","triaged","resolved","closed"],Ex=["low","normal","high","urgent"],ez=["fixed","works_as_intended","planned","duplicate","wont_fix","cannot_reproduce"],tz=["title","description","external_reference"],Lu={open:"Open",triaged:"Triaged",escalated:"Escalated",waiting_on_fix:"Waiting on fix",resolved:"Resolved",closed:"Closed"},Hk={open:"warning",triaged:"info",escalated:"info",waiting_on_fix:"info",resolved:"success",closed:"neutral"},uo={low:"Low",normal:"Normal",high:"High",urgent:"Urgent"},Ax={fixed:"Fixed",works_as_intended:"Works as intended",planned:"Planned",duplicate:"Duplicate",wont_fix:"Won't fix",cannot_reproduce:"Cannot reproduce"},Ik={title:"Title",description:"Description",external_reference:"External reference"},nz=[["year",365*24*3600],["month",30*24*3600],["week",7*24*3600],["day",24*3600],["hour",3600],["minute",60]];function Gc(e,t=Date.now()){const n=Math.round((new Date(e).getTime()-t)/1e3),a=new Intl.RelativeTimeFormat("en",{numeric:"auto"});for(const[r,l]of nz)if(Math.abs(n)>=l)return a.format(Math.round(n/l),r);return"just now"}function bm(e,t,n){const a=`/org/${encodeURIComponent(e)}/proj/${encodeURIComponent(t)}/support`;return n?`${a}/${encodeURIComponent(n)}`:a}function Mx(e,t){return e?t??"Not available":"A former member"}const sz="the issue integration";function az(e){return!e.created_by&&e.reporter_kind==="customer"?sz:Mx(e.created_by,e.created_by_username)}function rz(e,t){return!e.actor_id&&e.kind==="created"&&t.reporter_kind==="customer"?"The issue integration":Mx(e.actor_id,e.actor_username)}const jc="not_set",lz="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 iz({create:e,open:t,onOpenChange:n,onCreated:a}){const[r,l]=u.useState(""),[i,o]=u.useState(""),[c,d]=u.useState(!1),[f,h]=u.useState(""),[m,x]=u.useState(jc),[b,v]=u.useState(!1),[y,g]=u.useState(null),p=u.useRef(null),j=()=>{l(""),o(""),d(!1),h(""),x(jc),g(null),p.current=null},w=_=>{var S;return((S=y==null?void 0:y.personal_data)==null?void 0:S.field)===_?y.message:void 0},N=async _=>{if(_.preventDefault(),b)return;v(!0),p.current??(p.current=crypto.randomUUID());const S=await e({request_id:p.current,title:i.trim()||void 0,description:f||void 0,external_reference:r.trim()||void 0,priority:m===jc?null:m});if(v(!1),!S.ok){S.refusal.status!==0&&(p.current=null),g(S.refusal);return}j(),a(S.data.issue,S.data.duplicates)},C=y&&!y.personal_data?y.message:void 0;return s.jsx(pn,{open:t,onOpenChange:_=>{_||j(),n(_)},children:s.jsx(xn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:N,className:"grid gap-4",children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"New support issue"}),s.jsx(jn,{children:"Log one help-desk report. Text is shown exactly as entered."})]}),s.jsxs(he,{variant:"warning",children:[s.jsx(Qt,{}),s.jsx(xe,{children:lz})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-issue-reference",children:"External reference"}),s.jsx(bt,{id:"maintain-issue-reference",value:r,"aria-invalid":!!w("external_reference"),onChange:_=>{l(_.target.value),c||o(_.target.value)}}),w("external_reference")?s.jsx(ns,{children:w("external_reference")}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"The help-desk ticket number."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-issue-title",children:"Title"}),s.jsx(bt,{id:"maintain-issue-title",value:i,"aria-invalid":!!w("title"),onChange:_=>{o(_.target.value),d(!0)}}),w("title")?s.jsx(ns,{children:w("title")}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"Prefilled from the external reference; edit it if you like."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-issue-description",children:"Description"}),s.jsx(Dn,{id:"maintain-issue-description",rows:4,placeholder:"What the end user reported, without personal data",value:f,"aria-invalid":!!w("description"),onChange:_=>h(_.target.value)}),w("description")?s.jsx(ns,{children:w("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-issue-priority",children:"Priority"}),s.jsxs(pt,{value:m,onValueChange:x,children:[s.jsx(ut,{id:"maintain-issue-priority",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:jc,children:"Not set"}),Ex.map(_=>s.jsx(Re,{value:_,children:uo[_]},_))]})]})]}),C?s.jsx(ns,{children:C}):null,s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>{j(),n(!1)},children:"Cancel"}),s.jsx(V,{type:"submit",loading:b,disabled:!i.trim()&&!r.trim(),children:"Log issue"})]})]})})})}const oz=["supportAccess","assigneeCandidates","create","update","assign","transition","redact"];function Pk(){return cz(mn().issues)}function cz(e){return e&&oz.every(t=>typeof e[t]=="function")?e:null}function qk(e){const[t,n]=u.useState(null);return u.useEffect(()=>{if(!e)return;let a=!1;return e.supportAccess().then(r=>{a||n({contract:e,state:r.ok?{state:"ready",access:r.data}:{state:"error"}})}),()=>{a=!0}},[e]),t&&e&&t.contract===e?t.state:{state:"loading"}}function Gk({access:e,header:t,back_href:n,children:a}){const{href:r,Link:l}=Xe();return e.state==="loading"?s.jsxs("div",{className:"flex flex-1 items-center justify-center py-24",children:[s.jsx(Wt,{className:"size-5"}),s.jsx("span",{className:"sr-only",children:"Loading…"})]}):e.state==="error"||!e.access.enabled?s.jsx(Ga,{title:"Page not found",description:"This page does not exist or you do not have access to it.",backHref:r(n),backLabel:"Back to the project",link:l}):e.access.can_view?s.jsx(s.Fragment,{children:a(e.access)}):s.jsxs(s.Fragment,{children:[t,s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(cT,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",children:"Support needs a Maintain seat"}),s.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 uz(){const e=Xe();return t=>{e.navigate?e.navigate(t):window.location.assign(e.href(t))}}const Nn="all",bc=25;function wm({action:e}){return s.jsx(en,{title:"Support",description:"Help-desk reports logged against this project.",actions:e})}function dz({org:e,project:t,query:n}){const a=Pk(),r=qk(a),l=`/org/${e}/proj/${t}`;return s.jsx("div",{className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:s.jsx(Gk,{access:r,header:s.jsx(wm,{}),back_href:l,children:i=>a?s.jsx(fz,{contract:a,access:i,org_name:e,proj_name:t,query:n}):null})})}function fz({contract:e,access:t,org_name:n,proj_name:a,query:r}){const{href:l,Link:i}=Xe(),o=uz(),[c,d]=u.useState(()=>new URLSearchParams(r).get("external_reference")??""),[f,h]=u.useState(Nn),[m,x]=u.useState(Nn),[b,v]=u.useState(Nn),[y,g]=u.useState(0),[p,j]=u.useState(null),[w,N]=u.useState(0),[C,_]=u.useState(null),[S,D]=u.useState([]),[z,P]=u.useState(!1),F=c.trim()!==""||f!==Nn||m!==Nn||b!==Nn,H=u.useCallback(async()=>{const k=await e.list({external_reference:c.trim()||void 0,status:f===Nn?void 0:f,priority:m===Nn?void 0:m,assignee:b===Nn?void 0:b,limit:bc,offset:y*bc});if(!k.ok){_(k.refusal.message);return}_(null),j(k.data.issues),N(k.data.total)},[e,c,f,m,b,y]);u.useEffect(()=>{const k=setTimeout(()=>void H(),200);return()=>clearTimeout(k)},[H]),u.useEffect(()=>{e.assigneeCandidates().then(k=>{k.ok&&D(k.data.candidates)})},[e]);const A=t.can_change?s.jsxs(V,{onClick:()=>P(!0),children:[s.jsx(Tl,{className:"mr-2 size-4"}),"New issue"]}):void 0,M=s.jsx(iz,{create:e.create,open:z,onOpenChange:P,onCreated:(k,O)=>{P(!1);const Y=bm(n,a,k.id);o(O.length?`${Y}?duplicates=${O.length}`:Y)}});if(p!==null&&w===0&&!F&&y===0)return s.jsxs(s.Fragment,{children:[s.jsx(wm,{}),s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(sT,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",children:"No support issues yet"}),s.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?s.jsxs(V,{onClick:()=>P(!0),children:[s.jsx(Tl,{className:"mr-2 size-4"}),"Log the first issue"]}):null]}),M]});const R=w===0?0:y*bc+1,T=Math.min(w,(y+1)*bc);return s.jsxs(s.Fragment,{children:[s.jsx(wm,{action:A}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"relative w-full max-w-sm",children:[s.jsx(ST,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2","aria-hidden":!0}),s.jsx(bt,{"aria-label":"Filter by external reference",placeholder:"Filter by external reference",className:"pl-9",value:c,onChange:k=>{d(k.target.value),g(0)}})]}),s.jsx(Kf,{label:"Status",value:f,onChange:k=>{h(k),g(0)},options:JD.map(k=>({value:k,label:Lu[k]}))}),s.jsx(Kf,{label:"Priority",value:m,onChange:k=>{x(k),g(0)},options:Ex.map(k=>({value:k,label:uo[k]}))}),s.jsx(Kf,{label:"Assignee",value:b,onChange:k=>{v(k),g(0)},options:[{value:"unassigned",label:"Unassigned"},{value:"cannot_act",label:"Assignee cannot act"},...S.map(k=>({value:k.user_id,label:k.username??"Not available"}))]})]}),C?s.jsx(ns,{children:C}):null,s.jsx("div",{className:"rounded-md border",children:s.jsxs(qe,{children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Title"}),s.jsx(Z,{children:"External reference"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Priority"}),s.jsx(Z,{children:"Assignee"}),s.jsx(Z,{children:"Updated"})]})}),s.jsx(Ge,{children:p===null?s.jsx(de,{children:s.jsx(K,{colSpan:6,className:"h-24 text-center",children:"Loading…"})}):p.length===0?s.jsx(de,{children:s.jsx(K,{colSpan:6,className:"h-24 text-center",children:"No issues match these filters."})}):p.map(k=>s.jsxs(de,{children:[s.jsx(K,{className:"max-w-md",children:s.jsx(i,{href:l(bm(n,a,k.id)),className:"font-medium hover:underline",children:k.title})}),s.jsx(K,{className:"font-mono text-xs",children:k.external_reference??""}),s.jsx(K,{children:s.jsx(ue,{variant:Hk[k.status],children:Lu[k.status]})}),s.jsx(K,{children:k.priority?uo[k.priority]:""}),s.jsx(K,{children:s.jsx(hz,{issue:k})}),s.jsx(K,{className:"text-muted-foreground",children:Gc(k.updated_at)})]},k.id))})]})}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-muted-foreground text-sm",children:w===0?"No issues.":`Showing ${R}–${T} of ${w} issue${w===1?"":"s"}.`}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(V,{variant:"outline",size:"sm",disabled:y===0,onClick:()=>g(k=>Math.max(0,k-1)),children:"Previous"}),s.jsx(V,{variant:"outline",size:"sm",disabled:T>=w,onClick:()=>g(k=>k+1),children:"Next"})]})]}),M]})}function hz({issue:e}){return e.assignee_id?s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:e.assignee_username??"Not available"}),e.assignee_can_act===!1?s.jsx(ue,{variant:"error",children:"Assignee cannot act"}):null]}):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}function Kf({label:e,value:t,onChange:n,options:a}){var l;const r=u.useMemo(()=>t===Nn||a.some(i=>i.value===t),[a,t]);return s.jsxs(pt,{value:r?t:Nn,onValueChange:n,children:[s.jsx(ut,{className:"w-44","aria-label":e,children:s.jsx(xt,{placeholder:e,children:t===Nn?e:(l=a.find(i=>i.value===t))==null?void 0:l.label})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Nn,children:"All"}),a.map(i=>s.jsx(Re,{value:i.value,children:i.label},i.value))]})]})}const Vk=[{key:"local",label:"Local"},{key:"staging",label:"Staging"},{key:"production",label:"Production"}],mz=/^iss-\d{1,9}$/,pz=/^col-\d{1,9}$/,xz=e=>e&&e[0].toUpperCase()+e.slice(1);function Yk(e){const t=xz(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 Pi(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 _m={search:"",owner:null,urgent:!1,seen:[],label:null,collection:null};function Vc(e){const t=new URLSearchParams(e),n=t.getAll("seen").filter(r=>Vk.some(l=>l.key===r)),a=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:a&&pz.test(a)?a:null}}function sl(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()}function gz(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 ny=e=>!!(e.search.trim()||e.owner||e.urgent||e.seen.length||e.label||e.collection),vz={agent:"Filed by an agent",user:"Filed by you",tool:"Filed by a tool"},yz={graph:"Placed on the graph by its anchors",files:"Placed by its files",unplaced:"Triaged, not placed yet"},jz={handoff:"Handed to its owner",backlog:"Sent to the unowned backlog",batch:"Routed to a batch"};function bz(e,t=""){const n=(e??t).trim();if(!n)return"";const a=n.indexOf(": "),r=(a===-1?n:n.slice(0,a)).trim(),l=a===-1?"":n.slice(a+2).trim(),i=o=>l?`${o} ${l}`:o;switch(r){case"filed":return vz[l]??i("Filed by");case"labelled":return i("Labelled");case"unlabelled":return l?`Label removed: ${l}`:"Label removed";case"anchored":return l?`Anchored to ${l}`:"Anchored";case"triaged":return yz[l]??(l?`Triaged: ${l}`:"Triaged");case"routed":return jz[l]??(l?`Routed: ${l}`:"Routed");case"route closed":return l==="backlog"?"Taken off the unowned backlog":l?`Route closed: ${l}`:"Route closed";case"released":return l?`Released by its owner (task ${l})`:"Released by its owner";case"resolved":return l==="duplicate"?"Resolved as a duplicate":l?`Resolved · ${l.replace(/_/g," ")}`:"Resolved";case"reopened":return l?`Reopened: ${l}`:"Reopened";case"fix landed":return l?`Fix landed in ${l.slice(0,10)}`:"Fix landed";case"merged":return l?`Merged ${l} into this issue`:"Merged a duplicate into this issue";default:return n}}const wz=e=>e.replace(/`+/g,"").replace(/\s+/g," ").trim(),Fk="This page only reads issues",Kk="File, route and resolve issues with the issue command or through the thread working on them.",_z=10,Nz=250,Ur="__all",kz="none",Sz=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function Xk(){const e=mn().issues;if(!e)throw new Error("The Issues page rendered without the issues seam.");return e}const Cz=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 Rz({project:e,query:t,onQuery:n}){var X;const a=Xk(),{href:r,Link:l}=Xe(),i=u.useMemo(()=>Vc(t),[t]),o=sl(i),c=ny(i),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState(null),[x,b]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(null),j=ds(),w=u.useRef(!1),[N,C]=u.useState(i.search),_=u.useCallback(L=>n(sl({...i,...L})),[i,n]),S=u.useCallback(async()=>{const L=y.current+=1;b(null);const q=await a.list(gz(Vc(o)));if(L!==y.current)return;if(q.ok){v.current=0,m(null),f({state:"ok",list:q.data,local:q.data.local??Cz(new Date().toISOString()),key:o});return}const ne=q.refusal.reason;if(ne==="engine_missing")return f({state:"engine_missing",refusal:q.refusal});if(ne==="view_outdated")return f({state:"view_outdated"});if(v.current+=1,v.current===1&&Sz(q.refusal)){b(q.refusal.retry_after??_z);return}m(q.refusal)},[a.list,o]);u.useEffect(()=>{S()},[S]),u.useEffect(()=>{if(x===null)return;const L=setTimeout(()=>void S(),x*1e3);return()=>clearTimeout(L)},[x,S]),u.useEffect(()=>{document.activeElement!==g.current&&C(i.search)},[i.search]),u.useEffect(()=>{if(N===i.search)return;const L=setTimeout(()=>_({search:N}),Nz);return()=>clearTimeout(L)},[N,i.search,_]),u.useEffect(()=>{const L=q=>{if(q.key!=="/"||q.metaKey||q.ctrlKey||q.altKey)return;const ne=q.target;ne&&(ne.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(ne.tagName))||g.current&&(q.preventDefault(),g.current.focus())};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[]);const D=()=>{var L;C(""),n(sl(_m)),(L=g.current)==null||L.focus()},z=()=>{v.current=0,S()},P=()=>{w.current=!0,z()};u.useEffect(()=>{var q;if(!w.current||d.state==="loading"||x!==null)return;w.current=!1;const L=(q=p.current)==null?void 0:q.querySelector("h1");L&&(L.tabIndex=-1,L.focus())},[d,h,x]);const F=L=>`/proj/${encodeURIComponent(e)}/issues${L?`?${L}`:""}`,H=L=>`/proj/${encodeURIComponent(e)}/issues/${encodeURIComponent(L)}?from=issues${o?`&${o}`:""}`,A=s.jsx("div",{role:"status","aria-live":"polite",children:x!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(Wt,{"aria-hidden":"true"}),"Issues are busy. Reading them again…"]}):null}),M=h?s.jsxs(he,{variant:"destructive",className:"mt-4",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Issues could not be loaded"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[h.message,h.since?` Since ${rs(h.since)}.`:"",d.state==="ok"?` The list below was read at ${rs(d.local.read_at)}.`:"",h.message.includes(mr)?"":` ${mr}`]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:P,children:"Retry"})]})]}):null,R=s.jsx(en,{title:"Issues",description:"This repository's local issues: what agents and you reported, where triage placed each, and what fixes it.",actions:d.state==="ok"?s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",rs(d.local.read_at)]}),s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:z,children:[s.jsx(kr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]}):null});if(d.state==="engine_missing")return s.jsx(wc,{ref:p,children:s.jsx(la,{page:"Issues"})});if(d.state==="view_outdated")return s.jsxs(wc,{ref:p,children:[R,s.jsxs(he,{variant:"warning",className:"mt-6",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsx(xe,{children:j})]})]});if(d.state==="loading")return s.jsxs(wc,{ref:p,children:[R,A,M,!h&&x===null?s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading issues",children:Array.from({length:6},(L,q)=>s.jsx(jt,{className:q===5?"h-10 w-2/3":"h-10 w-full"},q))}):null]});const{list:T,local:k}=d,O=!h&&x===null&&(d.key!==o||N!==i.search),Y=ny(Vc(d.key)),E=k.scope==="folder",I=k.listed===0&&!c,Q=Math.max(0,k.listed-k.facets.owners.reduce((L,q)=>L+q.count,0)),te=i.collection?((X=k.collections.find(L=>L.collection===i.collection))==null?void 0:X.title)??i.collection:null,ce=new Map;for(const L of T.issues){const q=L.group??"unplaced";ce.set(q,[...ce.get(q)??[],L])}return s.jsxs(wc,{ref:p,children:[R,E&&k.folder?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Issues of the folder ",k.folder,", from its issue store."]}):null,s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(Oo,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Fk}),s.jsx(xe,{children:Kk})]}),A,M,I?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(ZR,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No issues yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Issues filed in this repository with the issue command appear here."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[s.jsx(bt,{ref:g,type:"search",className:"w-64","aria-label":"Search issues",placeholder:"Search issues",value:N,onChange:L=>C(L.target.value)}),s.jsxs(pt,{value:i.owner??Ur,onValueChange:L=>_({owner:L===Ur?null:L}),children:[s.jsx(ut,{className:"w-56","aria-label":"Owner",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Ur,children:"All owners"}),s.jsxs(Re,{value:kz,children:["Unowned (",Q,")"]}),k.facets.owners.map(L=>s.jsxs(Re,{value:L.key,children:[L.title," (",L.count,")"]},L.key))]})]}),s.jsxs(pt,{value:i.label??Ur,onValueChange:L=>_({label:L===Ur?null:L}),children:[s.jsx(ut,{className:"w-48","aria-label":"Label",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Ur,children:"All labels"}),k.facets.labels.map(L=>s.jsxs(Re,{value:L.label,children:[L.label," (",L.count,")"]},L.label))]})]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2",children:[s.jsx("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Marks",children:s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":i.urgent,onClick:()=>_({urgent:!i.urgent}),children:["Urgent ",k.facets.urgent]})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Seen on",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Seen on"}),Vk.map(L=>{const q=i.seen.includes(L.key);return s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":q,onClick:()=>_({seen:q?i.seen.filter(ne=>ne!==L.key):[...i.seen,L.key]}),children:[L.label," ",k.facets.seen[L.key]]},L.key)}),te!==null?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{"data-testid":"issues-collection-chip",className:ie(_d({variant:"outline",size:"sm"}),cM),children:["Collection ",te]}),s.jsx(V,{type:"button",variant:"ghost",size:"sm-icon","aria-label":"Remove the collection filter",onClick:()=>{var L;_({collection:null}),(L=g.current)==null||L.focus()},children:s.jsx(xd,{className:"size-4","aria-hidden":"true"})})]}):null]})]}),s.jsx("div",{role:"status","aria-live":"polite",children:O?s.jsxs("p",{className:"text-muted-foreground mt-3 flex items-center gap-2 text-sm",children:[s.jsx(Wt,{"aria-hidden":"true"}),"Searching…"]}):c&&T.total>0?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:[T.total," of ",k.listed," issues ·"," ",s.jsx(V,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:D,children:"Clear"})]}):null}),s.jsx("div",{"data-testid":"issues-results","aria-busy":O||void 0,className:"shrink-0 transition-opacity aria-busy:opacity-50",children:Y&&T.total===0?s.jsxs("p",{className:"mt-6 flex items-center gap-2 text-sm",children:[s.jsx(pd,{className:"text-muted-foreground size-4","aria-hidden":"true"}),"No issues match."," ",s.jsx(V,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:D,children:"Clear"})]}):k.groups.map(L=>s.jsx(Tz,{id:`issues-${L.key}`,title:`${L.label} · ${L.count}`,issues:ce.get(L.key)??[],folder:E,link:q=>s.jsx(l,{className:"text-primary hover:underline",href:r(H(q.id)),children:q.title})},L.key))}),!c&&k.collections.length>0?s.jsxs("section",{className:"mt-8","aria-labelledby":"issues-collections-title",children:[s.jsxs("h2",{id:"issues-collections-title",className:"text-lg font-semibold",children:["Collections · ",k.collections.length]}),s.jsx(ot,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Collections",className:"table-fixed",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{className:"w-1/2",children:"Collection"}),s.jsx(Z,{className:"w-1/4",children:"Resolved"}),s.jsx(Z,{className:"w-1/4",children:"Updated"})]})}),s.jsx(Ge,{children:k.collections.map(L=>s.jsxs(de,{children:[s.jsxs(K,{children:[s.jsx(l,{className:"text-primary hover:underline",href:r(F(sl({..._m,collection:L.collection}))),children:L.title}),s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:L.collection})]}),s.jsxs(K,{children:[L.resolved," of ",L.total," resolved"]}),s.jsx(K,{className:"text-muted-foreground",children:Pi(L.updated_at)})]},L.collection))})]})})]}):null]})]})}const wc=u.forwardRef(function({children:t},n){return s.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})});function Tz({id:e,title:t,issues:n,folder:a,link:r}){return s.jsxs("section",{className:"mt-6","aria-labelledby":`${e}-title`,"data-testid":"issues-group",children:[s.jsx("h2",{id:`${e}-title`,className:"text-lg font-semibold",children:t}),s.jsx(ot,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:t,className:"table-fixed",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{className:a?"w-[30%]":"w-[36%]",children:"Title"}),s.jsx(Z,{className:"w-[10%]",children:"Issue"}),a?s.jsx(Z,{className:"w-[12%]",children:"Project"}):null,s.jsx(Z,{className:"w-[16%]",children:"Status"}),s.jsx(Z,{className:"w-[8%]",children:"Urgent"}),s.jsx(Z,{className:a?"w-[14%]":"w-[18%]",children:"Owner"}),s.jsx(Z,{className:"w-[12%]",children:"Updated"})]})}),s.jsx(Ge,{children:n.map(l=>{var o;const i=Yk(l);return s.jsxs(de,{"data-testid":"issues-row",children:[s.jsxs(K,{className:"break-words",children:[r(l),(o=l.labels)!=null&&o.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:l.labels.map(c=>s.jsx(ue,{variant:"neutral",size:"dense",children:c},c))}):null]}),s.jsx(K,{className:"font-mono text-xs",children:l.id}),a?s.jsx(K,{className:"break-words",children:l.project_id??"Folder"}):null,s.jsx(K,{children:s.jsx(ue,{variant:i.tone,children:i.label})}),s.jsx(K,{children:l.urgent&&l.status!=="resolved"&&l.group!=="resolved"?s.jsx(ue,{variant:"warning",children:"Urgent"}):null}),s.jsx(K,{className:"break-words",children:l.owner_title?l.owner_title:s.jsx("span",{className:"text-muted-foreground",children:"Unowned"})}),s.jsx(K,{className:"text-muted-foreground",children:Pi(l.updated_at)})]},l.id)})})]})})]})}function Ez(e){var t;return(t=mn().issues)!=null&&t.issueSections?s.jsx(Rz,{...e}):s.jsx(dz,{org:e.org,project:e.project,query:e.query})}function Az({update:e,issue:t,open:n,onOpenChange:a,onDone:r,onReload:l}){const[i,o]=u.useState(t.title),[c,d]=u.useState(t.description),[f,h]=u.useState(t.external_reference??""),[m,x]=u.useState(t),[b,v]=u.useState(null),[y,g]=u.useState(!1);u.useEffect(()=>{n&&(o(t.title),d(t.description),h(t.external_reference??""),x(t),v(null))},[n]);const p=N=>{var C;return((C=b==null?void 0:b.personal_data)==null?void 0:C.field)===N?b.message:void 0},j=async N=>{N.preventDefault(),g(!0);const C=await e(m.id,m.revision,{title:i,description:c,external_reference:f.trim()||null});if(g(!1),!C.ok){v(C.refusal);return}r(C.data.issue)},w=async()=>{const N=await l();N&&(x(N),v(null))};return s.jsx(pn,{open:n,onOpenChange:a,children:s.jsx(xn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:j,className:"grid gap-4",children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Edit issue"}),s.jsx(jn,{children:"Text is shown exactly as entered."})]}),b!=null&&b.conflict?s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{}),s.jsx(xe,{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,s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-edit-title",children:"Title"}),s.jsx(bt,{id:"maintain-edit-title",value:i,"aria-invalid":!!p("title"),onChange:N=>o(N.target.value)}),p("title")?s.jsx(ns,{children:p("title")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-edit-description",children:"Description"}),s.jsx(Dn,{id:"maintain-edit-description",rows:4,value:c,"aria-invalid":!!p("description"),onChange:N=>d(N.target.value)}),p("description")?s.jsx(ns,{children:p("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-edit-reference",children:"External reference"}),s.jsx(bt,{id:"maintain-edit-reference",value:f,"aria-invalid":!!p("external_reference"),onChange:N=>h(N.target.value)}),p("external_reference")?s.jsx(ns,{children:p("external_reference")}):null]}),b&&!b.conflict&&!b.personal_data?s.jsx(ns,{children:b.message}):null,s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),b!=null&&b.conflict?s.jsxs(V,{type:"button",variant:"outline",onClick:w,children:[s.jsx(kr,{className:"mr-2 size-4"}),"Reload latest"]}):null,s.jsx(V,{type:"submit",loading:y,disabled:!!(b!=null&&b.conflict),children:"Save"})]})]})})})}function sy(e){return e.map(t=>Ik[t].toLowerCase()).join(", ")}function Mz(e){switch(e.kind){case"created":return"Logged the issue";case"updated":return`Edited the ${sy(e.fields)}`;case"redacted":return`Redacted the ${sy(e.fields)}`;case"priority_set":return e.priority?`Set priority to ${uo[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?Lu[e.to_status]:"";return e.resolution_reason?`Moved to ${t}: ${Ax[e.resolution_reason]}`:`Moved to ${t}`}}}function ay(e,t){return t==="external_reference"?e.external_reference??"":e[t]}function $z({redact:e,issue:t,open:n,onOpenChange:a,onDone:r,onReload:l}){const[i,o]=u.useState("description"),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,x]=u.useState(null),[b,v]=u.useState(t);u.useEffect(()=>{n&&(v(t),d(ay(t,i)),x(null))},[n]);const y=async g=>{g.preventDefault(),h(!0);const p=await e(b.id,b.revision,i,c);if(h(!1),!p.ok){if(p.refusal.conflict){const j=await l();j&&v(j),x("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}x(p.refusal.message);return}r(p.data.issue)};return s.jsx(pn,{open:n,onOpenChange:a,children:s.jsx(xn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:y,className:"grid gap-4",children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Redact text"}),s.jsx(jn,{children:"Replace text that holds personal data, such as a name."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-redact-field",children:"Field"}),s.jsxs(pt,{value:i,onValueChange:g=>{const p=g;o(p),d(ay(b,p))},children:[s.jsx(ut,{id:"maintain-redact-field",children:s.jsx(xt,{})}),s.jsx(dt,{children:tz.map(g=>s.jsx(Re,{value:g,children:Ik[g]},g))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-redact-replacement",children:"Replacement text"}),s.jsx(Dn,{id:"maintain-redact-replacement",rows:4,value:c,onChange:g=>d(g.target.value)})]}),s.jsxs(he,{variant:"warning",children:[s.jsx(Qt,{}),s.jsx(xe,{children:"This cannot be undone: the original text is removed for good. History records only that this field was redacted."})]}),m?s.jsx(ns,{children:m}):null,s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(V,{type:"submit",variant:"destructive",loading:f,children:"Redact"})]})]})})})}function Oz({transition:e,issue:t,open:n,onOpenChange:a,onDone:r}){const[l,i]=u.useState("fixed"),[o,c]=u.useState(!1),[d,f]=u.useState(null),h=async m=>{m.preventDefault(),c(!0);const x=await e(t.id,t.revision,"resolved",l);if(c(!1),!x.ok){if(x.refusal.conflict){r(null);return}f(x.refusal.message);return}f(null),r(x.data.issue)};return s.jsx(pn,{open:n,onOpenChange:a,children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:h,className:"grid gap-4",children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Resolve issue"}),s.jsx(jn,{children:"Choose how this report ended."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-resolution-reason",children:"Resolution reason *"}),s.jsxs(pt,{value:l,onValueChange:m=>i(m),children:[s.jsx(ut,{id:"maintain-resolution-reason",children:s.jsx(xt,{})}),s.jsx(dt,{children:ez.map(m=>s.jsx(Re,{value:m,children:Ax[m]},m))})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopening the issue clears its reason."})]}),d?s.jsx(ns,{children:d}):null,s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(V,{type:"submit",loading:o,children:"Resolve"})]})]})})})}const Br="not_set";function Dz({org:e,project:t,issue_id:n,query:a}){const r=Pk(),l=qk(r),i=bm(e,t);return s.jsx("div",{className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:s.jsx(Gk,{access:l,header:s.jsx(en,{title:"Support"}),back_href:i,children:o=>r?s.jsx(zz,{contract:r,issue_id:n,access:o,list_href:i,duplicates:Number(new URLSearchParams(a).get("duplicates")??0)}):null})})}function zz({contract:e,issue_id:t,access:n,list_href:a,duplicates:r}){const{href:l,Link:i}=Xe(),o=Nr(),[c,d]=u.useState(null),[f,h]=u.useState([]),[m,x]=u.useState(!1),[b,v]=u.useState([]),[y,g]=u.useState(null),p=u.useCallback(async()=>{const _=await e.issue(t);return _.ok?(d(_.data.issue),h(_.data.events),_.data.issue):(_.refusal.status===404?x(!0):o.error(_.refusal.message),null)},[e,t,o]);u.useEffect(()=>{let _=!1;return e.issue(t).then(S=>{if(!_){if(!S.ok){S.refusal.status===404?x(!0):o.error(S.refusal.message);return}d(S.data.issue),h(S.data.events)}}),()=>{_=!0}},[e,t]),u.useEffect(()=>{n.can_change&&e.assigneeCandidates().then(_=>{_.ok&&v(_.data.candidates)})},[e,n.can_change]);const j=async _=>{const S=await _;if(!S.ok){o.error(S.refusal.message),S.refusal.conflict&&await p();return}await p()};if(m)return s.jsx(Ga,{title:"Support issue not found",description:"This issue does not exist in this project.",backHref:l(a),backLabel:"Back to Support",link:i});if(!c)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading…"});const w=c.status==="closed",N=n.can_change,C=_=>j(e.transition(c.id,c.revision,_));return s.jsxs(s.Fragment,{children:[s.jsx(en,{title:c.title,actions:N?s.jsxs(s.Fragment,{children:[w?null:s.jsxs(V,{variant:"outline",onClick:()=>g("edit"),children:[s.jsx(md,{className:"mr-2 size-4"}),"Edit"]}),s.jsxs(V,{variant:"outline",onClick:()=>g("redact"),children:[s.jsx(LR,{className:"mr-2 size-4"}),"Redact"]}),c.status==="open"?s.jsx(V,{variant:"outline",disabled:!c.priority,"aria-description":c.priority?void 0:"Set a priority first.",onClick:()=>void C("triaged"),children:"Triage"}):null,c.status==="open"||c.status==="triaged"?s.jsxs(V,{onClick:()=>g("resolve"),children:[s.jsx(hd,{className:"mr-2 size-4"}),"Resolve"]}):null,c.status==="resolved"?s.jsxs(s.Fragment,{children:[s.jsxs(V,{variant:"outline",onClick:()=>void C("open"),children:[s.jsx(_T,{className:"mr-2 size-4"}),"Reopen"]}),s.jsx(V,{onClick:()=>void C("closed"),children:"Close"})]}):null]}):void 0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ue,{variant:Hk[c.status],children:Lu[c.status]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Logged by ",az(c)," ",Gc(c.created_at)]})]})}),s.jsxs("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-6",children:[r>0&&c.external_reference?s.jsxs(he,{variant:"info",children:[s.jsx(Ts,{}),s.jsxs(xe,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[s.jsxs("span",{children:[c.external_reference," is already logged on"," ",r===1?"another issue":`${r} other issues`," in this project."]}),s.jsx(V,{asChild:!0,variant:"outline",size:"sm",children:s.jsx(i,{href:l(`${a}?external_reference=${encodeURIComponent(c.external_reference)}`),children:"Show both"})})]})]}):null,s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Description"}),c.description?s.jsx("p",{className:"text-sm break-words whitespace-pre-wrap",children:c.description}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"No description."})]}),s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"History"}),s.jsx("div",{className:"rounded-md border",children:s.jsxs(qe,{children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"When"}),s.jsx(Z,{children:"Who"}),s.jsx(Z,{children:"What"})]})}),s.jsx(Ge,{children:f.map(_=>s.jsxs(de,{children:[s.jsx(K,{className:"text-muted-foreground",children:Gc(_.created_at)}),s.jsx(K,{children:rz(_,c)}),s.jsx(K,{children:Mz(_)})]},_.id))})]})})]})]}),s.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-5 lg:w-72",children:[s.jsx(hi,{label:"External reference",children:c.external_reference?s.jsx("span",{className:"font-mono text-sm",children:c.external_reference}):s.jsx("span",{className:"text-muted-foreground text-sm",children:"None"})}),c.resolution_reason?s.jsx(hi,{label:"Resolution",children:s.jsx("span",{className:"text-sm",children:Ax[c.resolution_reason]})}):null,s.jsx(hi,{label:"Priority",id:"maintain-issue-priority",children:s.jsxs(pt,{value:c.priority??Br,disabled:!N||w,onValueChange:_=>void j(e.update(c.id,c.revision,{priority:_===Br?null:_})),children:[s.jsx(ut,{id:"maintain-issue-priority",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Br,children:"Not set"}),Ex.map(_=>s.jsx(Re,{value:_,children:uo[_]},_))]})]})}),s.jsxs(hi,{label:"Assignee",id:"maintain-issue-assignee",children:[s.jsxs(pt,{value:c.assignee_id??Br,disabled:!N||w,onValueChange:_=>void j(e.assign(c.id,c.revision,_===Br?null:_)),children:[s.jsx(ut,{id:"maintain-issue-assignee",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Br,children:"Not set"}),c.assignee_id&&!b.some(_=>_.user_id===c.assignee_id)?s.jsx(Re,{value:c.assignee_id,children:Mx(c.assignee_id,c.assignee_username)}):null,b.map(_=>s.jsx(Re,{value:_.user_id,children:_.username??"Not available"},_.user_id))]})]}),c.assignee_can_act===!1?s.jsx(ue,{variant:"error",className:"self-start",children:"Assignee cannot act"}):null]}),s.jsx(hi,{label:"Updated",children:s.jsx("span",{className:"text-sm",children:Gc(c.updated_at)})})]})]}),s.jsx(Az,{update:e.update,issue:c,open:y==="edit",onOpenChange:_=>g(_?"edit":null),onReload:p,onDone:()=>{g(null),p()}}),s.jsx($z,{redact:e.redact,issue:c,open:y==="redact",onOpenChange:_=>g(_?"redact":null),onReload:p,onDone:()=>{g(null),o.success("The text was redacted."),p()}}),s.jsx(Oz,{transition:e.transition,issue:c,open:y==="resolve",onOpenChange:_=>g(_?"resolve":null),onDone:_=>{g(null),_||o.error("Someone else changed this issue; it is reloaded."),p()}})]})}function hi({label:e,id:t,children:n}){return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[t?s.jsx("label",{htmlFor:t,className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:e}):s.jsx("span",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:e}),n]})}const Lz=10,Uz=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,ry=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;function Bz(e,t,n,a=""){const r=n!=null&&n.startsWith("task:")?n.slice(5):null;if(r&&Uz.test(r))return{label:r,path:`/org/${e}/tasks/${r}`};const l=`/proj/${encodeURIComponent(t)}/releases`,i=n!=null&&n.startsWith("release:")?n.slice(8):null;if(i&&ry.test(i))return{label:i==="candidate"?"Candidate":i,path:`${l}?release=${encodeURIComponent(i)}`};const o=n!=null&&n.startsWith("planned:")?n.slice(8):null;if(o&&ry.test(o))return{label:o,path:`${l}?planned=${encodeURIComponent(o)}`};const c=sl(Vc(a));return{label:"Issues",path:`/proj/${encodeURIComponent(t)}/issues${c?`?${c}`:""}`}}const Hz=["Fixed in","Being fixed in","The release planned to fix it"];function Iz(e){const t=e.filter(n=>n.kind==="release");for(const n of Hz){const a=t.find(r=>r.relation===n);if(a)return a}return t[0]??null}function Pz({org:e,project:t,issue_id:n,from:a,query:r=""}){var He;const l=Xk(),{href:i,Link:o}=Xe(),c=Bz(e,t,a,r),d=`/proj/${encodeURIComponent(t)}/issues`,f=J=>`${d}/${encodeURIComponent(J)}`,[h,m]=u.useState({state:"loading"}),[x,b]=u.useState(null),[v,y]=u.useState(null),[g,p]=u.useState({state:"loading"}),[j,w]=u.useState({state:"loading"}),N=u.useRef(null),C=ds(),_=u.useRef(null),S=u.useRef(!1),D=u.useRef(0),z=u.useRef(0),P=u.useCallback(async()=>{if(!l.issueSections)return;p({state:"loading"});const J=await l.issueSections(n);p(J.ok?{state:"ok",data:J.data}:{state:"failed",refusal:J.refusal})},[l.issueSections,n]),F=u.useCallback(async()=>{if(!l.issueRelated)return;w({state:"loading"});const J=await l.issueRelated(n);w(J.ok?{state:"ok",data:J.data}:{state:"failed",refusal:J.refusal})},[l.issueRelated,n]),H=u.useCallback(async()=>{const J=z.current+=1;if(y(null),!mz.test(n)){m({state:"missing"});return}P(),F();const ke=await l.issue(n);if(J!==z.current)return;if(ke.ok){D.current=0,b(null),m({state:"ok",issue:ke.data.issue,events:ke.data.events,at:new Date().toISOString()});return}const Ue=ke.refusal.reason;if(ke.refusal.status===404||Ue==="not_found")return m({state:"missing"});if(Ue==="engine_missing")return m({state:"engine_missing",refusal:ke.refusal});if(Ue==="view_outdated")return m({state:"view_outdated"});if(D.current+=1,D.current===1&&Uk(ke.refusal)){y(ke.refusal.retry_after??Lz);return}b(ke.refusal)},[l.issue,n,P,F]);u.useEffect(()=>{H()},[H]),u.useEffect(()=>{if(v===null)return;const J=setTimeout(()=>void H(),v*1e3);return()=>clearTimeout(J)},[v,H]),u.useEffect(()=>{var ke;if(S.current||h.state!=="ok")return;S.current=!0;const J=(ke=N.current)==null?void 0:ke.querySelector("h1");J&&(J.tabIndex=-1,J.focus())},[h.state]);const A=u.useRef(null);u.useEffect(()=>{var Ue;const J=A.current;if(J===null||(J==="sections"?g:j).state==="loading")return;A.current=null;const ke=(J==="related"?_.current:null)??((Ue=N.current)==null?void 0:Ue.querySelector("h1"));ke==null||ke.focus()},[g,j]);const M=J=>{A.current=J,J==="sections"?P():F()},R=()=>{D.current=0,H()},T=u.useRef(!1),k=()=>{T.current=!0,R()};if(u.useEffect(()=>{var ke;if(!T.current||h.state==="loading"||v!==null)return;T.current=!1;const J=(ke=N.current)==null?void 0:ke.querySelector("h1");J&&(J.tabIndex=-1,J.focus())},[h,x,v]),h.state==="missing")return s.jsx(ka,{children:s.jsx(Ga,{icon:s.jsx(pd,{"aria-hidden":"true"}),title:"Issue not found",description:`No issue ${n} in this repository's issue store.`,backHref:i(a==="issues"?c.path:d),backLabel:"Back to issues",link:o})});const O=s.jsx(V,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(o,{href:i(c.path),children:[s.jsx(Bw,{className:"size-4","aria-hidden":"true"}),c.label]})});if(h.state==="engine_missing"||h.state==="view_outdated")return s.jsx(ka,{children:h.state==="engine_missing"?s.jsx(la,{page:"Issue",header:s.jsx(Ii,{back:O,id:null,title:n})}):s.jsxs(s.Fragment,{children:[s.jsx(Ii,{back:O,id:null,title:n}),s.jsxs(he,{variant:"warning",className:"mt-4",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsx(xe,{children:C})]})]})});const Y=x?s.jsxs(he,{variant:"destructive",className:"mt-4",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This issue could not be loaded"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[x.message,x.since?` Since ${rs(x.since)}.`:"",h.state==="ok"?` This page was read at ${rs(h.at)}.`:"",x.message.includes(mr)?"":` ${mr}`]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:k,children:"Retry"})]})]}):null,E=s.jsx("div",{role:"status","aria-live":"polite",children:v!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(Wt,{"aria-hidden":"true"}),"This issue is busy. Reading it again…"]}):null});if(h.state==="loading")return s.jsxs(ka,{children:[s.jsx("div",{children:O}),E,Y,!x&&v===null?s.jsxs("div",{className:"mt-4 grid gap-3",role:"status","aria-label":"Loading issue",children:[s.jsx(jt,{className:"h-6 w-40"}),s.jsx(jt,{className:"h-9 w-2/3"}),s.jsx(jt,{className:"h-24 w-full"})]}):null]});const{issue:I,events:Q,at:te}=h,ce=Yk(I),X=g.state==="ok"?g.data:null,L=(X==null?void 0:X.reporter)??I.created_by_username??null,q=j.state==="ok"?Iz(j.data):null,ne=I.status==="resolved"||I.group==="resolved",ae=!!(X!=null&&X.duplicate_of),je=g.state==="loading"?"Loading…":(X==null?void 0:X.routing.owner)??I.owner_title??s.jsx("span",{className:"text-muted-foreground",children:"Unowned"}),re=J=>`${d}?${sl({..._m,collection:J})}`,we=X==null?void 0:X.report,se=!!(we&&(we.actual||we.expected||we.steps.length||we.where)),tt=[...Q].reverse(),ge=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",rs(te)]}),s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:R,children:[s.jsx(kr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsx(ka,{children:s.jsxs("div",{ref:N,className:"contents",children:[s.jsx(Ii,{back:O,id:I.id,badge:s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:ce.tone,children:ce.label}),I.urgent&&!ne?s.jsx(ue,{variant:"warning",children:"Urgent"}):null]}),title:I.title,created:`Reported${L?` by ${L}`:""} · ${Pi(I.created_at)}`,actions:ge}),X!=null&&X.duplicate_of?s.jsxs("p",{className:"mt-1 text-sm",children:["Duplicate of"," ",s.jsx(o,{className:"text-primary font-mono hover:underline",href:i(f(X.duplicate_of)),children:X.duplicate_of})]}):null,E,Y,g.state==="loading"?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",role:"status",children:[s.jsx(Wt,{"aria-hidden":"true"}),"Loading the issue's sections"]}):null,s.jsxs("dl",{className:"mt-4 mb-0 flex flex-wrap gap-x-12 gap-y-4","data-testid":"issue-facts",children:[s.jsx(_s,{label:"Owner",value:je}),ae?null:s.jsx(_s,{label:"Release",value:j.state==="loading"?"Loading…":q?s.jsx("span",{className:ie(q.label===q.id&&"font-mono"),children:q.label}):s.jsx("span",{className:"text-muted-foreground",children:"No release yet"})}),s.jsx(_s,{label:"Reported",value:[L,I.created_at?Yn(I.created_at):null].filter(Boolean).join(" · ")})]}),s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(Oo,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Fk}),s.jsx(xe,{children:Kk})]}),g.state==="failed"?s.jsx("div",{className:"mt-6",children:s.jsx(Tx,{what:"this issue's sections",again:"Read the issue again",refusal:g.refusal,on_retry:()=>M("sections")})}):null,X&&se&&we?s.jsxs(Ct,{id:"issue-report",title:"What happens",children:[we.actual?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:we.actual}):null,we.expected?s.jsxs("div",{className:"mt-3",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Expected"}),s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:we.expected})]}):null,we.steps.length?s.jsxs("div",{className:"mt-3",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Steps"}),s.jsx("ol",{className:"list-decimal pl-5 text-sm",children:we.steps.map((J,ke)=>s.jsx("li",{children:J},ke))})]}):null,(He=we.where)!=null&&He.env?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:["Seen on ",we.where.env,we.where.sha?s.jsxs(s.Fragment,{children:[" ","at ",s.jsx("span",{className:"font-mono",children:we.where.sha})]}):null]}):null]}):null,X&&(X.placement.placed||X.placement.unplaced_why)?s.jsx(Ct,{id:"issue-placement",title:"Placement",children:X.placement.placed?s.jsxs("p",{className:"text-sm",children:["Placed in ",X.placement.placed]}):s.jsxs(he,{variant:"warning",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:["Not placed yet: ",X.placement.unplaced_why]})]})}):null,X&&(X.routing.route||X.routing.owner||X.routing.none)?s.jsxs(Ct,{id:"issue-routing",title:"Routing",children:[X.routing.route?s.jsx("p",{className:"text-sm",children:X.routing.route}):null,X.routing.owner?s.jsxs("p",{className:"text-sm",children:["Owner: ",X.routing.owner]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"Owner: none yet"})]}):null,X&&(X.labels.length>0||X.collections.length>0)?s.jsxs(Ct,{id:"issue-labels",title:"Labels and collections",children:[X.labels.length?s.jsx("div",{className:"flex flex-wrap gap-1",children:X.labels.map(J=>s.jsx(ue,{variant:"neutral",size:"dense",children:J},J))}):null,X.collections.length?s.jsx("ul",{className:"mt-2 grid gap-1 text-sm",children:X.collections.map(J=>s.jsxs("li",{children:[s.jsx(o,{className:"text-primary hover:underline",href:i(re(J.collection)),children:J.title}),J.ref?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",J.ref]}):null,s.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",J.resolved," of ",J.total," resolved"]})]},J.collection))}):null]}):null,X&&X.anchors.length>0?s.jsx(Ct,{id:"issue-anchors",title:"Anchors",children:s.jsx(Xf,{label:"Anchors",heads:["Kind","Value","By"],rows:X.anchors.map(J=>[J.kind,s.jsx("span",{className:"font-mono text-xs break-all",children:J.value}),J.by??""])})}):null,X&&X.seen.length>0?s.jsx(Ct,{id:"issue-seen",title:"Seen",aside:`${X.seen.length} of ${Math.max(I.occurrences??0,X.seen.length)} sightings`,children:s.jsx(Xf,{label:"Seen",heads:["When","Where","Who","Note"],rows:X.seen.map(J=>[Pi(J.at),s.jsxs(s.Fragment,{children:[J.sha?s.jsx("div",{className:"font-mono text-xs",children:J.sha}):null,J.env?s.jsx("div",{className:"text-muted-foreground text-xs",children:J.env}):null]}),J.who??"",J.note??""])})}):null,tt.length>0?s.jsx(Ct,{id:"issue-history",title:"History",aside:"From the issue store, newest first",children:s.jsx(Xf,{label:"History",heads:["When","Who","What"],rows:tt.map(J=>[Pi(J.created_at),J.actor_username??"",bz(J.note,J.kind)])})}):null,s.jsx(Bk,{id:"issue-related",related:j,heading_ref:_,on_retry:()=>M("related"),fixed:!0,link:J=>{const ke=J.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(J.id)}`:J.kind==="task"?`/org/${e}/tasks/${encodeURIComponent(J.id)}?from=issue:${I.id}`:J.kind==="issue"?f(J.id):J.kind==="release"?`/proj/${encodeURIComponent(t)}/releases?${J.planned?"planned":"release"}=${encodeURIComponent(J.id)}`:null;if(J.kind==="task"&&ke){const Ue=wz(J.label);return s.jsxs("div",{className:"min-w-0",children:[s.jsx(o,{className:"text-primary font-mono text-xs hover:underline",href:i(ke),children:J.id}),Ue&&Ue!==J.id?s.jsx("div",{className:"text-muted-foreground line-clamp-1 text-xs",title:Ue,"data-testid":"related-task-title",children:Ue}):null]})}return ke?s.jsx(o,{className:ie("text-primary hover:underline",J.kind!=="thread"&&J.label===J.id&&"font-mono"),href:i(ke),children:J.label}):J.label}})]})})}function Xf({label:e,heads:t,rows:n}){return s.jsx(ot,{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:e,children:[s.jsx(Ke,{children:s.jsx(de,{children:t.map(a=>s.jsx(Z,{children:a},a))})}),s.jsx(Ge,{children:n.map((a,r)=>s.jsx(de,{children:a.map((l,i)=>s.jsx(K,{className:"break-words",children:l},i))},r))})]})})}function qz({org:e,project:t,issue_id:n,from:a,query:r}){var l;return(l=mn().issues)!=null&&l.issueSections?s.jsx(Pz,{org:e,project:t,issue_id:n,from:a,query:r}):s.jsx(Dz,{org:e,project:t,issue_id:n,query:r})}function Uu(e,t){u.useEffect(()=>{const n=setInterval(()=>{document.visibilityState==="visible"&&e()},t),a=()=>{document.visibilityState==="visible"&&e()};return document.addEventListener("visibilitychange",a),()=>{clearInterval(n),document.removeEventListener("visibilitychange",a)}},[e,t])}const Qk={integration:"Integration",deploy:"Deploy",publish:"Publish",accept:"Accept",custom:"Custom"},Gz={self_service:"Self-service",managed:"Managed",manager_only:"Manager only"},Vz={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"},Yz={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 Fz(e){return Yz[e??"in_batch"]}function Kz(e){const t=e.turn==="next",n=t?"Next":"Waiting",a=e.batching==="managed"||e.batching==="released"?` · ${e.batching}`:"";return{label:`${n}${a}`,tone:t?"info":"neutral"}}const Wk=(e,t)=>`Holds ${e.toLowerCase()}${t?`: ${t}`:""}`;function Xz(e,t,n,a=!0){return e.fixing_since!==void 0?{label:`Fixing forward since ${es(e.fixing_since)}`,tone:"warning"}:e.ref===t?{label:"Landing",tone:"info"}:a&&e.hold?{label:Wk(n),tone:"info"}:{label:"Running",tone:"info"}}function es(e){return new Date(e*1e3).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Hr(e){const t=Math.round(e/60);if(t<60)return`${t} min`;const n=Math.floor(t/60),a=t%60;return a?`${n} h ${a} min`:`${n} h`}function Qz(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 Wz(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),a=e.teams.length;return a&&n.push(a===1?"1 team":`${a} teams`),n.length?n.join(", "):"Nobody"}}}function Zz(e,t){var o,c;const{policy:n,management:a}=e,r=(o=e.layer)==null?void 0:o.kind,l=d=>Wz(d,t),i=[["Mode",Vz[a.mode]],["Who can join",l(a.joiners)]];return r==="implement"&&i.push(["Managers",l(a.managers)],["Manager lease",Hr(a.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&&i.push(["Promotes to",e.layer.promotes_to]),i.push(["Carries waiting entries",n.ride?"Yes: a done turn carries entries already contained in it":"No"],["Freeze",n.freeze.enabled?`Up to ${Hr(n.freeze.max_seconds)}, ${Hr(n.freeze.default_seconds)} by default`+(e.layer.freezers?` · ${l(e.layer.freezers)}`:""):"Off"],["Fix forward",n.fix_forward?"Yes: a failed turn keeps its turn until fixed":"No"],["Stalled turns",a.stall_takers.kind==="none"?"Nobody takes one":`${l(a.stall_takers)} may take one after ${Hr(n.stall_seconds)}`])),i.push(["Reorder",l(a.reorderers)]),n.max_turns>1&&i.push(["Turns at once",`Up to ${n.max_turns} independent turns`]),i.push(["Turn lease",Hr(n.lease_seconds)],["Time to start",`${Hr(n.start_grace_seconds)} after the turn comes`]),n.entry_limit!==null&&i.push(["Waiting entries",`Up to ${n.entry_limit}`]),n.footprint!=="off"&&i.push(["Footprint",n.footprint==="required"?"Required":"Optional"]),i}const Zk="Where your organization's agents take turns at a shared branch, environment or proposal. One turn runs at a time in each queue.",Jk="A task you cannot see",Jz="A former member",e3="A member";function e1(){const e=mn().queues;if(!e)throw new Error("The Queues page rendered without the queues seam.");return e}function t3({org:e,open:t,path:n}){var h,m;const a=e1(),{href:r,Link:l}=Xe(),i=a.availability,[o,c]=u.useState({state:"loading"}),d=u.useCallback(async x=>{i&&(x&&c({state:"loading"}),c(await i({fresh:x})))},[i]);u.useEffect(()=>{d(!1)},[d]);const f=!i||o.state==="active";return o.state==="off"&&((h=o.refusal)==null?void 0:h.reason)!=="engine_missing"?s.jsx(Ga,{title:"Page not found",description:"This page does not exist, or you do not have access to it.",backHref:r(`/org/${e}`),backLabel:"Back to the organization",link:l}):s.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:f?s.jsx(s3,{org:e,open:t??null,path:n??`/org/${e}/tasks/queues`}):o.state==="off"&&((m=o.refusal)==null?void 0:m.reason)==="engine_missing"?s.jsx(la,{page:"Queues"}):s.jsxs(s.Fragment,{children:[s.jsx(en,{title:"Queues",description:a.description??Zk}),o.state==="loading"&&s.jsx(t1,{}),(o.state==="error"||o.state==="off")&&s.jsx(Nm,{refusal:o.refusal,on_retry:()=>void d(!0)}),o.state==="available"&&s.jsxs(he,{variant:"info",className:"mt-6",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Tasks are not on for this organization"}),s.jsxs(xe,{children:["Queues hold turns for tasks, so they show once Tasks are on."," ",s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/tasks`),children:"Go to Tasks"})]})]})]})})}function t1(){return s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading queues",children:Array.from({length:3},(e,t)=>s.jsx(jt,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function Nm({refusal:e,on_retry:t}){const n=ds();return(e==null?void 0:e.reason)==="store_locked"?s.jsxs(he,{variant:"info",className:"mt-6",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"The local stores are busy"}),s.jsxs(xe,{children:[s.jsx("p",{children:e.message}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]}):(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(he,{variant:"warning",className:"mt-6",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsx(xe,{children:n})]}):s.jsxs(he,{variant:"destructive",className:"mt-6",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Queues could not be loaded"}),s.jsxs(xe,{children:[s.jsx("p",{children:"The read did not answer. Try again in a moment."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}const Qf=e=>e.status===404||e.reason==="not_found"||e.code==="not_found";function n3(e,t,n,a){return t?e===null?`Not reading · trying again every ${n}s`:`Not reading since ${es(e)} · trying again every ${n}s`:e===null?"Connecting…":`Live · read ${es(e)} · refreshes every ${n}s${a?` · ${a}`:""}`}function s3({org:e,open:t,path:n}){var L;const{listQueues:a,queue:r,members:l,refresh_ms:i,settings_note:o,description:c,read_scope:d,subject_label:f="Task",thread_subjects:h=!1}=e1(),{self_id:m}=dd(),[x,b]=u.useState(null),[v,y]=u.useState(null),[g,p]=u.useState(null),[j,w]=u.useState(null),[N,C]=u.useState({state:"pending",members:[]});u.useEffect(()=>{let q=!0;return l().then(ne=>{q&&C(ae=>ne.ok?{state:"answered",members:ne.data}:{state:"failed",members:ae.members})}),()=>{q=!1}},[l]);const _=u.useMemo(()=>new Map(N.members.map(q=>[q.user_id,q])),[N.members]),S=N.state==="answered"?Jz:e3,D=u.useCallback((q,ne)=>{var ae;return(ne==null?void 0:ne.title)??(h?(ne==null?void 0:ne.id)??q:q===m?"You":((ae=_.get(q))==null?void 0:ae.label)??S)},[_,S,m,h]),z=u.useRef({list:{last:null,fresh:!1},detail:{last:null,fresh:!1}}),[P,F]=u.useState(null),[H,A]=u.useState(!1),M=u.useCallback((q,ne)=>{z.current[q]={last:ne,fresh:!0};const{list:ae,detail:je}=z.current;A(ae.last==="failed"||je.last==="failed"),ae.fresh&&je.fresh&&ae.last==="ok"&&je.last==="ok"&&F(Date.now()/1e3)},[]),R=t??((L=x==null?void 0:x.queues[0])==null?void 0:L.id)??null,T=u.useRef(R);u.useEffect(()=>{T.current=R},[R]);const k=u.useRef(0),O=u.useCallback(async()=>{var ae;const q=k.current+=1;z.current.list.fresh=!1;const ne=await a();if(q===k.current)if(ne.ok){if(b(ne.data),y(null),!t){const je=((ae=ne.data.queues[0])==null?void 0:ae.id)??null;je===null?z.current.detail={last:"ok",fresh:!0}:je!==T.current&&(z.current.detail.fresh=!1)}M("list","ok")}else y(ne.refusal),M("list","failed")},[a,t,M]),Y=u.useRef(0),E=u.useCallback(async()=>{const q=Y.current+=1;if(!R)return;z.current.detail.fresh=!1;const ne=await r(R);q===Y.current&&(ne.ok?(p(ne.data),w(null),M("detail","ok")):(w(ne.refusal),Qf(ne.refusal)&&p(null),M("detail",Qf(ne.refusal)?"ok":"failed")))},[R,r,M]);u.useEffect(()=>{O()},[O]),u.useEffect(()=>{p(null),w(null),E()},[E]);const I=u.useCallback(()=>{O(),E()},[O,E]),Q=!x&&(v==null?void 0:v.reason)==="engine_missing",te=u.useCallback(()=>{Q||I()},[Q,I]);if(Uu(te,i),Q)return s.jsx(la,{page:"Queues"});const ce=Math.round(i/1e3),X=j!==null&&Qf(j);return s.jsxs(s.Fragment,{children:[s.jsxs(en,{title:"Queues",description:c??Zk,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:n3(P,H,ce,d)}),s.jsx("span",{className:"sr-only",role:"status",children:H?"Not reading":P===null?"Connecting":"Live"})]}),!x&&!v&&s.jsx(t1,{}),!x&&v&&s.jsx(Nm,{refusal:v,on_retry:I}),x&&x.queues.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(qw,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No queues yet"}),s.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."})]}):x?s.jsxs(s.Fragment,{children:[s.jsx(r3,{path:n,queues:x.queues,open_id:R,name:D,held:h}),X?s.jsxs(he,{variant:"info",className:"mt-6",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This queue is no longer available"}),s.jsx(xe,{children:"It was archived, or you can no longer read its Workspace. Pick another queue above."})]}):g&&g.queue.id===R?s.jsx(l3,{org:e,detail:g,name:D,settings_note:o,subject_label:f,thread_subjects:h}):j?s.jsx(Nm,{refusal:j,on_retry:()=>void E()}):s.jsx(jt,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"})]}):null]})}function km({org:e,subject:t,link:n}){const{href:a,Link:r}=Xe();return!t||t.hidden?s.jsx("span",{className:"text-muted-foreground",children:Jk}):t.kind==="task"&&n?s.jsx(r,{className:"text-primary hover:underline",href:a(`/org/${e}/tasks/${t.id}`),children:t.title??t.id}):s.jsx("span",{children:t.title??t.id})}function a3(e,t,n){const a=e.freeze?`frozen until ${es(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 ${es(e.batch.opened_at)}`,a].filter(Boolean).join(" · "),warn:!1};if(e.turn){const r=e.turn.subject,l=r.hidden?Jk:r.title??r.id,i=(e.running_count??1)>1?`${e.running_count} turns · `:"",o=e.turn.landing?" landing":"",c=n&&!!e.turn.hold,d=[c?Wk(e.name,e.turn.note):null,e.turn.fixing_since!==void 0?"Fixing forward":null,a].filter(Boolean);return c&&e.turn.fixing_since===void 0&&!a?{primary:`${i}${l}${o}`,secondary:Wf(d.join(" · ")),warn:!1}:{primary:`${i}${l}${o}`,secondary:d.length?Wf(d.join(" · ")):null,warn:d.length>0}}return{primary:"Nothing running",secondary:a?Wf(a):null,warn:!!a}}const Wf=e=>e.charAt(0).toUpperCase()+e.slice(1);function r3({path:e,queues:t,open_id:n,name:a,held:r}){const{href:l,Link:i}=Xe();return s.jsx(ot,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Queues",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Queue"}),s.jsx(Z,{className:"hidden md:table-cell",children:"Step"}),s.jsx(Z,{children:"Running turn"}),s.jsx(Z,{className:"hidden text-right md:table-cell",children:"Waiting"})]})}),s.jsx(Ge,{children:t.map(o=>{var m;const c=o.id===n,d=Qz(o),f=a3(o,a,r),h=o.waiting-(((m=o.batch)==null?void 0:m.remaining)??0);return s.jsxs(de,{"data-testid":"queues-row",className:ie(c&&"bg-accent"),children:[s.jsxs(K,{children:[s.jsx(i,{className:"text-primary hover:underline",href:l(`${e}?queue=${encodeURIComponent(o.id)}`),"aria-current":c?"page":void 0,children:o.name}),d?s.jsx("div",{className:"text-muted-foreground text-xs",children:d}):null,s.jsxs("div",{className:"text-muted-foreground text-xs md:hidden",children:[h," waiting"]})]}),s.jsx(K,{className:"hidden md:table-cell",children:s.jsx(ue,{variant:"neutral",children:Qk[o.policy.step]})}),s.jsxs(K,{children:[s.jsx("div",{className:ie(!o.batch&&!o.turn&&"text-muted-foreground"),children:f.primary}),f.secondary?s.jsx("div",{className:ie("text-xs",f.warn?"text-warning":"text-muted-foreground"),children:f.secondary}):null]}),s.jsx(K,{className:"hidden text-right md:table-cell",children:h})]},o.id)})})]})})}function _c({id:e,title:t,side:n,children:a}){return s.jsxs("section",{"aria-labelledby":e,className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h3",{id:e,className:"text-sm font-semibold",children:t}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]}),a]})}function ly({org:e,entries:t,landing:n,queue_name:a,subject_label:r,held:l,label:i}){return s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(qe,{containerAriaLabel:i,children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:r}),s.jsx(Z,{children:"State"})]})}),s.jsx(Ge,{children:t.map(o=>{const c=Xz(o,n,a,l);return s.jsxs(de,{"data-testid":"queues-running",children:[s.jsxs(K,{children:[s.jsx(km,{org:e,subject:o.subject,link:!l}),l&&o.hold&&o.note&&!o.subject.hidden?s.jsx("div",{className:"text-muted-foreground text-xs",children:o.note}):null]}),s.jsx(K,{children:s.jsx(ue,{variant:c.tone,children:c.label})})]},o.ref)})})]})})}function l3({org:e,detail:t,name:n,settings_note:a,subject_label:r,thread_subjects:l}){var w;const{queue:i,state:o}=t,c=N=>n(N),d=new Map(o.entries.map(N=>[N.ref,N.subject])),f=o.entries.filter(N=>N.turn==="running"),h=o.entries.filter(N=>N.turn!=="running"&&N.batching!=="in_batch"),m=o.batch,x=Math.max(1,f.filter(N=>N.batching!=="in_batch").length),b=m&&i.policy.independent_turns?f.filter(N=>N.batching!=="in_batch"&&N.ref!==m.holder):[],v=o.manager,y=o.freeze,g=((w=i.layer)==null?void 0:w.kind)==="release"?i.layer.stall_hold:void 0,p=g?{who:n(g.by),why:g.reason,until:g.until}:v!=null&&v.hold?{who:n(v.holder,v.holder_subject),why:v.hold.why,until:v.hold.until}:null,j=!m&&f.length===0&&h.length===0;return s.jsxs(ot,{as:"section","aria-labelledby":"queue-title",className:"mt-6 flex shrink-0 flex-col gap-4 p-4","data-testid":"queues-detail",children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{id:"queue-title",className:"text-lg font-semibold",children:i.name}),s.jsx(ue,{variant:"neutral",children:Qk[i.policy.step]}),s.jsx(ue,{variant:"neutral",children:Gz[i.management.mode]})]}),i.purpose?s.jsx("p",{className:"text-muted-foreground text-sm",children:i.purpose}):null]}),v?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm","data-testid":"queues-manager",children:[s.jsx(zT,{className:"text-muted-foreground size-4","aria-hidden":"true"}),s.jsx("span",{className:"text-muted-foreground",children:"Manager"}),s.jsx("span",{className:"font-medium",children:n(v.holder,v.holder_subject)}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Lease until ",es(v.lease_until),v.serving_until!==void 0?" · serving now":""]})]}):null,y?s.jsxs(he,{variant:"warning",children:[s.jsx(ET,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:["Frozen until ",es(y.lease_until)]}),s.jsxs(xe,{children:[n(y.holder,y.holder_subject)," froze this queue at ",es(y.since),y.label?`: ${y.label}`:"",". Only ",n(y.holder,y.holder_subject),"'s entries start until it thaws."]})]}):null,p?s.jsxs(he,{variant:"info",children:[s.jsx(Gw,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:["Stall hold until ",es(p.until)]}),s.jsxs(xe,{children:[p.who,p.why?`: ${p.why}`:"",". The first entry is not treated as stalled while it lasts."]})]}):null,j?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running, and nothing waits in this queue."}):s.jsxs(s.Fragment,{children:[m?s.jsxs(_c,{id:"queue-running",title:"Running turn",side:`Batch opened by ${n(m.holder,m.holder_subject)} at ${es(m.opened_at)}`,children:[s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(qe,{containerAriaLabel:"Batch members",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Landing order"}),s.jsx(Z,{children:r}),s.jsx(Z,{children:"Outcome"})]})}),s.jsx(Ge,{children:m.members.map((N,C)=>{const _=Fz(N.outcome);return s.jsxs(de,{"data-testid":"queues-member",children:[s.jsx(K,{children:C+1}),s.jsx(K,{children:s.jsx(km,{org:e,subject:N.subject??d.get(N.ref)??(l?{kind:"thread",id:N.ref}:void 0),link:!l})}),s.jsx(K,{children:s.jsx(ue,{variant:_.tone,children:_.label})})]},N.ref)})})]})}),b.length>0?s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"text-muted-foreground text-xs font-medium",children:"Also running"}),s.jsx(ly,{org:e,entries:b,landing:o.landing,queue_name:i.name,subject_label:r,held:l,label:"Turns running beside the batch"})]}):null]}):s.jsx(_c,{id:"queue-running",title:f.length>1?"Running turns":"Running turn",children:f.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running."}):s.jsx(ly,{org:e,entries:f,landing:o.landing,queue_name:i.name,subject_label:r,held:l,label:"Running turns"})}),s.jsx(_c,{id:"queue-waiting",title:"Waiting",children:h.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing waits."}):s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(qe,{containerAriaLabel:"Waiting entries",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Position"}),s.jsx(Z,{children:r}),s.jsx(Z,{className:"hidden md:table-cell",children:"Joined"}),s.jsx(Z,{children:"Turn"}),s.jsx(Z,{className:"hidden md:table-cell",children:"Note"})]})}),s.jsx(Ge,{children:h.map((N,C)=>{const _=Kz(N);return s.jsxs(de,{"data-testid":"queues-waiting",children:[s.jsx(K,{children:m?x+C+1:N.position}),s.jsx(K,{children:s.jsx(km,{org:e,subject:N.subject,link:!l})}),s.jsx(K,{className:"hidden md:table-cell",children:es(N.joined_at)}),s.jsx(K,{children:s.jsx(ue,{variant:_.tone,children:_.label})}),s.jsx(K,{className:"hidden md:table-cell",children:N.subject.hidden?"":N.note??""})]},N.ref)})})]})})})]}),s.jsx(_c,{id:"queue-settings",title:"Settings",children:s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsx(qe,{containerAriaLabel:"Queue settings",children:s.jsx(Ge,{children:Zz(i,c).map(([N,C])=>s.jsxs(de,{children:[s.jsx(Z,{scope:"row",className:"h-auto w-48 py-2 font-normal",children:N}),s.jsx(K,{children:C})]},N))})})})}),s.jsx("p",{className:"text-muted-foreground text-xs",children:a})]})}const js="__no_parent__";function n1(e,t){const n=new Set([t]);for(let a=!0;a;){a=!1;for(const r of e)r.parent&&n.has(r.parent)&&!n.has(r.key)&&(n.add(r.key),a=!0)}return n}const fo=(e,t)=>(e.label||e.key).localeCompare(t.label||t.key);function dn({id:e,label:t,help:n,error:a,children:r}){const l=[n?`${e}-help`:null,a?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:e,children:t}),r(l),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground text-xs",children:n}):null,a?s.jsx("p",{id:`${e}-error`,className:"text-destructive text-sm",children:a}):null]})}function Sm({label:e,children:t}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-sm leading-none font-medium",children:e}),s.jsx("span",{className:"text-muted-foreground text-sm break-words",children:t})]})}function iy({id:e,label:t,help:n,checked:a,on_change:r}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Vl,{id:e,className:"mt-0.5",checked:a,"aria-describedby":n?`${e}-help`:void 0,onCheckedChange:l=>r(l===!0)}),s.jsx($e,{htmlFor:e,className:"font-normal",children:t})]}),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground pl-6 text-xs",children:n}):null]})}function s1({id:e,legend:t,help:n,error:a,options:r,checked:l,on_change:i,empty:o,notes:c,scroll:d}){const f=[c!=null&&c.length?`${e}-notes`:null,n?`${e}-help`:null,a?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return s.jsxs("fieldset",{className:"m-0 grid min-w-0 gap-2 border-0 p-0","aria-describedby":f,"aria-invalid":a?!0:void 0,children:[s.jsx("legend",{className:"mb-2 text-sm leading-none font-medium",children:t}),c!=null&&c.length?s.jsxs("div",{id:`${e}-notes`,className:"text-warning flex items-start gap-2 text-xs",children:[s.jsx(Qt,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),s.jsx("div",{className:"grid gap-0.5",children:c.map(h=>s.jsx("p",{children:h},h))})]}):null,r.length===0&&o?s.jsx("p",{className:"text-muted-foreground text-sm",children:o}):null,s.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:r.map((h,m)=>s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(Vl,{id:`${e}-${m}`,className:"mt-0.5",checked:l.has(h.value),onCheckedChange:x=>{const b=new Set(l);x===!0?b.add(h.value):b.delete(h.value),i(b)}}),s.jsx($e,{htmlFor:`${e}-${m}`,className:"min-w-0 font-normal break-words",children:h.label})]},h.value))}),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground text-xs",children:n}):null,a?s.jsx("p",{id:`${e}-error`,className:"text-destructive text-sm",children:a}):null]})}function ho({context:e,action:t,title:n="Two-factor sign-in needed",changing:a="Changing the org"}){const r=e.two_factor==="enroll";return s.jsxs(he,{variant:"destructive",role:"alert",children:[s.jsx(RT,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:n}),s.jsxs(xe,{children:[s.jsx("p",{children:r?`Turn on two-factor sign-in in Account Settings, then come back here and ${t}.`:`${a} needs a two-factor sign-in. Sign in again with your authenticator in Account Settings, then come back here and ${t}.`}),s.jsx(V,{asChild:!0,variant:"outline",size:"sm",className:"mt-2 h-auto min-h-8 py-1.5 whitespace-normal text-left",children:s.jsx("a",{href:e.settings_href,target:"_blank",rel:"noreferrer",children:"Open Account Settings in a new tab"})})]})]})}const Fa=e=>e.two_factor==="ok";function Ql({refusal:e,context:t,subject:n,action:a,changing:r,authority_title:l}){if((e==null?void 0:e.kind)==="two_factor")return s.jsx(ho,{context:t,action:a,changing:r,title:`Could not save ${n}`});const i=Fa(t)?null:s.jsx(ho,{context:t,action:a,changing:r});if(!e)return i;const o=e.kind==="changed"?"The org changed since you opened this":e.kind==="authority"?l??`Could not save ${n}`:null;return s.jsxs(s.Fragment,{children:[i,s.jsxs(he,{variant:"destructive",role:"alert",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),o?s.jsx(ye,{children:o}):null,s.jsx(xe,{children:e.message})]})]})}function a1({id:e,value:t,on_change:n,none:a,options:r,described_by:l}){return s.jsxs(pt,{value:t,onValueChange:n,children:[s.jsx(ut,{id:e,"aria-describedby":l,children:s.jsx(xt,{placeholder:"Choose a team"})}),s.jsxs(dt,{children:[a?s.jsx(Re,{value:js,children:a}):null,r.map(i=>s.jsx(Re,{value:i.key,children:i.label||i.key},i.key))]})]})}function Wl(e){const[t,n]=u.useState(!1),[a,r]=u.useState(null);return{saving:t,refusal:a,set_refusal:r,run:async i=>{n(!0),r(null);try{const o=await i();o?r(o):e()}finally{n(!1)}}}}function Zl({saving:e,blocked:t,described_by:n,children:a}){return s.jsx(V,{type:"submit",disabled:e,"aria-disabled":t||void 0,"aria-describedby":t?n:void 0,children:a})}const r1=(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 i3({open:e,chart:t,team:n,save:a,on_close:r,context:l=Jl,scope:i="full",parents:o}){var k;const c=l.host==="hosted",[d,f]=u.useState(""),[h,m]=u.useState(""),[x,b]=u.useState(""),[v,y]=u.useState(js),[g,p]=u.useState({}),{saving:j,refusal:w,set_refusal:N,run:C}=Wl(r),_=((k=t.teams.find(O=>O.parent===null))==null?void 0:k.key)??null;u.useEffect(()=>{e&&(f(""),m((n==null?void 0:n.label)??""),b((n==null?void 0:n.description)??""),y((n==null?void 0:n.parent)??(c&&_&&(!o||o.includes(_))?_:js)),p({}),N(null))},[e,n,N,c,_,o]);const S=O=>{const Y=t.teams.find(E=>E.key===O);return Y?Y.label||Y.key:O??""},D=n?n1(t.teams,n.key):new Set,z=[...t.teams].filter(O=>!D.has(O.key)&&(!o||o.includes(O.key))).sort((O,Y)=>O.key===_?-1:Y.key===_?1:fo(O,Y)),P=n?n.label||n.key:"",F=i==="description",H=!Fa(l),A=n?F?"save the description":"save the team":"add the team",M=O=>{if(O.preventDefault(),H)return;if(!n){const I=c?h.trim():d.trim();if(!I){p(c?{label:"Give the team a name."}:{key:"Give the team a key."});return}if(c&&v===js){p({parent:"Choose the parent team."});return}const Q=c?I:h.trim()||I;C(()=>a({action:"add",kind:"team",key:I,...h.trim()?{label:h.trim()}:{},...x.trim()?{description:x.trim()}:{},...v!==js?{parent:v}:{}},`Team ${Q} added.`));return}if(!F&&!h.trim()){p({label:c?"Give the team a name.":"Give the team a label."});return}const Y=v===js?null:v,E={...!F&&h.trim()!==n.label.trim()?{label:h.trim()}:{},...x.trim()!==(n.description??"").trim()?{description:x.trim()}:{},...!c&&Y!==n.parent?{parent:Y}:{}};if(Object.keys(E).length===0){r();return}C(()=>a({action:"edit",kind:"team",key:n.key,...E},F?`Saved the description of ${P}.`:`Team ${h.trim()} saved.`))},R=n?F?`Edit the description of ${P}`:`Edit team ${P}`:"Add team";let T;return F?T="Say what the team works on. Only the description is yours to change here.":c?T=n?"Rename the team or say what it works on.":"Add a team to the organization.":n?T=s.jsxs(s.Fragment,{children:["Its key, ",s.jsx("span",{className:"font-mono",children:n.key}),", names it in posts and in sdlc org and does not change."]}):T="Add a team to this repository's local org.",s.jsx(pn,{open:e,onOpenChange:O=>O||j?null:r(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:M,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:R}),s.jsx(jn,{children:T})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ql,{refusal:w,context:l,subject:F?"the description":"the team",action:A}),!n&&!c?s.jsx(dn,{id:"org-team-key",label:"Key",help:r1("team",l.host),error:g.key,children:O=>s.jsx(bt,{id:"org-team-key",className:"font-mono",value:d,autoComplete:"off","aria-invalid":g.key?!0:void 0,"aria-describedby":O,onChange:Y=>{f(Y.target.value),p({})}})}):null,F&&n?s.jsx(Sm,{label:"Name",children:n.parent?`${P} · under ${S(n.parent)}`:P}):s.jsx(dn,{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:g.label,children:O=>s.jsx(bt,{id:"org-team-label",value:h,"aria-invalid":g.label?!0:void 0,"aria-describedby":O,onChange:Y=>{m(Y.target.value),p({})}})}),s.jsx(dn,{id:"org-team-description",label:F?"Description":"Description (optional)",children:()=>s.jsx(Dn,{id:"org-team-description",rows:3,placeholder:"What the team does",value:x,onChange:O=>b(O.target.value)})}),F?null:c&&n?s.jsx(Sm,{label:"Parent team",children:n.parent?S(n.parent):"None: the organization itself"}):s.jsx(dn,{id:"org-team-parent",label:"Parent team",help:"Where the team sits; its posts report up through the team above.",error:g.parent,children:O=>s.jsx(a1,{id:"org-team-parent",value:v,on_change:Y=>{y(Y),p({})},none:c?void 0:"No parent (a root team)",options:z,described_by:O})})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:j,onClick:r,children:"Cancel"}),s.jsx(Zl,{saving:j,blocked:H,children:n?j?"Saving…":"Save":j?"Adding…":"Add team"})]})]})})})}const o3=(e,t)=>e.length===t.size&&e.every(n=>t.has(n));function c3({open:e,chart:t,job:n,save:a,on_close:r,context:l=Jl}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(js),[b,v]=u.useState(new Set),[y,g]=u.useState(!1),[p,j]=u.useState(!0),[w,N]=u.useState({}),{saving:C,refusal:_,set_refusal:S,run:D}=Wl(r);u.useEffect(()=>{e&&(o(""),d((n==null?void 0:n.label)??""),h((n==null?void 0:n.description)??""),x((n==null?void 0:n.parent)??js),v(new Set((n==null?void 0:n.fills)??[])),g((n==null?void 0:n.requires_person)??!1),j((n==null?void 0:n.escalable)??!0),N({}),S(null))},[e,n,S]);const z=n?n1(t.job_functions,n.key):new Set,P=[...t.job_functions].filter(R=>!z.has(R.key)).sort(fo),F=[...t.slots].sort(fo).map(R=>({value:R.key,label:R.label||R.key})),H=!Fa(l),A=n?"save the job function":"add the job function",M=R=>{if(R.preventDefault(),H)return;if(!n){if(!i.trim()){N({key:"Give the job function a key."});return}D(()=>a({action:"add",kind:"job_function",key:i.trim(),...c.trim()?{label:c.trim()}:{},...f.trim()?{description:f.trim()}:{},...m!==js?{parent:m}:{},fills:[...b],requires_person:y,escalable:p},`Job function ${c.trim()||i.trim()} added.`));return}if(!c.trim()){N({label:"Give the job function a label."});return}const T=m===js?null:m,k={...c.trim()!==n.label.trim()?{label:c.trim()}:{},...f.trim()!==(n.description??"").trim()?{description:f.trim()}:{},...T!==n.parent?{parent:T}:{},...o3(n.fills,b)?{}:{fills:[...b]},...y!==n.requires_person?{requires_person:y}:{},...p!==n.escalable?{escalable:p}:{}};if(Object.keys(k).length===0){r();return}D(()=>a({action:"edit",kind:"job_function",key:n.key,...k},`Job function ${c.trim()} saved.`))};return s.jsx(pn,{open:e,onOpenChange:R=>R||C?null:r(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:M,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:n?`Edit job function ${n.label||n.key}`:"Add job function"}),s.jsxs(jn,{children:["Its job description: what it does, the slots it fills and who may hold its posts.",n?s.jsxs(s.Fragment,{children:[" ","Its key, ",s.jsx("span",{className:"font-mono",children:n.key}),", does not change."]}):null]})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ql,{refusal:_,context:l,subject:"the job function",action:A}),n?null:s.jsx(dn,{id:"org-function-key",label:"Key",help:r1("job function",l.host),error:w.key,children:R=>s.jsx(bt,{id:"org-function-key",className:"font-mono",value:i,autoComplete:"off","aria-invalid":w.key?!0:void 0,"aria-describedby":R,onChange:T=>{o(T.target.value),N({})}})}),s.jsx(dn,{id:"org-function-label",label:n?"Label":"Label (optional)",error:w.label,children:R=>s.jsx(bt,{id:"org-function-label",value:c,"aria-invalid":w.label?!0:void 0,"aria-describedby":R,onChange:T=>{d(T.target.value),N({})}})}),s.jsx(dn,{id:"org-function-description",label:"Job description (optional)",children:()=>s.jsx(Dn,{id:"org-function-description",rows:3,placeholder:"What this job function does",value:f,onChange:R=>h(R.target.value)})}),s.jsx(dn,{id:"org-function-parent",label:"Parent function",help:"Its posts report to the post of the parent function.",children:R=>s.jsx(a1,{id:"org-function-parent",value:m,on_change:x,none:"No parent (a root function)",options:P,described_by:R})}),s.jsx(s1,{id:"org-function-fills",legend:"Slots it fills",options:F,checked:b,on_change:v,empty:l.host==="hosted"?"This organization has no slots yet.":"This org has no slots yet; add them with sdlc org add slot."}),s.jsx(iy,{id:"org-function-requires-person",label:"Requires a person",help:"Only a person may hold its posts.",checked:y,on_change:g}),s.jsx(iy,{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:p,on_change:j})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:C,onClick:r,children:"Cancel"}),s.jsx(Zl,{saving:C,blocked:H,children:n?C?"Saving…":"Save":C?"Adding…":"Add job function"})]})]})})})}const u3=/^[a-z][a-z0-9_-]{0,63}$/;function d3(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/,"")}function f3({open:e,chart:t,slot:n,save:a,on_close:r,context:l=Jl}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,x]=u.useState(""),[b,v]=u.useState({}),{saving:y,refusal:g,set_refusal:p,run:j}=Wl(r);u.useEffect(()=>{e&&(o((n==null?void 0:n.label)??""),d((n==null?void 0:n.key)??""),h(!1),x((n==null?void 0:n.description)??""),v({}),p(null))},[e,n,p]);const w=!Fa(l),N=n?"save the slot":"add the slot",C=_=>{if(_.preventDefault(),w)return;const S=i.trim();if(n){if(!S){v({label:"Give the slot a label."});return}const z={...S!==(n.label??"").trim()?{label:S}:{},...m.trim()!==(n.description??"").trim()?{description:m.trim()}:{}};if(Object.keys(z).length===0){r();return}j(()=>a({action:"edit",kind:"slot",key:n.key,...z},`Saved slot ${S}.`));return}const D={...S?{}:{label:"Give the slot a label."},...u3.test(c)?t.slots.some(z=>z.key===c)?{key:`Slot ${c} already exists.`}:{}:{key:"Use lowercase letters, digits, _ and -, starting with a letter, at most 64 characters."}};v(D),!(D.label||D.key)&&j(()=>a({action:"add",kind:"slot",key:c,label:S,...m.trim()?{description:m.trim()}:{}},`Added slot ${S}.`))};return s.jsx(pn,{open:e,onOpenChange:_=>_||y?null:r(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:C,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:n?`Edit ${n.label||n.key}`:"Add slot"}),s.jsx(jn,{children:"A slot is a workflow role a project fills from its team's posts. Job functions name the slots they fill."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ql,{refusal:g,context:l,subject:"the slot",action:N}),s.jsx(dn,{id:"org-slot-label",label:"Label",help:"How the slot is named on the chart and in project settings.",error:b.label,children:_=>s.jsx(bt,{id:"org-slot-label",value:i,"aria-invalid":b.label?!0:void 0,"aria-describedby":_,onChange:S=>{o(S.target.value),!n&&!f&&d(d3(S.target.value)),v({})}})}),n?s.jsx(Sm,{label:"Key",children:s.jsx("span",{className:"font-mono",children:n.key})}):s.jsx(dn,{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:b.key,children:_=>s.jsx(bt,{id:"org-slot-key",className:"font-mono",value:c,autoComplete:"off","aria-invalid":b.key?!0:void 0,"aria-describedby":_,onChange:S=>{d(S.target.value),h(!0),v({})}})}),s.jsx(dn,{id:"org-slot-description",label:"Description (optional)",children:()=>s.jsx(Dn,{id:"org-slot-description",rows:3,placeholder:"What this role does",value:m,onChange:_=>x(_.target.value)})})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:y,onClick:r,children:"Cancel"}),s.jsx(Zl,{saving:y,blocked:w,children:n?y?"Saving…":"Save":y?"Adding…":"Add slot"})]})]})})})}function h3({open:e,chart:t,binding:n,names:a,save:r,confirm:l,on_close:i,context:o=Jl,hosted:c}){var H;const[d,f]=u.useState(new Set),[h,m]=u.useState(""),[x,b]=u.useState({}),{saving:v,refusal:y,set_refusal:g,run:p}=Wl(i),j=(n==null?void 0:n.slot)??null;if(u.useEffect(()=>{!e||!n||(f(new Set(c&&n.source!=="override"?[]:n.posts.map(A=>A.post))),m(n.source==="override"?n.reason??"":""),b({}),g(null))},[e,j,g]),!n)return null;const w=a.slot(n.slot),N=(H=t.project)!=null&&H.team?t.teams.find(A=>{var M;return A.key===((M=t.project)==null?void 0:M.team)}):void 0,C=N?N.label||N.key:"the owning team",_=new Set(t.job_functions.filter(A=>A.fills.includes(n.slot)).map(A=>A.key)),S=[...t.posts].map(A=>A.post).sort(a.byPost).map(A=>{const M=_.has(A.split("/")[1]??"")?`${a.post(A)} (fills ${w})`:a.post(A),R=c==null?void 0:c.holders(A);return{value:A,label:c?R?`${M}: ${R}`:`${M} (no holder)`:M}}),D=c?[...d].sort(a.byPost).flatMap(A=>[..._.has(A.split("/")[1]??"")?[]:[`${a.post(A)} is not in the job description of ${w}.`],...c.chain.has(A.split("/")[0]??"")?[]:[`${a.post(A)} is outside ${c.owner} and the teams above it.`]]):[],z=!Fa(o),P=A=>{A.preventDefault();const M={...d.size===0?{posts:"Choose at least one post."}:{},...h.trim()?{}:{reason:"Give the reason for the override."}};b(M),!(M.posts||M.reason||z)&&p(()=>r({action:"bind",slot:n.slot,posts:[...d],reason:h.trim()},`Override of ${w} saved.`))},F=async()=>{await l({title:`Clear the override of ${w}?`,description:c?`${w} 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})&&p(()=>r({action:"unbind",slot:n.slot},`Override of ${w} cleared.`))};return s.jsx(pn,{open:e,onOpenChange:A=>A||v?null:i(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:P,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsxs(yn,{children:["Override ",w]}),s.jsxs(jn,{children:["Bind ",w," 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."]})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y||z?s.jsx("div",{id:"org-override-refusal",className:"grid gap-4",children:s.jsx(Ql,{refusal:y,context:o,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,s.jsx(s1,{id:"org-override-posts",legend:"Posts",help:c?`(fills ${w}) marks the posts whose job function fills ${w}.`:"A post outside its job description is marked on the chart.",notes:D,scroll:!!c,error:x.posts,options:S,checked:d,on_change:A=>{f(A),b(M=>({...M,posts:void 0}))}}),s.jsx(dn,{id:"org-override-reason",label:"Reason",error:x.reason,children:A=>s.jsx(Dn,{id:"org-override-reason",rows:2,placeholder:"Why this slot needs other posts",value:h,"aria-invalid":x.reason?!0:void 0,"aria-describedby":A,onChange:M=>{m(M.target.value),b(R=>({...R,reason:void 0}))}})}),c?null:s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Made as ",s.jsx("span",{className:"font-mono",children:"person:user"}),", who must hold the lead post of ",C," or of a team above it."]})]}),s.jsxs(vn,{className:"mt-6",children:[n.source==="override"?s.jsx(V,{type:"button",variant:"ghost",className:"sm:mr-auto",disabled:v,onClick:()=>void F(),children:"Clear override"}):null,s.jsx(V,{type:"button",variant:"outline",disabled:v,onClick:i,children:"Cancel"}),s.jsx(Zl,{saving:v,blocked:z,described_by:"org-override-refusal",children:v?"Saving…":"Save override"})]})]})})})}function m3(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function p3({open:e,chart:t,names:n,save:a,on_close:r,context:l}){var A;const i=t.authority,o=u.useMemo(()=>i?new Set(i.post_pairs):null,[i]),c=M=>!o||o.has(M),d=((A=t.teams.find(M=>M.parent===null))==null?void 0:A.key)??null,f=[...t.teams].filter(M=>!o||[...o].some(R=>R.startsWith(`${M.key}/`))).sort((M,R)=>M.key===d?-1:R.key===d?1:fo(M,R)),[h,m]=u.useState(""),[x,b]=u.useState(""),[v,y]=u.useState({}),{saving:g,refusal:p,set_refusal:j,run:w}=Wl(r);u.useEffect(()=>{var M;e&&(m(((M=f[0])==null?void 0:M.key)??""),b(""),y({}),j(null))},[e,j]);const N=new Set(t.posts.filter(M=>M.post.startsWith(`${h}/`)).map(M=>M.post.split("/")[1])),C=[],_=M=>{for(const R of[...t.job_functions].filter(T=>T.parent===M).sort(fo))C.push(R),_(R.key)};_(null);const S=C.filter(M=>c(`${h}/${M.key}`)&&!N.has(M.key)),D=h!==""&&S.length===0,z=!Fa(l)||D,P=M=>{if(M.preventDefault(),z)return;const R={...h?{}:{team:"Choose a team."},...x?{}:{job:"Choose a job function."}};y(R),!(R.team||R.job)&&w(()=>a({action:"add",kind:"post",key:`${h}/${x}`},`Added post ${n.job(x)} · ${n.team(h)}.`))},F=D?"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.",H=(i==null?void 0:i.ask)??[];return s.jsx(pn,{open:e,onOpenChange:M=>M||g?null:r(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:P,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Add post"}),s.jsx(jn,{children:"A post is a job function staffed in a team. People in this post report to the post above it."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ql,{refusal:p,context:l,subject:"the post",action:"add the post"}),s.jsx(dn,{id:"org-post-team",label:"Team",help:"The team the post is in.",error:v.team,children:M=>s.jsxs(pt,{value:h,onValueChange:R=>{m(R),b(""),y({})},children:[s.jsx(ut,{id:"org-post-team","aria-describedby":M,"aria-invalid":v.team?!0:void 0,children:s.jsx(xt,{placeholder:"Choose a team"})}),s.jsx(dt,{children:f.map(R=>s.jsx(Re,{value:R.key,children:R.label||R.key},R.key))})]})}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(dn,{id:"org-post-function",label:"Job function",help:F,error:v.job,children:M=>s.jsxs(pt,{value:x,disabled:D,onValueChange:R=>{b(R),y({})},children:[s.jsx(ut,{id:"org-post-function","aria-describedby":M,"aria-invalid":v.job?!0:void 0,children:s.jsx(xt,{placeholder:D?"Every job function has a post here":"Choose a job function"})}),s.jsx(dt,{children:S.map(R=>s.jsx(Re,{value:R.key,children:R.label||R.key},R.key))})]})}),i&&!i.administer?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Only the job functions directly below a post you hold are listed.",H.length?` For others, ask ${m3(H)}.`:""]}):null]})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:g,onClick:r,children:"Cancel"}),s.jsx(Zl,{saving:g,blocked:z,described_by:D?"org-post-function-help":void 0,children:g?"Adding…":"Add post"})]})]})})})}function x3({open:e,chart:t,post:n,names:a,members:r,save:l,on_close:i,context:o}){const[c,d]=u.useState({state:"loading"}),[f,h]=u.useState(""),[m,x]=u.useState(null),[b,v]=u.useState(-1),{saving:y,refusal:g,set_refusal:p,run:j}=Wl(i),w=u.useRef(0),N=u.useCallback(async()=>{const E=w.current+=1;d({state:"loading"});const I=await r();E===w.current&&d(I.ok?{state:"read",members:I.data}:{state:"failed"})},[r]);u.useEffect(()=>{e&&(h(""),x(null),v(-1),p(null),N())},[e,N,p]);const C=t.posts.find(E=>E.post===n);if(!n||!C)return null;const _=a.post(n),S=new Set(C.holders.map(E=>E.id)),z=t.posts.some(E=>E.reports_to===n)&&C.holders.length>0?C.holders[0]:null,P=f.trim().toLowerCase(),F=c.state==="read"?c.members.filter(E=>!S.has(E.id)).filter(E=>!P||[E.label,E.detail,E.email].some(I=>I==null?void 0:I.toLowerCase().includes(P))):[],H=c.state==="read"&&c.members.every(E=>S.has(E.id)),A=c.state==="read"&&!H&&F.length>0,M=A&&b>=0&&b<F.length?F[b]:null,R=E=>`org-holder-option-${E.id}`,T=!Fa(o)||!m||z!==null,k=E=>{if(!A)return;const I=F.length-1,Q=te=>{var ce,X;E.preventDefault(),v(te),(X=(ce=document.getElementById(R(F[te])))==null?void 0:ce.scrollIntoView)==null||X.call(ce,{block:"nearest"})};E.key==="ArrowDown"?Q(Math.min(M?b+1:0,I)):E.key==="ArrowUp"?Q(M?Math.max(b-1,0):I):E.key==="Home"&&M?Q(0):E.key==="End"&&M?Q(I):E.key==="Enter"&&M&&(m==null?void 0:m.id)!==M.id&&(E.preventDefault(),x(M))},O=z?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.",Y=E=>{E.preventDefault(),!(T||!m)&&j(()=>l({action:"hold",post:n,member:m.id},`Added ${m.label} to ${_}.`))};return s.jsx(pn,{open:e,onOpenChange:E=>E||y?null:i(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:Y,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsxs(yn,{children:["Add holder to ",_]}),s.jsx(jn,{children:"The member holds this post and reports as it does."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ql,{refusal:g,context:o,subject:"the holder",action:"add the holder"}),z?s.jsxs(he,{variant:"info",id:"org-holder-one",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsxs(xe,{children:["This post takes one holder. Remove ",a.member(z)," first, then add the new holder."]})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"org-holder-member",children:"Member"}),s.jsx(bt,{id:"org-holder-member",role:"combobox","aria-expanded":A,"aria-controls":A?"org-holder-members":void 0,"aria-activedescendant":M?R(M):void 0,"aria-autocomplete":"list","aria-describedby":O?"org-holder-member-help":void 0,placeholder:"Search members by name, username or email",autoComplete:"off",value:f,disabled:z!==null,onChange:E=>{h(E.target.value),v(-1)},onKeyDown:k}),s.jsx("div",{className:"max-h-56 overflow-y-auto rounded-md border",children:c.state==="loading"?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 px-3 py-2 text-sm",role:"status",children:[s.jsx(Wt,{className:"size-4","aria-hidden":"true"}),"Loading members…"]}):c.state==="failed"?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2",children:[s.jsx("p",{className:"text-destructive text-sm",children:"Could not read the members."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void N(),children:"Retry"})]}):H?s.jsx("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"Every member already holds this post."}):F.length===0?s.jsxs("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:["No member matches “",f.trim(),"”."]}):s.jsx("ul",{id:"org-holder-members",role:"listbox","aria-label":"Members",className:"m-0 list-none p-1",children:F.map((E,I)=>{const Q=(m==null?void 0:m.id)===E.id,te=(M==null?void 0:M.id)===E.id;return s.jsxs("li",{id:R(E),role:"option","aria-selected":Q,className:`cursor-pointer rounded-sm px-2 py-1.5 ${Q?"bg-accent text-accent-foreground":te?"bg-muted":"hover:bg-muted"} ${te?"ring-ring ring-2 ring-inset":""}`,onClick:()=>{z||(v(I),x(E))},children:[s.jsxs("div",{className:"text-sm font-medium break-words",children:[E.label,E.detail&&F.filter(ce=>ce.label===E.label).length>1?` (${E.detail})`:""]}),E.email?s.jsx("div",{className:"text-muted-foreground text-xs break-all",children:E.email}):null]},E.id)})})}),O?s.jsx("p",{id:"org-holder-member-help",className:"text-muted-foreground text-xs",children:O}):null]})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:y,onClick:i,children:"Cancel"}),s.jsx(Zl,{saving:y,blocked:T,described_by:z?"org-holder-one":O?"org-holder-member-help":void 0,children:y?"Adding…":"Add holder"})]})]})})})}function l1(e){const[t,n]=u.useState(null),a=u.useRef(t);u.useEffect(()=>{a.current=t},[t]);const r=u.useCallback(c=>{var d;(d=a.current)==null||d.resolve(c),n(null)},[]),l=u.useCallback(c=>new Promise(d=>{var f;(f=a.current)==null||f.resolve(!1),n({...c,resolve:d})}),[]);u.useEffect(()=>()=>{var c;return(c=a.current)==null?void 0:c.resolve(!1)},[]);const i=!Fa(e),o=s.jsx(Gp,{open:t!==null,onOpenChange:c=>c?null:r(!1),children:s.jsxs(Vp,{children:[s.jsxs(Yp,{children:[s.jsx(Kp,{children:t==null?void 0:t.title}),s.jsx(Xp,{className:"whitespace-pre-line",children:t==null?void 0:t.description})]}),t&&i?s.jsx(ho,{context:e,action:t.action}):null,s.jsxs(Fp,{children:[s.jsx(Qp,{children:"Cancel"}),s.jsx(H0,{variant:t!=null&&t.destructive?"destructive":"default","aria-disabled":i||void 0,onClick:c=>{if(i){c.preventDefault();return}r(!0)},children:t==null?void 0:t.action_label})]})]})});return{confirm:l,confirm_dialog:o}}function pl({label:e,on_edit:t,on_remove:n,items:a}){const r=a??[...t?[{label:"Edit",on_select:t}]:[],...n?[{label:"Remove",on_select:n,destructive:!0}]:[]];return s.jsxs($d,{children:[s.jsx(Od,{asChild:!0,children:s.jsx(V,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`More actions for ${e}`,children:s.jsx(Op,{className:"size-3.5","aria-hidden":"true"})})}),s.jsx(Go,{align:"end",children:r.map(l=>s.jsx(Al,{className:l.destructive?"text-destructive focus:text-destructive":void 0,onSelect:l.on_select,children:l.label},l.label))})]})}function g3({label:e,message:t,bound:n,on_dismiss:a}){return s.jsxs(he,{variant:"destructive",role:"alert",className:"mb-3",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:[e," was not removed"]}),s.jsxs(xe,{children:[s.jsx("p",{children:t}),n!=null&&n.projects.length?s.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(r=>s.jsxs("li",{className:"grid gap-0.5",children:[s.jsxs("a",{className:"text-primary text-sm underline underline-offset-2",href:r.href,children:["Settings of ",r.name]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Override set by ",r.set_by??"a former member"]})]},r.href))}):null,n&&n.more>0?s.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,s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:"Dismiss"})]})]})}const Jl={host:"local",two_factor:"ok",settings_href:""},Bu={open:{label:"Open",tone:"info"},accepted:{label:"Accepted",tone:"success"},rejected:{label:"Rejected",tone:"error"},withdrawn:{label:"Withdrawn",tone:"neutral"}},v3={added:{label:"Added",tone:"success"},changed:{label:"Changed",tone:"warning"},removed:{label:"Removed",tone:"error"}},y3={team:["team","teams"],job_function:["job function","job functions"],slot:["slot","slots"],post:["post","posts"],fill:["fill","fills"]},j3=["team","job_function","slot","post","fill"];function $x(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function i1(e){const t=a=>$x(j3.filter(r=>e[r][a]>0).map(r=>{const l=e[r][a];return`${l} ${y3[r][l===1?0:1]}`}));return[["Adds","adds",t("added")],["Changes","changes",t("changed")],["Removes","removes",t("removed")]].filter(([,,a])=>a).map(([a,r,l],i)=>`${i===0?a:r} ${l}`).join("; ")||"No changes"}function Hu(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function b3(e){const t=`Proposed by ${e.requested_by} on ${Hu(e.requested_at)}`;return e.status==="open"||!e.decided_at?t:`${t} · ${Bu[e.status].label} by ${e.decided_by??"a former member"} on ${Hu(e.decided_at)}`}function w3(e,t){const[n,a]=u.useState(e?{state:"loading"}:{state:"off"});return u.useEffect(()=>{if(!e||!t){e||a({state:"off"});return}let r=!0;return e.list().then(l=>{r&&(l.ok?a({state:"read",proposals:l.data}):l.refusal.status===404||l.refusal.reason==="not_found"?a({state:"off"}):a({state:"failed",message:l.refusal.message}))}),()=>{r=!1}},[e,t]),n}function oy({proposal:e,on_open:t}){const n=Bu[e.status];return s.jsxs("li",{className:"border-b px-4 py-2.5 last:border-b-0","data-testid":"org-proposal",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(V,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-left whitespace-normal",onClick:t,children:e.title}),s.jsx(ue,{variant:n.tone,children:n.label})]}),s.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:[e.status==="open"?`Proposed by ${e.requested_by} on ${Hu(e.requested_at)}`:`${n.label} by ${e.decided_by??"a former member"} on ${Hu(e.decided_at??e.requested_at)}`,` · ${i1(e.counts)}`]})]})}const _3="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 N3({listed:e,on_propose:t,on_open:n}){const[a,r]=u.useState(!1);if(e.state==="off"||e.state==="loading")return null;const l=e.state==="read"?e.proposals:[],i=l.filter(c=>c.status==="open"),o=l.filter(c=>c.status!=="open");return s.jsxs("section",{"aria-labelledby":"org-chart-proposals",className:"mt-6 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[s.jsxs("div",{className:"min-w-0 flex-1 basis-64",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{id:"org-chart-proposals",className:"text-lg font-semibold",children:"Proposals"}),i.length?s.jsx(ue,{variant:"info",children:`${i.length} open`}):null]}),s.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:_3})]}),s.jsxs(V,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(nm,{className:"size-4","aria-hidden":"true"}),"Propose a change"]})]}),s.jsxs("div",{className:"mt-3 grid gap-2",children:[e.state==="failed"?s.jsxs("p",{className:"text-destructive text-sm",role:"alert",children:["Could not read the proposals. ",e.message]}):null,e.state==="read"&&l.length===0?s.jsxs(ot,{className:"flex flex-col items-center gap-2 p-6 text-center",children:[s.jsx(nm,{className:"text-muted-foreground size-5","aria-hidden":"true"}),s.jsx("p",{className:"text-sm font-medium",children:"No proposals yet"}),s.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,i.length?s.jsx(ot,{className:"overflow-hidden",children:s.jsx("ul",{role:"list",className:"m-0 list-none p-0","aria-label":"Open proposals",children:i.map(c=>s.jsx(oy,{proposal:c,on_open:()=>n(c)},c.id))})}):null,o.length?s.jsxs("div",{children:[s.jsxs(V,{type:"button",variant:"ghost",size:"sm","aria-expanded":a,"aria-controls":"org-chart-proposals-decided",onClick:()=>r(c=>!c),children:[a?s.jsx($p,{className:"size-4","aria-hidden":"true"}):s.jsx(fd,{className:"size-4","aria-hidden":"true"}),`Decided (${o.length})`]}),a?s.jsx(ot,{className:"mt-2 overflow-hidden",children:s.jsx("ul",{id:"org-chart-proposals-decided",role:"list",className:"m-0 list-none p-0","aria-label":"Decided proposals",children:o.map(c=>s.jsx(oy,{proposal:c,on_open:()=>n(c)},c.id))})}):null]}):null]})]})}const k3="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 S3({draft:e,on_submit:t,on_discard:n}){var c;const a=((c=e.moved)==null?void 0:c.state)==="conflict"?e.moved.names:null,r=!!e.moved,l=e.total===0?"No changes yet":`${e.total} ${e.total===1?"change":"changes"}`,i=e.total===0||!!a,o=r?Qt:nm;return s.jsxs(he,{variant:r?"warning":"info",role:"status",className:"mt-6",children:[s.jsx(o,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:r?"The org changed while you drafted":"You are drafting a proposal"}),s.jsxs(xe,{children:[s.jsx("p",{id:"org-draft-why",children:a?`The org changed what your draft changes: ${$x(a)}. Discard the draft and start again from the org as it is now.`:r?"We moved your draft onto the org as it is now and kept your changes. Check the chart, then submit again.":k3}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[s.jsx(V,{type:"button",size:"sm","aria-disabled":i||void 0,"aria-describedby":i?a?"org-draft-why":"org-draft-count":void 0,onClick:()=>i?void 0:t(),children:"Submit proposal"}),s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:n,children:"Discard draft"}),s.jsx("span",{id:"org-draft-count",className:"text-muted-foreground text-xs",children:l})]})]})]})}const C3={proposal_empty:"The proposal changes nothing in the org."};function R3({open:e,draft:t,submit:n,on_close:a,on_done:r}){const[l,i]=u.useState(""),[o,c]=u.useState(""),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,b]=u.useState(!1),v=u.useRef(!1);u.useEffect(()=>{e&&(f(null),m(null))},[e]);const y=async g=>{if(g.preventDefault(),v.current)return;const p=l.trim();if(!p||p.length>200){f("Give the proposal a title of at most 200 characters.");return}f(null),m(null),b(!0),v.current=!0;try{const j=await n({title:p,...o.trim()?{note:o.trim()}:{}});if(!j.ok){m(C3[j.refusal.code??""]??j.refusal.message);return}j.data.state==="proposed"&&(i(""),c("")),r(j.data,p)}finally{v.current=!1,b(!1)}};return s.jsx(pn,{open:e,onOpenChange:g=>g?null:a(),children:s.jsx(xn,{className:"sm:max-w-lg",children:s.jsxs("form",{onSubmit:g=>void y(g),className:"grid gap-4",noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Submit proposal"}),s.jsx(jn,{children:"Someone who may make these changes reviews it. Nothing in the organization changes until it is accepted."})]}),h?s.jsxs(he,{variant:"destructive",role:"alert",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not submit the proposal"}),s.jsx(xe,{children:s.jsx("p",{children:h})})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"org-proposal-title",children:"Title"}),s.jsx(bt,{id:"org-proposal-title",value:l,maxLength:200,"aria-invalid":d?!0:void 0,"aria-describedby":d?"org-proposal-title-error":void 0,onChange:g=>i(g.target.value)}),d?s.jsx("p",{id:"org-proposal-title-error",className:"text-destructive text-sm",children:d}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"org-proposal-note",children:"Note (optional)"}),s.jsx(Dn,{id:"org-proposal-note",value:o,rows:3,maxLength:4e3,placeholder:"Why the org should make this change","aria-describedby":"org-proposal-note-help",onChange:g=>c(g.target.value)}),s.jsx("p",{id:"org-proposal-note-help",className:"text-muted-foreground text-xs",children:"At most 4000 characters."})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:i1(t.counts)}),s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),s.jsxs(V,{type:"submit","aria-disabled":x||void 0,children:[x?s.jsx(Wt,{className:"size-4","aria-hidden":"true"}):null,x?"Submitting…":"Submit proposal"]})]})]})})})}const T3=[{kind:"team",title:"Teams"},{kind:"job_function",title:"Job functions"},{kind:"slot",title:"Slots"},{kind:"post",title:"Posts"},{kind:"fill",title:"Fills"}];function E3({entry:e,decided:t}){const n=!t&&e.state==="settled",a=v3[e.change];return s.jsxs("li",{className:"grid gap-1 border-b py-2","data-testid":"org-proposal-entry",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&e.change==="added"?null:s.jsx(ue,{variant:a.tone,children:a.label}),s.jsx("span",{className:"text-sm font-medium",children:e.name}),n?s.jsx(ue,{variant:"neutral",children:"Already in the org"}):null,!t&&e.state==="conflict"?s.jsx(ue,{variant:"error",children:"Changed in the org since"}):null]}),[...e.where,...e.fields,...!t&&e.now?[e.now]:[]].map(r=>s.jsx("p",{className:"text-muted-foreground text-xs break-words",children:r},r))]})}function cy(e,t){if(t.code==="proposal_conflict"&&e){const n=e.entries.filter(a=>a.state==="conflict").map(a=>a.name);if(n.length){const a=`The org changed what this proposal changes: ${$x(n)}.`;if(e.proposal.mine)return`${a} 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?`${a} Reject it, or ${r}`:`${a} 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 A3({proposal:e,contract:t,context:n,check_two_factor:a,on_close:r,on_decided:l}){const[i,o]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(null),[m,x]=u.useState(!1),[b,v]=u.useState(null),[y,g]=u.useState("ok"),[p,j]=u.useState(null),[w,N]=u.useState(""),C=(e==null?void 0:e.id)??null,_=u.useRef(C);_.current=C;const S=u.useCallback(async()=>{if(!C)return;const E=await t.read(C);_.current===C&&(E.ok?(o(E.data),d(null)):d(E.refusal.message))},[t,C]);u.useEffect(()=>{if(o(null),d(null),h(null),x(!1),N(""),!C)return;S(),a().then(g);const E=()=>void a().then(I=>_.current===C&&g(I));return window.addEventListener("focus",E),()=>window.removeEventListener("focus",E)},[C,S,a]);const D=(i==null?void 0:i.proposal)??e,z=(D==null?void 0:D.title)??"",P=(D==null?void 0:D.status)==="open",F=(i==null?void 0:i.entries.some(E=>E.state==="conflict"))??!1,H=!!i&&(i.may_accept||i.may_reject),A=y==="ok",M={...n,two_factor:y},R=async E=>{if(C){v(E),h(null);try{const I=E==="accept"?await t.accept(C):E==="reject"?await t.reject(C,w.trim()||void 0):await t.withdraw(C);if(I.ok){j(null),l(E==="accept"?`Accepted ${z}.`:E==="reject"?`Rejected ${z}.`:`Withdrew ${z}.`);return}if(j(null),I.refusal.code==="mfa_challenge_required"||I.refusal.code==="mfa_enrollment_required"){g(I.refusal.code==="mfa_enrollment_required"?"enroll":"challenge");return}E==="accept"&&x(!0);const Q=await t.read(C);if(_.current!==C)return;const te=Q.ok?Q.data:i;Q.ok&&o(Q.data),h({title:`${z} was not ${E==="accept"?"accepted":E==="reject"?"rejected":"withdrawn"}`,message:cy(te,I.refusal)})}finally{v(null)}}},T=i&&F&&!f?cy(i,{code:"proposal_conflict",message:""}):null,k=P&&i&&i.may_reject&&!i.may_accept&&!F?i.accept_refusal??null:null,O=!A||F||!!k||b!==null,Y=[A?null:"org-proposal-two-factor",F?"org-proposal-refusal":null,k?"org-proposal-accept-refusal":null].filter(Boolean).join(" ");return s.jsxs(s.Fragment,{children:[s.jsx(pn,{open:e!==null,onOpenChange:E=>E?null:r(),children:s.jsxs(xn,{className:"flex max-h-[90vh] flex-col overflow-hidden sm:max-w-2xl",children:[s.jsxs(gn,{children:[s.jsx(yn,{children:z}),s.jsx(jn,{asChild:!0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[D?s.jsx(ue,{variant:Bu[D.status].tone,children:Bu[D.status].label}):null,s.jsx("span",{children:D?b3(D):null})]})})]}),s.jsxs("div",{className:"-mx-1 grid min-h-0 flex-1 gap-4 overflow-y-auto px-1","data-testid":"org-proposal-body",children:[D!=null&&D.note?s.jsx("p",{className:"text-sm whitespace-pre-line",children:D.note}):null,D!=null&&D.decision_note?s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-sm font-medium",children:"Decision note"}),s.jsx("p",{className:"text-muted-foreground text-sm whitespace-pre-line",children:D.decision_note})]}):null,c?s.jsxs(he,{variant:"destructive",role:"alert",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not read the proposal"}),s.jsx(xe,{children:s.jsx("p",{children:c})})]}):null,!i&&!c?s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Reading the proposal…"}):null,i?T3.map(E=>{const I=i.entries.filter(Q=>Q.kind===E.kind);return I.length?s.jsxs("div",{className:"grid",children:[s.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:E.title}),s.jsx("ul",{role:"list",className:"m-0 list-none p-0",children:I.map(Q=>s.jsx(E3,{entry:Q,decided:!P},`${Q.kind}:${Q.name}`))})]},E.kind):null}):null,P&&i&&!H&&i.decide_refusal?s.jsxs(he,{variant:"info",role:"status",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"You can't accept or reject this proposal"}),s.jsx(xe,{children:s.jsx("p",{children:i.decide_refusal})})]}):null,k?s.jsxs(he,{id:"org-proposal-accept-refusal",variant:"info",role:"status",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"You can't accept this proposal"}),s.jsx(xe,{children:s.jsx("p",{children:k})})]}):null,P&&H&&!A?s.jsx("div",{id:"org-proposal-two-factor",children:s.jsx(ho,{context:M,action:"decide the proposal",changing:"Accepting or rejecting a proposal"})}):null,f||T?s.jsxs(he,{id:"org-proposal-refusal",variant:"destructive",role:"alert",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:(f==null?void 0:f.title)??(m?`${z} was not accepted`:`${z} can't be accepted`)}),s.jsx(xe,{children:s.jsx("p",{children:(f==null?void 0:f.message)??T})})]}):null]}),s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:r,children:"Close"}),P&&(i!=null&&i.may_withdraw)?s.jsx(V,{type:"button",variant:"outline",onClick:()=>j("withdraw"),children:"Withdraw proposal"}):null,P&&(i!=null&&i.may_reject)?s.jsx(V,{type:"button",variant:"outline",onClick:()=>j("reject"),children:"Reject"}):null,P&&i&&(i.may_accept||i.may_reject&&(F||k))?s.jsxs(V,{type:"button","aria-disabled":O||void 0,"aria-describedby":Y||void 0,onClick:()=>O?void 0:void R("accept"),children:[b==="accept"?s.jsx(Wt,{className:"size-4","aria-hidden":"true"}):null,b==="accept"?"Accepting…":"Accept"]}):null]})]})}),s.jsx(Gp,{open:p!==null,onOpenChange:E=>E?null:j(null),children:s.jsxs(Vp,{children:[s.jsxs(Yp,{children:[s.jsx(Kp,{children:p==="reject"?`Reject ${z}?`:`Withdraw ${z}?`}),s.jsx(Xp,{children:p==="reject"?`${(D==null?void 0:D.requested_by)??"The requester"} sees your note on the proposal.`:"Nobody can accept it after this."})]}),p==="reject"&&!A?s.jsx("div",{id:"org-proposal-reject-two-factor",children:s.jsx(ho,{context:M,action:"reject the proposal",changing:"Accepting or rejecting a proposal"})}):null,p==="reject"?s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"org-proposal-reject-note",children:"Note (optional)"}),s.jsx(Dn,{id:"org-proposal-reject-note",value:w,rows:2,maxLength:4e3,placeholder:"Why you are rejecting it",onChange:E=>N(E.target.value)})]}):null,s.jsxs(Fp,{children:[s.jsx(Qp,{children:"Cancel"}),p==="reject"?s.jsx(V,{type:"button",variant:"destructive","aria-disabled":!A||b!==null||void 0,"aria-describedby":A?void 0:"org-proposal-reject-two-factor",onClick:()=>!A||b?void 0:void R("reject"),children:b==="reject"?"Rejecting…":"Reject proposal"}):s.jsx(V,{type:"button","aria-disabled":b!==null||void 0,onClick:()=>b?void 0:void R("withdraw"),children:b==="withdraw"?"Withdrawing…":"Withdraw"})]})]})})]})}const M3={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."},$3="Covered: someone holds a post that fills the slot. Vacant: posts fill it but nobody holds them. Uncovered: no job function fills it.",O3=4,Ox=e=>({paddingLeft:16+24*Math.min(e,O3)}),Iu={covered:{label:"Covered",tone:"success"},vacant:{label:"Vacant",tone:"warning"},uncovered:{label:"Uncovered",tone:"error"}};function D3(){const e=mn().org;if(!e)throw new Error("The Org chart page rendered without the org seam.");return e}function z3({host:e="local",org:t=""}={}){const n=D3(),[a,r]=u.useState({state:"loading"}),[l,i]=u.useState(null),o=u.useRef(0),c=u.useRef(null),d=u.useCallback(k=>{const O=async Y=>{const E=o.current+=1;c.current&&clearTimeout(c.current);const I=await n.chart();if(E!==o.current)return;if(I.ok){i({chart:I.data,at:new Date().toISOString()}),r({state:"read"});return}const{refusal:Q}=I;if(Q.reason==="no_local_org"){i(null),r({state:"none",seedable:Q.seedable!==!1});return}if(e==="hosted"&&(Q.reason==="not_found"||Q.status===404)){i(null),r({state:"missing"});return}if(Q.retry&&Q.reason==="store_locked"&&Y>0){const te=Q.retry_after??10;r({state:"busy",retry_after:te}),c.current=setTimeout(()=>void O(Y-1),te*1e3);return}r({state:"failed",refusal:Q})};return O(k)},[n,e]);u.useEffect(()=>(d(1),()=>{o.current+=1,c.current&&clearTimeout(c.current)}),[d]);const f=()=>void d(1),h=a.state==="none"||a.state==="missing"?null:l,{href:m}=Xe(),x=Nr(),b=m("/settings/account"),v=n.proposals,y=w3(v,(h==null?void 0:h.at)??null),g=!!v&&y.state!=="off",[p,j]=u.useState(null),[w,N]=u.useState(!1),[C,_]=u.useState(null),{confirm:S,confirm_dialog:D}=l1(Jl),z=u.useMemo(()=>p&&v?{draft:p,change:v.draft.change,on_draft:j}:null,[p,v]),P=V3(n,f,(p==null?void 0:p.chart)??(h==null?void 0:h.chart)??U3,e,b,z),F=n.twoFactor,H=u.useCallback(async()=>F?F():"ok",[F]),A=!!p&&p.total>0,M=u.useRef(()=>{});M.current=()=>{v==null||v.draft.discard(),j(null)},u.useEffect(()=>{if(!A)return;let k=!0;const O=I=>{I.preventDefault()},Y=()=>{k=!1,window.removeEventListener("beforeunload",O),document.removeEventListener("click",E,!0)},E=I=>{var q,ne;if(!k||I.defaultPrevented||I.button!==0||I.metaKey||I.ctrlKey||I.shiftKey||I.altKey)return;const Q=I.target,te=(q=Q==null?void 0:Q.closest)==null?void 0:q.call(Q,"a[href]"),ce=te?null:(ne=Q==null?void 0:Q.closest)==null?void 0:ne.call(Q,L3);let X=null;if(te&&te.target!=="_blank"&&!te.hasAttribute("download")){const ae=new URL(te.href,window.location.href),je=ae.pathname===window.location.pathname&&ae.search===window.location.search;ae.origin===window.location.origin&&!je&&(X=()=>window.location.assign(ae.href))}else ce&&ce.getAttribute("aria-current")!=="page"&&ce.getAttribute("aria-disabled")!=="true"&&!ce.hasAttribute("disabled")&&(X=()=>ce.click());if(!X)return;I.preventDefault(),I.stopPropagation();const L=X;S({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"}).then(ae=>{ae&&(Y(),M.current(),L())})};return window.addEventListener("beforeunload",O),document.addEventListener("click",E,!0),Y},[A,S]);const R=async()=>{if(!v)return;const k=await v.draft.begin();k.ok?j(k.data):x.error(k.refusal.message)},T=async()=>{(!(p&&p.total>0)||await S({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"}))&&(v==null||v.draft.discard(),j(null))};return a.state==="missing"?s.jsx(K3,{org:t}):s.jsx(Sk,{children:s.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:[s.jsx(en,{title:"Org chart",description:M3[e]}),a.state==="busy"&&!h?s.jsxs("p",{className:"text-muted-foreground mt-4 text-sm",role:"status",children:["Another sdlc command holds the repository store; reading again in ",a.retry_after," s."]}):null,(a.state==="loading"||a.state==="busy")&&!h?s.jsx(Y3,{quiet:a.state==="busy"}):null,a.state==="none"?s.jsx(F3,{edit:(P==null?void 0:P.actions)??null,seedable:a.seedable}):null,a.state==="failed"?s.jsx(Q3,{host:e,kept_at:(h==null?void 0:h.at)??null,on_retry:f}):null,h&&p?s.jsx(S3,{draft:p,on_submit:()=>N(!0),on_discard:()=>void T()}):h&&g?s.jsx(N3,{listed:y,on_propose:()=>void R(),on_open:_}):null,h?s.jsx(W3,{chart:(p==null?void 0:p.chart)??h.chart,host:e,edit:(P==null?void 0:P.actions)??null}):null,(P==null?void 0:P.dialogs)??null,v&&p?s.jsx(R3,{open:w,draft:p,submit:v.draft.submit,on_close:()=>N(!1),on_done:(k,O)=>{if(N(!1),k.state==="moved"){j(k.draft);return}j(null),x.success(`Proposed ${O}.`),f()}}):null,v&&g?s.jsx(A3,{proposal:C,contract:v,context:{host:e,two_factor:"ok",settings_href:b},check_two_factor:H,on_close:()=>_(null),on_decided:k=>{x.success(k),_(null),f()}}):null,D]})})}const L3='[data-sidebar="menu-button"]:not([aria-expanded]), [data-sidebar="menu-sub-button"]',U3={org:"",workflow:!1,teams:[],job_functions:[],slots:[],posts:[],members:[],slot_resolution:[],project:{team:null,roots:[]}};function B3(e){var i;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=((i=e.teams.find(o=>o.parent===null))==null?void 0:i.key)??null,a=new Set(t.teams),r=new Set(t.team_descriptions),l=new Set(t.posts);return{functions:t.administer,team_add:a.size>0,team:o=>o===n?t.administer?"root":r.has(o)?"description":null:a.has(o)?"full":r.has(o)?"description":null,post_add:t.post_pairs.length>0,post:o=>l.has(o),override:!1,slots:t.administer}}function H3(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 I3={functions:!0,team_add:!0,team:()=>"description",post_add:!0,post:()=>!0,override:!1,slots:!0};function Id({mark:e}){return e?e==="added"?s.jsx(ue,{variant:"success",children:"Added"}):s.jsx(ue,{variant:"warning",children:"Changed"}):null}const P3={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."},q3={mfa_challenge_required:"challenge",mfa_enrollment_required:"enroll"};function G3(e,t,n){var c;const a=t==="hosted"&&!!n.authority,r=((c=n.authority)==null?void 0:c.two_factor)??!0,[l,i]=u.useState("ok"),o=u.useCallback(async()=>{a&&i(e.twoFactor?await e.twoFactor():r?"ok":"challenge")},[e,a,r]);return u.useEffect(()=>{if(!a){i("ok");return}r?i("ok"):o();const d=()=>void o();return window.addEventListener("focus",d),()=>window.removeEventListener("focus",d)},[a,r,o]),{state:l,set_state:i,check:o}}function V3(e,t,n,a,r,l=null){const i=Nr(),o=o1(n),c=G3(e,a,n),d=l?{host:a,two_factor:"ok",settings_href:r}:a==="hosted"?{host:a,two_factor:c.state,settings_href:r}:Jl,{confirm:f,confirm_dialog:h}=l1(d),[m,x]=u.useState(null),[b,v]=u.useState({}),y=T=>v(k=>{if(!k[T])return k;const{[T]:O,...Y}=k;return Y}),g=e.members,p=u.useCallback(async()=>{if(!g)return{ok:!1};const T=await g();return T.ok?{ok:!0,data:T.data}:{ok:!1}},[g]),j=l?async T=>{const k=await l.change(T);return k.ok?(l.on_draft(k.data),{ok:!0,data:{}}):k}:e.change;if(!j||!l&&a==="hosted"&&(!n.authority||!H3(n)))return null;const w=l?I3:B3(n),N=T=>{const k=T.code?q3[T.code]:void 0;return k?(c.set_state(k),{kind:"two_factor",message:T.message}):T.code==="revision_conflict"?(t(),{kind:"changed",message:T.message}):T.code==="outside_authority"?(t(),{kind:"authority",message:T.message}):{message:T.message}},C=T=>T.action==="hold"||T.action==="release"?"posts":"kind"in T?T.kind==="team"?"teams":T.kind==="post"?"posts":T.kind==="slot"?"slots":"functions":null,_=(T,k)=>{if(l)return;const O=T==null?void 0:T.warning;O?i.error(O):i.success(k),t()},S=async(T,k)=>{const O=await j(T);if(!O.ok)return N(O.refusal);const Y=C(T);return Y&&y(Y),_(O.data,k),null},D=T=>{c.check(),x(T)},z=async(T,k,O,Y)=>{const E=await j(O);if(!E.ok){const I=N(E.refusal),Q=E.refusal.bound,te=Q?Q.projects.length+Q.more:0,ce=Q?`${Q.kind==="slot"?"Slot":"Post"} ${k} is still needed by the ${te===1?"override of 1 project that binds":`overrides of ${te} projects that bind`} it. Clear ${te===1?"it":"them"} on each project's Settings first.`:I.message;v(X=>({...X,[T]:{label:k,message:ce,...Q?{bound:Q}:{}}}));return}y(T),_(E.data,Y)},P=async(T,k,O)=>{const Y=T==="team"?"team":"job function";c.check(),(l||await f({title:`Remove ${Y} ${O}?`,description:P3[a],action_label:"Remove",destructive:!0,action:`remove the ${Y}`}))&&await z(T==="team"?"teams":"functions",O,{action:"remove",kind:T,key:k},`${T==="team"?"Team":"Job function"} ${O} removed.`)},F=async T=>{const k=T.label||T.key;c.check(),(l||await f({title:`Remove slot ${k}?`,description:"Projects stop showing it. This can't be undone.",action_label:"Remove slot",destructive:!0,action:"remove the slot"}))&&await z("slots",k,{action:"remove",kind:"slot",key:T.key},`Removed slot ${k}.`)},H=async T=>{const k=o.post(T);c.check(),(l||await f({title:`Remove post ${k}?`,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 z("posts",k,{action:"remove",kind:"post",key:T},`Removed post ${k}.`)},A=async(T,k)=>{const O=o.post(T),Y=o.member(k),E=n.posts.find(X=>X.post===T),Q=((E==null?void 0:E.holders.length)??0)<=1?E!=null&&E.escalates_to?` The post becomes vacant. Until someone holds it, its reports and the slots it fills go to ${o.manager(E.escalates_to)}.`:" The post becomes vacant.":"";if(c.check(),!await f({title:`Remove ${Y} from ${O}?`,description:`They stop holding this post and no longer report through it.${Q}`,action_label:"Remove",action:"remove the holder"}))return;const ce=await j({action:"release",post:T,member:k.id});if(!ce.ok){i.error(N(ce.refusal).message),t();return}y("posts"),_(ce.data,`Removed ${Y} from ${O}.`)},M=()=>x(null),R=(m==null?void 0:m.kind)==="override"&&n.project&&n.project.team!==null?n.project.slots.find(T=>T.slot===m.slot)??null:null;return{actions:{can:w,host:a,drafting:!!l,...l?{marks:l.draft.marks}:{},team:(T,k="full")=>D({kind:"team",team:T,scope:k}),job:T=>D({kind:"function",job:T}),override:T=>D({kind:"override",slot:T}),slot:T=>D({kind:"slot",slot:T}),slot_remove:T=>void F(T),remove:(T,k,O)=>void P(T,k,O),post_add:()=>D({kind:"post"}),post_remove:T=>void H(T),holder_add:T=>D({kind:"holder",post:T}),holder_remove:(T,k)=>void A(T,k),refused:T=>{const k=b[T];return k?s.jsx(g3,{label:k.label,message:k.message,bound:k.bound,on_dismiss:()=>y(T)}):null}},dialogs:s.jsxs(s.Fragment,{children:[s.jsx(i3,{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:!l&&n.authority?n.authority.teams:void 0,save:S,on_close:M,context:d}),s.jsx(c3,{open:(m==null?void 0:m.kind)==="function",chart:n,job:(m==null?void 0:m.kind)==="function"?m.job:null,save:S,on_close:M,context:d}),s.jsx(h3,{open:R!==null,chart:n,binding:R,names:o,save:S,confirm:T=>f({...T,action:"clear the override"}),on_close:M}),s.jsx(f3,{open:(m==null?void 0:m.kind)==="slot",chart:n,slot:(m==null?void 0:m.kind)==="slot"?m.slot:null,save:S,on_close:M,context:d}),s.jsx(p3,{open:(m==null?void 0:m.kind)==="post",chart:n,names:o,save:S,on_close:M,context:d}),s.jsx(x3,{open:(m==null?void 0:m.kind)==="holder",chart:n,post:(m==null?void 0:m.kind)==="holder"?m.post:null,names:o,members:p,save:S,on_close:M,context:d}),h]})}}function Y3({quiet:e=!1}){return s.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)=>s.jsx(jt,{className:n===3?"h-10 w-2/3":"h-10 w-full"},n))})}function xl({children:e}){return s.jsx("pre",{className:"bg-muted text-foreground m-0 overflow-x-auto rounded-md border px-3 py-2 font-mono text-sm",children:s.jsx("code",{children:e})})}function F3({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 s.jsxs(he,{variant:"info",className:"mt-6",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This repository has no local org yet"}),s.jsxs(xe,{children:[s.jsx("p",{children:n}),t||!e?s.jsxs("div",{className:"mt-2 grid w-full gap-2",children:[t?s.jsx(xl,{children:"sdlc org seed"}):null,e?null:s.jsx(xl,{children:"sdlc org add team <key>"})]}):null,e?s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>e.team(null),children:[s.jsx(Tl,{className:"size-4","aria-hidden":"true"}),"Add team"]}):null]})]})}function K3({org:e}){const{href:t,Link:n}=Xe();return s.jsx(Ga,{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 X3(e){return new Date(e).toDateString()===new Date().toDateString()?`today at ${cs(e)}`:`on ${Yn(e)} at ${cs(e)}`}function Q3({host:e,kept_at:t,on_retry:n}){const a=t?`The chart read ${X3(t)} is kept below. `:"";return s.jsxs(he,{variant:"destructive",className:"mt-6",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:e==="hosted"?"Could not read the org chart":"Could not read the local org"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[a,e==="hosted"?a?"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."]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function o1(e){return u.useMemo(()=>{const t=new Map(e.teams.map(y=>[y.key,y.label||y.key])),n=new Map(e.job_functions.map(y=>[y.key,y.label||y.key])),a=new Map(e.slots.map(y=>[y.key,y.label||y.key])),r=new Map(e.posts.map(y=>[y.post,y.holders])),l=y=>y.label||y.id,i=new Map;for(const y of[...e.members,...e.posts.flatMap(g=>g.holders)]){const g=l(y);i.set(g,(i.get(g)??new Set).add(`${y.kind}:${y.id}`))}const o=y=>{var g;return(((g=i.get(l(y)))==null?void 0:g.size)??0)>1},c=y=>{const g=o(y)?y.detail??y.id:null;return g&&g!==l(y)?g:null},d=y=>{const g=c(y);return g&&g!==l(y)?`${l(y)} (${g})`:l(y)},f=y=>{const[g="",p=""]=y.split("/");return{team:t.get(g)??g,job:n.get(p)??p}},h=y=>{const{team:g,job:p}=f(y);return`${p} · ${g}`},m=y=>{if(y==="top")return"Top of the org";if(typeof y!="string")return`A vacant ${n.get(y.vacant)??y.vacant}`;const g=(r.get(y)??[]).map(d);return g.length?`${h(y)} (${g.join(", ")})`:h(y)},x=new Map(e.teams.map(y=>[y.key,y.parent])),b=y=>{let g=0;for(let p=x.get(y);p&&g<e.teams.length;p=x.get(p))g+=1;return g};return{parts:f,post:h,member:d,memberLabel:l,memberDetail:c,manager:m,byPost:(y,g)=>{const[p="",j=""]=[y.split("/")[0],g.split("/")[0]],[w,N]=[f(y),f(g)];return b(p)-b(j)||w.team.localeCompare(N.team)||w.job.localeCompare(N.job)},slot:y=>a.get(y)??y,job:y=>n.get(y)??y,team:y=>t.get(y)??y}},[e])}function tr({id:e,title:t,description:n,actions:a,children:r,anchor:l}){const i=u.useRef(null);return u.useEffect(()=>{var o,c;!l||typeof window>"u"||window.location.hash!==`#${l}`||((o=i.current)==null||o.scrollIntoView({block:"start"}),(c=i.current)==null||c.focus({preventScroll:!0}))},[l]),s.jsxs("section",{id:l,"aria-labelledby":e,className:"mt-8 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[s.jsxs("div",{className:"min-w-0 flex-1 basis-64",children:[s.jsx("h2",{id:e,ref:i,tabIndex:l?-1:void 0,className:"text-lg font-semibold",children:t}),s.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:n})]}),a?s.jsx("div",{className:"flex shrink-0 gap-2",children:a}):null]}),s.jsx("div",{className:"mt-3",children:r})]})}function _i({children:e,on_click:t}){return s.jsxs(V,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(Tl,{className:"size-4","aria-hidden":"true"}),e]})}const uy={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 W3({chart:e,host:t,edit:n}){const a=o1(e),r=e.members.some(l=>l.kind==="agent");return s.jsxs(s.Fragment,{children:[s.jsxs(tr,{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?s.jsx(_i,{on_click:n.post_add,children:"Add post"}):void 0,children:[n==null?void 0:n.refused("posts"),s.jsx(eL,{chart:e,names:a,agents:r,host:t,edit:n})]}),s.jsx(tr,{id:"org-chart-members",title:"Members",description:r?`${uy[t]} Each agent answers to the nearest person in its reporting chain.`:uy[t],children:s.jsx(rL,{chart:e,names:a,host:t,agents:r})}),n?s.jsxs(tr,{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.can.team_add?s.jsx(_i,{on_click:()=>n.team(null),children:"Add team"}):void 0,children:[n.refused("teams"),s.jsx(Z3,{chart:e,edit:n})]}):null,s.jsxs("div",{className:"grid items-start gap-x-6 xl:grid-cols-2",children:[s.jsxs(tr,{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?s.jsx(_i,{on_click:()=>n.job(null),children:"Add job function"}):void 0,children:[n!=null&&n.can.functions?n.refused("functions"):null,s.jsx(lL,{chart:e,names:a,edit:n!=null&&n.can.functions?n:null})]}),s.jsxs(tr,{id:"org-chart-slots",anchor:"slots",title:"Slots",description:$3,actions:n!=null&&n.can.slots&&e.slot_resolution.length>0?s.jsx(_i,{on_click:()=>n.slot(null),children:"Add slot"}):void 0,children:[n!=null&&n.can.slots?n.refused("slots"):null,e.workflow===!1?s.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,s.jsx(oL,{chart:e,names:a,host:t,edit:n!=null&&n.can.slots?n:null})]})]}),e.project?s.jsx(uL,{project:e.project,chart:e,names:a,edit:n!=null&&n.can.override?n:null}):null]})}function Z3({chart:e,edit:t}){var c;const n=Dx([...e.teams].sort((d,f)=>(d.label||d.key).localeCompare(f.label||f.key)),d=>d.key,d=>d.parent);if(n.length===0)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"No teams yet."});const a=((c=e.project)==null?void 0:c.team)??null,r=t.host==="hosted",l=(d,f)=>{const h=t.can.team(d.key);return h==="full"?s.jsx(pl,{label:f,on_edit:()=>t.team(d),on_remove:()=>t.remove("team",d.key,f)}):h==="root"?s.jsx(pl,{label:f,on_edit:()=>t.team(d,"description")}):h==="description"&&t.drafting?s.jsx(pl,{label:f,items:[{label:"Edit description",on_select:()=>t.team(d,"description")}]}):h==="description"?s.jsx(V,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`Edit the description of ${f}`,onClick:()=>t.team(d,"description"),children:s.jsx(md,{className:"size-3.5","aria-hidden":"true"})}):null},i=(d,f)=>s.jsx("ul",{role:"list",className:f===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:d.map(({item:h,children:m})=>{var b;const x=h.label||h.key;return s.jsxs("li",{children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b py-2 pr-4",style:Ox(f),"data-testid":"org-chart-team",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:x}),s.jsx(Id,{mark:(b=t.marks)==null?void 0:b.teams[h.key]})]}),s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[r?null:s.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:h.key}),a===h.key?s.jsx(ue,{variant:"neutral",children:"Owns this project"}):null,l(h,x)]})]}),m.length>0?i(m,f+1):null]},h.key)})}),o=r&&e.teams.length===1;return s.jsxs(s.Fragment,{children:[s.jsx(ot,{className:"overflow-hidden",children:i(n,0)}),o?s.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 Dx(e,t,n){const a=new Set(e.map(t)),r=new Map(e.map(i=>[t(i),{item:i,children:[]}])),l=[];for(const i of e){const o=n(i),c=r.get(t(i));o&&a.has(o)&&o!==t(i)?r.get(o).children.push(c):l.push(c)}return l}const J3={local:"No posts yet.",hosted:"No posts yet. An org admin can add them."};function eL({chart:e,names:t,agents:n,host:a,edit:r}){const l=Dx([...e.posts].sort((c,d)=>t.byPost(c.post,d.post)),c=>c.post,c=>typeof c.reports_to=="string"&&c.reports_to!=="top"?c.reports_to:null);if(l.length===0){const c=a==="hosted"&&(r==null?void 0:r.can.functions)&&!r.can.post_add;return s.jsx("p",{className:"text-muted-foreground text-sm",children:r!=null&&r.can.post_add?"No posts yet. Add a post to staff a job function in a team.":c?"No posts yet. Add a job function under Function tree first, then add a post to staff it in a team.":J3[a]})}const i=new Map(e.members.map(c=>[`${c.kind}:${c.id}`,c])),o=(c,d)=>s.jsx("ul",{role:"list",className:d===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:c.map(({item:f,children:h})=>{var v;const{team:m}=t.parts(f.post),x=typeof f.reports_to=="object"?f.reports_to:null,b=!!(r!=null&&r.can.post(f.post));return s.jsxs("li",{children:[s.jsxs("div",{className:"border-b py-2 pr-4",style:Ox(d),"data-testid":"org-chart-post",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(vR,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{className:"text-sm font-medium",children:t.parts(f.post).job}),s.jsx("span",{className:"text-muted-foreground text-xs",children:x?`${m} · Reports to a vacant ${t.job(x.vacant)}`:m}),s.jsx(Id,{mark:(v=r==null?void 0:r.marks)==null?void 0:v.posts[f.post]}),b&&r?s.jsx("span",{className:"ml-auto",children:s.jsx(pl,{label:t.post(f.post),items:[...r.drafting?[]:[{label:"Add holder",on_select:()=>r.holder_add(f.post)}],{label:"Remove post",on_select:()=>r.post_remove(f.post),destructive:!0}]})}):null]}),s.jsx("div",{className:"mt-1 grid min-w-0 gap-1 pl-6",children:f.holders.length===0?s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ue,{variant:Iu.vacant.tone,children:Iu.vacant.label}),s.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(y=>s.jsx(sL,{holder:y,post:f.post,member:i.get(`${y.kind}:${y.id}`),names:t,agents:n,host:a,on_remove:b&&r&&!r.drafting?()=>r.holder_remove(f.post,y):void 0},`${y.kind}:${y.id}`))})]}),h.length>0?o(h,d+1):null]},f.post)})});return s.jsx(ot,{className:"overflow-hidden",children:o(l,0)})}function tL(e){return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function nL(e){if(!e.held_since)return null;const t=tL(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 sL({holder:e,post:t,member:n,names:a,agents:r,host:l,on_remove:i}){const o=e.kind==="person"?Dp:Mp,c=n==null?void 0:n.posts.find(b=>b.post===t),d=n==null?void 0:n.posts.find(b=>b.primary),f=a.memberDetail(e);let h=null;c!=null&&c.dotted&&d?h=`Dotted line: primary manager is ${a.manager(d.reports_to)}`:e.kind==="agent"&&n&&"accountable_person"in n&&(h=n.accountable_person?`Accountable person ${a.member(n.accountable_person)}`:"No accountable person");const m=l==="hosted"?nL(e):null,x=a.memberLabel(e);return s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[s.jsx(o,{className:"text-muted-foreground size-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{className:"text-sm font-medium break-all",children:x}),i?s.jsxs(Ck,{children:[s.jsx(Rk,{asChild:!0,children:s.jsx(V,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`Remove ${a.member(e)} from ${a.post(t)}`,onClick:i,children:s.jsx(xd,{className:"size-3.5","aria-hidden":"true"})})}),s.jsxs(Nx,{children:["Remove ",x]})]}):null,f?s.jsx("span",{className:"text-muted-foreground text-xs break-all",children:f}):null,r?s.jsx("span",{className:"text-muted-foreground text-xs",children:e.kind==="person"?"Person":"Agent"}):null]}),h?s.jsx("div",{className:"pl-5.5 text-xs",children:h}):null,m?s.jsx("div",{className:"text-muted-foreground pl-5.5 text-xs",children:m}):null]})}const aL=["sdlc org hold <team>/<function> --person <id>","sdlc org hold <team>/<function> --agent <id>"];function rL({chart:e,names:t,host:n,agents:a}){if(e.members.length===0)return n==="hosted"?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No one holds a post yet."}):s.jsxs("div",{className:"grid max-w-2xl gap-2",children:[s.jsx("p",{className:"text-muted-foreground text-sm",children:"No one holds a post yet. Give a post to a person or an agent:"}),aL.map(l=>s.jsx(xl,{children:l},l))]});const r=[...e.members].sort((l,i)=>l.kind===i.kind?t.memberLabel(l).localeCompare(t.memberLabel(i))||l.id.localeCompare(i.id):l.kind==="person"?-1:1);return s.jsx(ot,{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Members",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Member"}),s.jsx(Z,{children:"Posts"}),s.jsx(Z,{children:"Primary manager"}),s.jsx(Z,{children:"Dotted lines"}),a?s.jsx(Z,{children:"Accountable person"}):null]})}),s.jsx(Ge,{children:r.map(l=>{const i=l.posts.find(d=>d.primary),o=l.posts.filter(d=>d.dotted),c=t.memberDetail(l);return s.jsxs(de,{"data-testid":"org-chart-member",children:[s.jsxs(K,{children:[s.jsx("div",{className:"font-medium",children:t.memberLabel(l)}),c?s.jsx("div",{className:"text-muted-foreground text-xs",children:c}):null,a?s.jsx("div",{className:"text-muted-foreground text-xs",children:l.kind==="person"?"Person":"Agent"}):null]}),s.jsx(K,{children:l.posts.map(d=>t.post(d.post)).join(", ")}),s.jsx(K,{children:i?t.manager(i.reports_to):"None"}),s.jsx(K,{children:o.length?o.map(d=>t.manager(d.reports_to)).join(", "):"None"}),a?s.jsx(K,{children:l.kind==="person"?"Not an agent":l.accountable_person?t.member(l.accountable_person):"None"}):null]},`${l.kind}:${l.id}`)})})]})})}function lL({chart:e,names:t,edit:n}){const a=Dx([...e.job_functions].sort((l,i)=>(l.label||l.key).localeCompare(i.label||i.key)),l=>l.key,l=>l.parent);if(a.length===0)return s.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=(l,i)=>s.jsx("ul",{role:"list",className:i===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:l.map(({item:o,children:c})=>{var d;return s.jsxs("li",{children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b py-2 pr-4",style:Ox(i),"data-testid":"org-chart-function",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:o.label||o.key}),s.jsx(Id,{mark:(d=n==null?void 0:n.marks)==null?void 0:d.job_functions[o.key]})]}),s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:o.fills.length?`Fills ${o.fills.map(t.slot).join(", ")}`:"No slot"}),o.requires_person?s.jsx(ue,{variant:"neutral",children:"Requires a person"}):null,n?s.jsx(pl,{label:o.label||o.key,on_edit:()=>n.job(o),on_remove:()=>n.remove("job_function",o.key,o.label||o.key)}):null]})]}),c.length>0?r(c,i+1):null]},o.key)})});return s.jsx(ot,{className:"overflow-hidden",children:r(a,0)})}function iL(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 Pu={covered:0,vacant:1,uncovered:2};function c1(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 oL({chart:e,names:t,host:n,edit:a}){var i;const r=c1(e),l=new Map(e.slots.map(o=>[o.key,o]));if(n==="hosted"&&e.slot_resolution.length===0){const o=((i=e.authority)==null?void 0:i.ask)??[];return s.jsxs(ot,{className:"grid justify-items-center gap-2 p-6 text-center",children:[s.jsx("span",{className:"text-sm font-medium",children:"No slots yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Add the workflow roles your projects fill, such as Implementer or Approver."}),a?s.jsx(_i,{on_click:()=>a.slot(null),children:"Add slot"}):s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Only an org owner or admin adds slots."," ",o.length?`Ask ${o.slice(0,3).join(", ")} to make this change.`:"Ask an org owner to make this change."]})]})}return s.jsx(ot,{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Slots",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Slot"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Resolves to"}),a?s.jsx(Z,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(Ge,{children:[[...e.slot_resolution].sort((o,c)=>Pu[o.status]-Pu[c.status]||t.slot(o.slot).localeCompare(t.slot(c.slot))).map(o=>{var d,f,h;const c=Iu[o.status];return s.jsxs(de,{"data-testid":"org-chart-slot",children:[s.jsxs(K,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-medium",children:t.slot(o.slot)}),s.jsx(Id,{mark:(d=a==null?void 0:a.marks)==null?void 0:d.slots[o.slot]})]}),n==="hosted"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:o.slot}),(f=l.get(o.slot))!=null&&f.description?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:(h=l.get(o.slot))==null?void 0:h.description}):null]}):null,r.has(o.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.get(o.slot)}):null]}),s.jsx(K,{children:s.jsx(ue,{variant:c.tone,children:c.label})}),s.jsxs(K,{children:[iL(o,t),o.status==="covered"&&o.needs_person?s.jsx("div",{className:"text-muted-foreground text-xs",children:"Needs a person"}):null]}),a&&l.has(o.slot)?s.jsx(K,{className:"text-right",children:s.jsx(pl,{label:t.slot(o.slot),on_edit:()=>a.slot(l.get(o.slot)),on_remove:()=>a.slot_remove(l.get(o.slot))})}):null]},o.slot)}),e.slot_resolution.length===0?s.jsx(de,{children:s.jsx(K,{colSpan:3,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})})}const cL="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.",Zf=["sdlc org own <team>","sdlc org bind <slot> <team>/<function>... --reason <text>","sdlc org unbind <slot>"];function uL({project:e,chart:t,names:n,edit:a}){if(e.team===null){const i=e.roots.map(n.team);return s.jsx(tr,{id:"org-chart-project",title:"This project",description:i.length?`This org has several root teams (${i.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:s.jsx("div",{className:"max-w-2xl",children:s.jsx(xl,{children:i.length?Zf[0]:"sdlc org add team <key>"})})})}const r=c1(t),l=[...e.slots].sort((i,o)=>Pu[i.status]-Pu[o.status]||n.slot(i.slot).localeCompare(n.slot(o.slot)));return s.jsxs(tr,{id:"org-chart-project",title:"This project",description:cL,children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Owning team"}),s.jsx("span",{className:"text-sm font-medium",children:n.team(e.team)})]}),s.jsx(ot,{className:"mt-3 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Slots in this project",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Slot"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Bound to"}),s.jsx(Z,{children:"Source"}),a?s.jsx(Z,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(Ge,{children:[l.map(i=>{const o=Iu[i.status];return s.jsxs(de,{"data-testid":"org-chart-project-slot",children:[s.jsxs(K,{children:[s.jsx("div",{className:"font-medium",children:n.slot(i.slot)}),r.has(i.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.get(i.slot)}):null]}),s.jsx(K,{children:s.jsx(ue,{variant:o.tone,children:o.label})}),s.jsx(K,{children:s.jsx(dL,{binding:i,names:n})}),s.jsx(K,{children:s.jsx(fL,{binding:i})}),a?s.jsx(K,{className:"text-right",children:s.jsx(V,{type:"button",variant:"ghost",size:"control-icon","aria-label":i.source==="override"?`Edit the override of ${n.slot(i.slot)}`:`Override ${n.slot(i.slot)}`,onClick:()=>a.override(i.slot),children:s.jsx(md,{className:"size-3.5","aria-hidden":"true"})})}):null]},i.slot)}),l.length===0?s.jsx(de,{children:s.jsx(K,{colSpan:a?5:4,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})}),a?s.jsxs("div",{className:"mt-3 grid max-w-2xl gap-2",children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Overrides made here are made as ",s.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."]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Change the owning team with sdlc org:"}),s.jsx(xl,{children:Zf[0]})]}):s.jsxs("div",{className:"mt-3 grid max-w-2xl gap-2",children:[s.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:"}),Zf.map(i=>s.jsx(xl,{children:i},i))]})]})}function dL({binding:e,names:t}){const n=[];e.status==="covered"&&e.needs_person&&n.push("Needs a person");for(const r of e.posts)r.off_description&&n.push(`${t.post(r.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 a;return e.posts.length===0?a=e.source==="override"?"The override names no post the org still has":"No job function fills this slot":e.status==="vacant"?a=`${e.posts.map(r=>t.post(r.post)).join(", ")} has no holder`:a=e.posts.map(r=>r.holders.length?`${t.post(r.post)}: ${r.holders.map(t.member).join(", ")}`:`${t.post(r.post)}: no holder`).join("; "),s.jsxs(s.Fragment,{children:[a,n.map(r=>s.jsx("div",{className:"text-muted-foreground text-xs",children:r},r))]})}function fL({binding:e}){var a;if(e.source==="baseline")return s.jsx(s.Fragment,{children:"From job descriptions"});const t=(a=e.set_by)==null?void 0:a.split(":").slice(1).join(":"),n=[e.reason,[t,e.set_at?Yn(e.set_at):null].filter(Boolean).join(", ")].filter(Boolean).join(" · ");return s.jsxs(s.Fragment,{children:["Override",n?s.jsx("div",{className:"text-muted-foreground text-xs",children:n}):null]})}const hL={breaking:"Breaking",new:"New",improved:"Improved",other:"Other changes"},mL=["breaking","new","improved","other"],pL={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 u1(e){return pL[e]??e.replace(/_/g," ")}function xL(e){return e.bump==="major"?"breaking":e.change==="added"?"new":e.change==="changed"?"improved":"other"}function mo(e){const t=new Map;let n=0,a=0;for(const l of e){if(l.modeling_only){a+=1;continue}if(!l.bump){n+=1;continue}const i=xL(l);t.set(i,[...t.get(i)??[],l])}return{sections:mL.filter(l=>t.has(l)).map(l=>({key:l,label:hL[l],lines:t.get(l)})),breaking:t.has("breaking"),unlisted_count:n,modeling_only_count:a}}function gL(e,t){const n=[`## ${e}`];t.sections.length===0&&n.push("","No change affects the version.");for(const a of t.sections){n.push("",`### ${a.label}`,"");for(const r of a.lines){const l=r.why?`: ${r.why}`:"";n.push(`- ${r.label} (${u1(r.node_type)})${l}`)}}return`${n.join(`
|
|
390
|
+
It leaves the open tasks.`:"It leaves the open tasks.",action_label:"Mark done"}))return;tn(G);const gt=await i.complete(Be);if(tn(null),!gt.ok){Nt(At=>({...At,[G]:gt.refusal.message}));return}Nt(({[G]:At,...kt})=>kt),Gt(`${oe} marked done.`),await W.current(),Er({next:at})},[zs,Er]=u.useState(null);u.useEffect(()=>{var at;if(!zs)return;Er(null);const G=nn.current,oe=typeof zs.next=="function"?zs.next():zs.next;(at=(oe?(G==null?void 0:G.querySelector(`[data-done-key="${CSS.escape(oe)}"]`))??(G==null?void 0:G.querySelector(`[data-title-key="${CSS.escape(oe)}"] a`)):null)??Ce.current)==null||at.focus()},[zs]);const ia=()=>{var G;H(""),M(""),T(null),O(_i),E(!1),Q(!1),(G=Ce.current)==null||G.focus()},Q1=new Map(p.map(G=>[G.id,G])),W1=new Map(j.map(G=>[G.id,G])),Yd=new Map(ae.map(G=>[G.id,G.title])),Fd=w&&S==="active",Z1=ae.some(G=>G.local_done),Kd=Fd||Z1,Xd=!g||j.length>0,J1=!z&&!Wn,Qd=5+(Xd?1:0)+(Kd?1:0),eS=re!==null&&(re.reason==="store_locked"||re.reason==="engine_failed")&&se<=yD,Ko=(J==null?void 0:J.holds)??[],Wd=q==null?void 0:q.groups,tS=kD(ae,Wd,te,(q==null?void 0:q.matched)===void 0?X:[]),Xo=Wd?Wd.length===0:ae.length===0,nS=(G,oe)=>ce(Be=>({...Be,[G]:!oe})),sS=G=>L(oe=>oe.includes(G)?oe.filter(Be=>Be!==G):[...oe,G]),aS=Ko.map(G=>G.id);return s.jsxs("div",{ref:nn,className:"contents",children:[s.jsx(en,{title:"Tasks",description:a,actions:w?s.jsxs(V,{type:"button",onClick:()=>wt(!0),children:[s.jsx(Tl,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]}):null}),g&&(q!=null&&q.open)?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[q.open," open"]}):null,ve?s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",role:"status",children:re?`Not reading · trying again every ${Math.round(ve/1e3)}s`:q?`Live · refreshes every ${Math.round(ve/1e3)}s`:"Connecting…"}):null,g?s.jsx("p",{className:"sr-only",role:"status",children:bn}):null,(g||Ko.length>0)&&s.jsxs(ot,{as:"section","aria-labelledby":"waiting-title",className:"mt-4 p-4","data-testid":"tasks-waiting",children:[s.jsx("h2",{id:"waiting-title",className:"text-lg font-semibold",children:"Waiting on you"}),Ko.length>0?s.jsx("ul",{className:"mt-2 divide-y","aria-labelledby":"waiting-title",children:Ko.map((G,oe)=>{var gt,At;const Be=uo[G.hold_type],at=G.target.kind==="task"?`Because you claim ${Yd.get(G.target.task_id)??"the task it waits on"} · `:"",rn=G.local_done;return s.jsxs("li",{id:`waiting-${G.id}`,"data-title-key":G.id,className:"flex flex-wrap items-center gap-3 py-2",children:[G.task?s.jsx(h,{className:"text-primary min-w-40 flex-1 hover:underline",href:f(`/org/${t}/tasks/${G.task.id}`),children:G.task.title}):s.jsx("span",{className:"min-w-40 flex-1",children:G.reason}),s.jsx(ue,{variant:Be.tone,children:G.local_label??Be.label}),s.jsxs("div",{className:"min-w-48 flex-2",children:[G.task?s.jsx("div",{className:"text-sm",children:G.reason}):null,s.jsxs("div",{className:"text-muted-foreground text-xs",children:[at,"From ",_(G.opened_by)," · ",Yn(G.opened_at)]}),(gt=G.local_threads)!=null&>.length?s.jsxs("div",{className:"text-muted-foreground text-xs",children:["Answer it in"," ",s.jsx(h,{className:"text-primary hover:underline",href:f(`/org/${t}/threads`),children:"Threads"}),": ",G.local_threads.join(" · ")]}):null,_t[G.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:_t[G.id]}):null]}),rn&&(i!=null&&i.complete)?s.jsx(V,{type:"button",variant:"outline",size:"sm","data-done-key":G.id,"aria-label":`Mark ${((At=G.task)==null?void 0:At.title)??G.reason} done`,loading:Et===G.id,onClick:()=>{var kt;return void xs(G.id,((kt=G.task)==null?void 0:kt.title)??G.reason,rn,aS[oe+1]??null)},children:"Done"}):null,g?null:s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void si(G.id),children:"Release"})]},G.id)})}):J?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Nothing in this checkout waits on you."}):null,g&&Ue?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status",children:Ue.reason==="view_outdated"?`Waiting on you is not read here. ${_e}`:"Waiting on you could not be read. It is read again with the list."}):null,s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:g?"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."})]}),!w&&!r&&s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(Oo,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"You can view these tasks"}),s.jsx(xe,{children:"Ask an organization admin for write access to change them."})]}),s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-4",children:[(y==null?void 0:y.archived)!==!1?s.jsx(q4,{value:S,onValueChange:G=>D(G),children:s.jsxs(gk,{"aria-label":"Which tasks",children:[s.jsx(vm,{value:"active",children:"Active"}),s.jsx(vm,{value:"archived",children:"Archived"})]})}):null,(y==null?void 0:y.assigned_to_me)!==!1?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vl,{id:"tasks-mine",checked:z,onCheckedChange:G=>P(G===!0)}),s.jsx($e,{htmlFor:"tasks-mine",children:"Assigned to me"})]}):null,y!=null&&y.search?s.jsx(bt,{ref:Ce,type:"search",className:"w-64","aria-label":"Search tasks",placeholder:"Search title, ID or detail",value:F,onChange:G=>H(G.target.value)}):null,st!=null&&st.owners?s.jsx(ED,{owners:st.owners,no_owner:st.no_owner,value:k,on_change:O}):null]}),(Fx=st==null?void 0:st.groups)!=null&&Fx.length?s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Status",children:[st.groups.map(G=>s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":R===G.id,onClick:()=>T(oe=>oe===G.id?null:G.id),children:[G.label," ",G.count]},G.id)),st.marks?s.jsxs(s.Fragment,{children:[s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":Y,onClick:()=>E(G=>!G),children:["Urgent ",st.marks.urgent]}),s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":I,onClick:()=>Q(G=>!G),children:["Over estimate ",st.marks.over_estimate]})]}):null]}):null,Wn&&(q==null?void 0:q.matched)!==void 0&&q.total!==void 0?s.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:[q.matched," of ",q.total," match ·"," ",s.jsx(V,{type:"button",variant:"link",size:"inline-sm",onClick:ia,children:"Clear"})]}):null,eS?s.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:"Tasks are busy. Reading them again…"}):re?s.jsx(Dk,{refusal:re,on_retry:()=>void U()}):null,!q&&!re&&s.jsx(Ok,{}),q&&Xo&&Wn?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(pd,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No tasks match"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing open matches these filters."}),s.jsx(V,{type:"button",variant:"outline",onClick:ia,children:"Clear filters"})]}):q&&Xo&&S==="active"&&!z&&g?s.jsx("p",{className:"text-muted-foreground mt-6 text-sm",children:"No tasks recorded yet."}):q&&Xo&&S==="active"&&!z?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(q0,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No tasks yet"}),s.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."}),w&&s.jsxs(V,{type:"button",onClick:()=>wt(!0),children:[s.jsx(Tl,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]})]}):q?s.jsxs(s.Fragment,{children:[s.jsx(ot,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Tasks",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Title"}),s.jsx(Z,{children:"Status"}),Xd?s.jsx(Z,{className:"hidden md:table-cell",children:"Priority"}):null,s.jsx(Z,{className:"hidden md:table-cell",children:"Primary"}),s.jsx(Z,{className:"hidden md:table-cell",children:"Holds"}),s.jsx(Z,{children:"Claimed by"}),Kd?s.jsx(Z,{className:"text-right",children:"Actions"}):null]})}),s.jsxs(Ge,{children:[tS.map(G=>{var At,kt;if(G.kind==="group")return s.jsx(CD,{group:G.group,open:G.open,columns:Qd,on_toggle:()=>nS(G.group.id,G.open)},`group:${G.group.id}`);if(G.kind==="more")return s.jsx(RD,{group:G.group,whole:X.includes(G.group.id),columns:Qd,on_toggle:()=>sS(G.group.id)},`more:${G.group.id}`);const{row:oe,index:Be}=G,at=Q1.get(oe.status_id),rn=pD(oe),gt=oe.local_done;return s.jsxs(de,{"data-testid":"tasks-row",children:[s.jsxs(K,{"data-title-key":oe.id,children:[oe.no_page?s.jsx("span",{children:oe.title}):s.jsx(h,{className:"text-primary hover:underline",href:f(`/org/${t}/tasks/${oe.id}`),children:oe.title}),oe.parent_task_id&&Yd.get(oe.parent_task_id)?s.jsx("div",{className:"text-muted-foreground text-xs",children:Yd.get(oe.parent_task_id)}):null,g?s.jsx(TD,{row:oe}):null,_t[oe.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:_t[oe.id]}):null]}),s.jsx(K,{children:at?s.jsx(ue,{variant:Ak(at),children:at.name}):null}),Xd?s.jsx(K,{className:"hidden md:table-cell",children:oe.priority_id?((At=W1.get(oe.priority_id))==null?void 0:At.name)??"":s.jsx("span",{className:"text-muted-foreground",children:"Not set"})}):null,s.jsx(K,{className:"hidden md:table-cell",children:oe.owner_title?oe.owner_title:oe.primary_user_id?_(oe.primary_user_id):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}),s.jsx(K,{className:"hidden md:table-cell",children:rn?s.jsx(ue,{variant:rn.tone,children:rn.label}):s.jsx("span",{className:"text-muted-foreground",children:"None"})}),s.jsx(K,{"data-testid":"tasks-claim",children:s.jsx(AD,{row:oe,holder:_((kt=oe.claim)==null?void 0:kt.user_id)})}),Kd?s.jsx(K,{className:"text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[gt&&"hold"in gt?s.jsx("a",{className:"text-primary text-sm hover:underline",href:`#waiting-${gt.hold}`,children:"In Waiting on you"}):gt&&(i!=null&&i.complete)?s.jsx(V,{type:"button",variant:"outline",size:"sm","data-done-key":oe.id,"aria-label":`Mark ${oe.title} done`,loading:Et===oe.id,onClick:()=>void xs(oe.id,oe.title,gt,()=>{var ln;return(((ln=sn.current)==null?void 0:ln.tasks)??[]).map(Ls=>Ls.id).filter(Ls=>Ls!==oe.id)[Be]??null}),children:"Done"}):null,Fd&&J1?s.jsxs(s.Fragment,{children:[s.jsx(V,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${oe.title} up`,disabled:Be===0,onClick:()=>void Xa(oe,Be,-1),children:s.jsx(xR,{className:"size-4","aria-hidden":"true"})}),s.jsx(V,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${oe.title} down`,disabled:Be===ae.length-1,onClick:()=>void Xa(oe,Be,1),children:s.jsx(hR,{className:"size-4","aria-hidden":"true"})})]}):null,Fd?s.jsxs($d,{children:[s.jsx(Od,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon","aria-label":`More actions for ${oe.title}`,children:s.jsx(Op,{className:"size-4","aria-hidden":"true"})})}),s.jsxs(Go,{align:"end",children:[an&&oe.status_id!==an.id?s.jsx(Al,{onSelect:()=>Tr(oe),children:"Complete"}):null,N?s.jsx(Al,{className:"text-destructive focus:text-destructive",onSelect:()=>void ni(oe),children:"Archive"}):null]})]}):null]})}):null]},oe.id)}),Xo&&s.jsx(de,{children:s.jsx(K,{colSpan:Qd,className:"text-muted-foreground h-24 text-center",children:S==="archived"?"No archived tasks.":"No tasks are assigned to you."})})]})]})}),q.next_cursor?s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2 self-start",disabled:ge,onClick:async()=>{He(!0),await U(q.next_cursor??void 0),He(!1)},children:"Load more"}):null]}):null,w&&i&&s.jsx(gD,{open:Ht,commands:i,list_id:b.id,list_revision:(q==null?void 0:q.list.revision)??b.revision,default_status_id:b.default_status_id,statuses:p,priorities:j,members:n,on_close:()=>wt(!1),on_created:async()=>{wt(!1),await B()}}),Me]})}function ND(e,t){const n=Object.keys(e).filter(r=>e[r]),a=Object.keys(e).filter(r=>!e[r]);return{...n.length?{opened_groups:n}:{},...a.length?{closed_groups:a}:{},...t.length?{all_groups:t}:{}}}function kD(e,t,n,a){if(!t)return e.map((l,i)=>({kind:"row",row:l,index:i}));const r=[];for(const l of t){const i=n[l.id]??l.open;if(r.push({kind:"group",group:l,open:i}),!i||!l.open)continue;let o=0;e.forEach((c,d)=>{c.local_state===l.id&&(r.push({kind:"row",row:c,index:d}),o+=1)}),(l.hidden>0||a.includes(l.id)&&o>SD)&&r.push({kind:"more",group:l})}return r}const SD=10;function CD({group:e,open:t,columns:n,on_toggle:a}){const r=t?$p:fd;return s.jsx(de,{"data-testid":"tasks-group",children:s.jsx(K,{colSpan:n,className:"p-1",children:s.jsxs(V,{type:"button",variant:"ghost",size:"sm",className:"w-full justify-start font-semibold","aria-expanded":t,onClick:a,children:[s.jsx(r,{className:"size-4","aria-hidden":"true"}),e.label," ",e.count]})})})}function RD({group:e,whole:t,columns:n,on_toggle:a}){return s.jsx(de,{"data-testid":"tasks-group-more",children:s.jsx(K,{colSpan:n,children:s.jsx(V,{type:"button",variant:"link",size:"sm",className:"px-0","aria-expanded":t,onClick:a,children:t?"Show fewer":`Show all ${e.count}`})})})}function TD({row:e}){var n;const t=[e.local_after,e.local_detail].filter(Boolean).join(" · ");return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-muted-foreground font-mono text-xs",children:[e.id,e.match?` · matched in ${e.match}`:""]}),t?s.jsx("div",{className:"text-muted-foreground text-xs",children:t}):null,(n=e.local_marks)!=null&&n.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.local_marks.map(a=>s.jsx(ue,{variant:a.tone??"neutral",children:a.label},a.label))}):null]})}function ED({owners:e,no_owner:t,value:n,on_change:a}){return s.jsxs(pt,{value:n,onValueChange:a,children:[s.jsx(ut,{className:"w-56","aria-label":"Owner",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:_i,children:"Any owner"}),e.map(r=>s.jsxs(Re,{value:r.id,children:[r.label," (",r.count,")"]},r.id)),t!==void 0?s.jsxs(Re,{value:$k,children:["No owner (",t,")"]}):null]})]})}function AD({row:e,holder:t}){const n=e.claim;if(!n)return s.jsx("span",{className:"text-muted-foreground",children:"Nobody"});if(n.lapsed){const a=new Date(n.lease_expires_at)<=new Date;return s.jsxs("div",{children:[s.jsxs("div",{className:"text-warning",children:["Lapsed · ",t]}),s.jsx("div",{className:"text-muted-foreground text-xs",children:a?`Ran out at ${cs(n.lease_expires_at)}`:"Can no longer edit it"})]})}return s.jsxs("div",{className:"max-w-64",children:[s.jsxs("div",{children:[t,n.via?` · ${kx(n.via)}`:""]}),s.jsxs("div",{className:"text-muted-foreground truncate text-xs",title:n.via==="sdlc_login"&&n.via_device?Ek(n.via_device):void 0,children:["Until ",cs(n.lease_expires_at),n.via==="sdlc_login"&&n.via_device?s.jsxs(s.Fragment,{children:[" · ",s.jsx("bdi",{children:n.via_device})]}):null]})]})}const MD={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 $D({open:e,members:t,tasks:n,holds_my_web_claim:a,on_close:r,on_submit:l}){const[i,o]=u.useState("waiting_for_user"),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(!1),[b,v]=u.useState({}),[y,g]=u.useState(null),[p,j]=u.useState(!1);u.useEffect(()=>{e&&(o("waiting_for_user"),d(""),h(""),x(!1),v({}),g(null))},[e]);const w=MD[i],N=async C=>{C.preventDefault();const _={target:w!==null&&!c.trim(),reason:!f.trim()};if(v(_),_.target||_.reason)return;j(!0);const S={hold_type:i,reason:f.trim(),release_claim:m};i==="waiting_for_user"&&(S.target_user_id=c),i==="blocked"&&(S.target_task_id=c),i==="waiting_for_external"&&(S.target_label=c.trim());const D=await l(S);j(!1),g(D)};return s.jsx(pn,{open:e,onOpenChange:C=>C?null:r(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:C=>void N(C),noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Add hold"}),s.jsx(jn,{children:"Say what this task is waiting for."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y&&s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(xe,{children:y})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"hold-type",children:"Type"}),s.jsxs(pt,{value:i,onValueChange:C=>{o(C),d(""),v({})},children:[s.jsx(ut,{id:"hold-type",children:s.jsx(xt,{})}),s.jsx(dt,{children:Object.keys(uo).map(C=>s.jsx(Re,{value:C,children:uo[C].label},C))})]})]}),w?s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"hold-target",children:w.label}),i==="waiting_for_external"?s.jsx(bt,{id:"hold-target",value:c,"aria-invalid":b.target,onChange:C=>d(C.target.value)}):s.jsxs(pt,{value:c,onValueChange:d,children:[s.jsx(ut,{id:"hold-target","aria-invalid":b.target,children:s.jsx(xt,{placeholder:i==="blocked"?"Choose a task":"Choose a member"})}),s.jsx(dt,{children:i==="blocked"?n.map(C=>s.jsx(Re,{value:C.id,children:C.title},C.id)):t.map(C=>s.jsx(Re,{value:C.user_id,children:C.label},C.user_id))})]}),s.jsx("p",{className:b.target?"text-destructive text-xs":"text-muted-foreground text-xs",children:b.target?"Choose what it waits for.":w.help})]}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"You resume it yourself."}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"hold-reason",children:"Reason"}),s.jsx(Dn,{id:"hold-reason",rows:3,placeholder:"What the task is waiting for",value:f,"aria-invalid":b.reason,onChange:C=>h(C.target.value)}),b.reason&&s.jsx("p",{className:"text-destructive text-xs",children:"Give a reason."})]}),a&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vl,{id:"hold-release-claim",checked:m,onCheckedChange:C=>x(C===!0)}),s.jsx($e,{htmlFor:"hold-release-claim",children:"Also release my claim"})]})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),s.jsx(V,{type:"submit",disabled:p,children:p?"Adding…":"Add hold"})]})]})})})}function Yo(){const e=mn().tasks;if(!e)throw new Error("The Task page rendered without the tasks seam.");return e}function Rx(){return s.jsxs("div",{className:"grid gap-3",role:"status","aria-label":"Loading task",children:[s.jsx(jt,{className:"h-8 w-1/2"}),Array.from({length:7},(e,t)=>s.jsx(jt,{className:t===6?"h-6 w-2/3":"h-6 w-full"},t))]})}function zu({back:e,description:t}){const{href:n,Link:a}=Xe();return s.jsx(Ga,{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:a})}const Lr="not_set",OD=10*60*1e3,ey=20;function DD(){const{members:e}=Yo(),[t,n]=u.useState([]);u.useEffect(()=>{let l=!0;return e().then(i=>{l&&i.ok&&n(i.data)}),()=>{l=!1}},[e]);const a=u.useMemo(()=>new Map(t.map(l=>[l.user_id,l])),[t]),r=u.useCallback((l,i)=>{var o;return l?l===i?"You":((o=a.get(l))==null?void 0:o.label)??"A member":""},[a]);return{members:t,name:r}}function zD({active:e,task_id:t,back:n}){const a=Yo(),{task:r,activity:l,listTasks:i,hierarchyRevision:o,commands:c}=a,{href:d,Link:f}=Xe(),h=Nr(),{self_id:m}=dd(),{members:x,name:b}=DD(),{workspace:v}=e,{confirm:y,confirm_dialog:g}=Bo(),[p,j]=u.useState(null),[w,N]=u.useState(!1),[C,_]=u.useState(!1),[S,D]=u.useState(null),[z,P]=u.useState([]),[F,H]=u.useState(ey),[A,M]=u.useState([]),[R,T]=u.useState(!1),[k,O]=u.useState(null),[Y,E]=u.useState(null),[I,Q]=u.useState(""),[te,ce]=u.useState(null),X=u.useCallback(async()=>{if(!r)return;const U=await r(t);U.ok?(j(U.data),_(!1)):U.refusal.status===404||U.refusal.status===400?N(!0):_(!0)},[r,t]),L=u.useRef(0),q=u.useCallback(async()=>{if(!l)return;const U=L.current+=1;let $=[],B;for(;;){const W=await l(t,B);if(U!==L.current||!W.ok)return;if($=[...$,...W.data.events].slice(-1e3),!W.data.more||!W.data.next_cursor)break;B=W.data.next_cursor}U===L.current&&P($.reverse())},[l,t]);u.useEffect(()=>{X(),q()},[X,q]);const ne=p?v.lists.find(U=>U.id===p.task.list_id):void 0,ae=u.useMemo(()=>{var U;return((U=v.workflows.find($=>$.id===(p==null?void 0:p.task.workflow_id)))==null?void 0:U.statuses)??[]},[v,p==null?void 0:p.task.workflow_id]);u.useEffect(()=>{if(!p)return;let U=!0;return i(p.task.list_id,{limit:100}).then($=>{U&&M($.ok?$.data.tasks.filter(B=>B.id!==p.task.id).map(B=>({id:B.id,title:B.title})):[])}),()=>{U=!1}},[i,p==null?void 0:p.task.list_id,p==null?void 0:p.task.id,p]);const je=u.useCallback(async()=>{await Promise.all([X(),q()])},[X,q]),re=u.useCallback((U,$)=>c?c.run(U,$):Promise.resolve({ok:!1,refusal:{status:0,message:"This page cannot change tasks."}}),[c]),we=u.useCallback(async(U,$,B)=>{const W=await re(U,$);return W.ok?(B&&h.success(B),await je(),W.data):(W.refusal.code==="revision_conflict"?D({tone:"warning",title:"This task changed while you were editing",body:"We reloaded it. Check the change, then save again."}):W.refusal.code==="claim_held"?(await X(),D({tone:"destructive",title:"Someone else claimed this task first",body:"Their claim is shown below. You can take it over if it lapses."})):h.error(W.refusal.message),await je(),null)},[re,h,je,X]),se=(p==null?void 0:p.claim)??null,tt=se!==null&&se.id===te&&!se.lapsed&&!se.via?se.id:null;if(u.useEffect(()=>{if(!tt)return;const U=window.setInterval(()=>{re("renew_claim",{claim_id:tt,lease_seconds:Jv}).then(()=>X())},OD);return()=>window.clearInterval(U)},[tt,re,X]),w)return s.jsx(zu,{back:n});if(C&&!p)return s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This task could not be loaded"}),s.jsxs(xe,{children:[s.jsx("p",{children:"Check your connection and try again."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void X(),children:"Retry"})]})]});if(!p)return s.jsx(Rx,{});const{task:ge}=p,He=ge.archived_at!==null,J=Du(p.permission,"write")&&!He,ke=Du(p.permission,"manage"),Ue=ae.find(U=>U.id===ge.status_id),ft=ae.find(U=>U.category==="completed"),_e=v.priorities.find(U=>U.id===ge.priority_id),Ht=p.contributors.map(U=>U.user_id),wt=se!==null&&se.user_id===m,Et=se!==null&&!se.lapsed,tn=p.checklist.filter(U=>U.is_complete).length,_t=async()=>{const[U,$]=await Promise.all([i(ge.list_id,{limit:1}),o(v.id)]);return U.ok?$.ok?{ok:!0,data:{task_id:ge.id,expected_revision:ge.revision,expected_order_revision:U.data.list.order_revision,expected_hierarchy_revision:$.data}}:$:U},Nt=(U,$)=>we("update_task",{task_id:ge.id,expected_revision:ge.revision,changes:U},$),bn=U=>y(U.via==="sdlc_login"?{title:"Release this claim?",description:`You claimed it via ${Yf(U.via,U.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}),Gt=async()=>{if(!ft)return;if(Et&&(!wt||se.via)){const $=se.via==="api_key"?`${wt?"Your":`${b(se.user_id)}'s`} agent is still working on it.`:se.via==="sdlc_login"?`${wt?"You are":`${b(se.user_id)} is`} still working on it via ${Yf(se.via,se.via_device)}.`:`${b(se.user_id)} is still working on it.`;if(!await y({title:"Complete this task?",description:$,action_label:"Mark complete"}))return}await Nt({status_id:ft.id},"Task completed.")!==null&&se&&wt&&Et&&await we("end_claim",{claim_id:se.id,outcome:"completed"})},le=async(U,$)=>{const B=await _t();if(!B.ok){h.error(B.refusal.message);return}await we(U,B.data,$)},Me=async()=>{await y({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 le("archive_task","Task archived.")},Ce=async()=>{await le("restore_task","Task restored.")},nn=async()=>{var W;const U=se,$=await we("claim_task",{task_id:ge.id,lease_seconds:Jv}),B=(W=$==null?void 0:$.claim)==null?void 0:W.id;B&&!(U&&U.id===B&&U.via)&&ce(B)},sn=async()=>{se&&(se.via&&!await bn(se)||(await we("end_claim",{claim_id:se.id,outcome:"released"},"Claim released."),ce(null)))},zn=async()=>{se&&await we("end_claim",{claim_id:se.id,outcome:"expired"},"Claim cleared.")},st=async U=>{U.hold_type==="paused"&&m&&(U={...U,target_user_id:m});const $=await re("open_hold",{task_id:ge.id,hold_type:U.hold_type,reason:U.reason,...U.target_user_id?{target_user_id:U.target_user_id}:{},...U.target_task_id?{target_task_id:U.target_task_id}:{},...U.target_label?{target_label:U.target_label}:{}});return $.ok?(T(!1),h.success("Hold added."),U.release_claim&&se&&wt&&!se.via&&(await we("end_claim",{claim_id:se.id,outcome:"released"}),ce(null)),await je(),null):$.refusal.message},hs=U=>we("checklist",{task_id:ge.id,expected_revision:ge.revision,...U}),Wn=async U=>{for(const $ of U.filter(B=>!Ht.includes(B)))await we("set_contributor",{task_id:ge.id,expected_revision:ge.revision,user_id:$,action:"add"});for(const $ of p.contributors.filter(B=>!U.includes(B.user_id)))await we("set_contributor",{task_id:ge.id,expected_revision:ge.revision,user_id:$.user_id,action:"remove",expected_contributor_revision:$.revision})},ms=U=>{var B;if(U.target.kind==="user")return b(U.target.user_id,m);if(U.target.kind==="external")return U.target.label;if(U.target.hidden||!U.target.task_id)return"A task you cannot see";const $=U.target.task_id;return s.jsx(f,{className:"text-primary hover:underline",href:d(`${n}/${$}`),children:((B=A.find(W=>W.id===$))==null?void 0:B.title)??"Another task"})},ps=U=>U.target.kind==="user"&&U.target.user_id===m&&!U.released_at?s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void we("release_hold",{hold_id:U.id},"Hold released."),children:"Release"}):J?s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void we("resolve_hold",{hold_id:U.id},"Hold resolved."),children:"Resolve"}):null;return s.jsxs(s.Fragment,{children:[s.jsx(en,{title:ge.title,description:`Created ${Yn(ge.created_at)} by ${b(ge.created_by,m)}`,actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[J&&s.jsxs(s.Fragment,{children:[s.jsxs(V,{type:"button",variant:"outline",onClick:()=>O(ge.title),children:[s.jsx(md,{className:"mr-2 size-4","aria-hidden":"true"}),"Edit title"]}),ft&&ge.status_id!==ft.id&&s.jsxs(V,{type:"button",variant:"outline",onClick:()=>void Gt(),children:[s.jsx(Il,{className:"mr-2 size-4","aria-hidden":"true"}),"Mark complete"]})]}),ke&&!He&&s.jsxs(V,{type:"button",variant:"outline",onClick:()=>void Me(),children:[s.jsx(bv,{className:"mr-2 size-4","aria-hidden":"true"}),"Archive"]})]}),children:k!==null?s.jsxs("form",{className:"flex flex-wrap items-center gap-2 pt-1",onSubmit:async U=>{U.preventDefault(),k.trim()&&await Nt({title:k.trim()})!==null&&O(null)},children:[s.jsx($e,{htmlFor:"task-title",className:"sr-only",children:"Title"}),s.jsx(bt,{id:"task-title",className:"max-w-xl",value:k,onChange:U=>O(U.target.value)}),s.jsx(V,{type:"submit",size:"sm",children:"Save"}),s.jsx(V,{type:"button",size:"sm",variant:"outline",onClick:()=>O(null),children:"Cancel"})]}):null}),S&&s.jsxs(he,{variant:S.tone,className:"mt-4","data-testid":"task-notice",children:[S.tone==="warning"?s.jsx(kr,{className:"size-4","aria-hidden":"true"}):s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:S.title}),s.jsx(xe,{children:S.body})]}),He?s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(bv,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This task is archived"}),s.jsx(xe,{children:ke?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"It is out of the queue and cannot be claimed. Restore it to work on it again."}),s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void Ce(),children:[s.jsx(uR,{className:"mr-2 size-4","aria-hidden":"true"}),"Restore"]})]}):s.jsx("p",{children:"It is out of the queue and cannot be claimed. A manager can restore it."})})]}):J?null:s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(Oo,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"You can view this task"}),s.jsx(xe,{children:"Ask an organization admin for write access to change it."})]}),J?s.jsxs("div",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"task-status",children:"Status"}),s.jsxs(pt,{value:ge.status_id,onValueChange:U=>void Nt({status_id:U}),children:[s.jsx(ut,{id:"task-status",children:s.jsx(xt,{})}),s.jsx(dt,{children:ae.map(U=>s.jsx(Re,{value:U.id,children:U.name},U.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"task-priority",children:"Priority"}),s.jsxs(pt,{value:ge.priority_id??Lr,onValueChange:U=>void Nt({priority_id:U===Lr?null:U}),children:[s.jsx(ut,{id:"task-priority",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Lr,children:"Not set"}),v.priorities.map(U=>s.jsx(Re,{value:U.id,children:U.name},U.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"task-primary",children:"Primary"}),s.jsxs(pt,{value:ge.primary_user_id??Lr,onValueChange:U=>void Nt({primary_user_id:U===Lr?null:U}),children:[s.jsx(ut,{id:"task-primary",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Lr,children:"Not set"}),x.map(U=>s.jsx(Re,{value:U.user_id,children:U.label},U.user_id))]})]})]}),s.jsx(LD,{members:x,selected:Ht,on_change:U=>void Wn(U)})]}):s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(yc,{label:"Status",value:(Ue==null?void 0:Ue.name)??""}),s.jsx(yc,{label:"Priority",value:(_e==null?void 0:_e.name)??"Not set"}),s.jsx(yc,{label:"Primary",value:ge.primary_user_id?b(ge.primary_user_id,m):"Not set"}),s.jsx(yc,{label:"Contributors",value:Ht.map(U=>b(U,m)).join(", ")||"None"})]}),!He&&s.jsx(UD,{claim:se,mine:wt,holder:se?b(se.user_id):"",own:se!==null&&se.id===te,can_write:J,on_claim:()=>void nn(),on_release:()=>void sn(),on_clear:()=>void zn()}),s.jsxs("section",{className:"mt-6","aria-labelledby":"task-description-title",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("h2",{id:"task-description-title",className:"text-lg font-semibold",children:"Description"}),J&&Y===null&&s.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(ge.description??""),children:"Edit description"})]}),Y!==null?s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async U=>{U.preventDefault(),await Nt({description:Y})!==null&&E(null)},children:[s.jsx($e,{htmlFor:"task-description",className:"sr-only",children:"Description"}),s.jsx(Dn,{id:"task-description",rows:5,value:Y,onChange:U=>E(U.target.value)}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(V,{type:"submit",size:"sm",children:"Save"}),s.jsx(V,{type:"button",size:"sm",variant:"outline",onClick:()=>E(null),children:"Cancel"})]})]}):s.jsx("p",{className:"mt-2 text-sm whitespace-pre-wrap",children:ge.description||s.jsx("span",{className:"text-muted-foreground",children:"No description."})})]}),s.jsxs("section",{className:"mt-6","aria-labelledby":"task-checklist-title",children:[s.jsxs("h2",{id:"task-checklist-title",className:"text-lg font-semibold",children:["Checklist",p.checklist.length>0?` · ${tn} of ${p.checklist.length} done`:""]}),s.jsx("ul",{className:"mt-2 grid gap-1",children:p.checklist.map(U=>s.jsxs("li",{className:"flex items-center justify-between gap-2 py-1","data-testid":"task-checklist-item",children:[J?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vl,{id:`check-${U.id}`,checked:U.is_complete,onCheckedChange:$=>void hs({action:"toggle",item_id:U.id,expected_item_revision:U.revision,is_complete:$===!0})}),s.jsx($e,{htmlFor:`check-${U.id}`,className:"font-normal",children:U.label})]}):s.jsxs("span",{className:"text-sm",children:[U.is_complete?"Done: ":"To do: ",U.label]}),J&&s.jsxs($d,{children:[s.jsx(Od,{asChild:!0,children:s.jsx(V,{type:"button",variant:"ghost",size:"icon","aria-label":`Item actions for ${U.label}`,children:s.jsx(Op,{className:"size-4","aria-hidden":"true"})})}),s.jsx(Go,{align:"end",children:s.jsx(Al,{className:"text-destructive focus:text-destructive",onSelect:()=>void hs({action:"archive",item_id:U.id,expected_item_revision:U.revision}),children:"Remove"})})]})]},U.id))}),p.checklist.length===0&&!J&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"No checklist items."}),J&&s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async U=>{U.preventDefault(),I.trim()&&await hs({action:"add",label:I.trim()})!==null&&Q("")},children:[s.jsx($e,{htmlFor:"task-new-item",children:"Add an item"}),s.jsx(bt,{id:"task-new-item",placeholder:"Add an item and press Enter",value:I,onChange:U=>Q(U.target.value)})]})]}),s.jsxs("section",{className:"mt-6","aria-labelledby":"task-holds-title",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("h2",{id:"task-holds-title",className:"text-lg font-semibold",children:"Holds"}),J&&s.jsxs(V,{type:"button",variant:"outline",size:"sm",onClick:()=>T(!0),children:[s.jsx(V0,{className:"mr-2 size-4","aria-hidden":"true"}),"Add hold"]})]}),s.jsx("div",{className:"mt-2 shrink-0 overflow-x-auto rounded-lg border",children:s.jsxs(qe,{containerAriaLabel:"Holds",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Type"}),s.jsx(Z,{children:"Reason"}),s.jsx(Z,{children:"Waiting on"}),s.jsx(Z,{className:"text-right",children:"Actions"})]})}),s.jsxs(Ge,{children:[p.holds.map(U=>{const $=uo[U.hold_type];return s.jsxs(de,{"data-testid":"task-hold",children:[s.jsx(K,{children:s.jsx(ue,{variant:$.tone,children:$.label})}),s.jsxs(K,{children:[s.jsx("div",{children:U.reason}),s.jsx("div",{className:"text-muted-foreground text-xs",children:U.released_at?`Released by ${b(U.released_by,m)} · ${Yn(U.released_at)} · Ready to resolve`:`Opened by ${b(U.opened_by,m)} · ${Yn(U.opened_at)} · Open`})]}),s.jsx(K,{children:ms(U)}),s.jsx(K,{className:"text-right",children:ps(U)})]},U.id)}),p.holds.length===0&&s.jsx(de,{children:s.jsx(K,{colSpan:4,className:"text-muted-foreground h-16 text-center",children:"Nothing is holding this task."})})]})]})}),s.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."})]}),s.jsxs("section",{className:"mt-6 pb-8","aria-labelledby":"task-activity-title",children:[s.jsx("h2",{id:"task-activity-title",className:"text-lg font-semibold",children:"Activity"}),s.jsxs("ul",{className:"mt-2 divide-y rounded-lg border",children:[z.slice(0,F).map(U=>s.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:[s.jsx("span",{children:xD(U)}),s.jsxs("span",{className:"min-w-0 text-right sm:text-left",children:[s.jsx("span",{children:U.actor_id?b(U.actor_id,m):"The system"}),U.via?s.jsxs("span",{className:"text-muted-foreground block max-w-64 truncate text-xs sm:max-w-none",title:`via ${Yf(U.via,U.via_device)}`,children:["via ",kx(U.via),s.jsx(zk,{via:U.via,device:U.via_device})]}):null]}),s.jsx("span",{className:"text-muted-foreground col-span-2 sm:col-span-1 sm:text-right",children:Mk(U.created_at)})]},U.id)),z.length===0&&s.jsx("li",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No activity yet."})]}),z.length>F&&s.jsx(V,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>H(U=>U+ey),children:"Load more"})]}),J&&ne&&s.jsx($D,{open:R,members:x,tasks:A,holds_my_web_claim:wt&&Et&&!(se!=null&&se.via),on_close:()=>T(!1),on_submit:st}),g]})}function yc({label:e,value:t}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("dt",{className:"text-muted-foreground text-xs",children:e}),s.jsx("dd",{className:"text-sm",children:t})]})}function LD({members:e,selected:t,on_change:n}){return s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"task-contributors",children:"Contributors"}),s.jsxs($d,{children:[s.jsx(Od,{asChild:!0,children:s.jsxs(V,{id:"task-contributors",type:"button",variant:"outline",className:"justify-between font-normal",children:[t.length===0?s.jsx("span",{className:"text-muted-foreground",children:"Add a contributor"}):s.jsx("span",{className:"truncate",children:e.filter(a=>t.includes(a.user_id)).map(a=>a.label).join(", ")}),s.jsx(I0,{className:"text-muted-foreground size-4","aria-hidden":"true"})]})}),s.jsx(Go,{align:"start",children:e.map(a=>{const r=t.includes(a.user_id);return s.jsxs(Al,{onSelect:()=>n(r?t.filter(l=>l!==a.user_id):[...t,a.user_id]),children:[r?s.jsx(Il,{className:"mr-2 size-4","aria-hidden":"true"}):s.jsx("span",{className:"mr-2 size-4"}),a.label]},a.user_id)})})]})]})}function zk({via:e,device:t}){return e!=="sdlc_login"||!t?null:s.jsxs(s.Fragment,{children:[" on ",s.jsx("bdi",{children:t})]})}function UD({claim:e,mine:t,holder:n,own:a,can_write:r,on_claim:l,on_release:i,on_clear:o}){let c=s.jsx(Dp,{className:"size-4","aria-hidden":"true"}),d="Nobody is working on this",f=r?"Claim it to show others you are.":"",h=r?s.jsx(V,{type:"button",size:"sm",onClick:l,children:"Claim"}):null;if(e&&e.lapsed){const m=new Date(e.lease_expires_at)<=new Date;c=s.jsx($R,{className:"size-4","aria-hidden":"true"}),d=m?`${t?"Your":`${n}'s`} claim lapsed at ${cs(e.lease_expires_at)}`:`${t?"Your":`${n}'s`} claim lapsed`,f=m?"Its time ran out.":`${n} can no longer edit this task.`,r&&(f+=" Take it over to work on it yourself, or clear it so anyone can claim it."),h=r?s.jsxs(s.Fragment,{children:[s.jsx(V,{type:"button",size:"sm",variant:"outline",onClick:o,children:"Clear claim"}),s.jsx(V,{type:"button",size:"sm",onClick:l,children:"Take over"})]}):null}else if(e){const m=cs(e.lease_expires_at);c=e.via==="api_key"?s.jsx(Mp,{className:"size-4","aria-hidden":"true"}):e.via==="sdlc_login"?s.jsx(nT,{className:"size-4","aria-hidden":"true"}):s.jsx(DT,{className:"size-4","aria-hidden":"true"});const x=s.jsxs(s.Fragment,{children:["Claimed via sdlc login",s.jsx(zk,{via:e.via,device:e.via_device}),"."]});t&&e.via==="api_key"?(d=`Your agent is working on this until ${m}`,f="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}`,f=s.jsxs(s.Fragment,{children:[x," 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}`,f=x):t?(d=`You are working on this until ${m}`,f=a?"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}`,f="Claimed through an API key."):(d=`${n} is working on this until ${m}`,f=r?"Claimed on the web. You can take it over if the claim lapses.":"Claimed on the web."),h=t?s.jsx(V,{type:"button",size:"sm",variant:"outline",onClick:i,children:"Release claim"}):null}return s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 rounded-lg border p-3","data-testid":"task-claim",children:[c,s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm font-medium",children:d}),f?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:f}):null]}),h?s.jsx("div",{className:"flex items-center gap-2",children:h}):null]})}const BD=10,Lk=5,HD=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Uk="Not available",ID={added:"Added",changed:"Changed",removed:"Removed"},PD={thread:"Thread",task:"Task",issue:"Issue",release:"Release",test:"Test"},ty=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;function qD(e,t){const n=t!=null&&t.startsWith("task:")?t.slice(5):null;if(n&&HD.test(n))return{label:n,path:`/org/${e}/tasks/${n}`};const a=t!=null&&t.startsWith("issue:")?t.slice(6):null;if(a&&/^iss-\d{1,9}$/.test(a))return{label:a,path:`/org/${e}/issues/${a}`};const r=t!=null&&t.startsWith("release:")?t.slice(8):null;if(r&&ty.test(r))return{label:r==="candidate"?"Candidate":`Release ${r}`,path:`/releases?release=${r}`};const l=t!=null&&t.startsWith("planned:")?t.slice(8):null;return l&&ty.test(l)?{label:`Planned Release ${l}`,path:`/releases?planned=${l}`}:{label:"Tasks",path:`/org/${e}/tasks`}}const Bk=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function GD({org:e,task_id:t,from:n}){var Gt;const a=Yo(),{href:r,Link:l}=Xe(),{confirm:i,confirm_dialog:o}=Bo(),c=qD(e,n),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState([]),[x,b]=u.useState([]),[v,y]=u.useState(null),[g,p]=u.useState(null),[j,w]=u.useState({state:"loading"}),[N,C]=u.useState({state:"loading"}),[_,S]=u.useState(null),[D,z]=u.useState(null),[P,F]=u.useState(!1),H=u.useRef(null),A=ds(),M=u.useRef(null),R=u.useRef(null),T=u.useRef(null),k=u.useRef(null),O=u.useRef(!1),Y=u.useRef(0),E=u.useRef(0),I=u.useCallback(async()=>{if(!a.taskSections)return;w({state:"loading"});const le=await a.taskSections(t);w(le.ok?{state:"ok",data:le.data}:{state:"failed",refusal:le.refusal})},[a.taskSections,t]),Q=u.useCallback(async()=>{if(!a.taskRelated)return;C({state:"loading"});const le=await a.taskRelated(t);C(le.ok?{state:"ok",data:le.data}:{state:"failed",refusal:le.refusal})},[a.taskRelated,t]),te=u.useCallback(async()=>{var sn,zn;const le=E.current+=1;p(null),I(),Q();const[Me,Ce]=await Promise.all([a.availability(),a.task?a.task(t):Promise.resolve(null)]);if(le!==E.current)return;Me.state==="active"&&m(((sn=Me.workspace.workflows.find(st=>st.id===Me.list.workflow_id))==null?void 0:sn.statuses)??[]);const nn=Me.state==="off"&&((zn=Me.refusal)==null?void 0:zn.reason)==="engine_missing"?Me.refusal:null;if(!Ce||!Ce.ok&&Ce.refusal.reason==="engine_missing"||nn){f({state:"engine_missing",refusal:nn??(Ce&&!Ce.ok?Ce.refusal:{status:0,message:""})});return}if(Ce.ok){Y.current=0,y(null),z(null),f({state:"ok",detail:Ce.data,at:new Date().toISOString()});return}if(Ce.refusal.status===404||Ce.refusal.reason==="not_found"){f({state:"missing"});return}if(Y.current+=1,Y.current===1&&Bk(Ce.refusal)){p(Ce.refusal.retry_after??BD);return}y(Ce.refusal),f(st=>st.state==="loading"?{state:"loading"}:st)},[a,t,I,Q]);u.useEffect(()=>{te()},[te]),u.useEffect(()=>{if(g===null)return;const le=setTimeout(()=>void te(),g*1e3);return()=>clearTimeout(le)},[g,te]),u.useEffect(()=>{let le=!0;return a.members().then(Me=>{le&&Me.ok&&b(Me.data)}),()=>{le=!1}},[a.members]),u.useEffect(()=>{var Me;if(O.current||d.state!=="ok")return;O.current=!0;const le=(Me=H.current)==null?void 0:Me.querySelector("h1");le&&(le.tabIndex=-1,le.focus())},[d.state]),u.useEffect(()=>{var le;_&&((le=R.current)==null||le.focus())},[_]),u.useEffect(()=>{if(D===null)return;const le=setTimeout(()=>{var Me;return(Me=M.current)==null?void 0:Me.focus()},0);return()=>clearTimeout(le)},[D]);const ce=u.useMemo(()=>new Map(x.map(le=>[le.user_id,le.label])),[x]),X=le=>le?ce.get(le)??le:"",L=()=>{S(null),te()},q=u.useRef(null),ne=le=>(q.current=le,le==="graph"?I():Q());if(u.useEffect(()=>{var Ce;const le=q.current;if(le===null||(le==="graph"?j:N).state==="loading")return;q.current=null;const Me=(le==="graph"?T:k).current??((Ce=H.current)==null?void 0:Ce.querySelector("h1"));Me==null||Me.focus()},[j,N]),d.state==="missing")return s.jsx(ka,{children:s.jsx(zu,{back:`/org/${e}/tasks`,description:`No task ${t} in this checkout. It may have finished and been archived, or never been recorded.`})});const ae=s.jsx(V,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(l,{href:r(c.path),children:[s.jsx(H0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(d.state==="engine_missing")return s.jsx(ka,{children:s.jsx("div",{ref:H,className:"contents",children:s.jsx(la,{page:"Task",header:s.jsx(Pi,{back:ae,id:null,title:t})})})});const je=v?s.jsxs(he,{variant:"destructive",className:"mt-4",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not read this task"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[v.message,v.since?` Since ${rs(v.since)}.`:"",d.state==="ok"?` This page was read at ${rs(d.at)}.`:""," See the sdlc viewer terminal for more."]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:L,children:"Retry"})]})]}):null,re=g!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(Wt,{"aria-hidden":"true"}),"Could not read this task. Trying again in ",g," seconds."]}):null,we=s.jsx("div",{role:"status","aria-live":"polite",children:re});if(d.state==="loading")return s.jsxs(ka,{children:[we,je,!v&&g===null?s.jsx(Rx,{}):null]});const{detail:se,at:tt}=d,{task:ge}=se,He=h.find(le=>le.id===ge.status_id),J=se.local_done&&"task"in se.local_done?se.local_done:null,ke=se.local_waits??[],Ue=J?ke[0]??null:null,ft=Ue?X(Ue.opened_by):se.owner_title??X(se.thread),_e=j.state==="ok"?j.data:null,Ht=(_e==null?void 0:_e.lifecycle)==="finished",wt=Ht&&(_e==null?void 0:_e.outcome)==="cancelled",Et=Ht&&(_e==null?void 0:_e.outcome)==="complete",tn=!!ge.created_at,_t=se.acceptance??[],Nt=async()=>{var Ce;if(!J||!((Ce=a.commands)!=null&&Ce.complete)||!await i({title:`Mark ${ge.title} done?`,description:Ue?`This answers ${ft}'s ask, “${Ue.reason}”, closes that wait, and tells ${ft} to check and continue.`:`This tells ${ft||"its thread"} to check and continue.`,action_label:"Mark done"}))return;F(!0);const Me=await a.commands.complete(J);if(F(!1),!Me.ok){z(Me.refusal.message);return}await te(),S({title:ge.title,asker:ft||"Its thread"})},bn=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[J&&!_?s.jsxs(s.Fragment,{children:[s.jsxs(V,{ref:M,type:"button",variant:"outline",disabled:P,"aria-disabled":D!==null?!0:void 0,"aria-describedby":D!==null?"task-done-why":void 0,onClick:()=>{D===null&&Nt()},children:[s.jsx(Il,{className:"mr-2 size-4","aria-hidden":"true"}),"Done"]}),D!==null?s.jsx("span",{id:"task-done-why",className:"text-muted-foreground text-xs",children:"Read again first"}):null]}):null,s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",rs(tt)]}),s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:L,children:[s.jsx(kr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsxs(ka,{children:[s.jsxs("div",{ref:H,className:"contents",children:[s.jsx(Pi,{back:ae,id:ge.id,badge:He?s.jsx(ue,{variant:Ak(He),children:He.name}):null,title:ge.title,created:tn?`Created ${Yn(ge.created_at)}${ft||se.owner_title?` by ${se.owner_title??ft}`:""}`:null,actions:bn}),we,je,_?s.jsx("div",{ref:R,tabIndex:-1,role:"status","aria-live":"polite",className:"outline-none",children:s.jsxs(he,{variant:"success",className:"mt-4",children:[s.jsx(hd,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:["Marked ",_.title," done"]}),s.jsxs(xe,{children:[_.asker," is told to check and continue."]})]})}):null,D!==null?s.jsxs(he,{variant:"destructive",className:"mt-4",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Done was not recorded"}),s.jsxs(xe,{children:[D," Read again to see the task as it is now."]})]}):null,Ue&&!_?s.jsxs(he,{variant:"warning",className:"mt-4",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:[ft," asks: ",Ue.reason]}),s.jsxs(xe,{children:["Waiting on you since ",Sx(Ue.opened_at),". Done answers it and tells ",ft," to check and continue."]})]}):null,se.view_outdated?s.jsxs(he,{variant:"warning",className:"mt-4",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsxs(xe,{children:[A," Until then this page cannot read the claim and holds."]})]}):null,s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(_s,{label:"Owner thread",value:se.owner_title??(X(se.thread)||"None")}),s.jsx(_s,{label:"Release",value:se.release??"None"}),s.jsx(_s,{label:"Session",value:j.state==="loading"?"Loading…":j.state==="failed"?"Not available":_e!=null&&_e.session?s.jsxs(s.Fragment,{children:[_e.session.provider," ",s.jsx("span",{className:"font-mono break-all",children:_e.session.id})]}):"None"}),s.jsx(_s,{label:"Now",value:se.local_detail??(He==null?void 0:He.name)??""})]}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Local tasks have no priority or contributors."}),s.jsx(VD,{detail:se,holder:X((Gt=se.claim)==null?void 0:Gt.user_id),finished_at:Ht?(_e==null?void 0:_e.finished_at)??null:null,read_at:tt}),s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(Oo,{className:"text-info size-4","aria-hidden":"true"}),J?s.jsxs(s.Fragment,{children:[s.jsx(ye,{children:"Done is the one change this page makes"}),s.jsx(xe,{children:"Everything else about this task changes through its thread."})]}):s.jsxs(s.Fragment,{children:[s.jsx(ye,{children:"This page only reads tasks"}),s.jsx(xe,{children:"A task changes through the agent thread working on it."})]})]}),tn?_e!=null&&_e.record?s.jsxs("p",{className:"mt-4 text-sm",children:["Record ",s.jsx("span",{className:"font-mono break-all",children:_e.record})]}):null:s.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."}),J?s.jsx(Ct,{id:"task-done-needs",title:"What Done needs",children:_t.length>0?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The task's acceptance; ",ft||"its thread"," checks these after Done."]}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:_t.map(le=>s.jsx("li",{children:le},le))})]}):s.jsxs("p",{className:"text-sm",children:["Its thread gave no acceptance. Ask ",ft||"its thread"," what Done needs before marking it."]})}):_t.length>0?s.jsxs(Ct,{id:"task-acceptance",title:"Acceptance",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:Et?"All met: the task finished complete":wt&&(_e!=null&&_e.finished_at)?`Cancelled ${Yn(_e.finished_at)}`:"Met when the task finishes complete"}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:_t.map(le=>s.jsx("li",{children:Et?`Met: ${le}`:le},le))})]}):null,s.jsx(YD,{detail:se,waits:ke,given:J!==null,threadName:X,threadsLink:s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/threads`),children:"Threads"})}),j.state==="loading"?s.jsxs("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading the task's sections",children:[s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-2/3"})]}):null,_e?s.jsx(Ct,{id:"task-stands",title:"Where it stands",children:s.jsxs("p",{className:"text-sm",children:[(He==null?void 0:He.name)??ge.status_id,se.local_detail?` · ${se.local_detail}`:""]})}):null,_e!=null&&_e.time?s.jsx(FD,{time:_e.time}):null,s.jsx(KD,{sections:j,heading_ref:T,on_retry:()=>void ne("graph"),taskLink:le=>s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/tasks/${le}?from=task:${ge.id}`),children:le})}),_e!=null&&_e.files?s.jsx(XD,{files:_e.files,finished:Ht}):null,_e!=null&&_e.proof?s.jsx(QD,{proof:_e.proof,finished_at:_e.finished_at,who:se.owner_title??null}):null,_e&&_e.history.length>0?s.jsx(WD,{history:_e.history}):null,s.jsx(Hk,{related:N,heading_ref:k,on_retry:()=>void ne("related"),link:le=>{const Me=le.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(le.id)}`:le.kind==="task"?`/org/${e}/tasks/${le.id}?from=task:${ge.id}`:le.kind==="issue"?`/org/${e}/issues/${encodeURIComponent(le.id)}?from=task:${ge.id}`:le.kind==="release"?`/releases?${le.planned?"planned":"release"}=${encodeURIComponent(le.id)}`:null;return Me?s.jsx(l,{className:ie("text-primary hover:underline",le.kind!=="thread"&&le.label===le.id&&"font-mono"),href:r(Me),children:le.label}):le.label}})]}),o]})}function ka({children:e}){return s.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 Pi({back:e,id:t,badge:n,title:a,created:r,actions:l}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("div",{children:e}),t?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx("span",{className:"font-mono",children:t}),n]}):null,s.jsx(en,{title:a,description:r??void 0,actions:l})]})}function _s({label:e,value:t}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("dt",{className:"text-muted-foreground text-xs",children:e}),s.jsx("dd",{className:"m-0 text-sm break-words",children:t})]})}function Ct({id:e,title:t,aside:n,heading_ref:a,children:r}){return s.jsxs("section",{className:"mt-6","aria-labelledby":`${e}-title`,children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[s.jsx("h2",{id:`${e}-title`,ref:a,tabIndex:a?-1:void 0,className:"text-lg font-semibold outline-none",children:t}),n?s.jsx("span",{className:"text-muted-foreground text-sm",children:n}):null]}),s.jsx("div",{className:"mt-2",children:r})]})}function VD({detail:e,holder:t,finished_at:n,read_at:a}){const r=e.claim,[,l]=u.useReducer(f=>f+1,0),i=r&&!e.view_outdated?new Date(r.lease_expires_at).getTime():null;u.useEffect(()=>{if(i===null||!Number.isFinite(i))return;const f=i-Date.now();if(f<=0)return;const h=setTimeout(l,Math.min(f+50,2147483647));return()=>clearTimeout(h)},[i]);let o=s.jsx(Dp,{className:"size-4","aria-hidden":"true"}),c="Nobody is working on this",d=null;if(e.view_outdated)c=`Claimed by: ${Uk}`;else if(r){const f=new Date(r.lease_expires_at)<=new Date(Math.max(Date.now(),new Date(a).getTime()));o=s.jsx(Mp,{className:"size-4","aria-hidden":"true"}),c=`${t} is working on this until ${rs(r.lease_expires_at)}${f||r.lapsed?" · passed":""}`,d="Claimed in the coordination registry; its thread renews the claim."}else n&&(o=s.jsx(hd,{className:"size-4","aria-hidden":"true"}),d=`Finished ${Yn(n)}. Its claim ended when it finished.`);return s.jsxs(ot,{className:"mt-4 flex flex-wrap items-center gap-3 p-3","data-testid":"task-claim",children:[o,s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm font-medium",children:c}),d?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:d}):null]})]})}function YD({detail:e,waits:t,given:n,threadName:a,threadsLink:r}){if(e.view_outdated)return s.jsx(Ct,{id:"task-holds",title:"Holds",children:s.jsx("p",{className:"text-sm",children:Uk})});if(e.holds.length===0)return null;const l=new Map(t.map(i=>[i.id,i]));return s.jsxs(Ct,{id:"task-holds",title:`Holds · ${e.holds.length} open`,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"A hold does not change the task's status."}),s.jsx(ot,{className:"mt-2 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Holds",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Type"}),s.jsx(Z,{children:"Reason"}),s.jsx(Z,{children:"Waiting on"}),s.jsx(Z,{children:"Opened"})]})}),s.jsx(Ge,{children:e.holds.map(i=>{var f;const o=l.get(i.id),c=uo[i.hold_type],d=n?"Done above answers it":o!=null&&o.local_done?"In Waiting on you":(f=o==null?void 0:o.local_threads)!=null&&f.length?s.jsxs(s.Fragment,{children:["Answer it in ",r,": ",o.local_threads.join(" · ")]}):null;return s.jsxs(de,{"data-testid":"task-hold",children:[s.jsx(K,{children:s.jsx(ue,{variant:c.tone,children:(o==null?void 0:o.local_label)??c.label})}),s.jsxs(K,{children:[s.jsx("div",{children:i.reason}),s.jsxs("div",{className:"text-muted-foreground text-xs",children:["Opened by ",a(i.opened_by)]})]}),s.jsxs(K,{children:[s.jsx("div",{children:i.target.kind==="user"?"You":i.target.kind==="external"?i.target.label:"Another task"}),d?s.jsx("div",{className:"text-muted-foreground text-xs",children:d}):null]}),s.jsx(K,{children:Sx(i.opened_at)})]},i.id)})})]})})]})}function FD({time:e}){return s.jsx(Ct,{id:"task-time",title:"Time",children:s.jsxs("dl",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsx(_s,{label:"Estimate",value:e.estimate?`${hi(e.estimate.low)}–${hi(e.estimate.high)}`:e.unknown_reason??"None"}),s.jsx(_s,{label:"Time taken",value:e.elapsed!==null?`${hi(e.elapsed)}${e.over_estimate?" · over estimate":""}`:"Not started"}),e.forecast?s.jsx(_s,{label:"Reforecast",value:s.jsxs("span",{className:"text-muted-foreground",children:[hi(e.forecast.low),"–",hi(e.forecast.high)," left",e.forecast.reason?` · ${e.forecast.reason}`:""]})}):null]})})}function Tx({what:e,again:t,refusal:n,on_retry:a}){return s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:["Could not read ",e]}),s.jsxs(xe,{children:[s.jsx("p",{children:n.message}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:t})]})]})}function KD({sections:e,heading_ref:t,on_retry:n,taskLink:a}){const[r,l]=u.useState(!1);if(e.state==="loading")return null;const i=e.state==="failed"?e.refusal:e.data.graph.ok?null:e.data.graph.refusal;if(i)return s.jsx(Ct,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsx(Tx,{what:"graph changes",again:"Read graph changes again",refusal:i,on_retry:n})});const o=e.state==="ok"&&e.data.graph.ok?e.data.graph.data:null;if(!o)return null;if(o.exempt)return s.jsx(Ct,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsxs("p",{className:"text-sm",children:["This task changes no modeled design. Its plan says why: ",o.exempt,"."]})});if(o.changes.length===0)return null;const c=r?o.changes:o.changes.slice(0,Lk),d=o.changes.length-c.length;return s.jsxs(Ct,{id:"task-graph",title:"Graph changes",aside:o.document,heading_ref:t,children:[s.jsx(ot,{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Graph changes",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Change"}),s.jsx(Z,{children:"Kind of change"}),s.jsx(Z,{children:"Also in"}),s.jsx(Z,{children:"In the plan"})]})}),s.jsx(Ge,{children:c.map(f=>s.jsxs(de,{children:[s.jsxs(K,{children:[s.jsx("div",{children:f.label}),s.jsx("div",{className:"text-muted-foreground text-xs",children:f.type})]}),s.jsx(K,{children:ID[f.change]}),s.jsx(K,{children:f.also_in.length===0?"No other task":f.also_in.map((h,m)=>s.jsxs(u.Fragment,{children:[m>0?", ":null,a(h.id)]},h.id))}),s.jsx(K,{children:f.planned?"Yes":s.jsx(ue,{variant:"warning",children:"No longer planned"})})]},`${f.id}:${f.planned}`))})]})}),d>0?s.jsxs("p",{className:"mt-2 flex flex-wrap items-center gap-2 text-sm",children:[d," more changes in this task's plan slice.",s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:()=>l(!0),children:["Show all ",o.changes.length]})]}):null]})}function XD({files:e,finished:t}){const[n,a]=u.useState(!1),r=n?e.paths:e.paths.slice(0,Lk);return s.jsxs(Ct,{id:"task-files",title:"Files",children:[r.length>0?s.jsx("ul",{className:"grid gap-1 text-sm",children:r.map(l=>s.jsx("li",{children:s.jsx("span",{className:"font-mono break-all",children:l})},l))}):null,e.paths.length>r.length?s.jsxs(V,{type:"button",variant:"ghost",size:"sm",className:"mt-1",onClick:()=>a(!0),children:["Show all ",e.paths.length]}):null,e.landed?s.jsxs("p",{className:"mt-2 text-sm",children:["Landed ",s.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 QD({proof:e,finished_at:t,who:n}){return s.jsxs(Ct,{id:"task-proof",title:"Evidence and proof",children:[e.evidence?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:e.evidence}):null,e.no_code?s.jsxs("p",{className:"mt-2 text-sm",children:["No code: ",e.no_code]}):e.commit?s.jsxs("p",{className:"mt-2 text-sm",children:["Proof ",s.jsx("span",{className:"font-mono",children:e.commit.slice(0,10)})," ·"," ",e.on_main?"on main":"not yet on main"]}):null,t?s.jsxs("p",{className:"text-muted-foreground mt-2 text-xs",children:["Finished ",Yn(t),n?` by ${n}`:""]}):null]})}function WD({history:e}){return s.jsxs(Ct,{id:"task-history",title:"History",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"From the task record, newest first"}),s.jsx(ot,{className:"mt-2 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"History",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"What"}),s.jsx(Z,{children:"Who"}),s.jsx(Z,{children:"When"})]})}),s.jsx(Ge,{children:e.map((t,n)=>s.jsxs(de,{children:[s.jsx(K,{children:t.what}),s.jsx(K,{children:t.who??"Its thread"}),s.jsx(K,{children:Sx(t.at)})]},`${t.at}:${n}`))})]})})]})}function Hk({id:e="task-related",related:t,heading_ref:n,on_retry:a,link:r,fixed:l=!1}){return t.state==="ok"&&t.data.length===0?null:s.jsx(Ct,{id:e,title:"Related",heading_ref:n,children:t.state==="loading"?s.jsxs("div",{className:"grid gap-2",role:"status","aria-label":"Loading related work",children:[s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-2/3"})]}):t.state==="failed"?s.jsx(Tx,{what:"related work",again:"Read related work again",refusal:t.refusal,on_retry:a}):s.jsx(ot,{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Related",className:l?"table-fixed":void 0,children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{className:l?"w-[14%]":void 0,children:"Kind"}),s.jsx(Z,{className:l?"w-[45%]":void 0,children:"Item"}),s.jsx(Z,{className:l?"w-[41%]":void 0,children:"How it relates"})]})}),s.jsx(Ge,{children:t.data.map(i=>s.jsxs(de,{children:[s.jsx(K,{children:PD[i.kind]}),s.jsx(K,{className:l?"break-words":void 0,children:r(i)}),s.jsx(K,{className:l?"break-words":void 0,children:i.relation})]},`${i.kind}:${i.planned?"planned:":""}${i.id}`))})]})})})}function ZD({org:e,task_id:t,from:n}){const a=Yo(),r=`/org/${e}/tasks`;return a.taskSections?s.jsx(GD,{org:e,task_id:t,from:n??null}):s.jsx(JD,{task_id:t,back:r})}function JD({task_id:e,back:t}){const{availability:n}=Yo(),[a,r]=u.useState({state:"loading"});return u.useEffect(()=>{let l=!0;return n().then(i=>{l&&r(i)}),()=>{l=!1}},[n]),a.state==="off"?s.jsx(zu,{back:t}):s.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"?s.jsx(zD,{active:a,task_id:e,back:t}):a.state==="error"?s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This task could not be loaded"}),s.jsx(xe,{children:"Check your connection and try again."})]}):a.state==="available"?s.jsx(zu,{back:t}):s.jsx(Rx,{})})}function ns({children:e}){return s.jsx("p",{role:"alert",className:"text-destructive text-sm",children:e})}const ez=["open","triaged","resolved","closed"],Ex=["low","normal","high","urgent"],tz=["fixed","works_as_intended","planned","duplicate","wont_fix","cannot_reproduce"],nz=["title","description","external_reference"],Lu={open:"Open",triaged:"Triaged",escalated:"Escalated",waiting_on_fix:"Waiting on fix",resolved:"Resolved",closed:"Closed"},Ik={open:"warning",triaged:"info",escalated:"info",waiting_on_fix:"info",resolved:"success",closed:"neutral"},fo={low:"Low",normal:"Normal",high:"High",urgent:"Urgent"},Ax={fixed:"Fixed",works_as_intended:"Works as intended",planned:"Planned",duplicate:"Duplicate",wont_fix:"Won't fix",cannot_reproduce:"Cannot reproduce"},Pk={title:"Title",description:"Description",external_reference:"External reference"},sz=[["year",365*24*3600],["month",30*24*3600],["week",7*24*3600],["day",24*3600],["hour",3600],["minute",60]];function Gc(e,t=Date.now()){const n=Math.round((new Date(e).getTime()-t)/1e3),a=new Intl.RelativeTimeFormat("en",{numeric:"auto"});for(const[r,l]of sz)if(Math.abs(n)>=l)return a.format(Math.round(n/l),r);return"just now"}function bm(e,t,n){const a=`/org/${encodeURIComponent(e)}/proj/${encodeURIComponent(t)}/support`;return n?`${a}/${encodeURIComponent(n)}`:a}function Mx(e,t){return e?t??"Not available":"A former member"}const az="the issue integration";function rz(e){return!e.created_by&&e.reporter_kind==="customer"?az:Mx(e.created_by,e.created_by_username)}function lz(e,t){return!e.actor_id&&e.kind==="created"&&t.reporter_kind==="customer"?"The issue integration":Mx(e.actor_id,e.actor_username)}const jc="not_set",iz="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 oz({create:e,open:t,onOpenChange:n,onCreated:a}){const[r,l]=u.useState(""),[i,o]=u.useState(""),[c,d]=u.useState(!1),[f,h]=u.useState(""),[m,x]=u.useState(jc),[b,v]=u.useState(!1),[y,g]=u.useState(null),p=u.useRef(null),j=()=>{l(""),o(""),d(!1),h(""),x(jc),g(null),p.current=null},w=_=>{var S;return((S=y==null?void 0:y.personal_data)==null?void 0:S.field)===_?y.message:void 0},N=async _=>{if(_.preventDefault(),b)return;v(!0),p.current??(p.current=crypto.randomUUID());const S=await e({request_id:p.current,title:i.trim()||void 0,description:f||void 0,external_reference:r.trim()||void 0,priority:m===jc?null:m});if(v(!1),!S.ok){S.refusal.status!==0&&(p.current=null),g(S.refusal);return}j(),a(S.data.issue,S.data.duplicates)},C=y&&!y.personal_data?y.message:void 0;return s.jsx(pn,{open:t,onOpenChange:_=>{_||j(),n(_)},children:s.jsx(xn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:N,className:"grid gap-4",children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"New support issue"}),s.jsx(jn,{children:"Log one help-desk report. Text is shown exactly as entered."})]}),s.jsxs(he,{variant:"warning",children:[s.jsx(Qt,{}),s.jsx(xe,{children:iz})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-issue-reference",children:"External reference"}),s.jsx(bt,{id:"maintain-issue-reference",value:r,"aria-invalid":!!w("external_reference"),onChange:_=>{l(_.target.value),c||o(_.target.value)}}),w("external_reference")?s.jsx(ns,{children:w("external_reference")}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"The help-desk ticket number."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-issue-title",children:"Title"}),s.jsx(bt,{id:"maintain-issue-title",value:i,"aria-invalid":!!w("title"),onChange:_=>{o(_.target.value),d(!0)}}),w("title")?s.jsx(ns,{children:w("title")}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"Prefilled from the external reference; edit it if you like."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-issue-description",children:"Description"}),s.jsx(Dn,{id:"maintain-issue-description",rows:4,placeholder:"What the end user reported, without personal data",value:f,"aria-invalid":!!w("description"),onChange:_=>h(_.target.value)}),w("description")?s.jsx(ns,{children:w("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-issue-priority",children:"Priority"}),s.jsxs(pt,{value:m,onValueChange:x,children:[s.jsx(ut,{id:"maintain-issue-priority",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:jc,children:"Not set"}),Ex.map(_=>s.jsx(Re,{value:_,children:fo[_]},_))]})]})]}),C?s.jsx(ns,{children:C}):null,s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>{j(),n(!1)},children:"Cancel"}),s.jsx(V,{type:"submit",loading:b,disabled:!i.trim()&&!r.trim(),children:"Log issue"})]})]})})})}const cz=["supportAccess","assigneeCandidates","create","update","assign","transition","redact"];function qk(){return uz(mn().issues)}function uz(e){return e&&cz.every(t=>typeof e[t]=="function")?e:null}function Gk(e){const[t,n]=u.useState(null);return u.useEffect(()=>{if(!e)return;let a=!1;return e.supportAccess().then(r=>{a||n({contract:e,state:r.ok?{state:"ready",access:r.data}:{state:"error"}})}),()=>{a=!0}},[e]),t&&e&&t.contract===e?t.state:{state:"loading"}}function Vk({access:e,header:t,back_href:n,children:a}){const{href:r,Link:l}=Xe();return e.state==="loading"?s.jsxs("div",{className:"flex flex-1 items-center justify-center py-24",children:[s.jsx(Wt,{className:"size-5"}),s.jsx("span",{className:"sr-only",children:"Loading…"})]}):e.state==="error"||!e.access.enabled?s.jsx(Ga,{title:"Page not found",description:"This page does not exist or you do not have access to it.",backHref:r(n),backLabel:"Back to the project",link:l}):e.access.can_view?s.jsx(s.Fragment,{children:a(e.access)}):s.jsxs(s.Fragment,{children:[t,s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(uT,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",children:"Support needs a Maintain seat"}),s.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 dz(){const e=Xe();return t=>{e.navigate?e.navigate(t):window.location.assign(e.href(t))}}const Nn="all",bc=25;function wm({action:e}){return s.jsx(en,{title:"Support",description:"Help-desk reports logged against this project.",actions:e})}function fz({org:e,project:t,query:n}){const a=qk(),r=Gk(a),l=`/org/${e}/proj/${t}`;return s.jsx("div",{className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:s.jsx(Vk,{access:r,header:s.jsx(wm,{}),back_href:l,children:i=>a?s.jsx(hz,{contract:a,access:i,org_name:e,proj_name:t,query:n}):null})})}function hz({contract:e,access:t,org_name:n,proj_name:a,query:r}){const{href:l,Link:i}=Xe(),o=dz(),[c,d]=u.useState(()=>new URLSearchParams(r).get("external_reference")??""),[f,h]=u.useState(Nn),[m,x]=u.useState(Nn),[b,v]=u.useState(Nn),[y,g]=u.useState(0),[p,j]=u.useState(null),[w,N]=u.useState(0),[C,_]=u.useState(null),[S,D]=u.useState([]),[z,P]=u.useState(!1),F=c.trim()!==""||f!==Nn||m!==Nn||b!==Nn,H=u.useCallback(async()=>{const k=await e.list({external_reference:c.trim()||void 0,status:f===Nn?void 0:f,priority:m===Nn?void 0:m,assignee:b===Nn?void 0:b,limit:bc,offset:y*bc});if(!k.ok){_(k.refusal.message);return}_(null),j(k.data.issues),N(k.data.total)},[e,c,f,m,b,y]);u.useEffect(()=>{const k=setTimeout(()=>void H(),200);return()=>clearTimeout(k)},[H]),u.useEffect(()=>{e.assigneeCandidates().then(k=>{k.ok&&D(k.data.candidates)})},[e]);const A=t.can_change?s.jsxs(V,{onClick:()=>P(!0),children:[s.jsx(Tl,{className:"mr-2 size-4"}),"New issue"]}):void 0,M=s.jsx(oz,{create:e.create,open:z,onOpenChange:P,onCreated:(k,O)=>{P(!1);const Y=bm(n,a,k.id);o(O.length?`${Y}?duplicates=${O.length}`:Y)}});if(p!==null&&w===0&&!F&&y===0)return s.jsxs(s.Fragment,{children:[s.jsx(wm,{}),s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(aT,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",children:"No support issues yet"}),s.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?s.jsxs(V,{onClick:()=>P(!0),children:[s.jsx(Tl,{className:"mr-2 size-4"}),"Log the first issue"]}):null]}),M]});const R=w===0?0:y*bc+1,T=Math.min(w,(y+1)*bc);return s.jsxs(s.Fragment,{children:[s.jsx(wm,{action:A}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"relative w-full max-w-sm",children:[s.jsx(CT,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2","aria-hidden":!0}),s.jsx(bt,{"aria-label":"Filter by external reference",placeholder:"Filter by external reference",className:"pl-9",value:c,onChange:k=>{d(k.target.value),g(0)}})]}),s.jsx(Kf,{label:"Status",value:f,onChange:k=>{h(k),g(0)},options:ez.map(k=>({value:k,label:Lu[k]}))}),s.jsx(Kf,{label:"Priority",value:m,onChange:k=>{x(k),g(0)},options:Ex.map(k=>({value:k,label:fo[k]}))}),s.jsx(Kf,{label:"Assignee",value:b,onChange:k=>{v(k),g(0)},options:[{value:"unassigned",label:"Unassigned"},{value:"cannot_act",label:"Assignee cannot act"},...S.map(k=>({value:k.user_id,label:k.username??"Not available"}))]})]}),C?s.jsx(ns,{children:C}):null,s.jsx("div",{className:"rounded-md border",children:s.jsxs(qe,{children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Title"}),s.jsx(Z,{children:"External reference"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Priority"}),s.jsx(Z,{children:"Assignee"}),s.jsx(Z,{children:"Updated"})]})}),s.jsx(Ge,{children:p===null?s.jsx(de,{children:s.jsx(K,{colSpan:6,className:"h-24 text-center",children:"Loading…"})}):p.length===0?s.jsx(de,{children:s.jsx(K,{colSpan:6,className:"h-24 text-center",children:"No issues match these filters."})}):p.map(k=>s.jsxs(de,{children:[s.jsx(K,{className:"max-w-md",children:s.jsx(i,{href:l(bm(n,a,k.id)),className:"font-medium hover:underline",children:k.title})}),s.jsx(K,{className:"font-mono text-xs",children:k.external_reference??""}),s.jsx(K,{children:s.jsx(ue,{variant:Ik[k.status],children:Lu[k.status]})}),s.jsx(K,{children:k.priority?fo[k.priority]:""}),s.jsx(K,{children:s.jsx(mz,{issue:k})}),s.jsx(K,{className:"text-muted-foreground",children:Gc(k.updated_at)})]},k.id))})]})}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-muted-foreground text-sm",children:w===0?"No issues.":`Showing ${R}–${T} of ${w} issue${w===1?"":"s"}.`}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(V,{variant:"outline",size:"sm",disabled:y===0,onClick:()=>g(k=>Math.max(0,k-1)),children:"Previous"}),s.jsx(V,{variant:"outline",size:"sm",disabled:T>=w,onClick:()=>g(k=>k+1),children:"Next"})]})]}),M]})}function mz({issue:e}){return e.assignee_id?s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:e.assignee_username??"Not available"}),e.assignee_can_act===!1?s.jsx(ue,{variant:"error",children:"Assignee cannot act"}):null]}):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}function Kf({label:e,value:t,onChange:n,options:a}){var l;const r=u.useMemo(()=>t===Nn||a.some(i=>i.value===t),[a,t]);return s.jsxs(pt,{value:r?t:Nn,onValueChange:n,children:[s.jsx(ut,{className:"w-44","aria-label":e,children:s.jsx(xt,{placeholder:e,children:t===Nn?e:(l=a.find(i=>i.value===t))==null?void 0:l.label})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Nn,children:"All"}),a.map(i=>s.jsx(Re,{value:i.value,children:i.label},i.value))]})]})}const Yk=[{key:"local",label:"Local"},{key:"staging",label:"Staging"},{key:"production",label:"Production"}],pz=/^iss-\d{1,9}$/,xz=/^col-\d{1,9}$/,gz=e=>e&&e[0].toUpperCase()+e.slice(1);function Fk(e){const t=gz(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 qi(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 _m={search:"",owner:null,urgent:!1,seen:[],label:null,collection:null};function Vc(e){const t=new URLSearchParams(e),n=t.getAll("seen").filter(r=>Yk.some(l=>l.key===r)),a=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:a&&xz.test(a)?a:null}}function sl(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()}function vz(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 ny=e=>!!(e.search.trim()||e.owner||e.urgent||e.seen.length||e.label||e.collection),yz={agent:"Filed by an agent",user:"Filed by you",tool:"Filed by a tool"},jz={graph:"Placed on the graph by its anchors",files:"Placed by its files",unplaced:"Triaged, not placed yet"},bz={handoff:"Handed to its owner",backlog:"Sent to the unowned backlog",batch:"Routed to a batch"};function wz(e,t=""){const n=(e??t).trim();if(!n)return"";const a=n.indexOf(": "),r=(a===-1?n:n.slice(0,a)).trim(),l=a===-1?"":n.slice(a+2).trim(),i=o=>l?`${o} ${l}`:o;switch(r){case"filed":return yz[l]??i("Filed by");case"labelled":return i("Labelled");case"unlabelled":return l?`Label removed: ${l}`:"Label removed";case"anchored":return l?`Anchored to ${l}`:"Anchored";case"triaged":return jz[l]??(l?`Triaged: ${l}`:"Triaged");case"routed":return bz[l]??(l?`Routed: ${l}`:"Routed");case"route closed":return l==="backlog"?"Taken off the unowned backlog":l?`Route closed: ${l}`:"Route closed";case"released":return l?`Released by its owner (task ${l})`:"Released by its owner";case"resolved":return l==="duplicate"?"Resolved as a duplicate":l?`Resolved · ${l.replace(/_/g," ")}`:"Resolved";case"reopened":return l?`Reopened: ${l}`:"Reopened";case"fix landed":return l?`Fix landed in ${l.slice(0,10)}`:"Fix landed";case"merged":return l?`Merged ${l} into this issue`:"Merged a duplicate into this issue";default:return n}}const _z=e=>e.replace(/`+/g,"").replace(/\s+/g," ").trim(),Kk="This page only reads issues",Xk="File, route and resolve issues with the issue command or through the thread working on them.",Nz=10,kz=250,Ur="__all",Sz="none",Cz=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function Qk(){const e=mn().issues;if(!e)throw new Error("The Issues page rendered without the issues seam.");return e}const Rz=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 Tz({project:e,query:t,onQuery:n}){var X;const a=Qk(),{href:r,Link:l}=Xe(),i=u.useMemo(()=>Vc(t),[t]),o=sl(i),c=ny(i),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState(null),[x,b]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(null),j=ds(),w=u.useRef(!1),[N,C]=u.useState(i.search),_=u.useCallback(L=>n(sl({...i,...L})),[i,n]),S=u.useCallback(async()=>{const L=y.current+=1;b(null);const q=await a.list(vz(Vc(o)));if(L!==y.current)return;if(q.ok){v.current=0,m(null),f({state:"ok",list:q.data,local:q.data.local??Rz(new Date().toISOString()),key:o});return}const ne=q.refusal.reason;if(ne==="engine_missing")return f({state:"engine_missing",refusal:q.refusal});if(ne==="view_outdated")return f({state:"view_outdated"});if(v.current+=1,v.current===1&&Cz(q.refusal)){b(q.refusal.retry_after??Nz);return}m(q.refusal)},[a.list,o]);u.useEffect(()=>{S()},[S]),u.useEffect(()=>{if(x===null)return;const L=setTimeout(()=>void S(),x*1e3);return()=>clearTimeout(L)},[x,S]),u.useEffect(()=>{document.activeElement!==g.current&&C(i.search)},[i.search]),u.useEffect(()=>{if(N===i.search)return;const L=setTimeout(()=>_({search:N}),kz);return()=>clearTimeout(L)},[N,i.search,_]),u.useEffect(()=>{const L=q=>{if(q.key!=="/"||q.metaKey||q.ctrlKey||q.altKey)return;const ne=q.target;ne&&(ne.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(ne.tagName))||g.current&&(q.preventDefault(),g.current.focus())};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[]);const D=()=>{var L;C(""),n(sl(_m)),(L=g.current)==null||L.focus()},z=()=>{v.current=0,S()},P=()=>{w.current=!0,z()};u.useEffect(()=>{var q;if(!w.current||d.state==="loading"||x!==null)return;w.current=!1;const L=(q=p.current)==null?void 0:q.querySelector("h1");L&&(L.tabIndex=-1,L.focus())},[d,h,x]);const F=L=>`/proj/${encodeURIComponent(e)}/issues${L?`?${L}`:""}`,H=L=>`/proj/${encodeURIComponent(e)}/issues/${encodeURIComponent(L)}?from=issues${o?`&${o}`:""}`,A=s.jsx("div",{role:"status","aria-live":"polite",children:x!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(Wt,{"aria-hidden":"true"}),"Issues are busy. Reading them again…"]}):null}),M=h?s.jsxs(he,{variant:"destructive",className:"mt-4",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Issues could not be loaded"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[h.message,h.since?` Since ${rs(h.since)}.`:"",d.state==="ok"?` The list below was read at ${rs(d.local.read_at)}.`:"",h.message.includes(mr)?"":` ${mr}`]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:P,children:"Retry"})]})]}):null,R=s.jsx(en,{title:"Issues",description:"This repository's local issues: what agents and you reported, where triage placed each, and what fixes it.",actions:d.state==="ok"?s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",rs(d.local.read_at)]}),s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:z,children:[s.jsx(kr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]}):null});if(d.state==="engine_missing")return s.jsx(wc,{ref:p,children:s.jsx(la,{page:"Issues"})});if(d.state==="view_outdated")return s.jsxs(wc,{ref:p,children:[R,s.jsxs(he,{variant:"warning",className:"mt-6",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsx(xe,{children:j})]})]});if(d.state==="loading")return s.jsxs(wc,{ref:p,children:[R,A,M,!h&&x===null?s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading issues",children:Array.from({length:6},(L,q)=>s.jsx(jt,{className:q===5?"h-10 w-2/3":"h-10 w-full"},q))}):null]});const{list:T,local:k}=d,O=!h&&x===null&&(d.key!==o||N!==i.search),Y=ny(Vc(d.key)),E=k.scope==="folder",I=k.listed===0&&!c,Q=Math.max(0,k.listed-k.facets.owners.reduce((L,q)=>L+q.count,0)),te=i.collection?((X=k.collections.find(L=>L.collection===i.collection))==null?void 0:X.title)??i.collection:null,ce=new Map;for(const L of T.issues){const q=L.group??"unplaced";ce.set(q,[...ce.get(q)??[],L])}return s.jsxs(wc,{ref:p,children:[R,E&&k.folder?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Issues of the folder ",k.folder,", from its issue store."]}):null,s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(Oo,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Kk}),s.jsx(xe,{children:Xk})]}),A,M,I?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(JR,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No issues yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Issues filed in this repository with the issue command appear here."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[s.jsx(bt,{ref:g,type:"search",className:"w-64","aria-label":"Search issues",placeholder:"Search issues",value:N,onChange:L=>C(L.target.value)}),s.jsxs(pt,{value:i.owner??Ur,onValueChange:L=>_({owner:L===Ur?null:L}),children:[s.jsx(ut,{className:"w-56","aria-label":"Owner",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Ur,children:"All owners"}),s.jsxs(Re,{value:Sz,children:["Unowned (",Q,")"]}),k.facets.owners.map(L=>s.jsxs(Re,{value:L.key,children:[L.title," (",L.count,")"]},L.key))]})]}),s.jsxs(pt,{value:i.label??Ur,onValueChange:L=>_({label:L===Ur?null:L}),children:[s.jsx(ut,{className:"w-48","aria-label":"Label",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Ur,children:"All labels"}),k.facets.labels.map(L=>s.jsxs(Re,{value:L.label,children:[L.label," (",L.count,")"]},L.label))]})]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2",children:[s.jsx("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Marks",children:s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":i.urgent,onClick:()=>_({urgent:!i.urgent}),children:["Urgent ",k.facets.urgent]})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Seen on",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Seen on"}),Yk.map(L=>{const q=i.seen.includes(L.key);return s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":q,onClick:()=>_({seen:q?i.seen.filter(ne=>ne!==L.key):[...i.seen,L.key]}),children:[L.label," ",k.facets.seen[L.key]]},L.key)}),te!==null?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{"data-testid":"issues-collection-chip",className:ie(_d({variant:"outline",size:"sm"}),uM),children:["Collection ",te]}),s.jsx(V,{type:"button",variant:"ghost",size:"sm-icon","aria-label":"Remove the collection filter",onClick:()=>{var L;_({collection:null}),(L=g.current)==null||L.focus()},children:s.jsx(xd,{className:"size-4","aria-hidden":"true"})})]}):null]})]}),s.jsx("div",{role:"status","aria-live":"polite",children:O?s.jsxs("p",{className:"text-muted-foreground mt-3 flex items-center gap-2 text-sm",children:[s.jsx(Wt,{"aria-hidden":"true"}),"Searching…"]}):c&&T.total>0?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:[T.total," of ",k.listed," issues ·"," ",s.jsx(V,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:D,children:"Clear"})]}):null}),s.jsx("div",{"data-testid":"issues-results","aria-busy":O||void 0,className:"shrink-0 transition-opacity aria-busy:opacity-50",children:Y&&T.total===0?s.jsxs("p",{className:"mt-6 flex items-center gap-2 text-sm",children:[s.jsx(pd,{className:"text-muted-foreground size-4","aria-hidden":"true"}),"No issues match."," ",s.jsx(V,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:D,children:"Clear"})]}):k.groups.map(L=>s.jsx(Ez,{id:`issues-${L.key}`,title:`${L.label} · ${L.count}`,issues:ce.get(L.key)??[],folder:E,link:q=>s.jsx(l,{className:"text-primary hover:underline",href:r(H(q.id)),children:q.title})},L.key))}),!c&&k.collections.length>0?s.jsxs("section",{className:"mt-8","aria-labelledby":"issues-collections-title",children:[s.jsxs("h2",{id:"issues-collections-title",className:"text-lg font-semibold",children:["Collections · ",k.collections.length]}),s.jsx(ot,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Collections",className:"table-fixed",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{className:"w-1/2",children:"Collection"}),s.jsx(Z,{className:"w-1/4",children:"Resolved"}),s.jsx(Z,{className:"w-1/4",children:"Updated"})]})}),s.jsx(Ge,{children:k.collections.map(L=>s.jsxs(de,{children:[s.jsxs(K,{children:[s.jsx(l,{className:"text-primary hover:underline",href:r(F(sl({..._m,collection:L.collection}))),children:L.title}),s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:L.collection})]}),s.jsxs(K,{children:[L.resolved," of ",L.total," resolved"]}),s.jsx(K,{className:"text-muted-foreground",children:qi(L.updated_at)})]},L.collection))})]})})]}):null]})]})}const wc=u.forwardRef(function({children:t},n){return s.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})});function Ez({id:e,title:t,issues:n,folder:a,link:r}){return s.jsxs("section",{className:"mt-6","aria-labelledby":`${e}-title`,"data-testid":"issues-group",children:[s.jsx("h2",{id:`${e}-title`,className:"text-lg font-semibold",children:t}),s.jsx(ot,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:t,className:"table-fixed",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{className:a?"w-[30%]":"w-[36%]",children:"Title"}),s.jsx(Z,{className:"w-[10%]",children:"Issue"}),a?s.jsx(Z,{className:"w-[12%]",children:"Project"}):null,s.jsx(Z,{className:"w-[16%]",children:"Status"}),s.jsx(Z,{className:"w-[8%]",children:"Urgent"}),s.jsx(Z,{className:a?"w-[14%]":"w-[18%]",children:"Owner"}),s.jsx(Z,{className:"w-[12%]",children:"Updated"})]})}),s.jsx(Ge,{children:n.map(l=>{var o;const i=Fk(l);return s.jsxs(de,{"data-testid":"issues-row",children:[s.jsxs(K,{className:"break-words",children:[r(l),(o=l.labels)!=null&&o.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:l.labels.map(c=>s.jsx(ue,{variant:"neutral",size:"dense",children:c},c))}):null]}),s.jsx(K,{className:"font-mono text-xs",children:l.id}),a?s.jsx(K,{className:"break-words",children:l.project_id??"Folder"}):null,s.jsx(K,{children:s.jsx(ue,{variant:i.tone,children:i.label})}),s.jsx(K,{children:l.urgent&&l.status!=="resolved"&&l.group!=="resolved"?s.jsx(ue,{variant:"warning",children:"Urgent"}):null}),s.jsx(K,{className:"break-words",children:l.owner_title?l.owner_title:s.jsx("span",{className:"text-muted-foreground",children:"Unowned"})}),s.jsx(K,{className:"text-muted-foreground",children:qi(l.updated_at)})]},l.id)})})]})})]})}function Az(e){var t;return(t=mn().issues)!=null&&t.issueSections?s.jsx(Tz,{...e}):s.jsx(fz,{org:e.org,project:e.project,query:e.query})}function Mz({update:e,issue:t,open:n,onOpenChange:a,onDone:r,onReload:l}){const[i,o]=u.useState(t.title),[c,d]=u.useState(t.description),[f,h]=u.useState(t.external_reference??""),[m,x]=u.useState(t),[b,v]=u.useState(null),[y,g]=u.useState(!1);u.useEffect(()=>{n&&(o(t.title),d(t.description),h(t.external_reference??""),x(t),v(null))},[n]);const p=N=>{var C;return((C=b==null?void 0:b.personal_data)==null?void 0:C.field)===N?b.message:void 0},j=async N=>{N.preventDefault(),g(!0);const C=await e(m.id,m.revision,{title:i,description:c,external_reference:f.trim()||null});if(g(!1),!C.ok){v(C.refusal);return}r(C.data.issue)},w=async()=>{const N=await l();N&&(x(N),v(null))};return s.jsx(pn,{open:n,onOpenChange:a,children:s.jsx(xn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:j,className:"grid gap-4",children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Edit issue"}),s.jsx(jn,{children:"Text is shown exactly as entered."})]}),b!=null&&b.conflict?s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{}),s.jsx(xe,{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,s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-edit-title",children:"Title"}),s.jsx(bt,{id:"maintain-edit-title",value:i,"aria-invalid":!!p("title"),onChange:N=>o(N.target.value)}),p("title")?s.jsx(ns,{children:p("title")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-edit-description",children:"Description"}),s.jsx(Dn,{id:"maintain-edit-description",rows:4,value:c,"aria-invalid":!!p("description"),onChange:N=>d(N.target.value)}),p("description")?s.jsx(ns,{children:p("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-edit-reference",children:"External reference"}),s.jsx(bt,{id:"maintain-edit-reference",value:f,"aria-invalid":!!p("external_reference"),onChange:N=>h(N.target.value)}),p("external_reference")?s.jsx(ns,{children:p("external_reference")}):null]}),b&&!b.conflict&&!b.personal_data?s.jsx(ns,{children:b.message}):null,s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),b!=null&&b.conflict?s.jsxs(V,{type:"button",variant:"outline",onClick:w,children:[s.jsx(kr,{className:"mr-2 size-4"}),"Reload latest"]}):null,s.jsx(V,{type:"submit",loading:y,disabled:!!(b!=null&&b.conflict),children:"Save"})]})]})})})}function sy(e){return e.map(t=>Pk[t].toLowerCase()).join(", ")}function $z(e){switch(e.kind){case"created":return"Logged the issue";case"updated":return`Edited the ${sy(e.fields)}`;case"redacted":return`Redacted the ${sy(e.fields)}`;case"priority_set":return e.priority?`Set priority to ${fo[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?Lu[e.to_status]:"";return e.resolution_reason?`Moved to ${t}: ${Ax[e.resolution_reason]}`:`Moved to ${t}`}}}function ay(e,t){return t==="external_reference"?e.external_reference??"":e[t]}function Oz({redact:e,issue:t,open:n,onOpenChange:a,onDone:r,onReload:l}){const[i,o]=u.useState("description"),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,x]=u.useState(null),[b,v]=u.useState(t);u.useEffect(()=>{n&&(v(t),d(ay(t,i)),x(null))},[n]);const y=async g=>{g.preventDefault(),h(!0);const p=await e(b.id,b.revision,i,c);if(h(!1),!p.ok){if(p.refusal.conflict){const j=await l();j&&v(j),x("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}x(p.refusal.message);return}r(p.data.issue)};return s.jsx(pn,{open:n,onOpenChange:a,children:s.jsx(xn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:y,className:"grid gap-4",children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Redact text"}),s.jsx(jn,{children:"Replace text that holds personal data, such as a name."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-redact-field",children:"Field"}),s.jsxs(pt,{value:i,onValueChange:g=>{const p=g;o(p),d(ay(b,p))},children:[s.jsx(ut,{id:"maintain-redact-field",children:s.jsx(xt,{})}),s.jsx(dt,{children:nz.map(g=>s.jsx(Re,{value:g,children:Pk[g]},g))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-redact-replacement",children:"Replacement text"}),s.jsx(Dn,{id:"maintain-redact-replacement",rows:4,value:c,onChange:g=>d(g.target.value)})]}),s.jsxs(he,{variant:"warning",children:[s.jsx(Qt,{}),s.jsx(xe,{children:"This cannot be undone: the original text is removed for good. History records only that this field was redacted."})]}),m?s.jsx(ns,{children:m}):null,s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(V,{type:"submit",variant:"destructive",loading:f,children:"Redact"})]})]})})})}function Dz({transition:e,issue:t,open:n,onOpenChange:a,onDone:r}){const[l,i]=u.useState("fixed"),[o,c]=u.useState(!1),[d,f]=u.useState(null),h=async m=>{m.preventDefault(),c(!0);const x=await e(t.id,t.revision,"resolved",l);if(c(!1),!x.ok){if(x.refusal.conflict){r(null);return}f(x.refusal.message);return}f(null),r(x.data.issue)};return s.jsx(pn,{open:n,onOpenChange:a,children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:h,className:"grid gap-4",children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Resolve issue"}),s.jsx(jn,{children:"Choose how this report ended."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"maintain-resolution-reason",children:"Resolution reason *"}),s.jsxs(pt,{value:l,onValueChange:m=>i(m),children:[s.jsx(ut,{id:"maintain-resolution-reason",children:s.jsx(xt,{})}),s.jsx(dt,{children:tz.map(m=>s.jsx(Re,{value:m,children:Ax[m]},m))})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopening the issue clears its reason."})]}),d?s.jsx(ns,{children:d}):null,s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(V,{type:"submit",loading:o,children:"Resolve"})]})]})})})}const Br="not_set";function zz({org:e,project:t,issue_id:n,query:a}){const r=qk(),l=Gk(r),i=bm(e,t);return s.jsx("div",{className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:s.jsx(Vk,{access:l,header:s.jsx(en,{title:"Support"}),back_href:i,children:o=>r?s.jsx(Lz,{contract:r,issue_id:n,access:o,list_href:i,duplicates:Number(new URLSearchParams(a).get("duplicates")??0)}):null})})}function Lz({contract:e,issue_id:t,access:n,list_href:a,duplicates:r}){const{href:l,Link:i}=Xe(),o=Nr(),[c,d]=u.useState(null),[f,h]=u.useState([]),[m,x]=u.useState(!1),[b,v]=u.useState([]),[y,g]=u.useState(null),p=u.useCallback(async()=>{const _=await e.issue(t);return _.ok?(d(_.data.issue),h(_.data.events),_.data.issue):(_.refusal.status===404?x(!0):o.error(_.refusal.message),null)},[e,t,o]);u.useEffect(()=>{let _=!1;return e.issue(t).then(S=>{if(!_){if(!S.ok){S.refusal.status===404?x(!0):o.error(S.refusal.message);return}d(S.data.issue),h(S.data.events)}}),()=>{_=!0}},[e,t]),u.useEffect(()=>{n.can_change&&e.assigneeCandidates().then(_=>{_.ok&&v(_.data.candidates)})},[e,n.can_change]);const j=async _=>{const S=await _;if(!S.ok){o.error(S.refusal.message),S.refusal.conflict&&await p();return}await p()};if(m)return s.jsx(Ga,{title:"Support issue not found",description:"This issue does not exist in this project.",backHref:l(a),backLabel:"Back to Support",link:i});if(!c)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading…"});const w=c.status==="closed",N=n.can_change,C=_=>j(e.transition(c.id,c.revision,_));return s.jsxs(s.Fragment,{children:[s.jsx(en,{title:c.title,actions:N?s.jsxs(s.Fragment,{children:[w?null:s.jsxs(V,{variant:"outline",onClick:()=>g("edit"),children:[s.jsx(md,{className:"mr-2 size-4"}),"Edit"]}),s.jsxs(V,{variant:"outline",onClick:()=>g("redact"),children:[s.jsx(UR,{className:"mr-2 size-4"}),"Redact"]}),c.status==="open"?s.jsx(V,{variant:"outline",disabled:!c.priority,"aria-description":c.priority?void 0:"Set a priority first.",onClick:()=>void C("triaged"),children:"Triage"}):null,c.status==="open"||c.status==="triaged"?s.jsxs(V,{onClick:()=>g("resolve"),children:[s.jsx(hd,{className:"mr-2 size-4"}),"Resolve"]}):null,c.status==="resolved"?s.jsxs(s.Fragment,{children:[s.jsxs(V,{variant:"outline",onClick:()=>void C("open"),children:[s.jsx(NT,{className:"mr-2 size-4"}),"Reopen"]}),s.jsx(V,{onClick:()=>void C("closed"),children:"Close"})]}):null]}):void 0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ue,{variant:Ik[c.status],children:Lu[c.status]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Logged by ",rz(c)," ",Gc(c.created_at)]})]})}),s.jsxs("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-6",children:[r>0&&c.external_reference?s.jsxs(he,{variant:"info",children:[s.jsx(Ts,{}),s.jsxs(xe,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[s.jsxs("span",{children:[c.external_reference," is already logged on"," ",r===1?"another issue":`${r} other issues`," in this project."]}),s.jsx(V,{asChild:!0,variant:"outline",size:"sm",children:s.jsx(i,{href:l(`${a}?external_reference=${encodeURIComponent(c.external_reference)}`),children:"Show both"})})]})]}):null,s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Description"}),c.description?s.jsx("p",{className:"text-sm break-words whitespace-pre-wrap",children:c.description}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"No description."})]}),s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"History"}),s.jsx("div",{className:"rounded-md border",children:s.jsxs(qe,{children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"When"}),s.jsx(Z,{children:"Who"}),s.jsx(Z,{children:"What"})]})}),s.jsx(Ge,{children:f.map(_=>s.jsxs(de,{children:[s.jsx(K,{className:"text-muted-foreground",children:Gc(_.created_at)}),s.jsx(K,{children:lz(_,c)}),s.jsx(K,{children:$z(_)})]},_.id))})]})})]})]}),s.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-5 lg:w-72",children:[s.jsx(mi,{label:"External reference",children:c.external_reference?s.jsx("span",{className:"font-mono text-sm",children:c.external_reference}):s.jsx("span",{className:"text-muted-foreground text-sm",children:"None"})}),c.resolution_reason?s.jsx(mi,{label:"Resolution",children:s.jsx("span",{className:"text-sm",children:Ax[c.resolution_reason]})}):null,s.jsx(mi,{label:"Priority",id:"maintain-issue-priority",children:s.jsxs(pt,{value:c.priority??Br,disabled:!N||w,onValueChange:_=>void j(e.update(c.id,c.revision,{priority:_===Br?null:_})),children:[s.jsx(ut,{id:"maintain-issue-priority",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Br,children:"Not set"}),Ex.map(_=>s.jsx(Re,{value:_,children:fo[_]},_))]})]})}),s.jsxs(mi,{label:"Assignee",id:"maintain-issue-assignee",children:[s.jsxs(pt,{value:c.assignee_id??Br,disabled:!N||w,onValueChange:_=>void j(e.assign(c.id,c.revision,_===Br?null:_)),children:[s.jsx(ut,{id:"maintain-issue-assignee",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[s.jsx(Re,{value:Br,children:"Not set"}),c.assignee_id&&!b.some(_=>_.user_id===c.assignee_id)?s.jsx(Re,{value:c.assignee_id,children:Mx(c.assignee_id,c.assignee_username)}):null,b.map(_=>s.jsx(Re,{value:_.user_id,children:_.username??"Not available"},_.user_id))]})]}),c.assignee_can_act===!1?s.jsx(ue,{variant:"error",className:"self-start",children:"Assignee cannot act"}):null]}),s.jsx(mi,{label:"Updated",children:s.jsx("span",{className:"text-sm",children:Gc(c.updated_at)})})]})]}),s.jsx(Mz,{update:e.update,issue:c,open:y==="edit",onOpenChange:_=>g(_?"edit":null),onReload:p,onDone:()=>{g(null),p()}}),s.jsx(Oz,{redact:e.redact,issue:c,open:y==="redact",onOpenChange:_=>g(_?"redact":null),onReload:p,onDone:()=>{g(null),o.success("The text was redacted."),p()}}),s.jsx(Dz,{transition:e.transition,issue:c,open:y==="resolve",onOpenChange:_=>g(_?"resolve":null),onDone:_=>{g(null),_||o.error("Someone else changed this issue; it is reloaded."),p()}})]})}function mi({label:e,id:t,children:n}){return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[t?s.jsx("label",{htmlFor:t,className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:e}):s.jsx("span",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:e}),n]})}const Uz=10,Bz=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,ry=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;function Hz(e,t,n,a=""){const r=n!=null&&n.startsWith("task:")?n.slice(5):null;if(r&&Bz.test(r))return{label:r,path:`/org/${e}/tasks/${r}`};const l=`/proj/${encodeURIComponent(t)}/releases`,i=n!=null&&n.startsWith("release:")?n.slice(8):null;if(i&&ry.test(i))return{label:i==="candidate"?"Candidate":i,path:`${l}?release=${encodeURIComponent(i)}`};const o=n!=null&&n.startsWith("planned:")?n.slice(8):null;if(o&&ry.test(o))return{label:o,path:`${l}?planned=${encodeURIComponent(o)}`};const c=sl(Vc(a));return{label:"Issues",path:`/proj/${encodeURIComponent(t)}/issues${c?`?${c}`:""}`}}const Iz=["Fixed in","Being fixed in","The release planned to fix it"];function Pz(e){const t=e.filter(n=>n.kind==="release");for(const n of Iz){const a=t.find(r=>r.relation===n);if(a)return a}return t[0]??null}function qz({org:e,project:t,issue_id:n,from:a,query:r=""}){var He;const l=Qk(),{href:i,Link:o}=Xe(),c=Hz(e,t,a,r),d=`/proj/${encodeURIComponent(t)}/issues`,f=J=>`${d}/${encodeURIComponent(J)}`,[h,m]=u.useState({state:"loading"}),[x,b]=u.useState(null),[v,y]=u.useState(null),[g,p]=u.useState({state:"loading"}),[j,w]=u.useState({state:"loading"}),N=u.useRef(null),C=ds(),_=u.useRef(null),S=u.useRef(!1),D=u.useRef(0),z=u.useRef(0),P=u.useCallback(async()=>{if(!l.issueSections)return;p({state:"loading"});const J=await l.issueSections(n);p(J.ok?{state:"ok",data:J.data}:{state:"failed",refusal:J.refusal})},[l.issueSections,n]),F=u.useCallback(async()=>{if(!l.issueRelated)return;w({state:"loading"});const J=await l.issueRelated(n);w(J.ok?{state:"ok",data:J.data}:{state:"failed",refusal:J.refusal})},[l.issueRelated,n]),H=u.useCallback(async()=>{const J=z.current+=1;if(y(null),!pz.test(n)){m({state:"missing"});return}P(),F();const ke=await l.issue(n);if(J!==z.current)return;if(ke.ok){D.current=0,b(null),m({state:"ok",issue:ke.data.issue,events:ke.data.events,at:new Date().toISOString()});return}const Ue=ke.refusal.reason;if(ke.refusal.status===404||Ue==="not_found")return m({state:"missing"});if(Ue==="engine_missing")return m({state:"engine_missing",refusal:ke.refusal});if(Ue==="view_outdated")return m({state:"view_outdated"});if(D.current+=1,D.current===1&&Bk(ke.refusal)){y(ke.refusal.retry_after??Uz);return}b(ke.refusal)},[l.issue,n,P,F]);u.useEffect(()=>{H()},[H]),u.useEffect(()=>{if(v===null)return;const J=setTimeout(()=>void H(),v*1e3);return()=>clearTimeout(J)},[v,H]),u.useEffect(()=>{var ke;if(S.current||h.state!=="ok")return;S.current=!0;const J=(ke=N.current)==null?void 0:ke.querySelector("h1");J&&(J.tabIndex=-1,J.focus())},[h.state]);const A=u.useRef(null);u.useEffect(()=>{var Ue;const J=A.current;if(J===null||(J==="sections"?g:j).state==="loading")return;A.current=null;const ke=(J==="related"?_.current:null)??((Ue=N.current)==null?void 0:Ue.querySelector("h1"));ke==null||ke.focus()},[g,j]);const M=J=>{A.current=J,J==="sections"?P():F()},R=()=>{D.current=0,H()},T=u.useRef(!1),k=()=>{T.current=!0,R()};if(u.useEffect(()=>{var ke;if(!T.current||h.state==="loading"||v!==null)return;T.current=!1;const J=(ke=N.current)==null?void 0:ke.querySelector("h1");J&&(J.tabIndex=-1,J.focus())},[h,x,v]),h.state==="missing")return s.jsx(ka,{children:s.jsx(Ga,{icon:s.jsx(pd,{"aria-hidden":"true"}),title:"Issue not found",description:`No issue ${n} in this repository's issue store.`,backHref:i(a==="issues"?c.path:d),backLabel:"Back to issues",link:o})});const O=s.jsx(V,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(o,{href:i(c.path),children:[s.jsx(H0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(h.state==="engine_missing"||h.state==="view_outdated")return s.jsx(ka,{children:h.state==="engine_missing"?s.jsx(la,{page:"Issue",header:s.jsx(Pi,{back:O,id:null,title:n})}):s.jsxs(s.Fragment,{children:[s.jsx(Pi,{back:O,id:null,title:n}),s.jsxs(he,{variant:"warning",className:"mt-4",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsx(xe,{children:C})]})]})});const Y=x?s.jsxs(he,{variant:"destructive",className:"mt-4",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This issue could not be loaded"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[x.message,x.since?` Since ${rs(x.since)}.`:"",h.state==="ok"?` This page was read at ${rs(h.at)}.`:"",x.message.includes(mr)?"":` ${mr}`]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:k,children:"Retry"})]})]}):null,E=s.jsx("div",{role:"status","aria-live":"polite",children:v!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(Wt,{"aria-hidden":"true"}),"This issue is busy. Reading it again…"]}):null});if(h.state==="loading")return s.jsxs(ka,{children:[s.jsx("div",{children:O}),E,Y,!x&&v===null?s.jsxs("div",{className:"mt-4 grid gap-3",role:"status","aria-label":"Loading issue",children:[s.jsx(jt,{className:"h-6 w-40"}),s.jsx(jt,{className:"h-9 w-2/3"}),s.jsx(jt,{className:"h-24 w-full"})]}):null]});const{issue:I,events:Q,at:te}=h,ce=Fk(I),X=g.state==="ok"?g.data:null,L=(X==null?void 0:X.reporter)??I.created_by_username??null,q=j.state==="ok"?Pz(j.data):null,ne=I.status==="resolved"||I.group==="resolved",ae=!!(X!=null&&X.duplicate_of),je=g.state==="loading"?"Loading…":(X==null?void 0:X.routing.owner)??I.owner_title??s.jsx("span",{className:"text-muted-foreground",children:"Unowned"}),re=J=>`${d}?${sl({..._m,collection:J})}`,we=X==null?void 0:X.report,se=!!(we&&(we.actual||we.expected||we.steps.length||we.where)),tt=[...Q].reverse(),ge=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",rs(te)]}),s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:R,children:[s.jsx(kr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsx(ka,{children:s.jsxs("div",{ref:N,className:"contents",children:[s.jsx(Pi,{back:O,id:I.id,badge:s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:ce.tone,children:ce.label}),I.urgent&&!ne?s.jsx(ue,{variant:"warning",children:"Urgent"}):null]}),title:I.title,created:`Reported${L?` by ${L}`:""} · ${qi(I.created_at)}`,actions:ge}),X!=null&&X.duplicate_of?s.jsxs("p",{className:"mt-1 text-sm",children:["Duplicate of"," ",s.jsx(o,{className:"text-primary font-mono hover:underline",href:i(f(X.duplicate_of)),children:X.duplicate_of})]}):null,E,Y,g.state==="loading"?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",role:"status",children:[s.jsx(Wt,{"aria-hidden":"true"}),"Loading the issue's sections"]}):null,s.jsxs("dl",{className:"mt-4 mb-0 flex flex-wrap gap-x-12 gap-y-4","data-testid":"issue-facts",children:[s.jsx(_s,{label:"Owner",value:je}),ae?null:s.jsx(_s,{label:"Release",value:j.state==="loading"?"Loading…":q?s.jsx("span",{className:ie(q.label===q.id&&"font-mono"),children:q.label}):s.jsx("span",{className:"text-muted-foreground",children:"No release yet"})}),s.jsx(_s,{label:"Reported",value:[L,I.created_at?Yn(I.created_at):null].filter(Boolean).join(" · ")})]}),s.jsxs(he,{variant:"info",className:"mt-4",children:[s.jsx(Oo,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Kk}),s.jsx(xe,{children:Xk})]}),g.state==="failed"?s.jsx("div",{className:"mt-6",children:s.jsx(Tx,{what:"this issue's sections",again:"Read the issue again",refusal:g.refusal,on_retry:()=>M("sections")})}):null,X&&se&&we?s.jsxs(Ct,{id:"issue-report",title:"What happens",children:[we.actual?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:we.actual}):null,we.expected?s.jsxs("div",{className:"mt-3",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Expected"}),s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:we.expected})]}):null,we.steps.length?s.jsxs("div",{className:"mt-3",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Steps"}),s.jsx("ol",{className:"list-decimal pl-5 text-sm",children:we.steps.map((J,ke)=>s.jsx("li",{children:J},ke))})]}):null,(He=we.where)!=null&&He.env?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:["Seen on ",we.where.env,we.where.sha?s.jsxs(s.Fragment,{children:[" ","at ",s.jsx("span",{className:"font-mono",children:we.where.sha})]}):null]}):null]}):null,X&&(X.placement.placed||X.placement.unplaced_why)?s.jsx(Ct,{id:"issue-placement",title:"Placement",children:X.placement.placed?s.jsxs("p",{className:"text-sm",children:["Placed in ",X.placement.placed]}):s.jsxs(he,{variant:"warning",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:["Not placed yet: ",X.placement.unplaced_why]})]})}):null,X&&(X.routing.route||X.routing.owner||X.routing.none)?s.jsxs(Ct,{id:"issue-routing",title:"Routing",children:[X.routing.route?s.jsx("p",{className:"text-sm",children:X.routing.route}):null,X.routing.owner?s.jsxs("p",{className:"text-sm",children:["Owner: ",X.routing.owner]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"Owner: none yet"})]}):null,X&&(X.labels.length>0||X.collections.length>0)?s.jsxs(Ct,{id:"issue-labels",title:"Labels and collections",children:[X.labels.length?s.jsx("div",{className:"flex flex-wrap gap-1",children:X.labels.map(J=>s.jsx(ue,{variant:"neutral",size:"dense",children:J},J))}):null,X.collections.length?s.jsx("ul",{className:"mt-2 grid gap-1 text-sm",children:X.collections.map(J=>s.jsxs("li",{children:[s.jsx(o,{className:"text-primary hover:underline",href:i(re(J.collection)),children:J.title}),J.ref?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",J.ref]}):null,s.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",J.resolved," of ",J.total," resolved"]})]},J.collection))}):null]}):null,X&&X.anchors.length>0?s.jsx(Ct,{id:"issue-anchors",title:"Anchors",children:s.jsx(Xf,{label:"Anchors",heads:["Kind","Value","By"],rows:X.anchors.map(J=>[J.kind,s.jsx("span",{className:"font-mono text-xs break-all",children:J.value}),J.by??""])})}):null,X&&X.seen.length>0?s.jsx(Ct,{id:"issue-seen",title:"Seen",aside:`${X.seen.length} of ${Math.max(I.occurrences??0,X.seen.length)} sightings`,children:s.jsx(Xf,{label:"Seen",heads:["When","Where","Who","Note"],rows:X.seen.map(J=>[qi(J.at),s.jsxs(s.Fragment,{children:[J.sha?s.jsx("div",{className:"font-mono text-xs",children:J.sha}):null,J.env?s.jsx("div",{className:"text-muted-foreground text-xs",children:J.env}):null]}),J.who??"",J.note??""])})}):null,tt.length>0?s.jsx(Ct,{id:"issue-history",title:"History",aside:"From the issue store, newest first",children:s.jsx(Xf,{label:"History",heads:["When","Who","What"],rows:tt.map(J=>[qi(J.created_at),J.actor_username??"",wz(J.note,J.kind)])})}):null,s.jsx(Hk,{id:"issue-related",related:j,heading_ref:_,on_retry:()=>M("related"),fixed:!0,link:J=>{const ke=J.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(J.id)}`:J.kind==="task"?`/org/${e}/tasks/${encodeURIComponent(J.id)}?from=issue:${I.id}`:J.kind==="issue"?f(J.id):J.kind==="release"?`/proj/${encodeURIComponent(t)}/releases?${J.planned?"planned":"release"}=${encodeURIComponent(J.id)}`:null;if(J.kind==="task"&&ke){const Ue=_z(J.label);return s.jsxs("div",{className:"min-w-0",children:[s.jsx(o,{className:"text-primary font-mono text-xs hover:underline",href:i(ke),children:J.id}),Ue&&Ue!==J.id?s.jsx("div",{className:"text-muted-foreground line-clamp-1 text-xs",title:Ue,"data-testid":"related-task-title",children:Ue}):null]})}return ke?s.jsx(o,{className:ie("text-primary hover:underline",J.kind!=="thread"&&J.label===J.id&&"font-mono"),href:i(ke),children:J.label}):J.label}})]})})}function Xf({label:e,heads:t,rows:n}){return s.jsx(ot,{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:e,children:[s.jsx(Ke,{children:s.jsx(de,{children:t.map(a=>s.jsx(Z,{children:a},a))})}),s.jsx(Ge,{children:n.map((a,r)=>s.jsx(de,{children:a.map((l,i)=>s.jsx(K,{className:"break-words",children:l},i))},r))})]})})}function Gz({org:e,project:t,issue_id:n,from:a,query:r}){var l;return(l=mn().issues)!=null&&l.issueSections?s.jsx(qz,{org:e,project:t,issue_id:n,from:a,query:r}):s.jsx(zz,{org:e,project:t,issue_id:n,query:r})}function Uu(e,t){u.useEffect(()=>{const n=setInterval(()=>{document.visibilityState==="visible"&&e()},t),a=()=>{document.visibilityState==="visible"&&e()};return document.addEventListener("visibilitychange",a),()=>{clearInterval(n),document.removeEventListener("visibilitychange",a)}},[e,t])}const Wk={integration:"Integration",deploy:"Deploy",publish:"Publish",accept:"Accept",custom:"Custom"},Vz={self_service:"Self-service",managed:"Managed",manager_only:"Manager only"},Yz={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"},Fz={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 Kz(e){return Fz[e??"in_batch"]}function Xz(e){const t=e.turn==="next",n=t?"Next":"Waiting",a=e.batching==="managed"||e.batching==="released"?` · ${e.batching}`:"";return{label:`${n}${a}`,tone:t?"info":"neutral"}}const Zk=(e,t)=>`Holds ${e.toLowerCase()}${t?`: ${t}`:""}`;function Qz(e,t,n,a=!0){return e.fixing_since!==void 0?{label:`Fixing forward since ${es(e.fixing_since)}`,tone:"warning"}:e.ref===t?{label:"Landing",tone:"info"}:a&&e.hold?{label:Zk(n),tone:"info"}:{label:"Running",tone:"info"}}function es(e){return new Date(e*1e3).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Hr(e){const t=Math.round(e/60);if(t<60)return`${t} min`;const n=Math.floor(t/60),a=t%60;return a?`${n} h ${a} min`:`${n} h`}function Wz(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 Zz(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),a=e.teams.length;return a&&n.push(a===1?"1 team":`${a} teams`),n.length?n.join(", "):"Nobody"}}}function Jz(e,t){var o,c;const{policy:n,management:a}=e,r=(o=e.layer)==null?void 0:o.kind,l=d=>Zz(d,t),i=[["Mode",Yz[a.mode]],["Who can join",l(a.joiners)]];return r==="implement"&&i.push(["Managers",l(a.managers)],["Manager lease",Hr(a.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&&i.push(["Promotes to",e.layer.promotes_to]),i.push(["Carries waiting entries",n.ride?"Yes: a done turn carries entries already contained in it":"No"],["Freeze",n.freeze.enabled?`Up to ${Hr(n.freeze.max_seconds)}, ${Hr(n.freeze.default_seconds)} by default`+(e.layer.freezers?` · ${l(e.layer.freezers)}`:""):"Off"],["Fix forward",n.fix_forward?"Yes: a failed turn keeps its turn until fixed":"No"],["Stalled turns",a.stall_takers.kind==="none"?"Nobody takes one":`${l(a.stall_takers)} may take one after ${Hr(n.stall_seconds)}`])),i.push(["Reorder",l(a.reorderers)]),n.max_turns>1&&i.push(["Turns at once",`Up to ${n.max_turns} independent turns`]),i.push(["Turn lease",Hr(n.lease_seconds)],["Time to start",`${Hr(n.start_grace_seconds)} after the turn comes`]),n.entry_limit!==null&&i.push(["Waiting entries",`Up to ${n.entry_limit}`]),n.footprint!=="off"&&i.push(["Footprint",n.footprint==="required"?"Required":"Optional"]),i}const Jk="Where your organization's agents take turns at a shared branch, environment or proposal. One turn runs at a time in each queue.",e1="A task you cannot see",e3="A former member",t3="A member";function t1(){const e=mn().queues;if(!e)throw new Error("The Queues page rendered without the queues seam.");return e}function n3({org:e,open:t,path:n}){var h,m;const a=t1(),{href:r,Link:l}=Xe(),i=a.availability,[o,c]=u.useState({state:"loading"}),d=u.useCallback(async x=>{i&&(x&&c({state:"loading"}),c(await i({fresh:x})))},[i]);u.useEffect(()=>{d(!1)},[d]);const f=!i||o.state==="active";return o.state==="off"&&((h=o.refusal)==null?void 0:h.reason)!=="engine_missing"?s.jsx(Ga,{title:"Page not found",description:"This page does not exist, or you do not have access to it.",backHref:r(`/org/${e}`),backLabel:"Back to the organization",link:l}):s.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:f?s.jsx(a3,{org:e,open:t??null,path:n??`/org/${e}/tasks/queues`}):o.state==="off"&&((m=o.refusal)==null?void 0:m.reason)==="engine_missing"?s.jsx(la,{page:"Queues"}):s.jsxs(s.Fragment,{children:[s.jsx(en,{title:"Queues",description:a.description??Jk}),o.state==="loading"&&s.jsx(n1,{}),(o.state==="error"||o.state==="off")&&s.jsx(Nm,{refusal:o.refusal,on_retry:()=>void d(!0)}),o.state==="available"&&s.jsxs(he,{variant:"info",className:"mt-6",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Tasks are not on for this organization"}),s.jsxs(xe,{children:["Queues hold turns for tasks, so they show once Tasks are on."," ",s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/tasks`),children:"Go to Tasks"})]})]})]})})}function n1(){return s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading queues",children:Array.from({length:3},(e,t)=>s.jsx(jt,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function Nm({refusal:e,on_retry:t}){const n=ds();return(e==null?void 0:e.reason)==="store_locked"?s.jsxs(he,{variant:"info",className:"mt-6",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"The local stores are busy"}),s.jsxs(xe,{children:[s.jsx("p",{children:e.message}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]}):(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(he,{variant:"warning",className:"mt-6",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsx(xe,{children:n})]}):s.jsxs(he,{variant:"destructive",className:"mt-6",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Queues could not be loaded"}),s.jsxs(xe,{children:[s.jsx("p",{children:"The read did not answer. Try again in a moment."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}const Qf=e=>e.status===404||e.reason==="not_found"||e.code==="not_found";function s3(e,t,n,a){return t?e===null?`Not reading · trying again every ${n}s`:`Not reading since ${es(e)} · trying again every ${n}s`:e===null?"Connecting…":`Live · read ${es(e)} · refreshes every ${n}s${a?` · ${a}`:""}`}function a3({org:e,open:t,path:n}){var L;const{listQueues:a,queue:r,members:l,refresh_ms:i,settings_note:o,description:c,read_scope:d,subject_label:f="Task",thread_subjects:h=!1}=t1(),{self_id:m}=dd(),[x,b]=u.useState(null),[v,y]=u.useState(null),[g,p]=u.useState(null),[j,w]=u.useState(null),[N,C]=u.useState({state:"pending",members:[]});u.useEffect(()=>{let q=!0;return l().then(ne=>{q&&C(ae=>ne.ok?{state:"answered",members:ne.data}:{state:"failed",members:ae.members})}),()=>{q=!1}},[l]);const _=u.useMemo(()=>new Map(N.members.map(q=>[q.user_id,q])),[N.members]),S=N.state==="answered"?e3:t3,D=u.useCallback((q,ne)=>{var ae;return(ne==null?void 0:ne.title)??(h?(ne==null?void 0:ne.id)??q:q===m?"You":((ae=_.get(q))==null?void 0:ae.label)??S)},[_,S,m,h]),z=u.useRef({list:{last:null,fresh:!1},detail:{last:null,fresh:!1}}),[P,F]=u.useState(null),[H,A]=u.useState(!1),M=u.useCallback((q,ne)=>{z.current[q]={last:ne,fresh:!0};const{list:ae,detail:je}=z.current;A(ae.last==="failed"||je.last==="failed"),ae.fresh&&je.fresh&&ae.last==="ok"&&je.last==="ok"&&F(Date.now()/1e3)},[]),R=t??((L=x==null?void 0:x.queues[0])==null?void 0:L.id)??null,T=u.useRef(R);u.useEffect(()=>{T.current=R},[R]);const k=u.useRef(0),O=u.useCallback(async()=>{var ae;const q=k.current+=1;z.current.list.fresh=!1;const ne=await a();if(q===k.current)if(ne.ok){if(b(ne.data),y(null),!t){const je=((ae=ne.data.queues[0])==null?void 0:ae.id)??null;je===null?z.current.detail={last:"ok",fresh:!0}:je!==T.current&&(z.current.detail.fresh=!1)}M("list","ok")}else y(ne.refusal),M("list","failed")},[a,t,M]),Y=u.useRef(0),E=u.useCallback(async()=>{const q=Y.current+=1;if(!R)return;z.current.detail.fresh=!1;const ne=await r(R);q===Y.current&&(ne.ok?(p(ne.data),w(null),M("detail","ok")):(w(ne.refusal),Qf(ne.refusal)&&p(null),M("detail",Qf(ne.refusal)?"ok":"failed")))},[R,r,M]);u.useEffect(()=>{O()},[O]),u.useEffect(()=>{p(null),w(null),E()},[E]);const I=u.useCallback(()=>{O(),E()},[O,E]),Q=!x&&(v==null?void 0:v.reason)==="engine_missing",te=u.useCallback(()=>{Q||I()},[Q,I]);if(Uu(te,i),Q)return s.jsx(la,{page:"Queues"});const ce=Math.round(i/1e3),X=j!==null&&Qf(j);return s.jsxs(s.Fragment,{children:[s.jsxs(en,{title:"Queues",description:c??Jk,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:s3(P,H,ce,d)}),s.jsx("span",{className:"sr-only",role:"status",children:H?"Not reading":P===null?"Connecting":"Live"})]}),!x&&!v&&s.jsx(n1,{}),!x&&v&&s.jsx(Nm,{refusal:v,on_retry:I}),x&&x.queues.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(G0,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No queues yet"}),s.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."})]}):x?s.jsxs(s.Fragment,{children:[s.jsx(l3,{path:n,queues:x.queues,open_id:R,name:D,held:h}),X?s.jsxs(he,{variant:"info",className:"mt-6",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This queue is no longer available"}),s.jsx(xe,{children:"It was archived, or you can no longer read its Workspace. Pick another queue above."})]}):g&&g.queue.id===R?s.jsx(i3,{org:e,detail:g,name:D,settings_note:o,subject_label:f,thread_subjects:h}):j?s.jsx(Nm,{refusal:j,on_retry:()=>void E()}):s.jsx(jt,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"})]}):null]})}function km({org:e,subject:t,link:n}){const{href:a,Link:r}=Xe();return!t||t.hidden?s.jsx("span",{className:"text-muted-foreground",children:e1}):t.kind==="task"&&n?s.jsx(r,{className:"text-primary hover:underline",href:a(`/org/${e}/tasks/${t.id}`),children:t.title??t.id}):s.jsx("span",{children:t.title??t.id})}function r3(e,t,n){const a=e.freeze?`frozen until ${es(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 ${es(e.batch.opened_at)}`,a].filter(Boolean).join(" · "),warn:!1};if(e.turn){const r=e.turn.subject,l=r.hidden?e1:r.title??r.id,i=(e.running_count??1)>1?`${e.running_count} turns · `:"",o=e.turn.landing?" landing":"",c=n&&!!e.turn.hold,d=[c?Zk(e.name,e.turn.note):null,e.turn.fixing_since!==void 0?"Fixing forward":null,a].filter(Boolean);return c&&e.turn.fixing_since===void 0&&!a?{primary:`${i}${l}${o}`,secondary:Wf(d.join(" · ")),warn:!1}:{primary:`${i}${l}${o}`,secondary:d.length?Wf(d.join(" · ")):null,warn:d.length>0}}return{primary:"Nothing running",secondary:a?Wf(a):null,warn:!!a}}const Wf=e=>e.charAt(0).toUpperCase()+e.slice(1);function l3({path:e,queues:t,open_id:n,name:a,held:r}){const{href:l,Link:i}=Xe();return s.jsx(ot,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Queues",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Queue"}),s.jsx(Z,{className:"hidden md:table-cell",children:"Step"}),s.jsx(Z,{children:"Running turn"}),s.jsx(Z,{className:"hidden text-right md:table-cell",children:"Waiting"})]})}),s.jsx(Ge,{children:t.map(o=>{var m;const c=o.id===n,d=Wz(o),f=r3(o,a,r),h=o.waiting-(((m=o.batch)==null?void 0:m.remaining)??0);return s.jsxs(de,{"data-testid":"queues-row",className:ie(c&&"bg-accent"),children:[s.jsxs(K,{children:[s.jsx(i,{className:"text-primary hover:underline",href:l(`${e}?queue=${encodeURIComponent(o.id)}`),"aria-current":c?"page":void 0,children:o.name}),d?s.jsx("div",{className:"text-muted-foreground text-xs",children:d}):null,s.jsxs("div",{className:"text-muted-foreground text-xs md:hidden",children:[h," waiting"]})]}),s.jsx(K,{className:"hidden md:table-cell",children:s.jsx(ue,{variant:"neutral",children:Wk[o.policy.step]})}),s.jsxs(K,{children:[s.jsx("div",{className:ie(!o.batch&&!o.turn&&"text-muted-foreground"),children:f.primary}),f.secondary?s.jsx("div",{className:ie("text-xs",f.warn?"text-warning":"text-muted-foreground"),children:f.secondary}):null]}),s.jsx(K,{className:"hidden text-right md:table-cell",children:h})]},o.id)})})]})})}function _c({id:e,title:t,side:n,children:a}){return s.jsxs("section",{"aria-labelledby":e,className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h3",{id:e,className:"text-sm font-semibold",children:t}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]}),a]})}function ly({org:e,entries:t,landing:n,queue_name:a,subject_label:r,held:l,label:i}){return s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(qe,{containerAriaLabel:i,children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:r}),s.jsx(Z,{children:"State"})]})}),s.jsx(Ge,{children:t.map(o=>{const c=Qz(o,n,a,l);return s.jsxs(de,{"data-testid":"queues-running",children:[s.jsxs(K,{children:[s.jsx(km,{org:e,subject:o.subject,link:!l}),l&&o.hold&&o.note&&!o.subject.hidden?s.jsx("div",{className:"text-muted-foreground text-xs",children:o.note}):null]}),s.jsx(K,{children:s.jsx(ue,{variant:c.tone,children:c.label})})]},o.ref)})})]})})}function i3({org:e,detail:t,name:n,settings_note:a,subject_label:r,thread_subjects:l}){var w;const{queue:i,state:o}=t,c=N=>n(N),d=new Map(o.entries.map(N=>[N.ref,N.subject])),f=o.entries.filter(N=>N.turn==="running"),h=o.entries.filter(N=>N.turn!=="running"&&N.batching!=="in_batch"),m=o.batch,x=Math.max(1,f.filter(N=>N.batching!=="in_batch").length),b=m&&i.policy.independent_turns?f.filter(N=>N.batching!=="in_batch"&&N.ref!==m.holder):[],v=o.manager,y=o.freeze,g=((w=i.layer)==null?void 0:w.kind)==="release"?i.layer.stall_hold:void 0,p=g?{who:n(g.by),why:g.reason,until:g.until}:v!=null&&v.hold?{who:n(v.holder,v.holder_subject),why:v.hold.why,until:v.hold.until}:null,j=!m&&f.length===0&&h.length===0;return s.jsxs(ot,{as:"section","aria-labelledby":"queue-title",className:"mt-6 flex shrink-0 flex-col gap-4 p-4","data-testid":"queues-detail",children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{id:"queue-title",className:"text-lg font-semibold",children:i.name}),s.jsx(ue,{variant:"neutral",children:Wk[i.policy.step]}),s.jsx(ue,{variant:"neutral",children:Vz[i.management.mode]})]}),i.purpose?s.jsx("p",{className:"text-muted-foreground text-sm",children:i.purpose}):null]}),v?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm","data-testid":"queues-manager",children:[s.jsx(LT,{className:"text-muted-foreground size-4","aria-hidden":"true"}),s.jsx("span",{className:"text-muted-foreground",children:"Manager"}),s.jsx("span",{className:"font-medium",children:n(v.holder,v.holder_subject)}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Lease until ",es(v.lease_until),v.serving_until!==void 0?" · serving now":""]})]}):null,y?s.jsxs(he,{variant:"warning",children:[s.jsx(AT,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:["Frozen until ",es(y.lease_until)]}),s.jsxs(xe,{children:[n(y.holder,y.holder_subject)," froze this queue at ",es(y.since),y.label?`: ${y.label}`:"",". Only ",n(y.holder,y.holder_subject),"'s entries start until it thaws."]})]}):null,p?s.jsxs(he,{variant:"info",children:[s.jsx(V0,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:["Stall hold until ",es(p.until)]}),s.jsxs(xe,{children:[p.who,p.why?`: ${p.why}`:"",". The first entry is not treated as stalled while it lasts."]})]}):null,j?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running, and nothing waits in this queue."}):s.jsxs(s.Fragment,{children:[m?s.jsxs(_c,{id:"queue-running",title:"Running turn",side:`Batch opened by ${n(m.holder,m.holder_subject)} at ${es(m.opened_at)}`,children:[s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(qe,{containerAriaLabel:"Batch members",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Landing order"}),s.jsx(Z,{children:r}),s.jsx(Z,{children:"Outcome"})]})}),s.jsx(Ge,{children:m.members.map((N,C)=>{const _=Kz(N.outcome);return s.jsxs(de,{"data-testid":"queues-member",children:[s.jsx(K,{children:C+1}),s.jsx(K,{children:s.jsx(km,{org:e,subject:N.subject??d.get(N.ref)??(l?{kind:"thread",id:N.ref}:void 0),link:!l})}),s.jsx(K,{children:s.jsx(ue,{variant:_.tone,children:_.label})})]},N.ref)})})]})}),b.length>0?s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"text-muted-foreground text-xs font-medium",children:"Also running"}),s.jsx(ly,{org:e,entries:b,landing:o.landing,queue_name:i.name,subject_label:r,held:l,label:"Turns running beside the batch"})]}):null]}):s.jsx(_c,{id:"queue-running",title:f.length>1?"Running turns":"Running turn",children:f.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running."}):s.jsx(ly,{org:e,entries:f,landing:o.landing,queue_name:i.name,subject_label:r,held:l,label:"Running turns"})}),s.jsx(_c,{id:"queue-waiting",title:"Waiting",children:h.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing waits."}):s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(qe,{containerAriaLabel:"Waiting entries",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Position"}),s.jsx(Z,{children:r}),s.jsx(Z,{className:"hidden md:table-cell",children:"Joined"}),s.jsx(Z,{children:"Turn"}),s.jsx(Z,{className:"hidden md:table-cell",children:"Note"})]})}),s.jsx(Ge,{children:h.map((N,C)=>{const _=Xz(N);return s.jsxs(de,{"data-testid":"queues-waiting",children:[s.jsx(K,{children:m?x+C+1:N.position}),s.jsx(K,{children:s.jsx(km,{org:e,subject:N.subject,link:!l})}),s.jsx(K,{className:"hidden md:table-cell",children:es(N.joined_at)}),s.jsx(K,{children:s.jsx(ue,{variant:_.tone,children:_.label})}),s.jsx(K,{className:"hidden md:table-cell",children:N.subject.hidden?"":N.note??""})]},N.ref)})})]})})})]}),s.jsx(_c,{id:"queue-settings",title:"Settings",children:s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsx(qe,{containerAriaLabel:"Queue settings",children:s.jsx(Ge,{children:Jz(i,c).map(([N,C])=>s.jsxs(de,{children:[s.jsx(Z,{scope:"row",className:"h-auto w-48 py-2 font-normal",children:N}),s.jsx(K,{children:C})]},N))})})})}),s.jsx("p",{className:"text-muted-foreground text-xs",children:a})]})}const js="__no_parent__";function s1(e,t){const n=new Set([t]);for(let a=!0;a;){a=!1;for(const r of e)r.parent&&n.has(r.parent)&&!n.has(r.key)&&(n.add(r.key),a=!0)}return n}const ho=(e,t)=>(e.label||e.key).localeCompare(t.label||t.key);function dn({id:e,label:t,help:n,error:a,children:r}){const l=[n?`${e}-help`:null,a?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:e,children:t}),r(l),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground text-xs",children:n}):null,a?s.jsx("p",{id:`${e}-error`,className:"text-destructive text-sm",children:a}):null]})}function Sm({label:e,children:t}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-sm leading-none font-medium",children:e}),s.jsx("span",{className:"text-muted-foreground text-sm break-words",children:t})]})}function iy({id:e,label:t,help:n,checked:a,on_change:r}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Vl,{id:e,className:"mt-0.5",checked:a,"aria-describedby":n?`${e}-help`:void 0,onCheckedChange:l=>r(l===!0)}),s.jsx($e,{htmlFor:e,className:"font-normal",children:t})]}),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground pl-6 text-xs",children:n}):null]})}function a1({id:e,legend:t,help:n,error:a,options:r,checked:l,on_change:i,empty:o,notes:c,scroll:d}){const f=[c!=null&&c.length?`${e}-notes`:null,n?`${e}-help`:null,a?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return s.jsxs("fieldset",{className:"m-0 grid min-w-0 gap-2 border-0 p-0","aria-describedby":f,"aria-invalid":a?!0:void 0,children:[s.jsx("legend",{className:"mb-2 text-sm leading-none font-medium",children:t}),c!=null&&c.length?s.jsxs("div",{id:`${e}-notes`,className:"text-warning flex items-start gap-2 text-xs",children:[s.jsx(Qt,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),s.jsx("div",{className:"grid gap-0.5",children:c.map(h=>s.jsx("p",{children:h},h))})]}):null,r.length===0&&o?s.jsx("p",{className:"text-muted-foreground text-sm",children:o}):null,s.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:r.map((h,m)=>s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(Vl,{id:`${e}-${m}`,className:"mt-0.5",checked:l.has(h.value),onCheckedChange:x=>{const b=new Set(l);x===!0?b.add(h.value):b.delete(h.value),i(b)}}),s.jsx($e,{htmlFor:`${e}-${m}`,className:"min-w-0 font-normal break-words",children:h.label})]},h.value))}),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground text-xs",children:n}):null,a?s.jsx("p",{id:`${e}-error`,className:"text-destructive text-sm",children:a}):null]})}function mo({context:e,action:t,title:n="Two-factor sign-in needed",changing:a="Changing the org"}){const r=e.two_factor==="enroll";return s.jsxs(he,{variant:"destructive",role:"alert",children:[s.jsx(TT,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:n}),s.jsxs(xe,{children:[s.jsx("p",{children:r?`Turn on two-factor sign-in in Account Settings, then come back here and ${t}.`:`${a} needs a two-factor sign-in. Sign in again with your authenticator in Account Settings, then come back here and ${t}.`}),s.jsx(V,{asChild:!0,variant:"outline",size:"sm",className:"mt-2 h-auto min-h-8 py-1.5 whitespace-normal text-left",children:s.jsx("a",{href:e.settings_href,target:"_blank",rel:"noreferrer",children:"Open Account Settings in a new tab"})})]})]})}const Fa=e=>e.two_factor==="ok";function Ql({refusal:e,context:t,subject:n,action:a,changing:r,authority_title:l}){if((e==null?void 0:e.kind)==="two_factor")return s.jsx(mo,{context:t,action:a,changing:r,title:`Could not save ${n}`});const i=Fa(t)?null:s.jsx(mo,{context:t,action:a,changing:r});if(!e)return i;const o=e.kind==="changed"?"The org changed since you opened this":e.kind==="authority"?l??`Could not save ${n}`:null;return s.jsxs(s.Fragment,{children:[i,s.jsxs(he,{variant:"destructive",role:"alert",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),o?s.jsx(ye,{children:o}):null,s.jsx(xe,{children:e.message})]})]})}function r1({id:e,value:t,on_change:n,none:a,options:r,described_by:l}){return s.jsxs(pt,{value:t,onValueChange:n,children:[s.jsx(ut,{id:e,"aria-describedby":l,children:s.jsx(xt,{placeholder:"Choose a team"})}),s.jsxs(dt,{children:[a?s.jsx(Re,{value:js,children:a}):null,r.map(i=>s.jsx(Re,{value:i.key,children:i.label||i.key},i.key))]})]})}function Wl(e){const[t,n]=u.useState(!1),[a,r]=u.useState(null);return{saving:t,refusal:a,set_refusal:r,run:async i=>{n(!0),r(null);try{const o=await i();o?r(o):e()}finally{n(!1)}}}}function Zl({saving:e,blocked:t,described_by:n,children:a}){return s.jsx(V,{type:"submit",disabled:e,"aria-disabled":t||void 0,"aria-describedby":t?n:void 0,children:a})}const l1=(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 o3({open:e,chart:t,team:n,save:a,on_close:r,context:l=Jl,scope:i="full",parents:o}){var k;const c=l.host==="hosted",[d,f]=u.useState(""),[h,m]=u.useState(""),[x,b]=u.useState(""),[v,y]=u.useState(js),[g,p]=u.useState({}),{saving:j,refusal:w,set_refusal:N,run:C}=Wl(r),_=((k=t.teams.find(O=>O.parent===null))==null?void 0:k.key)??null;u.useEffect(()=>{e&&(f(""),m((n==null?void 0:n.label)??""),b((n==null?void 0:n.description)??""),y((n==null?void 0:n.parent)??(c&&_&&(!o||o.includes(_))?_:js)),p({}),N(null))},[e,n,N,c,_,o]);const S=O=>{const Y=t.teams.find(E=>E.key===O);return Y?Y.label||Y.key:O??""},D=n?s1(t.teams,n.key):new Set,z=[...t.teams].filter(O=>!D.has(O.key)&&(!o||o.includes(O.key))).sort((O,Y)=>O.key===_?-1:Y.key===_?1:ho(O,Y)),P=n?n.label||n.key:"",F=i==="description",H=!Fa(l),A=n?F?"save the description":"save the team":"add the team",M=O=>{if(O.preventDefault(),H)return;if(!n){const I=c?h.trim():d.trim();if(!I){p(c?{label:"Give the team a name."}:{key:"Give the team a key."});return}if(c&&v===js){p({parent:"Choose the parent team."});return}const Q=c?I:h.trim()||I;C(()=>a({action:"add",kind:"team",key:I,...h.trim()?{label:h.trim()}:{},...x.trim()?{description:x.trim()}:{},...v!==js?{parent:v}:{}},`Team ${Q} added.`));return}if(!F&&!h.trim()){p({label:c?"Give the team a name.":"Give the team a label."});return}const Y=v===js?null:v,E={...!F&&h.trim()!==n.label.trim()?{label:h.trim()}:{},...x.trim()!==(n.description??"").trim()?{description:x.trim()}:{},...!c&&Y!==n.parent?{parent:Y}:{}};if(Object.keys(E).length===0){r();return}C(()=>a({action:"edit",kind:"team",key:n.key,...E},F?`Saved the description of ${P}.`:`Team ${h.trim()} saved.`))},R=n?F?`Edit the description of ${P}`:`Edit team ${P}`:"Add team";let T;return F?T="Say what the team works on. Only the description is yours to change here.":c?T=n?"Rename the team or say what it works on.":"Add a team to the organization.":n?T=s.jsxs(s.Fragment,{children:["Its key, ",s.jsx("span",{className:"font-mono",children:n.key}),", names it in posts and in sdlc org and does not change."]}):T="Add a team to this repository's local org.",s.jsx(pn,{open:e,onOpenChange:O=>O||j?null:r(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:M,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:R}),s.jsx(jn,{children:T})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ql,{refusal:w,context:l,subject:F?"the description":"the team",action:A}),!n&&!c?s.jsx(dn,{id:"org-team-key",label:"Key",help:l1("team",l.host),error:g.key,children:O=>s.jsx(bt,{id:"org-team-key",className:"font-mono",value:d,autoComplete:"off","aria-invalid":g.key?!0:void 0,"aria-describedby":O,onChange:Y=>{f(Y.target.value),p({})}})}):null,F&&n?s.jsx(Sm,{label:"Name",children:n.parent?`${P} · under ${S(n.parent)}`:P}):s.jsx(dn,{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:g.label,children:O=>s.jsx(bt,{id:"org-team-label",value:h,"aria-invalid":g.label?!0:void 0,"aria-describedby":O,onChange:Y=>{m(Y.target.value),p({})}})}),s.jsx(dn,{id:"org-team-description",label:F?"Description":"Description (optional)",children:()=>s.jsx(Dn,{id:"org-team-description",rows:3,placeholder:"What the team does",value:x,onChange:O=>b(O.target.value)})}),F?null:c&&n?s.jsx(Sm,{label:"Parent team",children:n.parent?S(n.parent):"None: the organization itself"}):s.jsx(dn,{id:"org-team-parent",label:"Parent team",help:"Where the team sits; its posts report up through the team above.",error:g.parent,children:O=>s.jsx(r1,{id:"org-team-parent",value:v,on_change:Y=>{y(Y),p({})},none:c?void 0:"No parent (a root team)",options:z,described_by:O})})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:j,onClick:r,children:"Cancel"}),s.jsx(Zl,{saving:j,blocked:H,children:n?j?"Saving…":"Save":j?"Adding…":"Add team"})]})]})})})}const c3=(e,t)=>e.length===t.size&&e.every(n=>t.has(n));function u3({open:e,chart:t,job:n,save:a,on_close:r,context:l=Jl}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(js),[b,v]=u.useState(new Set),[y,g]=u.useState(!1),[p,j]=u.useState(!0),[w,N]=u.useState({}),{saving:C,refusal:_,set_refusal:S,run:D}=Wl(r);u.useEffect(()=>{e&&(o(""),d((n==null?void 0:n.label)??""),h((n==null?void 0:n.description)??""),x((n==null?void 0:n.parent)??js),v(new Set((n==null?void 0:n.fills)??[])),g((n==null?void 0:n.requires_person)??!1),j((n==null?void 0:n.escalable)??!0),N({}),S(null))},[e,n,S]);const z=n?s1(t.job_functions,n.key):new Set,P=[...t.job_functions].filter(R=>!z.has(R.key)).sort(ho),F=[...t.slots].sort(ho).map(R=>({value:R.key,label:R.label||R.key})),H=!Fa(l),A=n?"save the job function":"add the job function",M=R=>{if(R.preventDefault(),H)return;if(!n){if(!i.trim()){N({key:"Give the job function a key."});return}D(()=>a({action:"add",kind:"job_function",key:i.trim(),...c.trim()?{label:c.trim()}:{},...f.trim()?{description:f.trim()}:{},...m!==js?{parent:m}:{},fills:[...b],requires_person:y,escalable:p},`Job function ${c.trim()||i.trim()} added.`));return}if(!c.trim()){N({label:"Give the job function a label."});return}const T=m===js?null:m,k={...c.trim()!==n.label.trim()?{label:c.trim()}:{},...f.trim()!==(n.description??"").trim()?{description:f.trim()}:{},...T!==n.parent?{parent:T}:{},...c3(n.fills,b)?{}:{fills:[...b]},...y!==n.requires_person?{requires_person:y}:{},...p!==n.escalable?{escalable:p}:{}};if(Object.keys(k).length===0){r();return}D(()=>a({action:"edit",kind:"job_function",key:n.key,...k},`Job function ${c.trim()} saved.`))};return s.jsx(pn,{open:e,onOpenChange:R=>R||C?null:r(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:M,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:n?`Edit job function ${n.label||n.key}`:"Add job function"}),s.jsxs(jn,{children:["Its job description: what it does, the slots it fills and who may hold its posts.",n?s.jsxs(s.Fragment,{children:[" ","Its key, ",s.jsx("span",{className:"font-mono",children:n.key}),", does not change."]}):null]})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ql,{refusal:_,context:l,subject:"the job function",action:A}),n?null:s.jsx(dn,{id:"org-function-key",label:"Key",help:l1("job function",l.host),error:w.key,children:R=>s.jsx(bt,{id:"org-function-key",className:"font-mono",value:i,autoComplete:"off","aria-invalid":w.key?!0:void 0,"aria-describedby":R,onChange:T=>{o(T.target.value),N({})}})}),s.jsx(dn,{id:"org-function-label",label:n?"Label":"Label (optional)",error:w.label,children:R=>s.jsx(bt,{id:"org-function-label",value:c,"aria-invalid":w.label?!0:void 0,"aria-describedby":R,onChange:T=>{d(T.target.value),N({})}})}),s.jsx(dn,{id:"org-function-description",label:"Job description (optional)",children:()=>s.jsx(Dn,{id:"org-function-description",rows:3,placeholder:"What this job function does",value:f,onChange:R=>h(R.target.value)})}),s.jsx(dn,{id:"org-function-parent",label:"Parent function",help:"Its posts report to the post of the parent function.",children:R=>s.jsx(r1,{id:"org-function-parent",value:m,on_change:x,none:"No parent (a root function)",options:P,described_by:R})}),s.jsx(a1,{id:"org-function-fills",legend:"Slots it fills",options:F,checked:b,on_change:v,empty:l.host==="hosted"?"This organization has no slots yet.":"This org has no slots yet; add them with sdlc org add slot."}),s.jsx(iy,{id:"org-function-requires-person",label:"Requires a person",help:"Only a person may hold its posts.",checked:y,on_change:g}),s.jsx(iy,{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:p,on_change:j})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:C,onClick:r,children:"Cancel"}),s.jsx(Zl,{saving:C,blocked:H,children:n?C?"Saving…":"Save":C?"Adding…":"Add job function"})]})]})})})}const d3=/^[a-z][a-z0-9_-]{0,63}$/;function f3(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/,"")}function h3({open:e,chart:t,slot:n,save:a,on_close:r,context:l=Jl}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,x]=u.useState(""),[b,v]=u.useState({}),{saving:y,refusal:g,set_refusal:p,run:j}=Wl(r);u.useEffect(()=>{e&&(o((n==null?void 0:n.label)??""),d((n==null?void 0:n.key)??""),h(!1),x((n==null?void 0:n.description)??""),v({}),p(null))},[e,n,p]);const w=!Fa(l),N=n?"save the slot":"add the slot",C=_=>{if(_.preventDefault(),w)return;const S=i.trim();if(n){if(!S){v({label:"Give the slot a label."});return}const z={...S!==(n.label??"").trim()?{label:S}:{},...m.trim()!==(n.description??"").trim()?{description:m.trim()}:{}};if(Object.keys(z).length===0){r();return}j(()=>a({action:"edit",kind:"slot",key:n.key,...z},`Saved slot ${S}.`));return}const D={...S?{}:{label:"Give the slot a label."},...d3.test(c)?t.slots.some(z=>z.key===c)?{key:`Slot ${c} already exists.`}:{}:{key:"Use lowercase letters, digits, _ and -, starting with a letter, at most 64 characters."}};v(D),!(D.label||D.key)&&j(()=>a({action:"add",kind:"slot",key:c,label:S,...m.trim()?{description:m.trim()}:{}},`Added slot ${S}.`))};return s.jsx(pn,{open:e,onOpenChange:_=>_||y?null:r(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:C,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:n?`Edit ${n.label||n.key}`:"Add slot"}),s.jsx(jn,{children:"A slot is a workflow role a project fills from its team's posts. Job functions name the slots they fill."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ql,{refusal:g,context:l,subject:"the slot",action:N}),s.jsx(dn,{id:"org-slot-label",label:"Label",help:"How the slot is named on the chart and in project settings.",error:b.label,children:_=>s.jsx(bt,{id:"org-slot-label",value:i,"aria-invalid":b.label?!0:void 0,"aria-describedby":_,onChange:S=>{o(S.target.value),!n&&!f&&d(f3(S.target.value)),v({})}})}),n?s.jsx(Sm,{label:"Key",children:s.jsx("span",{className:"font-mono",children:n.key})}):s.jsx(dn,{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:b.key,children:_=>s.jsx(bt,{id:"org-slot-key",className:"font-mono",value:c,autoComplete:"off","aria-invalid":b.key?!0:void 0,"aria-describedby":_,onChange:S=>{d(S.target.value),h(!0),v({})}})}),s.jsx(dn,{id:"org-slot-description",label:"Description (optional)",children:()=>s.jsx(Dn,{id:"org-slot-description",rows:3,placeholder:"What this role does",value:m,onChange:_=>x(_.target.value)})})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:y,onClick:r,children:"Cancel"}),s.jsx(Zl,{saving:y,blocked:w,children:n?y?"Saving…":"Save":y?"Adding…":"Add slot"})]})]})})})}function m3({open:e,chart:t,binding:n,names:a,save:r,confirm:l,on_close:i,context:o=Jl,hosted:c}){var H;const[d,f]=u.useState(new Set),[h,m]=u.useState(""),[x,b]=u.useState({}),{saving:v,refusal:y,set_refusal:g,run:p}=Wl(i),j=(n==null?void 0:n.slot)??null;if(u.useEffect(()=>{!e||!n||(f(new Set(c&&n.source!=="override"?[]:n.posts.map(A=>A.post))),m(n.source==="override"?n.reason??"":""),b({}),g(null))},[e,j,g]),!n)return null;const w=a.slot(n.slot),N=(H=t.project)!=null&&H.team?t.teams.find(A=>{var M;return A.key===((M=t.project)==null?void 0:M.team)}):void 0,C=N?N.label||N.key:"the owning team",_=new Set(t.job_functions.filter(A=>A.fills.includes(n.slot)).map(A=>A.key)),S=[...t.posts].map(A=>A.post).sort(a.byPost).map(A=>{const M=_.has(A.split("/")[1]??"")?`${a.post(A)} (fills ${w})`:a.post(A),R=c==null?void 0:c.holders(A);return{value:A,label:c?R?`${M}: ${R}`:`${M} (no holder)`:M}}),D=c?[...d].sort(a.byPost).flatMap(A=>[..._.has(A.split("/")[1]??"")?[]:[`${a.post(A)} is not in the job description of ${w}.`],...c.chain.has(A.split("/")[0]??"")?[]:[`${a.post(A)} is outside ${c.owner} and the teams above it.`]]):[],z=!Fa(o),P=A=>{A.preventDefault();const M={...d.size===0?{posts:"Choose at least one post."}:{},...h.trim()?{}:{reason:"Give the reason for the override."}};b(M),!(M.posts||M.reason||z)&&p(()=>r({action:"bind",slot:n.slot,posts:[...d],reason:h.trim()},`Override of ${w} saved.`))},F=async()=>{await l({title:`Clear the override of ${w}?`,description:c?`${w} 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})&&p(()=>r({action:"unbind",slot:n.slot},`Override of ${w} cleared.`))};return s.jsx(pn,{open:e,onOpenChange:A=>A||v?null:i(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:P,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsxs(yn,{children:["Override ",w]}),s.jsxs(jn,{children:["Bind ",w," 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."]})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y||z?s.jsx("div",{id:"org-override-refusal",className:"grid gap-4",children:s.jsx(Ql,{refusal:y,context:o,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,s.jsx(a1,{id:"org-override-posts",legend:"Posts",help:c?`(fills ${w}) marks the posts whose job function fills ${w}.`:"A post outside its job description is marked on the chart.",notes:D,scroll:!!c,error:x.posts,options:S,checked:d,on_change:A=>{f(A),b(M=>({...M,posts:void 0}))}}),s.jsx(dn,{id:"org-override-reason",label:"Reason",error:x.reason,children:A=>s.jsx(Dn,{id:"org-override-reason",rows:2,placeholder:"Why this slot needs other posts",value:h,"aria-invalid":x.reason?!0:void 0,"aria-describedby":A,onChange:M=>{m(M.target.value),b(R=>({...R,reason:void 0}))}})}),c?null:s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Made as ",s.jsx("span",{className:"font-mono",children:"person:user"}),", who must hold the lead post of ",C," or of a team above it."]})]}),s.jsxs(vn,{className:"mt-6",children:[n.source==="override"?s.jsx(V,{type:"button",variant:"ghost",className:"sm:mr-auto",disabled:v,onClick:()=>void F(),children:"Clear override"}):null,s.jsx(V,{type:"button",variant:"outline",disabled:v,onClick:i,children:"Cancel"}),s.jsx(Zl,{saving:v,blocked:z,described_by:"org-override-refusal",children:v?"Saving…":"Save override"})]})]})})})}function p3(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function x3({open:e,chart:t,names:n,save:a,on_close:r,context:l}){var A;const i=t.authority,o=u.useMemo(()=>i?new Set(i.post_pairs):null,[i]),c=M=>!o||o.has(M),d=((A=t.teams.find(M=>M.parent===null))==null?void 0:A.key)??null,f=[...t.teams].filter(M=>!o||[...o].some(R=>R.startsWith(`${M.key}/`))).sort((M,R)=>M.key===d?-1:R.key===d?1:ho(M,R)),[h,m]=u.useState(""),[x,b]=u.useState(""),[v,y]=u.useState({}),{saving:g,refusal:p,set_refusal:j,run:w}=Wl(r);u.useEffect(()=>{var M;e&&(m(((M=f[0])==null?void 0:M.key)??""),b(""),y({}),j(null))},[e,j]);const N=new Set(t.posts.filter(M=>M.post.startsWith(`${h}/`)).map(M=>M.post.split("/")[1])),C=[],_=M=>{for(const R of[...t.job_functions].filter(T=>T.parent===M).sort(ho))C.push(R),_(R.key)};_(null);const S=C.filter(M=>c(`${h}/${M.key}`)&&!N.has(M.key)),D=h!==""&&S.length===0,z=!Fa(l)||D,P=M=>{if(M.preventDefault(),z)return;const R={...h?{}:{team:"Choose a team."},...x?{}:{job:"Choose a job function."}};y(R),!(R.team||R.job)&&w(()=>a({action:"add",kind:"post",key:`${h}/${x}`},`Added post ${n.job(x)} · ${n.team(h)}.`))},F=D?"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.",H=(i==null?void 0:i.ask)??[];return s.jsx(pn,{open:e,onOpenChange:M=>M||g?null:r(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:P,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Add post"}),s.jsx(jn,{children:"A post is a job function staffed in a team. People in this post report to the post above it."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ql,{refusal:p,context:l,subject:"the post",action:"add the post"}),s.jsx(dn,{id:"org-post-team",label:"Team",help:"The team the post is in.",error:v.team,children:M=>s.jsxs(pt,{value:h,onValueChange:R=>{m(R),b(""),y({})},children:[s.jsx(ut,{id:"org-post-team","aria-describedby":M,"aria-invalid":v.team?!0:void 0,children:s.jsx(xt,{placeholder:"Choose a team"})}),s.jsx(dt,{children:f.map(R=>s.jsx(Re,{value:R.key,children:R.label||R.key},R.key))})]})}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(dn,{id:"org-post-function",label:"Job function",help:F,error:v.job,children:M=>s.jsxs(pt,{value:x,disabled:D,onValueChange:R=>{b(R),y({})},children:[s.jsx(ut,{id:"org-post-function","aria-describedby":M,"aria-invalid":v.job?!0:void 0,children:s.jsx(xt,{placeholder:D?"Every job function has a post here":"Choose a job function"})}),s.jsx(dt,{children:S.map(R=>s.jsx(Re,{value:R.key,children:R.label||R.key},R.key))})]})}),i&&!i.administer?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Only the job functions directly below a post you hold are listed.",H.length?` For others, ask ${p3(H)}.`:""]}):null]})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:g,onClick:r,children:"Cancel"}),s.jsx(Zl,{saving:g,blocked:z,described_by:D?"org-post-function-help":void 0,children:g?"Adding…":"Add post"})]})]})})})}function g3({open:e,chart:t,post:n,names:a,members:r,save:l,on_close:i,context:o}){const[c,d]=u.useState({state:"loading"}),[f,h]=u.useState(""),[m,x]=u.useState(null),[b,v]=u.useState(-1),{saving:y,refusal:g,set_refusal:p,run:j}=Wl(i),w=u.useRef(0),N=u.useCallback(async()=>{const E=w.current+=1;d({state:"loading"});const I=await r();E===w.current&&d(I.ok?{state:"read",members:I.data}:{state:"failed"})},[r]);u.useEffect(()=>{e&&(h(""),x(null),v(-1),p(null),N())},[e,N,p]);const C=t.posts.find(E=>E.post===n);if(!n||!C)return null;const _=a.post(n),S=new Set(C.holders.map(E=>E.id)),z=t.posts.some(E=>E.reports_to===n)&&C.holders.length>0?C.holders[0]:null,P=f.trim().toLowerCase(),F=c.state==="read"?c.members.filter(E=>!S.has(E.id)).filter(E=>!P||[E.label,E.detail,E.email].some(I=>I==null?void 0:I.toLowerCase().includes(P))):[],H=c.state==="read"&&c.members.every(E=>S.has(E.id)),A=c.state==="read"&&!H&&F.length>0,M=A&&b>=0&&b<F.length?F[b]:null,R=E=>`org-holder-option-${E.id}`,T=!Fa(o)||!m||z!==null,k=E=>{if(!A)return;const I=F.length-1,Q=te=>{var ce,X;E.preventDefault(),v(te),(X=(ce=document.getElementById(R(F[te])))==null?void 0:ce.scrollIntoView)==null||X.call(ce,{block:"nearest"})};E.key==="ArrowDown"?Q(Math.min(M?b+1:0,I)):E.key==="ArrowUp"?Q(M?Math.max(b-1,0):I):E.key==="Home"&&M?Q(0):E.key==="End"&&M?Q(I):E.key==="Enter"&&M&&(m==null?void 0:m.id)!==M.id&&(E.preventDefault(),x(M))},O=z?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.",Y=E=>{E.preventDefault(),!(T||!m)&&j(()=>l({action:"hold",post:n,member:m.id},`Added ${m.label} to ${_}.`))};return s.jsx(pn,{open:e,onOpenChange:E=>E||y?null:i(),children:s.jsx(xn,{children:s.jsxs("form",{onSubmit:Y,noValidate:!0,children:[s.jsxs(gn,{children:[s.jsxs(yn,{children:["Add holder to ",_]}),s.jsx(jn,{children:"The member holds this post and reports as it does."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ql,{refusal:g,context:o,subject:"the holder",action:"add the holder"}),z?s.jsxs(he,{variant:"info",id:"org-holder-one",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsxs(xe,{children:["This post takes one holder. Remove ",a.member(z)," first, then add the new holder."]})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"org-holder-member",children:"Member"}),s.jsx(bt,{id:"org-holder-member",role:"combobox","aria-expanded":A,"aria-controls":A?"org-holder-members":void 0,"aria-activedescendant":M?R(M):void 0,"aria-autocomplete":"list","aria-describedby":O?"org-holder-member-help":void 0,placeholder:"Search members by name, username or email",autoComplete:"off",value:f,disabled:z!==null,onChange:E=>{h(E.target.value),v(-1)},onKeyDown:k}),s.jsx("div",{className:"max-h-56 overflow-y-auto rounded-md border",children:c.state==="loading"?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 px-3 py-2 text-sm",role:"status",children:[s.jsx(Wt,{className:"size-4","aria-hidden":"true"}),"Loading members…"]}):c.state==="failed"?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2",children:[s.jsx("p",{className:"text-destructive text-sm",children:"Could not read the members."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void N(),children:"Retry"})]}):H?s.jsx("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"Every member already holds this post."}):F.length===0?s.jsxs("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:["No member matches “",f.trim(),"”."]}):s.jsx("ul",{id:"org-holder-members",role:"listbox","aria-label":"Members",className:"m-0 list-none p-1",children:F.map((E,I)=>{const Q=(m==null?void 0:m.id)===E.id,te=(M==null?void 0:M.id)===E.id;return s.jsxs("li",{id:R(E),role:"option","aria-selected":Q,className:`cursor-pointer rounded-sm px-2 py-1.5 ${Q?"bg-accent text-accent-foreground":te?"bg-muted":"hover:bg-muted"} ${te?"ring-ring ring-2 ring-inset":""}`,onClick:()=>{z||(v(I),x(E))},children:[s.jsxs("div",{className:"text-sm font-medium break-words",children:[E.label,E.detail&&F.filter(ce=>ce.label===E.label).length>1?` (${E.detail})`:""]}),E.email?s.jsx("div",{className:"text-muted-foreground text-xs break-all",children:E.email}):null]},E.id)})})}),O?s.jsx("p",{id:"org-holder-member-help",className:"text-muted-foreground text-xs",children:O}):null]})]}),s.jsxs(vn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:y,onClick:i,children:"Cancel"}),s.jsx(Zl,{saving:y,blocked:T,described_by:z?"org-holder-one":O?"org-holder-member-help":void 0,children:y?"Adding…":"Add holder"})]})]})})})}function i1(e){const[t,n]=u.useState(null),a=u.useRef(t);u.useEffect(()=>{a.current=t},[t]);const r=u.useCallback(c=>{var d;(d=a.current)==null||d.resolve(c),n(null)},[]),l=u.useCallback(c=>new Promise(d=>{var f;(f=a.current)==null||f.resolve(!1),n({...c,resolve:d})}),[]);u.useEffect(()=>()=>{var c;return(c=a.current)==null?void 0:c.resolve(!1)},[]);const i=!Fa(e),o=s.jsx(Gp,{open:t!==null,onOpenChange:c=>c?null:r(!1),children:s.jsxs(Vp,{children:[s.jsxs(Yp,{children:[s.jsx(Kp,{children:t==null?void 0:t.title}),s.jsx(Xp,{className:"whitespace-pre-line",children:t==null?void 0:t.description})]}),t&&i?s.jsx(mo,{context:e,action:t.action}):null,s.jsxs(Fp,{children:[s.jsx(Qp,{children:"Cancel"}),s.jsx(Iw,{variant:t!=null&&t.destructive?"destructive":"default","aria-disabled":i||void 0,onClick:c=>{if(i){c.preventDefault();return}r(!0)},children:t==null?void 0:t.action_label})]})]})});return{confirm:l,confirm_dialog:o}}function pl({label:e,on_edit:t,on_remove:n,items:a}){const r=a??[...t?[{label:"Edit",on_select:t}]:[],...n?[{label:"Remove",on_select:n,destructive:!0}]:[]];return s.jsxs($d,{children:[s.jsx(Od,{asChild:!0,children:s.jsx(V,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`More actions for ${e}`,children:s.jsx(Op,{className:"size-3.5","aria-hidden":"true"})})}),s.jsx(Go,{align:"end",children:r.map(l=>s.jsx(Al,{className:l.destructive?"text-destructive focus:text-destructive":void 0,onSelect:l.on_select,children:l.label},l.label))})]})}function v3({label:e,message:t,bound:n,on_dismiss:a}){return s.jsxs(he,{variant:"destructive",role:"alert",className:"mb-3",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsxs(ye,{children:[e," was not removed"]}),s.jsxs(xe,{children:[s.jsx("p",{children:t}),n!=null&&n.projects.length?s.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(r=>s.jsxs("li",{className:"grid gap-0.5",children:[s.jsxs("a",{className:"text-primary text-sm underline underline-offset-2",href:r.href,children:["Settings of ",r.name]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Override set by ",r.set_by??"a former member"]})]},r.href))}):null,n&&n.more>0?s.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,s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:"Dismiss"})]})]})}const Jl={host:"local",two_factor:"ok",settings_href:""},Bu={open:{label:"Open",tone:"info"},accepted:{label:"Accepted",tone:"success"},rejected:{label:"Rejected",tone:"error"},withdrawn:{label:"Withdrawn",tone:"neutral"}},y3={added:{label:"Added",tone:"success"},changed:{label:"Changed",tone:"warning"},removed:{label:"Removed",tone:"error"}},j3={team:["team","teams"],job_function:["job function","job functions"],slot:["slot","slots"],post:["post","posts"],fill:["fill","fills"]},b3=["team","job_function","slot","post","fill"];function $x(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function o1(e){const t=a=>$x(b3.filter(r=>e[r][a]>0).map(r=>{const l=e[r][a];return`${l} ${j3[r][l===1?0:1]}`}));return[["Adds","adds",t("added")],["Changes","changes",t("changed")],["Removes","removes",t("removed")]].filter(([,,a])=>a).map(([a,r,l],i)=>`${i===0?a:r} ${l}`).join("; ")||"No changes"}function Hu(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function w3(e){const t=`Proposed by ${e.requested_by} on ${Hu(e.requested_at)}`;return e.status==="open"||!e.decided_at?t:`${t} · ${Bu[e.status].label} by ${e.decided_by??"a former member"} on ${Hu(e.decided_at)}`}function _3(e,t){const[n,a]=u.useState(e?{state:"loading"}:{state:"off"});return u.useEffect(()=>{if(!e||!t){e||a({state:"off"});return}let r=!0;return e.list().then(l=>{r&&(l.ok?a({state:"read",proposals:l.data}):l.refusal.status===404||l.refusal.reason==="not_found"?a({state:"off"}):a({state:"failed",message:l.refusal.message}))}),()=>{r=!1}},[e,t]),n}function oy({proposal:e,on_open:t}){const n=Bu[e.status];return s.jsxs("li",{className:"border-b px-4 py-2.5 last:border-b-0","data-testid":"org-proposal",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(V,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-left whitespace-normal",onClick:t,children:e.title}),s.jsx(ue,{variant:n.tone,children:n.label})]}),s.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:[e.status==="open"?`Proposed by ${e.requested_by} on ${Hu(e.requested_at)}`:`${n.label} by ${e.decided_by??"a former member"} on ${Hu(e.decided_at??e.requested_at)}`,` · ${o1(e.counts)}`]})]})}const N3="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 k3({listed:e,on_propose:t,on_open:n}){const[a,r]=u.useState(!1);if(e.state==="off"||e.state==="loading")return null;const l=e.state==="read"?e.proposals:[],i=l.filter(c=>c.status==="open"),o=l.filter(c=>c.status!=="open");return s.jsxs("section",{"aria-labelledby":"org-chart-proposals",className:"mt-6 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[s.jsxs("div",{className:"min-w-0 flex-1 basis-64",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{id:"org-chart-proposals",className:"text-lg font-semibold",children:"Proposals"}),i.length?s.jsx(ue,{variant:"info",children:`${i.length} open`}):null]}),s.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:N3})]}),s.jsxs(V,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(nm,{className:"size-4","aria-hidden":"true"}),"Propose a change"]})]}),s.jsxs("div",{className:"mt-3 grid gap-2",children:[e.state==="failed"?s.jsxs("p",{className:"text-destructive text-sm",role:"alert",children:["Could not read the proposals. ",e.message]}):null,e.state==="read"&&l.length===0?s.jsxs(ot,{className:"flex flex-col items-center gap-2 p-6 text-center",children:[s.jsx(nm,{className:"text-muted-foreground size-5","aria-hidden":"true"}),s.jsx("p",{className:"text-sm font-medium",children:"No proposals yet"}),s.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,i.length?s.jsx(ot,{className:"overflow-hidden",children:s.jsx("ul",{role:"list",className:"m-0 list-none p-0","aria-label":"Open proposals",children:i.map(c=>s.jsx(oy,{proposal:c,on_open:()=>n(c)},c.id))})}):null,o.length?s.jsxs("div",{children:[s.jsxs(V,{type:"button",variant:"ghost",size:"sm","aria-expanded":a,"aria-controls":"org-chart-proposals-decided",onClick:()=>r(c=>!c),children:[a?s.jsx($p,{className:"size-4","aria-hidden":"true"}):s.jsx(fd,{className:"size-4","aria-hidden":"true"}),`Decided (${o.length})`]}),a?s.jsx(ot,{className:"mt-2 overflow-hidden",children:s.jsx("ul",{id:"org-chart-proposals-decided",role:"list",className:"m-0 list-none p-0","aria-label":"Decided proposals",children:o.map(c=>s.jsx(oy,{proposal:c,on_open:()=>n(c)},c.id))})}):null]}):null]})]})}const S3="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 C3({draft:e,on_submit:t,on_discard:n}){var c;const a=((c=e.moved)==null?void 0:c.state)==="conflict"?e.moved.names:null,r=!!e.moved,l=e.total===0?"No changes yet":`${e.total} ${e.total===1?"change":"changes"}`,i=e.total===0||!!a,o=r?Qt:nm;return s.jsxs(he,{variant:r?"warning":"info",role:"status",className:"mt-6",children:[s.jsx(o,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:r?"The org changed while you drafted":"You are drafting a proposal"}),s.jsxs(xe,{children:[s.jsx("p",{id:"org-draft-why",children:a?`The org changed what your draft changes: ${$x(a)}. Discard the draft and start again from the org as it is now.`:r?"We moved your draft onto the org as it is now and kept your changes. Check the chart, then submit again.":S3}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[s.jsx(V,{type:"button",size:"sm","aria-disabled":i||void 0,"aria-describedby":i?a?"org-draft-why":"org-draft-count":void 0,onClick:()=>i?void 0:t(),children:"Submit proposal"}),s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:n,children:"Discard draft"}),s.jsx("span",{id:"org-draft-count",className:"text-muted-foreground text-xs",children:l})]})]})]})}const R3={proposal_empty:"The proposal changes nothing in the org."};function T3({open:e,draft:t,submit:n,on_close:a,on_done:r}){const[l,i]=u.useState(""),[o,c]=u.useState(""),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,b]=u.useState(!1),v=u.useRef(!1);u.useEffect(()=>{e&&(f(null),m(null))},[e]);const y=async g=>{if(g.preventDefault(),v.current)return;const p=l.trim();if(!p||p.length>200){f("Give the proposal a title of at most 200 characters.");return}f(null),m(null),b(!0),v.current=!0;try{const j=await n({title:p,...o.trim()?{note:o.trim()}:{}});if(!j.ok){m(R3[j.refusal.code??""]??j.refusal.message);return}j.data.state==="proposed"&&(i(""),c("")),r(j.data,p)}finally{v.current=!1,b(!1)}};return s.jsx(pn,{open:e,onOpenChange:g=>g?null:a(),children:s.jsx(xn,{className:"sm:max-w-lg",children:s.jsxs("form",{onSubmit:g=>void y(g),className:"grid gap-4",noValidate:!0,children:[s.jsxs(gn,{children:[s.jsx(yn,{children:"Submit proposal"}),s.jsx(jn,{children:"Someone who may make these changes reviews it. Nothing in the organization changes until it is accepted."})]}),h?s.jsxs(he,{variant:"destructive",role:"alert",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not submit the proposal"}),s.jsx(xe,{children:s.jsx("p",{children:h})})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"org-proposal-title",children:"Title"}),s.jsx(bt,{id:"org-proposal-title",value:l,maxLength:200,"aria-invalid":d?!0:void 0,"aria-describedby":d?"org-proposal-title-error":void 0,onChange:g=>i(g.target.value)}),d?s.jsx("p",{id:"org-proposal-title-error",className:"text-destructive text-sm",children:d}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"org-proposal-note",children:"Note (optional)"}),s.jsx(Dn,{id:"org-proposal-note",value:o,rows:3,maxLength:4e3,placeholder:"Why the org should make this change","aria-describedby":"org-proposal-note-help",onChange:g=>c(g.target.value)}),s.jsx("p",{id:"org-proposal-note-help",className:"text-muted-foreground text-xs",children:"At most 4000 characters."})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:o1(t.counts)}),s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),s.jsxs(V,{type:"submit","aria-disabled":x||void 0,children:[x?s.jsx(Wt,{className:"size-4","aria-hidden":"true"}):null,x?"Submitting…":"Submit proposal"]})]})]})})})}const E3=[{kind:"team",title:"Teams"},{kind:"job_function",title:"Job functions"},{kind:"slot",title:"Slots"},{kind:"post",title:"Posts"},{kind:"fill",title:"Fills"}];function A3({entry:e,decided:t}){const n=!t&&e.state==="settled",a=y3[e.change];return s.jsxs("li",{className:"grid gap-1 border-b py-2","data-testid":"org-proposal-entry",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&e.change==="added"?null:s.jsx(ue,{variant:a.tone,children:a.label}),s.jsx("span",{className:"text-sm font-medium",children:e.name}),n?s.jsx(ue,{variant:"neutral",children:"Already in the org"}):null,!t&&e.state==="conflict"?s.jsx(ue,{variant:"error",children:"Changed in the org since"}):null]}),[...e.where,...e.fields,...!t&&e.now?[e.now]:[]].map(r=>s.jsx("p",{className:"text-muted-foreground text-xs break-words",children:r},r))]})}function cy(e,t){if(t.code==="proposal_conflict"&&e){const n=e.entries.filter(a=>a.state==="conflict").map(a=>a.name);if(n.length){const a=`The org changed what this proposal changes: ${$x(n)}.`;if(e.proposal.mine)return`${a} 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?`${a} Reject it, or ${r}`:`${a} 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 M3({proposal:e,contract:t,context:n,check_two_factor:a,on_close:r,on_decided:l}){const[i,o]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(null),[m,x]=u.useState(!1),[b,v]=u.useState(null),[y,g]=u.useState("ok"),[p,j]=u.useState(null),[w,N]=u.useState(""),C=(e==null?void 0:e.id)??null,_=u.useRef(C);_.current=C;const S=u.useCallback(async()=>{if(!C)return;const E=await t.read(C);_.current===C&&(E.ok?(o(E.data),d(null)):d(E.refusal.message))},[t,C]);u.useEffect(()=>{if(o(null),d(null),h(null),x(!1),N(""),!C)return;S(),a().then(g);const E=()=>void a().then(I=>_.current===C&&g(I));return window.addEventListener("focus",E),()=>window.removeEventListener("focus",E)},[C,S,a]);const D=(i==null?void 0:i.proposal)??e,z=(D==null?void 0:D.title)??"",P=(D==null?void 0:D.status)==="open",F=(i==null?void 0:i.entries.some(E=>E.state==="conflict"))??!1,H=!!i&&(i.may_accept||i.may_reject),A=y==="ok",M={...n,two_factor:y},R=async E=>{if(C){v(E),h(null);try{const I=E==="accept"?await t.accept(C):E==="reject"?await t.reject(C,w.trim()||void 0):await t.withdraw(C);if(I.ok){j(null),l(E==="accept"?`Accepted ${z}.`:E==="reject"?`Rejected ${z}.`:`Withdrew ${z}.`);return}if(j(null),I.refusal.code==="mfa_challenge_required"||I.refusal.code==="mfa_enrollment_required"){g(I.refusal.code==="mfa_enrollment_required"?"enroll":"challenge");return}E==="accept"&&x(!0);const Q=await t.read(C);if(_.current!==C)return;const te=Q.ok?Q.data:i;Q.ok&&o(Q.data),h({title:`${z} was not ${E==="accept"?"accepted":E==="reject"?"rejected":"withdrawn"}`,message:cy(te,I.refusal)})}finally{v(null)}}},T=i&&F&&!f?cy(i,{code:"proposal_conflict",message:""}):null,k=P&&i&&i.may_reject&&!i.may_accept&&!F?i.accept_refusal??null:null,O=!A||F||!!k||b!==null,Y=[A?null:"org-proposal-two-factor",F?"org-proposal-refusal":null,k?"org-proposal-accept-refusal":null].filter(Boolean).join(" ");return s.jsxs(s.Fragment,{children:[s.jsx(pn,{open:e!==null,onOpenChange:E=>E?null:r(),children:s.jsxs(xn,{className:"flex max-h-[90vh] flex-col overflow-hidden sm:max-w-2xl",children:[s.jsxs(gn,{children:[s.jsx(yn,{children:z}),s.jsx(jn,{asChild:!0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[D?s.jsx(ue,{variant:Bu[D.status].tone,children:Bu[D.status].label}):null,s.jsx("span",{children:D?w3(D):null})]})})]}),s.jsxs("div",{className:"-mx-1 grid min-h-0 flex-1 gap-4 overflow-y-auto px-1","data-testid":"org-proposal-body",children:[D!=null&&D.note?s.jsx("p",{className:"text-sm whitespace-pre-line",children:D.note}):null,D!=null&&D.decision_note?s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-sm font-medium",children:"Decision note"}),s.jsx("p",{className:"text-muted-foreground text-sm whitespace-pre-line",children:D.decision_note})]}):null,c?s.jsxs(he,{variant:"destructive",role:"alert",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not read the proposal"}),s.jsx(xe,{children:s.jsx("p",{children:c})})]}):null,!i&&!c?s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Reading the proposal…"}):null,i?E3.map(E=>{const I=i.entries.filter(Q=>Q.kind===E.kind);return I.length?s.jsxs("div",{className:"grid",children:[s.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:E.title}),s.jsx("ul",{role:"list",className:"m-0 list-none p-0",children:I.map(Q=>s.jsx(A3,{entry:Q,decided:!P},`${Q.kind}:${Q.name}`))})]},E.kind):null}):null,P&&i&&!H&&i.decide_refusal?s.jsxs(he,{variant:"info",role:"status",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"You can't accept or reject this proposal"}),s.jsx(xe,{children:s.jsx("p",{children:i.decide_refusal})})]}):null,k?s.jsxs(he,{id:"org-proposal-accept-refusal",variant:"info",role:"status",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"You can't accept this proposal"}),s.jsx(xe,{children:s.jsx("p",{children:k})})]}):null,P&&H&&!A?s.jsx("div",{id:"org-proposal-two-factor",children:s.jsx(mo,{context:M,action:"decide the proposal",changing:"Accepting or rejecting a proposal"})}):null,f||T?s.jsxs(he,{id:"org-proposal-refusal",variant:"destructive",role:"alert",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:(f==null?void 0:f.title)??(m?`${z} was not accepted`:`${z} can't be accepted`)}),s.jsx(xe,{children:s.jsx("p",{children:(f==null?void 0:f.message)??T})})]}):null]}),s.jsxs(vn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:r,children:"Close"}),P&&(i!=null&&i.may_withdraw)?s.jsx(V,{type:"button",variant:"outline",onClick:()=>j("withdraw"),children:"Withdraw proposal"}):null,P&&(i!=null&&i.may_reject)?s.jsx(V,{type:"button",variant:"outline",onClick:()=>j("reject"),children:"Reject"}):null,P&&i&&(i.may_accept||i.may_reject&&(F||k))?s.jsxs(V,{type:"button","aria-disabled":O||void 0,"aria-describedby":Y||void 0,onClick:()=>O?void 0:void R("accept"),children:[b==="accept"?s.jsx(Wt,{className:"size-4","aria-hidden":"true"}):null,b==="accept"?"Accepting…":"Accept"]}):null]})]})}),s.jsx(Gp,{open:p!==null,onOpenChange:E=>E?null:j(null),children:s.jsxs(Vp,{children:[s.jsxs(Yp,{children:[s.jsx(Kp,{children:p==="reject"?`Reject ${z}?`:`Withdraw ${z}?`}),s.jsx(Xp,{children:p==="reject"?`${(D==null?void 0:D.requested_by)??"The requester"} sees your note on the proposal.`:"Nobody can accept it after this."})]}),p==="reject"&&!A?s.jsx("div",{id:"org-proposal-reject-two-factor",children:s.jsx(mo,{context:M,action:"reject the proposal",changing:"Accepting or rejecting a proposal"})}):null,p==="reject"?s.jsxs("div",{className:"grid gap-2",children:[s.jsx($e,{htmlFor:"org-proposal-reject-note",children:"Note (optional)"}),s.jsx(Dn,{id:"org-proposal-reject-note",value:w,rows:2,maxLength:4e3,placeholder:"Why you are rejecting it",onChange:E=>N(E.target.value)})]}):null,s.jsxs(Fp,{children:[s.jsx(Qp,{children:"Cancel"}),p==="reject"?s.jsx(V,{type:"button",variant:"destructive","aria-disabled":!A||b!==null||void 0,"aria-describedby":A?void 0:"org-proposal-reject-two-factor",onClick:()=>!A||b?void 0:void R("reject"),children:b==="reject"?"Rejecting…":"Reject proposal"}):s.jsx(V,{type:"button","aria-disabled":b!==null||void 0,onClick:()=>b?void 0:void R("withdraw"),children:b==="withdraw"?"Withdrawing…":"Withdraw"})]})]})})]})}const $3={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."},O3="Covered: someone holds a post that fills the slot. Vacant: posts fill it but nobody holds them. Uncovered: no job function fills it.",D3=4,Ox=e=>({paddingLeft:16+24*Math.min(e,D3)}),Iu={covered:{label:"Covered",tone:"success"},vacant:{label:"Vacant",tone:"warning"},uncovered:{label:"Uncovered",tone:"error"}};function z3(){const e=mn().org;if(!e)throw new Error("The Org chart page rendered without the org seam.");return e}function L3({host:e="local",org:t=""}={}){const n=z3(),[a,r]=u.useState({state:"loading"}),[l,i]=u.useState(null),o=u.useRef(0),c=u.useRef(null),d=u.useCallback(k=>{const O=async Y=>{const E=o.current+=1;c.current&&clearTimeout(c.current);const I=await n.chart();if(E!==o.current)return;if(I.ok){i({chart:I.data,at:new Date().toISOString()}),r({state:"read"});return}const{refusal:Q}=I;if(Q.reason==="no_local_org"){i(null),r({state:"none",seedable:Q.seedable!==!1});return}if(e==="hosted"&&(Q.reason==="not_found"||Q.status===404)){i(null),r({state:"missing"});return}if(Q.retry&&Q.reason==="store_locked"&&Y>0){const te=Q.retry_after??10;r({state:"busy",retry_after:te}),c.current=setTimeout(()=>void O(Y-1),te*1e3);return}r({state:"failed",refusal:Q})};return O(k)},[n,e]);u.useEffect(()=>(d(1),()=>{o.current+=1,c.current&&clearTimeout(c.current)}),[d]);const f=()=>void d(1),h=a.state==="none"||a.state==="missing"?null:l,{href:m}=Xe(),x=Nr(),b=m("/settings/account"),v=n.proposals,y=_3(v,(h==null?void 0:h.at)??null),g=!!v&&y.state!=="off",[p,j]=u.useState(null),[w,N]=u.useState(!1),[C,_]=u.useState(null),{confirm:S,confirm_dialog:D}=i1(Jl),z=u.useMemo(()=>p&&v?{draft:p,change:v.draft.change,on_draft:j}:null,[p,v]),P=Y3(n,f,(p==null?void 0:p.chart)??(h==null?void 0:h.chart)??B3,e,b,z),F=n.twoFactor,H=u.useCallback(async()=>F?F():"ok",[F]),A=!!p&&p.total>0,M=u.useRef(()=>{});M.current=()=>{v==null||v.draft.discard(),j(null)},u.useEffect(()=>{if(!A)return;let k=!0;const O=I=>{I.preventDefault()},Y=()=>{k=!1,window.removeEventListener("beforeunload",O),document.removeEventListener("click",E,!0)},E=I=>{var q,ne;if(!k||I.defaultPrevented||I.button!==0||I.metaKey||I.ctrlKey||I.shiftKey||I.altKey)return;const Q=I.target,te=(q=Q==null?void 0:Q.closest)==null?void 0:q.call(Q,"a[href]"),ce=te?null:(ne=Q==null?void 0:Q.closest)==null?void 0:ne.call(Q,U3);let X=null;if(te&&te.target!=="_blank"&&!te.hasAttribute("download")){const ae=new URL(te.href,window.location.href),je=ae.pathname===window.location.pathname&&ae.search===window.location.search;ae.origin===window.location.origin&&!je&&(X=()=>window.location.assign(ae.href))}else ce&&ce.getAttribute("aria-current")!=="page"&&ce.getAttribute("aria-disabled")!=="true"&&!ce.hasAttribute("disabled")&&(X=()=>ce.click());if(!X)return;I.preventDefault(),I.stopPropagation();const L=X;S({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"}).then(ae=>{ae&&(Y(),M.current(),L())})};return window.addEventListener("beforeunload",O),document.addEventListener("click",E,!0),Y},[A,S]);const R=async()=>{if(!v)return;const k=await v.draft.begin();k.ok?j(k.data):x.error(k.refusal.message)},T=async()=>{(!(p&&p.total>0)||await S({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"}))&&(v==null||v.draft.discard(),j(null))};return a.state==="missing"?s.jsx(X3,{org:t}):s.jsx(Ck,{children:s.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:[s.jsx(en,{title:"Org chart",description:$3[e]}),a.state==="busy"&&!h?s.jsxs("p",{className:"text-muted-foreground mt-4 text-sm",role:"status",children:["Another sdlc command holds the repository store; reading again in ",a.retry_after," s."]}):null,(a.state==="loading"||a.state==="busy")&&!h?s.jsx(F3,{quiet:a.state==="busy"}):null,a.state==="none"?s.jsx(K3,{edit:(P==null?void 0:P.actions)??null,seedable:a.seedable}):null,a.state==="failed"?s.jsx(W3,{host:e,kept_at:(h==null?void 0:h.at)??null,on_retry:f}):null,h&&p?s.jsx(C3,{draft:p,on_submit:()=>N(!0),on_discard:()=>void T()}):h&&g?s.jsx(k3,{listed:y,on_propose:()=>void R(),on_open:_}):null,h?s.jsx(Z3,{chart:(p==null?void 0:p.chart)??h.chart,host:e,edit:(P==null?void 0:P.actions)??null}):null,(P==null?void 0:P.dialogs)??null,v&&p?s.jsx(T3,{open:w,draft:p,submit:v.draft.submit,on_close:()=>N(!1),on_done:(k,O)=>{if(N(!1),k.state==="moved"){j(k.draft);return}j(null),x.success(`Proposed ${O}.`),f()}}):null,v&&g?s.jsx(M3,{proposal:C,contract:v,context:{host:e,two_factor:"ok",settings_href:b},check_two_factor:H,on_close:()=>_(null),on_decided:k=>{x.success(k),_(null),f()}}):null,D]})})}const U3='[data-sidebar="menu-button"]:not([aria-expanded]), [data-sidebar="menu-sub-button"]',B3={org:"",workflow:!1,teams:[],job_functions:[],slots:[],posts:[],members:[],slot_resolution:[],project:{team:null,roots:[]}};function H3(e){var i;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=((i=e.teams.find(o=>o.parent===null))==null?void 0:i.key)??null,a=new Set(t.teams),r=new Set(t.team_descriptions),l=new Set(t.posts);return{functions:t.administer,team_add:a.size>0,team:o=>o===n?t.administer?"root":r.has(o)?"description":null:a.has(o)?"full":r.has(o)?"description":null,post_add:t.post_pairs.length>0,post:o=>l.has(o),override:!1,slots:t.administer}}function I3(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 P3={functions:!0,team_add:!0,team:()=>"description",post_add:!0,post:()=>!0,override:!1,slots:!0};function Id({mark:e}){return e?e==="added"?s.jsx(ue,{variant:"success",children:"Added"}):s.jsx(ue,{variant:"warning",children:"Changed"}):null}const q3={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."},G3={mfa_challenge_required:"challenge",mfa_enrollment_required:"enroll"};function V3(e,t,n){var c;const a=t==="hosted"&&!!n.authority,r=((c=n.authority)==null?void 0:c.two_factor)??!0,[l,i]=u.useState("ok"),o=u.useCallback(async()=>{a&&i(e.twoFactor?await e.twoFactor():r?"ok":"challenge")},[e,a,r]);return u.useEffect(()=>{if(!a){i("ok");return}r?i("ok"):o();const d=()=>void o();return window.addEventListener("focus",d),()=>window.removeEventListener("focus",d)},[a,r,o]),{state:l,set_state:i,check:o}}function Y3(e,t,n,a,r,l=null){const i=Nr(),o=c1(n),c=V3(e,a,n),d=l?{host:a,two_factor:"ok",settings_href:r}:a==="hosted"?{host:a,two_factor:c.state,settings_href:r}:Jl,{confirm:f,confirm_dialog:h}=i1(d),[m,x]=u.useState(null),[b,v]=u.useState({}),y=T=>v(k=>{if(!k[T])return k;const{[T]:O,...Y}=k;return Y}),g=e.members,p=u.useCallback(async()=>{if(!g)return{ok:!1};const T=await g();return T.ok?{ok:!0,data:T.data}:{ok:!1}},[g]),j=l?async T=>{const k=await l.change(T);return k.ok?(l.on_draft(k.data),{ok:!0,data:{}}):k}:e.change;if(!j||!l&&a==="hosted"&&(!n.authority||!I3(n)))return null;const w=l?P3:H3(n),N=T=>{const k=T.code?G3[T.code]:void 0;return k?(c.set_state(k),{kind:"two_factor",message:T.message}):T.code==="revision_conflict"?(t(),{kind:"changed",message:T.message}):T.code==="outside_authority"?(t(),{kind:"authority",message:T.message}):{message:T.message}},C=T=>T.action==="hold"||T.action==="release"?"posts":"kind"in T?T.kind==="team"?"teams":T.kind==="post"?"posts":T.kind==="slot"?"slots":"functions":null,_=(T,k)=>{if(l)return;const O=T==null?void 0:T.warning;O?i.error(O):i.success(k),t()},S=async(T,k)=>{const O=await j(T);if(!O.ok)return N(O.refusal);const Y=C(T);return Y&&y(Y),_(O.data,k),null},D=T=>{c.check(),x(T)},z=async(T,k,O,Y)=>{const E=await j(O);if(!E.ok){const I=N(E.refusal),Q=E.refusal.bound,te=Q?Q.projects.length+Q.more:0,ce=Q?`${Q.kind==="slot"?"Slot":"Post"} ${k} is still needed by the ${te===1?"override of 1 project that binds":`overrides of ${te} projects that bind`} it. Clear ${te===1?"it":"them"} on each project's Settings first.`:I.message;v(X=>({...X,[T]:{label:k,message:ce,...Q?{bound:Q}:{}}}));return}y(T),_(E.data,Y)},P=async(T,k,O)=>{const Y=T==="team"?"team":"job function";c.check(),(l||await f({title:`Remove ${Y} ${O}?`,description:q3[a],action_label:"Remove",destructive:!0,action:`remove the ${Y}`}))&&await z(T==="team"?"teams":"functions",O,{action:"remove",kind:T,key:k},`${T==="team"?"Team":"Job function"} ${O} removed.`)},F=async T=>{const k=T.label||T.key;c.check(),(l||await f({title:`Remove slot ${k}?`,description:"Projects stop showing it. This can't be undone.",action_label:"Remove slot",destructive:!0,action:"remove the slot"}))&&await z("slots",k,{action:"remove",kind:"slot",key:T.key},`Removed slot ${k}.`)},H=async T=>{const k=o.post(T);c.check(),(l||await f({title:`Remove post ${k}?`,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 z("posts",k,{action:"remove",kind:"post",key:T},`Removed post ${k}.`)},A=async(T,k)=>{const O=o.post(T),Y=o.member(k),E=n.posts.find(X=>X.post===T),Q=((E==null?void 0:E.holders.length)??0)<=1?E!=null&&E.escalates_to?` The post becomes vacant. Until someone holds it, its reports and the slots it fills go to ${o.manager(E.escalates_to)}.`:" The post becomes vacant.":"";if(c.check(),!await f({title:`Remove ${Y} from ${O}?`,description:`They stop holding this post and no longer report through it.${Q}`,action_label:"Remove",action:"remove the holder"}))return;const ce=await j({action:"release",post:T,member:k.id});if(!ce.ok){i.error(N(ce.refusal).message),t();return}y("posts"),_(ce.data,`Removed ${Y} from ${O}.`)},M=()=>x(null),R=(m==null?void 0:m.kind)==="override"&&n.project&&n.project.team!==null?n.project.slots.find(T=>T.slot===m.slot)??null:null;return{actions:{can:w,host:a,drafting:!!l,...l?{marks:l.draft.marks}:{},team:(T,k="full")=>D({kind:"team",team:T,scope:k}),job:T=>D({kind:"function",job:T}),override:T=>D({kind:"override",slot:T}),slot:T=>D({kind:"slot",slot:T}),slot_remove:T=>void F(T),remove:(T,k,O)=>void P(T,k,O),post_add:()=>D({kind:"post"}),post_remove:T=>void H(T),holder_add:T=>D({kind:"holder",post:T}),holder_remove:(T,k)=>void A(T,k),refused:T=>{const k=b[T];return k?s.jsx(v3,{label:k.label,message:k.message,bound:k.bound,on_dismiss:()=>y(T)}):null}},dialogs:s.jsxs(s.Fragment,{children:[s.jsx(o3,{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:!l&&n.authority?n.authority.teams:void 0,save:S,on_close:M,context:d}),s.jsx(u3,{open:(m==null?void 0:m.kind)==="function",chart:n,job:(m==null?void 0:m.kind)==="function"?m.job:null,save:S,on_close:M,context:d}),s.jsx(m3,{open:R!==null,chart:n,binding:R,names:o,save:S,confirm:T=>f({...T,action:"clear the override"}),on_close:M}),s.jsx(h3,{open:(m==null?void 0:m.kind)==="slot",chart:n,slot:(m==null?void 0:m.kind)==="slot"?m.slot:null,save:S,on_close:M,context:d}),s.jsx(x3,{open:(m==null?void 0:m.kind)==="post",chart:n,names:o,save:S,on_close:M,context:d}),s.jsx(g3,{open:(m==null?void 0:m.kind)==="holder",chart:n,post:(m==null?void 0:m.kind)==="holder"?m.post:null,names:o,members:p,save:S,on_close:M,context:d}),h]})}}function F3({quiet:e=!1}){return s.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)=>s.jsx(jt,{className:n===3?"h-10 w-2/3":"h-10 w-full"},n))})}function xl({children:e}){return s.jsx("pre",{className:"bg-muted text-foreground m-0 overflow-x-auto rounded-md border px-3 py-2 font-mono text-sm",children:s.jsx("code",{children:e})})}function K3({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 s.jsxs(he,{variant:"info",className:"mt-6",children:[s.jsx(Ts,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"This repository has no local org yet"}),s.jsxs(xe,{children:[s.jsx("p",{children:n}),t||!e?s.jsxs("div",{className:"mt-2 grid w-full gap-2",children:[t?s.jsx(xl,{children:"sdlc org seed"}):null,e?null:s.jsx(xl,{children:"sdlc org add team <key>"})]}):null,e?s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>e.team(null),children:[s.jsx(Tl,{className:"size-4","aria-hidden":"true"}),"Add team"]}):null]})]})}function X3({org:e}){const{href:t,Link:n}=Xe();return s.jsx(Ga,{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 Q3(e){return new Date(e).toDateString()===new Date().toDateString()?`today at ${cs(e)}`:`on ${Yn(e)} at ${cs(e)}`}function W3({host:e,kept_at:t,on_retry:n}){const a=t?`The chart read ${Q3(t)} is kept below. `:"";return s.jsxs(he,{variant:"destructive",className:"mt-6",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:e==="hosted"?"Could not read the org chart":"Could not read the local org"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[a,e==="hosted"?a?"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."]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function c1(e){return u.useMemo(()=>{const t=new Map(e.teams.map(y=>[y.key,y.label||y.key])),n=new Map(e.job_functions.map(y=>[y.key,y.label||y.key])),a=new Map(e.slots.map(y=>[y.key,y.label||y.key])),r=new Map(e.posts.map(y=>[y.post,y.holders])),l=y=>y.label||y.id,i=new Map;for(const y of[...e.members,...e.posts.flatMap(g=>g.holders)]){const g=l(y);i.set(g,(i.get(g)??new Set).add(`${y.kind}:${y.id}`))}const o=y=>{var g;return(((g=i.get(l(y)))==null?void 0:g.size)??0)>1},c=y=>{const g=o(y)?y.detail??y.id:null;return g&&g!==l(y)?g:null},d=y=>{const g=c(y);return g&&g!==l(y)?`${l(y)} (${g})`:l(y)},f=y=>{const[g="",p=""]=y.split("/");return{team:t.get(g)??g,job:n.get(p)??p}},h=y=>{const{team:g,job:p}=f(y);return`${p} · ${g}`},m=y=>{if(y==="top")return"Top of the org";if(typeof y!="string")return`A vacant ${n.get(y.vacant)??y.vacant}`;const g=(r.get(y)??[]).map(d);return g.length?`${h(y)} (${g.join(", ")})`:h(y)},x=new Map(e.teams.map(y=>[y.key,y.parent])),b=y=>{let g=0;for(let p=x.get(y);p&&g<e.teams.length;p=x.get(p))g+=1;return g};return{parts:f,post:h,member:d,memberLabel:l,memberDetail:c,manager:m,byPost:(y,g)=>{const[p="",j=""]=[y.split("/")[0],g.split("/")[0]],[w,N]=[f(y),f(g)];return b(p)-b(j)||w.team.localeCompare(N.team)||w.job.localeCompare(N.job)},slot:y=>a.get(y)??y,job:y=>n.get(y)??y,team:y=>t.get(y)??y}},[e])}function tr({id:e,title:t,description:n,actions:a,children:r,anchor:l}){const i=u.useRef(null);return u.useEffect(()=>{var o,c;!l||typeof window>"u"||window.location.hash!==`#${l}`||((o=i.current)==null||o.scrollIntoView({block:"start"}),(c=i.current)==null||c.focus({preventScroll:!0}))},[l]),s.jsxs("section",{id:l,"aria-labelledby":e,className:"mt-8 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[s.jsxs("div",{className:"min-w-0 flex-1 basis-64",children:[s.jsx("h2",{id:e,ref:i,tabIndex:l?-1:void 0,className:"text-lg font-semibold",children:t}),s.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:n})]}),a?s.jsx("div",{className:"flex shrink-0 gap-2",children:a}):null]}),s.jsx("div",{className:"mt-3",children:r})]})}function Ni({children:e,on_click:t}){return s.jsxs(V,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(Tl,{className:"size-4","aria-hidden":"true"}),e]})}const uy={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 Z3({chart:e,host:t,edit:n}){const a=c1(e),r=e.members.some(l=>l.kind==="agent");return s.jsxs(s.Fragment,{children:[s.jsxs(tr,{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?s.jsx(Ni,{on_click:n.post_add,children:"Add post"}):void 0,children:[n==null?void 0:n.refused("posts"),s.jsx(tL,{chart:e,names:a,agents:r,host:t,edit:n})]}),s.jsx(tr,{id:"org-chart-members",title:"Members",description:r?`${uy[t]} Each agent answers to the nearest person in its reporting chain.`:uy[t],children:s.jsx(lL,{chart:e,names:a,host:t,agents:r})}),n?s.jsxs(tr,{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.can.team_add?s.jsx(Ni,{on_click:()=>n.team(null),children:"Add team"}):void 0,children:[n.refused("teams"),s.jsx(J3,{chart:e,edit:n})]}):null,s.jsxs("div",{className:"grid items-start gap-x-6 xl:grid-cols-2",children:[s.jsxs(tr,{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?s.jsx(Ni,{on_click:()=>n.job(null),children:"Add job function"}):void 0,children:[n!=null&&n.can.functions?n.refused("functions"):null,s.jsx(iL,{chart:e,names:a,edit:n!=null&&n.can.functions?n:null})]}),s.jsxs(tr,{id:"org-chart-slots",anchor:"slots",title:"Slots",description:O3,actions:n!=null&&n.can.slots&&e.slot_resolution.length>0?s.jsx(Ni,{on_click:()=>n.slot(null),children:"Add slot"}):void 0,children:[n!=null&&n.can.slots?n.refused("slots"):null,e.workflow===!1?s.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,s.jsx(cL,{chart:e,names:a,host:t,edit:n!=null&&n.can.slots?n:null})]})]}),e.project?s.jsx(dL,{project:e.project,chart:e,names:a,edit:n!=null&&n.can.override?n:null}):null]})}function J3({chart:e,edit:t}){var c;const n=Dx([...e.teams].sort((d,f)=>(d.label||d.key).localeCompare(f.label||f.key)),d=>d.key,d=>d.parent);if(n.length===0)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"No teams yet."});const a=((c=e.project)==null?void 0:c.team)??null,r=t.host==="hosted",l=(d,f)=>{const h=t.can.team(d.key);return h==="full"?s.jsx(pl,{label:f,on_edit:()=>t.team(d),on_remove:()=>t.remove("team",d.key,f)}):h==="root"?s.jsx(pl,{label:f,on_edit:()=>t.team(d,"description")}):h==="description"&&t.drafting?s.jsx(pl,{label:f,items:[{label:"Edit description",on_select:()=>t.team(d,"description")}]}):h==="description"?s.jsx(V,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`Edit the description of ${f}`,onClick:()=>t.team(d,"description"),children:s.jsx(md,{className:"size-3.5","aria-hidden":"true"})}):null},i=(d,f)=>s.jsx("ul",{role:"list",className:f===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:d.map(({item:h,children:m})=>{var b;const x=h.label||h.key;return s.jsxs("li",{children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b py-2 pr-4",style:Ox(f),"data-testid":"org-chart-team",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:x}),s.jsx(Id,{mark:(b=t.marks)==null?void 0:b.teams[h.key]})]}),s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[r?null:s.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:h.key}),a===h.key?s.jsx(ue,{variant:"neutral",children:"Owns this project"}):null,l(h,x)]})]}),m.length>0?i(m,f+1):null]},h.key)})}),o=r&&e.teams.length===1;return s.jsxs(s.Fragment,{children:[s.jsx(ot,{className:"overflow-hidden",children:i(n,0)}),o?s.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 Dx(e,t,n){const a=new Set(e.map(t)),r=new Map(e.map(i=>[t(i),{item:i,children:[]}])),l=[];for(const i of e){const o=n(i),c=r.get(t(i));o&&a.has(o)&&o!==t(i)?r.get(o).children.push(c):l.push(c)}return l}const eL={local:"No posts yet.",hosted:"No posts yet. An org admin can add them."};function tL({chart:e,names:t,agents:n,host:a,edit:r}){const l=Dx([...e.posts].sort((c,d)=>t.byPost(c.post,d.post)),c=>c.post,c=>typeof c.reports_to=="string"&&c.reports_to!=="top"?c.reports_to:null);if(l.length===0){const c=a==="hosted"&&(r==null?void 0:r.can.functions)&&!r.can.post_add;return s.jsx("p",{className:"text-muted-foreground text-sm",children:r!=null&&r.can.post_add?"No posts yet. Add a post to staff a job function in a team.":c?"No posts yet. Add a job function under Function tree first, then add a post to staff it in a team.":eL[a]})}const i=new Map(e.members.map(c=>[`${c.kind}:${c.id}`,c])),o=(c,d)=>s.jsx("ul",{role:"list",className:d===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:c.map(({item:f,children:h})=>{var v;const{team:m}=t.parts(f.post),x=typeof f.reports_to=="object"?f.reports_to:null,b=!!(r!=null&&r.can.post(f.post));return s.jsxs("li",{children:[s.jsxs("div",{className:"border-b py-2 pr-4",style:Ox(d),"data-testid":"org-chart-post",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(yR,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{className:"text-sm font-medium",children:t.parts(f.post).job}),s.jsx("span",{className:"text-muted-foreground text-xs",children:x?`${m} · Reports to a vacant ${t.job(x.vacant)}`:m}),s.jsx(Id,{mark:(v=r==null?void 0:r.marks)==null?void 0:v.posts[f.post]}),b&&r?s.jsx("span",{className:"ml-auto",children:s.jsx(pl,{label:t.post(f.post),items:[...r.drafting?[]:[{label:"Add holder",on_select:()=>r.holder_add(f.post)}],{label:"Remove post",on_select:()=>r.post_remove(f.post),destructive:!0}]})}):null]}),s.jsx("div",{className:"mt-1 grid min-w-0 gap-1 pl-6",children:f.holders.length===0?s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ue,{variant:Iu.vacant.tone,children:Iu.vacant.label}),s.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(y=>s.jsx(aL,{holder:y,post:f.post,member:i.get(`${y.kind}:${y.id}`),names:t,agents:n,host:a,on_remove:b&&r&&!r.drafting?()=>r.holder_remove(f.post,y):void 0},`${y.kind}:${y.id}`))})]}),h.length>0?o(h,d+1):null]},f.post)})});return s.jsx(ot,{className:"overflow-hidden",children:o(l,0)})}function nL(e){return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function sL(e){if(!e.held_since)return null;const t=nL(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 aL({holder:e,post:t,member:n,names:a,agents:r,host:l,on_remove:i}){const o=e.kind==="person"?Dp:Mp,c=n==null?void 0:n.posts.find(b=>b.post===t),d=n==null?void 0:n.posts.find(b=>b.primary),f=a.memberDetail(e);let h=null;c!=null&&c.dotted&&d?h=`Dotted line: primary manager is ${a.manager(d.reports_to)}`:e.kind==="agent"&&n&&"accountable_person"in n&&(h=n.accountable_person?`Accountable person ${a.member(n.accountable_person)}`:"No accountable person");const m=l==="hosted"?sL(e):null,x=a.memberLabel(e);return s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[s.jsx(o,{className:"text-muted-foreground size-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{className:"text-sm font-medium break-all",children:x}),i?s.jsxs(Rk,{children:[s.jsx(Tk,{asChild:!0,children:s.jsx(V,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`Remove ${a.member(e)} from ${a.post(t)}`,onClick:i,children:s.jsx(xd,{className:"size-3.5","aria-hidden":"true"})})}),s.jsxs(Nx,{children:["Remove ",x]})]}):null,f?s.jsx("span",{className:"text-muted-foreground text-xs break-all",children:f}):null,r?s.jsx("span",{className:"text-muted-foreground text-xs",children:e.kind==="person"?"Person":"Agent"}):null]}),h?s.jsx("div",{className:"pl-5.5 text-xs",children:h}):null,m?s.jsx("div",{className:"text-muted-foreground pl-5.5 text-xs",children:m}):null]})}const rL=["sdlc org hold <team>/<function> --person <id>","sdlc org hold <team>/<function> --agent <id>"];function lL({chart:e,names:t,host:n,agents:a}){if(e.members.length===0)return n==="hosted"?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No one holds a post yet."}):s.jsxs("div",{className:"grid max-w-2xl gap-2",children:[s.jsx("p",{className:"text-muted-foreground text-sm",children:"No one holds a post yet. Give a post to a person or an agent:"}),rL.map(l=>s.jsx(xl,{children:l},l))]});const r=[...e.members].sort((l,i)=>l.kind===i.kind?t.memberLabel(l).localeCompare(t.memberLabel(i))||l.id.localeCompare(i.id):l.kind==="person"?-1:1);return s.jsx(ot,{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Members",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Member"}),s.jsx(Z,{children:"Posts"}),s.jsx(Z,{children:"Primary manager"}),s.jsx(Z,{children:"Dotted lines"}),a?s.jsx(Z,{children:"Accountable person"}):null]})}),s.jsx(Ge,{children:r.map(l=>{const i=l.posts.find(d=>d.primary),o=l.posts.filter(d=>d.dotted),c=t.memberDetail(l);return s.jsxs(de,{"data-testid":"org-chart-member",children:[s.jsxs(K,{children:[s.jsx("div",{className:"font-medium",children:t.memberLabel(l)}),c?s.jsx("div",{className:"text-muted-foreground text-xs",children:c}):null,a?s.jsx("div",{className:"text-muted-foreground text-xs",children:l.kind==="person"?"Person":"Agent"}):null]}),s.jsx(K,{children:l.posts.map(d=>t.post(d.post)).join(", ")}),s.jsx(K,{children:i?t.manager(i.reports_to):"None"}),s.jsx(K,{children:o.length?o.map(d=>t.manager(d.reports_to)).join(", "):"None"}),a?s.jsx(K,{children:l.kind==="person"?"Not an agent":l.accountable_person?t.member(l.accountable_person):"None"}):null]},`${l.kind}:${l.id}`)})})]})})}function iL({chart:e,names:t,edit:n}){const a=Dx([...e.job_functions].sort((l,i)=>(l.label||l.key).localeCompare(i.label||i.key)),l=>l.key,l=>l.parent);if(a.length===0)return s.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=(l,i)=>s.jsx("ul",{role:"list",className:i===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:l.map(({item:o,children:c})=>{var d;return s.jsxs("li",{children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b py-2 pr-4",style:Ox(i),"data-testid":"org-chart-function",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:o.label||o.key}),s.jsx(Id,{mark:(d=n==null?void 0:n.marks)==null?void 0:d.job_functions[o.key]})]}),s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:o.fills.length?`Fills ${o.fills.map(t.slot).join(", ")}`:"No slot"}),o.requires_person?s.jsx(ue,{variant:"neutral",children:"Requires a person"}):null,n?s.jsx(pl,{label:o.label||o.key,on_edit:()=>n.job(o),on_remove:()=>n.remove("job_function",o.key,o.label||o.key)}):null]})]}),c.length>0?r(c,i+1):null]},o.key)})});return s.jsx(ot,{className:"overflow-hidden",children:r(a,0)})}function oL(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 Pu={covered:0,vacant:1,uncovered:2};function u1(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 cL({chart:e,names:t,host:n,edit:a}){var i;const r=u1(e),l=new Map(e.slots.map(o=>[o.key,o]));if(n==="hosted"&&e.slot_resolution.length===0){const o=((i=e.authority)==null?void 0:i.ask)??[];return s.jsxs(ot,{className:"grid justify-items-center gap-2 p-6 text-center",children:[s.jsx("span",{className:"text-sm font-medium",children:"No slots yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Add the workflow roles your projects fill, such as Implementer or Approver."}),a?s.jsx(Ni,{on_click:()=>a.slot(null),children:"Add slot"}):s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Only an org owner or admin adds slots."," ",o.length?`Ask ${o.slice(0,3).join(", ")} to make this change.`:"Ask an org owner to make this change."]})]})}return s.jsx(ot,{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Slots",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Slot"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Resolves to"}),a?s.jsx(Z,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(Ge,{children:[[...e.slot_resolution].sort((o,c)=>Pu[o.status]-Pu[c.status]||t.slot(o.slot).localeCompare(t.slot(c.slot))).map(o=>{var d,f,h;const c=Iu[o.status];return s.jsxs(de,{"data-testid":"org-chart-slot",children:[s.jsxs(K,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-medium",children:t.slot(o.slot)}),s.jsx(Id,{mark:(d=a==null?void 0:a.marks)==null?void 0:d.slots[o.slot]})]}),n==="hosted"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:o.slot}),(f=l.get(o.slot))!=null&&f.description?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:(h=l.get(o.slot))==null?void 0:h.description}):null]}):null,r.has(o.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.get(o.slot)}):null]}),s.jsx(K,{children:s.jsx(ue,{variant:c.tone,children:c.label})}),s.jsxs(K,{children:[oL(o,t),o.status==="covered"&&o.needs_person?s.jsx("div",{className:"text-muted-foreground text-xs",children:"Needs a person"}):null]}),a&&l.has(o.slot)?s.jsx(K,{className:"text-right",children:s.jsx(pl,{label:t.slot(o.slot),on_edit:()=>a.slot(l.get(o.slot)),on_remove:()=>a.slot_remove(l.get(o.slot))})}):null]},o.slot)}),e.slot_resolution.length===0?s.jsx(de,{children:s.jsx(K,{colSpan:3,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})})}const uL="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.",Zf=["sdlc org own <team>","sdlc org bind <slot> <team>/<function>... --reason <text>","sdlc org unbind <slot>"];function dL({project:e,chart:t,names:n,edit:a}){if(e.team===null){const i=e.roots.map(n.team);return s.jsx(tr,{id:"org-chart-project",title:"This project",description:i.length?`This org has several root teams (${i.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:s.jsx("div",{className:"max-w-2xl",children:s.jsx(xl,{children:i.length?Zf[0]:"sdlc org add team <key>"})})})}const r=u1(t),l=[...e.slots].sort((i,o)=>Pu[i.status]-Pu[o.status]||n.slot(i.slot).localeCompare(n.slot(o.slot)));return s.jsxs(tr,{id:"org-chart-project",title:"This project",description:uL,children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Owning team"}),s.jsx("span",{className:"text-sm font-medium",children:n.team(e.team)})]}),s.jsx(ot,{className:"mt-3 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Slots in this project",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Slot"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Bound to"}),s.jsx(Z,{children:"Source"}),a?s.jsx(Z,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(Ge,{children:[l.map(i=>{const o=Iu[i.status];return s.jsxs(de,{"data-testid":"org-chart-project-slot",children:[s.jsxs(K,{children:[s.jsx("div",{className:"font-medium",children:n.slot(i.slot)}),r.has(i.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.get(i.slot)}):null]}),s.jsx(K,{children:s.jsx(ue,{variant:o.tone,children:o.label})}),s.jsx(K,{children:s.jsx(fL,{binding:i,names:n})}),s.jsx(K,{children:s.jsx(hL,{binding:i})}),a?s.jsx(K,{className:"text-right",children:s.jsx(V,{type:"button",variant:"ghost",size:"control-icon","aria-label":i.source==="override"?`Edit the override of ${n.slot(i.slot)}`:`Override ${n.slot(i.slot)}`,onClick:()=>a.override(i.slot),children:s.jsx(md,{className:"size-3.5","aria-hidden":"true"})})}):null]},i.slot)}),l.length===0?s.jsx(de,{children:s.jsx(K,{colSpan:a?5:4,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})}),a?s.jsxs("div",{className:"mt-3 grid max-w-2xl gap-2",children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Overrides made here are made as ",s.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."]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Change the owning team with sdlc org:"}),s.jsx(xl,{children:Zf[0]})]}):s.jsxs("div",{className:"mt-3 grid max-w-2xl gap-2",children:[s.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:"}),Zf.map(i=>s.jsx(xl,{children:i},i))]})]})}function fL({binding:e,names:t}){const n=[];e.status==="covered"&&e.needs_person&&n.push("Needs a person");for(const r of e.posts)r.off_description&&n.push(`${t.post(r.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 a;return e.posts.length===0?a=e.source==="override"?"The override names no post the org still has":"No job function fills this slot":e.status==="vacant"?a=`${e.posts.map(r=>t.post(r.post)).join(", ")} has no holder`:a=e.posts.map(r=>r.holders.length?`${t.post(r.post)}: ${r.holders.map(t.member).join(", ")}`:`${t.post(r.post)}: no holder`).join("; "),s.jsxs(s.Fragment,{children:[a,n.map(r=>s.jsx("div",{className:"text-muted-foreground text-xs",children:r},r))]})}function hL({binding:e}){var a;if(e.source==="baseline")return s.jsx(s.Fragment,{children:"From job descriptions"});const t=(a=e.set_by)==null?void 0:a.split(":").slice(1).join(":"),n=[e.reason,[t,e.set_at?Yn(e.set_at):null].filter(Boolean).join(", ")].filter(Boolean).join(" · ");return s.jsxs(s.Fragment,{children:["Override",n?s.jsx("div",{className:"text-muted-foreground text-xs",children:n}):null]})}const mL={breaking:"Breaking",new:"New",improved:"Improved",other:"Other changes"},pL=["breaking","new","improved","other"],xL={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 d1(e){return xL[e]??e.replace(/_/g," ")}function gL(e){return e.bump==="major"?"breaking":e.change==="added"?"new":e.change==="changed"?"improved":"other"}function po(e){const t=new Map;let n=0,a=0;for(const l of e){if(l.modeling_only){a+=1;continue}if(!l.bump){n+=1;continue}const i=gL(l);t.set(i,[...t.get(i)??[],l])}return{sections:pL.filter(l=>t.has(l)).map(l=>({key:l,label:mL[l],lines:t.get(l)})),breaking:t.has("breaking"),unlisted_count:n,modeling_only_count:a}}function vL(e,t){const n=[`## ${e}`];t.sections.length===0&&n.push("","No change affects the version.");for(const a of t.sections){n.push("",`### ${a.label}`,"");for(const r of a.lines){const l=r.why?`: ${r.why}`:"";n.push(`- ${r.label} (${d1(r.node_type)})${l}`)}}return`${n.join(`
|
|
391
391
|
`)}
|
|
392
|
-
`}const qs="candidate";function zx(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}const vL="Versioned records of this project's release branch, with notes from its graph changes.";function d1({description:e=vL,actions:t}){return s.jsx(en,{title:"Releases",description:e,actions:t})}function f1(e){var l;if(!e)return"";const t=(l=e.previous_release)==null?void 0:l.version,n=Number(e.version.split("-rc.")[1]??0),a=e.commits_since??n,r=`${e.commits_since===null?"At least ":""}${a} commit${a===1?"":"s"}`;return t?`${r} since ${t}`:`${r} before the first Release`}function Yc({active:e,onClick:t,version:n,badges:a,caption:r,item_ref:l}){return s.jsxs("button",{ref:l,type:"button","aria-current":e?"true":void 0,onClick:t,className:ie("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:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[s.jsx("span",{className:"truncate",children:n}),a]}),s.jsx("span",{className:"text-muted-foreground text-xs",children:r})]})}function Gn({children:e}){return s.jsx("section",{className:"border-border flex flex-col gap-4 rounded-xl border p-4",children:e})}function Fn({title:e,error:t,onRetry:n}){return s.jsxs(he,{variant:"destructive",children:[s.jsx(Qt,{}),e?s.jsx(ye,{children:e}):null,s.jsxs(xe,{className:"flex flex-col items-start gap-2",children:[t,n?s.jsx(V,{variant:"outline",size:"sm",onClick:n,children:"Try again"}):null]})]})}function yL({title:e,text:t}){return s.jsx(Gn,{children:s.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[s.jsx(hd,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",tabIndex:-1,children:e}),s.jsx("p",{className:"text-muted-foreground max-w-md text-sm",children:t})]})})}function jL(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 qu({changes:e}){const t=u.useMemo(()=>mo(e),[e]),[n,a]=u.useState(!1),r=t.unlisted_count+t.modeling_only_count;return s.jsxs("div",{className:"flex flex-col gap-4",children:[t.sections.map(l=>{const i=s.jsx("ul",{className:"flex flex-col gap-2",children:l.lines.map(o=>s.jsx(dy,{line:o},`${o.node_id}:${o.change}`))});return l.key==="breaking"?s.jsxs(he,{variant:"destructive",className:"border-destructive/40",children:[s.jsx(Qt,{}),s.jsx(ye,{children:s.jsx("h3",{className:"text-destructive text-sm font-semibold",children:l.label})}),s.jsx(xe,{className:"text-foreground",children:i})]},l.key):s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:l.label}),i]},l.key)}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Fixed"}),s.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?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No change affects the version."}):null,r>0?s.jsxs("p",{className:"text-muted-foreground text-sm",children:[r," more change",r===1?"":"s"," do",r===1?"es":""," not affect the version."]}):null,e.length>0?s.jsx(V,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":n,onClick:()=>a(l=>!l),children:n?"Hide all changes":"Show all changes"}):null,n?s.jsx("ul",{className:"flex flex-col gap-2",children:e.map(l=>s.jsx(dy,{line:l,detail:!0},`all:${l.node_id}:${l.change}:${l.modeling_only}`))}):null]})}function dy({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 s.jsxs("li",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[e.label,s.jsx(ue,{variant:"outline",children:u1(e.node_type)})]}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]})}const h1="Releases of this checkout: the roadmap of open Planned Releases, the next candidate, and each production release with its notes.",fy=5,Cm="Not available",Rm="planned:";function m1(){const e=ds();return s.jsx("p",{className:"text-muted-foreground text-sm",children:`${Cm}. ${e}`})}const ls=e=>`${Rm}${e}`,bL=e=>e!=null&&e.startsWith(Rm)?e.slice(Rm.length):null,Lx=e=>e?e.slice(0,7):"";function wL(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 _L(){return s.jsxs(he,{variant:"info",children:[s.jsx(Ts,{}),s.jsx(ye,{children:"This page only reads Releases"}),s.jsx(xe,{className:"text-info",children:"A Release is written when production runs a release candidate, once its commit is merged into origin/main."})]})}function NL(e){if(e.state==="unreadable")return{badges:s.jsx(ue,{variant:"error",children:"Could not be read"}),caption:""};if(e.state==="withdrawn")return{badges:s.jsx(ue,{variant:"warning",children:"Withdrawn"}),caption:e.replaced_by?`Replaced by ${e.replaced_by}`:"Withdrawn"};const t=s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:"neutral",children:e.app_changed===!1?"App unchanged":e.previous_release_id?e.bump??"patch":"First"}),e.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),n=e.written_at?zx(e.written_at):"",a=e.tracks&&e.tracks.length>0?` · ${e.tracks.join(", ")}`:"";return{badges:t,caption:`${n}${a}`}}function cr({query:e,select:t,onSelect:n,children:a,inline:r=!1}){return s.jsx("a",{href:`?${e}`,className:r?"text-primary underline":"text-primary hover:underline",onClick:l=>{l.preventDefault(),n(t)},children:a})}function Pd({pairs:e}){const t=e.filter(([,n])=>n!=null&&n!=="");return t.length===0?null:s.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1 text-sm",children:t.map(([n,a])=>s.jsxs(u.Fragment,{children:[s.jsx("dt",{className:"text-muted-foreground",children:n}),s.jsx("dd",{className:"min-w-0",children:a})]},n))})}const Rs=({children:e})=>s.jsx("code",{className:"font-mono text-xs",children:e});function p1(e,t){if(e.judged_commit&&t&&e.judged_commit!==t)return`Judged ${Lx(e.judged_commit)}, not this commit`;const n=e.verdict==="ready"?"Ready":e.verdict==="untested"?"Nothing tested yet":"Not ready",a=e.accepted>0?` · ${e.accepted} failed, accepted`:"";return`${n} · ${e.satisfied} of ${e.total} satisfied${a}`}function qd({title:e,count:t,heading_ref:n}){return s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{ref:n,tabIndex:-1,className:"text-lg font-semibold outline-none",children:e}),t!==void 0?s.jsx("span",{className:"text-muted-foreground text-xs",children:t}):null]})}const kL={ready:"success",verifying:"info",fixing:"warning",abandoned:"warning",ready_older:"neutral",none:"neutral",unknown:"neutral"};function SL({batch:e}){if(e.state==="loading")return s.jsxs(he,{children:[s.jsx(ku,{}),s.jsxs(xe,{className:"flex flex-row items-center gap-2",role:"status",children:[s.jsx(Wt,{"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 s.jsxs(he,{children:[s.jsx(ku,{}),s.jsxs(ye,{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:t.text}),s.jsx(ue,{variant:kL[t.state],children:t.chip})]}),t.help?s.jsx(xe,{children:t.help}):null]})}function CL(e,t,n){return`/org/${e}/issues/${encodeURIComponent(t)}?from=${encodeURIComponent(n)}`}function x1({issues:e,error:t}){return t?s.jsx(Fn,{title:"Known issues could not be read",error:t}):!e||e.length===0?null:s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(qd,{title:"Known issues",count:e.length}),s.jsx("ul",{className:"flex flex-col gap-2",children:e.map(n=>s.jsxs("li",{className:"flex flex-col gap-0.5 text-sm",children:[s.jsxs("span",{children:[n.id,": ",n.title]}),n.accepted_by?s.jsxs("span",{className:"text-muted-foreground text-xs",children:["accepted by ",n.accepted_by]}):null,n.file?s.jsx(Rs,{children:n.file}):null]},n.key))})]})}function g1({tracks:e,error:t}){return t?s.jsx(Fn,{title:"Tracks could not be read",error:t}):!e||e.length===0||e.length===1&&e[0].key==="app"?null:s.jsxs("section",{className:"flex flex-col gap-3",children:[s.jsx(qd,{title:"Tracks",count:e.length}),e.map(n=>n.key==="app"||n.released_by==="release_batch"?s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[n.label,n.version?s.jsx(Rs,{children:n.version}):null,n.bump?s.jsx(ue,{variant:"neutral",children:n.bump}):null]}),s.jsx("span",{className:"text-muted-foreground text-xs",children:"Released with the release batch"})]},n.key):s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[n.label,s.jsxs("span",{className:"text-muted-foreground text-xs",children:[n.packages.length," package",n.packages.length===1?"":"s"]})]}),s.jsx("ul",{className:"flex flex-col gap-1",children:n.packages.map(a=>s.jsxs("li",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Rs,{children:a.name}),s.jsxs(Rs,{children:[a.from??"—"," → ",a.to??"—"]})]}),a.changes.map((r,l)=>s.jsxs("span",{className:"text-muted-foreground text-xs",children:[r.feature,": ",r.entry]},l))]},a.name))}),n.published&&!n.published.recorded?s.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 v1({delivery:e,candidate:t,onSelect:n}){if(!e||e.planned.length===0&&e.outside===0)return null;const a=r=>r.length===0?"—":r.map(l=>l.went?`${l.label} (${l.went})`:l.label).join(", ");return s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(qd,{title:"Planned Releases",count:e.planned.length}),s.jsx("p",{className:"text-muted-foreground text-xs",children:t?"What this candidate would deliver":"What this Release delivered"}),e.planned.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Planned Releases",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Planned Release"}),s.jsx(Z,{children:"Delivered"}),s.jsx(Z,{children:"Not delivered"})]})}),s.jsx(Ge,{children:e.planned.map(r=>s.jsxs(de,{children:[s.jsx(K,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.open&&t?s.jsx(cr,{query:`planned=${encodeURIComponent(r.id)}`,select:ls(r.id),onSelect:n,children:r.name}):s.jsx("span",{children:r.name}),s.jsx(Rs,{children:r.id})]})}),s.jsx(K,{children:a(r.delivered)}),s.jsx(K,{children:a(r.not_delivered)})]},r.id))})]})}):null,e.outside>0?s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.outside," landing",e.outside===1?"":"s"," served no Planned Release."]}):null]})}const RL={thread:"Thread",task:"Task",issue:"Issue",test:"Test"};function y1({rows:e,org:t,from:n,untasked:a}){const{href:r,Link:l}=Xe(),[i,o]=u.useState(!1),c=i?e:e.slice(0,fy),d=f=>f.kind==="task"?s.jsx(l,{className:"text-primary font-mono text-xs hover:underline",href:r(`/org/${t}/tasks/${encodeURIComponent(f.id)}?from=${encodeURIComponent(n)}`),children:f.id}):f.kind==="issue"?s.jsx(l,{className:"text-primary font-mono text-xs hover:underline",href:r(CL(t,f.id,n)),children:f.id}):f.kind==="thread"?s.jsx(l,{className:"text-primary hover:underline",href:r(`${t?`/org/${t}`:""}/threads#thread-${encodeURIComponent(f.id)}`),children:f.label}):f.kind==="test"&&f.url?s.jsx("a",{className:"text-primary hover:underline",href:f.url,target:"_blank",rel:"noreferrer",children:f.label}):s.jsx("span",{children:f.label});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Related",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Kind"}),s.jsx(Z,{children:"Item"}),s.jsx(Z,{children:"How it relates"})]})}),s.jsx(Ge,{children:c.map(f=>s.jsxs(de,{children:[s.jsx(K,{children:RL[f.kind]}),s.jsx(K,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[d(f),f.state&&f.kind!=="thread"?s.jsx("span",{className:"text-muted-foreground text-xs",children:f.state}):null]})}),s.jsx(K,{children:f.relation})]},`${f.kind}:${f.id}`))})]})}),e.length>fy?s.jsx(V,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":i,onClick:()=>o(f=>!f),children:i?"Show fewer":`Show all ${e.length}`}):null,a?s.jsxs("p",{className:"text-muted-foreground text-xs",children:[a," landing",a===1?"":"s"," not tied to a task"]}):null]})}const j1=e=>(e==null?void 0:e.status)===409&&e.reason==="view_outdated";function b1(e){const t=Ux(),[n,a]=u.useState(t!=null&&t.related?{state:"loading"}:null),r=u.useRef(0),l=u.useCallback(async(i=!1)=>{if(!(t!=null&&t.related))return;const o=++r.current;a({state:"loading"});const c=await t.related(e,i?{fresh:!0}:void 0);o===r.current&&a(c.ok?{state:"ready",value:c.data}:{state:"error",error:c.refusal.message,refusal:c.refusal})},[t,e]);return u.useEffect(()=>{l()},[l]),{related:n,read:l}}function w1({related:e,org:t,from:n,onRetry:a}){const r=u.useRef(null),l=u.useRef(!1);if(u.useEffect(()=>{var o;l.current&&(e==null?void 0:e.state)!=="loading"&&(l.current=!1,(o=r.current)==null||o.focus())},[e]),!e)return null;const i=e.state==="ready"?e.value.rows.length:void 0;return s.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":"release-related",children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{id:"release-related",ref:r,tabIndex:-1,className:"text-lg font-semibold outline-none",children:"Related"}),i!==void 0?s.jsx("span",{className:"text-muted-foreground text-xs",children:i}):null]}),e.state==="loading"?s.jsxs("div",{className:"grid gap-2",role:"status","aria-label":"Loading related work",children:[s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-2/3"})]}):e.state==="error"?j1(e.refusal)?s.jsx(m1,{}):s.jsx(Fn,{title:"Related work could not be read",error:e.error,onRetry:()=>{l.current=!0,a()}}):e.value.rows.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):s.jsx(y1,{rows:e.value.rows,org:t,from:n,untasked:e.value.untasked})]})}function TL(e){if(!e||e.of===0)return null;if(e.tasks===0)return s.jsx("span",{className:"text-muted-foreground",children:"none"});const t=Object.entries(e.outcomes);return s.jsxs("span",{children:[e.tasks," of ",e.of," tasks",t.map(([n,a])=>s.jsxs("span",{className:n==="failed"?"text-destructive":void 0,children:[" · ",a," ",n]},n))]})}function _1({planned:e,onSelect:t}){return e?e.open?s.jsx(cr,{query:`planned=${encodeURIComponent(e.id)}`,select:ls(e.id),onSelect:t,children:e.name}):s.jsxs("span",{children:[e.name," ",s.jsx(Rs,{children:e.id})]}):null}function EL({candidate:e,org:t,onSelect:n,notes:a}){const r=Ux(),{related:l,read:i}=b1("candidate"),[o,c]=u.useState(r!=null&&r.candidateBatch?{state:"loading"}:null);u.useEffect(()=>{if(!(r!=null&&r.candidateBatch))return;let f=!0;return r.candidateBatch().then(h=>{f&&(h.ok?c(h.data.batch===null?null:{state:"ready",value:h.data.batch}):c({state:"error",error:h.refusal.message}))}),()=>{f=!1}},[r]);const d=e.readiness??((l==null?void 0:l.state)==="ready"?l.value.readiness:null)??null;return s.jsxs(s.Fragment,{children:[s.jsx(Pd,{pairs:[["Environment",e.environment??"staging"],["Commit",s.jsx(Rs,{children:Lx(e.head_commit_id)},"commit")],["Readiness",d?p1(d,e.head_commit_id):null],["Planned",e.planned_release?s.jsx(_1,{planned:e.planned_release,onSelect:n}):null]]}),o?s.jsx(SL,{batch:o}):null,a,s.jsx(x1,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(g1,{tracks:e.tracks,error:e.tracks_error}),s.jsx(v1,{delivery:e.planned_delivery,candidate:!0,onSelect:n}),s.jsx(w1,{related:l,org:t,from:"release:candidate",onRetry:()=>i(!0)})]})}function AL({release:e,onSelect:t}){const n=e.label??e.version,a=!e.previous_release_id;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:n}),e.state==="withdrawn"?s.jsx(ue,{variant:"warning",children:"Withdrawn"}):s.jsx(ue,{variant:"neutral",children:e.app_changed===!1?"App unchanged":a?"First":e.bump}),e.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),e.state==="withdrawn"&&e.replaced_by?s.jsxs("p",{className:"text-sm",children:["Replaced by"," ",s.jsx(cr,{query:`release=${encodeURIComponent(e.replaced_by)}`,select:e.replaced_by,onSelect:t,inline:!0,children:e.replaced_by})]}):null]})}function ML({release:e,org:t,onSelect:n,notes:a}){const r=e.label??e.version,{related:l,read:i}=b1(r),o=(l==null?void 0:l.state)==="ready"?TL(l.value.previews):null;return s.jsxs(s.Fragment,{children:[s.jsx(Pd,{pairs:[["Environment",e.environment??"production"],["Commit",e.commit?s.jsx(Rs,{children:Lx(e.commit)},"commit"):null],["Readiness",e.readiness?`${p1(e.readiness)} on staging`:null],["Previews",o],["Planned",e.planned_release?s.jsx(_1,{planned:e.planned_release,onSelect:n}):null]]}),a,s.jsx(x1,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(g1,{tracks:e.tracks,error:e.tracks_error}),s.jsx(v1,{delivery:e.planned_delivery,candidate:!1,onSelect:n}),s.jsx(w1,{related:l,org:t,from:`release:${r}`,onRetry:()=>i(!0)})]})}function $L({id:e,summary:t,org:n,onNotFound:a,forecast:r}){var x,b;const l=Ux(),[i,o]=u.useState({state:"loading"}),c=u.useRef(0),d=u.useCallback(async(v=!1)=>{const y=++c.current;if(!(l!=null&&l.plannedRelease)){o({state:"error",error:Cm,refusal:{status:409,message:Cm,reason:"view_outdated"}});return}o({state:"loading"});const g=await l.plannedRelease(e,v?{fresh:!0}:void 0);y===c.current&&o(g.ok?{state:"ready",value:g.data}:{state:"error",error:g.refusal.message,refusal:g.refusal})},[l,e]);u.useEffect(()=>{d()},[d]);const f=i.state==="error"&&(((x=i.refusal)==null?void 0:x.status)===404||((b=i.refusal)==null?void 0:b.reason)==="not_found");if(u.useEffect(()=>{f&&a()},[f,a]),i.state==="loading")return s.jsxs(Gn,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),s.jsx(ue,{variant:"neutral",children:"Planned"})]}),s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Planned Release…"})]});if(i.state==="error")return s.jsxs(Gn,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),j1(i.refusal)?s.jsx(m1,{}):f?null:s.jsx(Fn,{error:i.error,onRetry:()=>void d(!0)})]});const h=i.value,m=h.order===null?null:h.order===1?`Next of ${h.open} open`:`${h.order} of ${h.open} open`;return s.jsxs(Gn,{children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:h.name}),s.jsx(ue,{variant:"neutral",children:"Planned"})]}),h.goal?s.jsx("p",{className:"text-muted-foreground text-sm",children:h.goal}):null]}),s.jsx(Pd,{pairs:[["Planned Release",s.jsx(Rs,{children:h.id},"id")],["Date",h.date],["Order",m],["Members",String(h.members.length)]]}),r,s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"A Planned Release changes through release_plan.py:"}),s.jsxs("pre",{className:"bg-muted rounded-md px-3 py-2 font-mono text-xs",children:["sdlc view --planned ",h.id]})]}),s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(qd,{title:"Members",count:h.members.length}),h.members.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Members",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Member"}),s.jsx(Z,{children:"Level"}),s.jsx(Z,{children:"Tasks"}),s.jsx(Z,{children:"State"})]})}),s.jsx(Ge,{children:h.members.map(v=>{const y=v.tasks.filter(p=>p.state==="done").length,g=v.tasks.filter(p=>p.state!=="done").map(p=>p.id);return s.jsxs(de,{children:[s.jsx(K,{children:v.label}),s.jsx(K,{children:v.level?s.jsx(ue,{variant:"neutral",children:OL(v.level)}):null}),s.jsx(K,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[v.tasks.length>0?s.jsxs("span",{children:[y," of ",v.tasks.length," done"]}):null,g.length>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Open: ",s.jsx(Rs,{children:g.join(", ")})]}):null,v.untracked>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[v.untracked," slice",v.untracked===1?" has":"s have"," no task yet"]}):null]})}),s.jsx(K,{children:v.state})]},v.item)})})]})}):null]}),s.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":"planned-related",children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{id:"planned-related",className:"text-lg font-semibold",children:"Related"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:h.related.length})]}),h.related.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):s.jsx(y1,{rows:h.related,org:n,from:`planned:${h.id}`})]})]})}const OL=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ux(){return mn().releases}const ts={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"},hy=3,DL=["in_progress","not_started","planned","blocked"],Bx="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),Rt=e=>e.charAt(0).toUpperCase()+e.slice(1);function Jf(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(e??""));return t?`${Number(t[3])} ${Bx[Number(t[2])-1]}`:String(e??"")}function N1(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${Bx[t.getMonth()]} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function zL(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${Bx[t.getMonth()]}`}function Gs(e){return e?e.from===e.to&&e.or_later?`${Jf(e.from)} or later`:`${Jf(e.from)} to ${Jf(e.to)}${e.or_later?", or later":""}`:""}function LL(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 k1(e){var h;const t=e??{},n=t.source??{},r=[t.no_date==="no date: no rate"&&n.rate_why?n.rate_why:"",/members estimated$/.test(t.no_date??"")?"":LL(t)].filter(Boolean).join(" · "),l=t.projected?Gs(t.projected):t.no_date??"",i=(h=t.projected)==null?void 0:h.raw,o=!!(i&&t.projected&&(i.from!==t.projected.from||i.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,f=[r,c,o&&i&&t.projected?`corrected for past estimates: raw ${Gs({...i,or_later:t.projected.or_later})}`:"",d?`past forecasts at this coverage: ${d.inside} of ${d.of} inside their range`:""].filter(Boolean);return{lead:l?Rt(l):"",caption:f}}function UL(e){const t=e.kinds??[];return[t.includes("range")?"Not promised":"",e.goal??(t.includes("major")?"No goal yet":"")].filter(Boolean).join(" · ")}function BL(e){var c,d,f,h;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`,a=(e.blocked??[]).length,r=(e.needs_user??[]).length,l=!a&&!r?["none blocked · none waiting on you"]:[a?`${a} blocked`:"",r?`${r} waiting on you`:""],i=((f=e.tasks)==null?void 0:f.untracked_slices)??0;i&&l.push(`${i} slice${i===1?"":"s"} not tasks yet`);const o=((h=e.not_a_member)==null?void 0:h.count)??0;return o&&l.push(`${o} not a member yet`),{lead:n,rest:l.filter(Boolean).join(" · ")}}const S1=e=>String(e??"").replace(/_/g," ");function HL(e){const t=e??{},n=t.kinds??[],a=n.includes("slipped"),r=!a&&t.was&&t.now?Gs(t.was)===Gs(t.now)?`, range still ${Gs(t.now)}`:`, range was ${Gs(t.was)}, now ${Gs(t.now)}`:"",l=[a&&t.was?`was ${Gs(t.was)}`:"",n.includes("scope changed")?`scope changed${r}`:""].filter(Boolean),i=(t.what??[]).slice(-3).map(o=>{const c=o.by&&(o.by.title||o.by.thread||o.by.person);return`${[o.kind,o.label||o.item].filter(Boolean).join(" ")}${c?` by ${c}`:""}${o.why?`: ${o.why}`:""}`});return{head:l.length?Rt(l.join(" · ")):"",what:i}}const gl="roadmap",my={reading:!1,value:null,refusal:null};function IL(e){const[t,n]=u.useState({all:my,mine:my}),a=u.useRef({all:0,mine:0}),r=u.useCallback(async(l,i=!1)=>{if(!(e!=null&&e.roadmap))return;const o=++a.current[l];n(d=>({...d,[l]:{...d[l],reading:!0}}));const c=await e.roadmap({...i?{fresh:!0}:{},...l==="mine"?{mine:!0}:{}});o===a.current[l]&&n(d=>({...d,[l]:c.ok?{reading:!1,value:c.data,refusal:null}:{reading:!1,value:d[l].value,refusal:c.refusal}}))},[e]);return{reads:t,read:r,available:!!(e!=null&&e.roadmap)}}function PL(e,t){return`${e} open${t.length?` · ${t.join(", ")} moved since you looked`:""}`}function qi({children:e}){return s.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 C1=({level:e})=>e?s.jsx(ue,{variant:"neutral",children:Rt(e)}):null;function R1({state:e}){const t=Rt(S1(e));return DL.includes(String(e))?s.jsx("span",{className:"font-medium",children:t}):s.jsx("span",{children:t})}function qL({reads:e,scope:t,onScope:n,onRead:a,org:r,onSelect:l}){var x,b;const i=e[t],o=i.value,c=ds(),d=u.useRef(null),f=u.useRef(!1);u.useEffect(()=>{!i.reading&&!i.value&&!i.refusal&&a(t)},[t,i.reading,i.value,i.refusal,a]),u.useEffect(()=>{var v;f.current&&!i.reading&&(f.current=!1,(v=d.current)==null||v.focus())},[i.reading]);const h=()=>{f.current=!0,a(t,!0)},m=o?[o.as_of?`as of ${N1(o.as_of)}`:"",`${((x=o.source)==null?void 0:x.machine)||"this machine"}'s records`,((b=o.decider)==null?void 0:b.words)??""].filter(Boolean).join(" · "):"";return s.jsxs(Gn,{children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[s.jsx("h2",{ref:d,tabIndex:-1,className:"text-lg font-semibold outline-none",children:"Roadmap"}),m?s.jsx("p",{className:"text-muted-foreground text-xs",children:m}):null]}),s.jsx("div",{role:"group","aria-label":"Roadmap scope",className:"flex gap-2",children:["all","mine"].map(v=>s.jsx(V,{variant:"outline",size:"sm","aria-pressed":t===v,onClick:()=>n(v),children:v==="all"?"All":"Mine"},v))})]}),s.jsx("div",{"aria-live":"polite",children:i.reading?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[s.jsx(Wt,{"aria-hidden":!0,className:"size-4"})," ",Rt(ts.pending),"…"]}):null}),i.refusal&&!i.reading?i.refusal.reason==="no_roadmap"?s.jsx(Fn,{title:ts.failedLead,error:`${Rt(ts.noEngineLead)}. ${c}`}):i.refusal.reason==="refused"?s.jsx(Fn,{title:ts.failedLead,error:i.refusal.message}):s.jsx(Fn,{title:ts.failedLead,error:i.refusal.message,onRetry:h}):null,o?t==="mine"?s.jsx(QL,{mine:o.mine,org:r,onSelect:l}):s.jsx(VL,{read:o,org:r,onSelect:l}):null]})}function GL(e){if(!e||typeof e.seconds_per_day!="number")return"No rate";const t=zL(e.as_of);return`${Math.round(e.seconds_per_day/3600)} task hours a day over the ${e.days} days${t?` to ${t}`:""}`}function VL({read:e,org:t,onSelect:n}){var r,l;const a=e.releases??[];if(!a.length){const[i,o]=ts.noRelease.split(" Create one: ");return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("p",{className:"text-sm",children:i}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Create one in the terminal:"}),s.jsx(qi,{children:o})]})}return s.jsxs(s.Fragment,{children:[s.jsx(Pd,{pairs:[["Forecast from",Rt(`${((r=e.source)==null?void 0:r.machine)||"this machine"}'s task records and rate`)],["Rate",GL(e.rate)],["Not counted",Rt(((l=e.source)==null?void 0:l.not_counted)||"other machines' work")]]}),a.map(i=>s.jsx(YL,{row:i,org:t,onSelect:n},i.id))]})}function YL({row:e,org:t,onSelect:n}){var h,m,x;const a=k1(e.forecast),r=BL(e),l=UL(e),i=`roadmap-${e.id}`,o=e.moved?HL(e.told):null,c=(((h=e.counts)==null?void 0:h.members)??0)===0,d=((m=e.not_a_member)==null?void 0:m.count)??0,f=[l,c&&d?`${d} not a member yet`:""].filter(Boolean).join(" · ");return s.jsxs("section",{"aria-labelledby":i,className:"flex flex-col gap-2 border-t pt-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h3",{id:i,className:"text-base font-semibold",children:s.jsx(cr,{query:`planned=${encodeURIComponent(e.id)}`,select:ls(e.id),onSelect:n,children:e.name})}),e.kinds.map(b=>s.jsx(ue,{variant:"neutral",children:b},b))]}),a.lead||a.caption.length?s.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.lead?s.jsx("p",{className:"text-sm",children:a.lead}):null,a.caption.length?s.jsx("p",{className:"text-muted-foreground text-xs",children:Rt(a.caption.join(" · "))}):null]}):null,f?s.jsx("p",{className:"text-muted-foreground text-sm",children:f}):null,o?s.jsxs(he,{variant:"info",children:[s.jsx(KR,{"aria-hidden":!0}),s.jsx(ye,{children:"Moved since you looked"}),s.jsxs(xe,{className:"text-info flex flex-col gap-0.5",children:[o.head?s.jsx("span",{children:o.head}):null,o.what.map((b,v)=>s.jsx("span",{className:"text-xs",children:b},v))]})]}):null,c?null:s.jsxs("p",{className:"text-sm",children:[r.lead,r.rest?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",r.rest]}):null]}),(x=e.stale_unchecked)!=null&&x.words?s.jsx("p",{className:"text-muted-foreground text-xs",children:Rt(e.stale_unchecked.words)}):null,e.for_you&&e.kinds.includes("major")?s.jsx(FL,{row:e}):null,s.jsx(XL,{row:e,org:t})]})}function FL({row:e}){const t=e.for_you;return!t||!t.proposals.length&&!t.committed_nobody_on.length&&!t.widens_most&&!t.set_goal?null:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h4",{className:"text-sm font-semibold",children:"For you"}),t.proposals.map(a=>{const r=[a.proposed_by_title||a.proposed_by?`by ${a.proposed_by_title||a.proposed_by}`:"",a.reason??""].filter(Boolean).join(": ");return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("p",{className:"text-sm",children:["Proposed: ",a.label||a.item]}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[r?`${Rt(r).replace(/\.$/,"")}. `:"","Accept or reject in the terminal:"]}),s.jsx(qi,{children:a.accept}),s.jsx(qi,{children:a.reject})]},a.item)}),t.committed_nobody_on.map(a=>s.jsxs("p",{className:"text-sm",children:["Nobody on this machine is on ",a.label||a.item,a.level?` (${a.level})`:""]},a.item)),t.widens_most?s.jsxs("p",{className:"text-sm",children:["Widens the range most: ",t.widens_most.label||t.widens_most.item,t.widens_most.high_seconds?s.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?s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("p",{className:"text-sm",children:"Set its goal:"}),s.jsx(qi,{children:t.set_goal})]}):null]})}function T1({next:e,org:t}){const{href:n,Link:a}=Xe(),r=e.tasks[0],l=e.label||e.item;return r?s.jsx(a,{className:"text-primary hover:underline",href:n(`/org/${t}/tasks/${encodeURIComponent(r.id)}?from=roadmap`),children:l}):s.jsx("span",{children:l})}function KL(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?Rt(e.nobody):""}function XL({row:e,org:t}){const[n,a]=u.useState(!1),r=e.next??[];if(!r.length){const o=e.kinds.includes("range")?e.tagged_threads??[]:[];return o.length?s.jsx("p",{className:"text-muted-foreground text-sm",children:o.map(c=>`${c.title}: ${c.words}`).join(", ")}):null}const l=n?r:r.slice(0,hy),i=new Map((e.stale_estimates??[]).map(o=>[o.item,o]));return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h4",{className:"text-sm font-semibold",children:"Next"}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:`Next in ${e.name}`,children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Member"}),s.jsx(Z,{children:"Level"}),s.jsx(Z,{children:"State"}),s.jsx(Z,{children:"Who is on it"})]})}),s.jsx(Ge,{children:l.map(o=>{const c=i.get(o.item);return s.jsxs(de,{children:[s.jsx(K,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(T1,{next:o,org:t}),c?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[Rt(c.words),c.estimate_as_of?` (estimated ${N1(c.estimate_as_of)})`:""]}):null]})}),s.jsx(K,{children:s.jsx(C1,{level:o.level})}),s.jsx(K,{children:s.jsx(R1,{state:o.state})}),s.jsx(K,{children:KL(o,e)})]},o.item)})})]})}),r.length>hy&&!n?s.jsxs(V,{variant:"outline",size:"sm",className:"self-start",onClick:()=>a(!0),children:["Show all ",r.length]}):null,l.some(o=>i.has(o.item))?s.jsx("p",{className:"text-muted-foreground text-xs",children:"Re-forecast it in the terminal: task-record reforecast"}):null]})}function QL({mine:e,org:t,onSelect:n}){const{href:a,Link:r}=Xe();if(!e)return null;const l=e.tasks.filter(i=>i.propose);return s.jsxs(s.Fragment,{children:[s.jsxs("section",{"aria-labelledby":"roadmap-your-work",className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h3",{id:"roadmap-your-work",className:"text-base font-semibold",children:"Your work"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:e.title})]}),e.tasks.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:Rt(ts.noTask)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Your work",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Task"}),s.jsx(Z,{children:"Release"}),s.jsx(Z,{children:"Member"})]})}),s.jsx(Ge,{children:e.tasks.map(i=>{var o,c;return s.jsxs(de,{children:[s.jsx(K,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:a(`/org/${t}/tasks/${encodeURIComponent(i.id)}?from=roadmap`),children:i.id}),s.jsx("span",{className:"text-muted-foreground text-xs",children:[i.title||i.thread,Rt(S1(i.state))].filter(Boolean).join(" · ")})]})}),s.jsx(K,{children:(o=i.members)!=null&&o.length?i.members.map(d=>s.jsx("div",{children:s.jsx(cr,{query:`planned=${encodeURIComponent(d.planned_release)}`,select:ls(d.planned_release),onSelect:n,children:d.name})},d.planned_release)):i.release?s.jsx(cr,{query:`planned=${encodeURIComponent(i.release.planned_release)}`,select:ls(i.release.planned_release),onSelect:n,children:i.release.name}):s.jsx("span",{className:"text-muted-foreground",children:i.words?Rt(i.words):"—"})}),s.jsx(K,{children:(c=i.members)!=null&&c.length?i.members.map(d=>s.jsx(C1,{level:d.level},d.planned_release)):i.not_a_member?s.jsx("span",{className:"text-muted-foreground",children:"Not a member yet"}):null})]},i.id)})})]})}),l.map(i=>{var o;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Propose ",i.id,"'s plan to ",((o=i.release)==null?void 0:o.name)??"its release"," in the terminal:"]}),s.jsx(qi,{children:i.propose??""})]},i.id)})]}),s.jsxs("section",{"aria-labelledby":"roadmap-your-next",className:"flex flex-col gap-2",children:[s.jsx("h3",{id:"roadmap-your-next",className:"text-base font-semibold",children:"Your next members"}),e.next.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:Rt(ts.noNext)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Your next members",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Release"}),s.jsx(Z,{children:"Member"}),s.jsx(Z,{children:"State"})]})}),s.jsx(Ge,{children:e.next.map(i=>s.jsxs(de,{children:[s.jsx(K,{children:s.jsx(cr,{query:`planned=${encodeURIComponent(i.release)}`,select:ls(i.release),onSelect:n,children:i.name})}),s.jsx(K,{children:s.jsx(T1,{next:i,org:t})}),s.jsx(K,{children:s.jsx(R1,{state:i.state})})]},`${i.release}:${i.item}`))})]})})]})]})}function WL({state:e,id:t}){var l;const n=ds();if(!e)return null;const a=(l=e.value)==null?void 0:l.releases.find(i=>i.id===t);if(!a){if(e.reading)return s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[s.jsx(Wt,{"aria-hidden":!0,className:"size-4"})," ",Rt(ts.pending),"…"]});if(e.refusal){const i=e.refusal.reason==="no_roadmap"?`${Rt(ts.noEngineLead)}. ${n}`:e.refusal.message;return s.jsx("p",{className:"text-muted-foreground text-xs",children:`${ts.failedLead}: ${i}`})}return null}const r=k1(a.forecast);return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.lead?s.jsx("p",{className:"text-sm",children:r.lead}):null,r.caption.length?s.jsx("p",{className:"text-muted-foreground text-xs",children:Rt(r.caption.join(" · "))}):null]})}function E1(){const e=mn().releases;if(!e)throw new Error("The Releases page rendered without a Releases contract.");return e}function ZL({initial:e,environments:t,branch_options:n,chooseBranch:a,renderWrite:r,selection:l,org:i,onReadAgain:o,onNotFound:c,notice:d,focusOnMount:f}){var nn,sn,zn,st,hs,Wn,ms,ps,U,$;const h=E1(),m=e.local??null,[x,b]=u.useState(e),[v,y]=u.useState(null),g=l?l.selected:v,p=l?l.onSelect:y,j=!!(m||x.release_branch),[w,N]=u.useState(m||e.release_branch?{state:"loading"}:{state:"ready",value:null}),[C,_]=u.useState({}),[S,D]=u.useState(null),[z,P]=u.useState(!1),[F,H]=u.useState(null),[A,M]=u.useState(null),R=u.useRef(null),T=m?{fresh:!0}:void 0,k=u.useCallback(async B=>{const W=await h.candidate(B);N(W.ok?{state:"ready",value:W.data.candidate}:{state:"error",error:W.refusal.message,refusal:W.refusal})},[h]),O=u.useCallback(async()=>{N({state:"loading"}),await k(T)},[k,m]),Y=u.useCallback(async()=>{const B=await h.list();B.ok&&b(B.data)},[h]),E=((nn=x.release_branch)==null?void 0:nn.id)??null;u.useEffect(()=>{if(!m&&!E)return;let B=!1;return h.candidate().then(W=>{B||N(W.ok?{state:"ready",value:W.data.candidate}:{state:"error",error:W.refusal.message,refusal:W.refusal})}),()=>{B=!0}},[E,h,m]);const I=u.useRef(new Set),Q=u.useCallback((B,W)=>_(ve=>({...ve,[B]:W.ok?{state:"ready",value:W.data.release}:{state:"error",error:W.refusal.message,refusal:W.refusal}})),[]),te=async B=>{_(W=>({...W,[B]:{state:"loading"}})),I.current.add(B),Q(B,await h.release(B,T))},ce=w.state!=="ready"||w.value!==null,X=bL(g),L=IL(m?h:void 0),q=L.available&&g===gl,[ne,ae]=u.useState("all"),je=x.release_branch||m?ce?qs:null:((sn=x.releases[0])==null?void 0:sn.version)??null,re=X!==null||q?null:g===qs?ce?qs:null:g??je,[we,se]=u.useState([]),tt=u.useRef(0);u.useEffect(()=>{if(!m||!h.roadmapMoved)return;let B=!0;const W=tt.current;return h.roadmapMoved().then(ve=>{B&&ve.ok&&W===tt.current&&se(ve.data.moved.map(Oe=>Oe.name))}),()=>{B=!1}},[h,m]);const ge=L.reads.all,He=L.read;u.useEffect(()=>{X===null||!L.available||!ge.value&&!ge.reading&&!ge.refusal&&He("all")},[X,L.available,ge,He]);const[J,ke]=u.useState(0),Ue=u.useRef(0),ft=B=>{B===gl&&ke(W=>W+1),p(B)};u.useEffect(()=>{if(J!==Ue.current){if(!q){Ue.current=J;return}ne!=="all"||ge.reading||!ge.value||!h.roadmapSeen||(Ue.current=J,h.roadmapSeen(ge.value.as_of).then(B=>{B.ok&&(tt.current+=1,se([]))}))}},[J,q,ne,ge,h]);const _e=new Map((((zn=ge.value)==null?void 0:zn.releases)??[]).map(B=>[B.id,[B.kinds.includes("range")?"range":"",B.forecast.projected?Gs(B.forecast.projected):"no date"].filter(Boolean).join(" · ")])),Ht=re===null||re===qs||x.releases.some(B=>B.version===re);u.useEffect(()=>{!m||!c||re!==null&&re!==qs&&!Ht&&c({kind:"release",id:re})},[m,c,re,Ht]),u.useEffect(()=>{!re||re===qs||I.current.has(re)||m&&!Ht||(I.current.add(re),h.release(re).then(B=>Q(re,B)))},[re,h,Q,Ht]);const wt=u.useRef(g),Et=u.useRef(!1),tn=u.useRef(!!f),_t=u.useRef(null);u.useEffect(()=>{var W,ve;if(!m)return;if(tn.current){const Oe=(W=_t.current)==null?void 0:W.querySelector('[aria-current="true"]');if(Oe){tn.current=!1,wt.current=g,Oe.focus();return}}if(wt.current!==g&&(wt.current=g,Et.current=!0),!Et.current)return;const B=(ve=R.current)==null?void 0:ve.querySelector("h2");B&&(Et.current=!1,B.tabIndex=-1,B.focus())});const Nt=async B=>{if(!a)return;D(null);const W=await a(B);if(!W.ok){D(W.error);return}y(null),N({state:"loading"}),await Y()},bn=async()=>{if(!x.next_before)return;M(null);const B=await h.list({before:x.next_before});if(!B.ok){M(B.refusal.message);return}b(W=>({...B.data,releases:[...W.releases,...B.data.releases]}))},Gt=x.release_branch?s.jsx(e6,{value:x.release_branch.id,label:x.release_branch.name,options:n??[],can_write:x.can_write,onChange:Nt}):null,le=m?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Read at ",JL(m.read_at)]}),o?s.jsxs(V,{variant:"ghost",size:"sm",onClick:o,children:[s.jsx(kr,{className:"mr-1 size-4","aria-hidden":!0}),"Read again"]}):null]}):Gt,Me=m?wL(((st=x.releases[0])==null?void 0:st.label)??((hs=x.releases[0])==null?void 0:hs.version)??null):jL(((Wn=x.releases[0])==null?void 0:Wn.version)??null,((ms=x.release_branch)==null?void 0:ms.name)??null),Ce={org:i??""};return s.jsxs(s.Fragment,{children:[s.jsx(d1,{description:m?h1:void 0,actions:le}),d,m?s.jsx(_L,{}):null,S?s.jsx(Fn,{error:S}):null,m?null:t,!m&&!x.release_branch?s.jsx(t6,{can_write:x.can_write,options:n??[],onChoose:Nt}):null,x.release_branch||x.releases.length>0||m?s.jsxs("div",{ref:_t,className:"flex flex-col gap-6 md:flex-row md:items-start",children:[s.jsx(n6,{list:x,candidate:j?w:null,shown:q?gl:X!==null?ls(X):re,onSelect:ft,roadmap:L.available?PL(((ps=x.planned)==null?void 0:ps.length)??0,we):null,planned_ranges:_e,can_load_older:!!x.next_before,older_error:A,onLoadOlder:bn}),s.jsx("div",{className:"min-w-0 flex-1",ref:R,children:q?s.jsx(qL,{reads:L.reads,scope:ne,onScope:ae,onRead:He,org:Ce.org,onSelect:p}):X!==null?s.jsx($L,{id:X,summary:((U=x.planned)==null?void 0:U.find(B=>B.id===X))??null,org:Ce.org,onNotFound:()=>c==null?void 0:c({kind:"planned",id:X}),forecast:L.available?s.jsx(WL,{state:ge,id:X}):null}):re===qs?s.jsx(a6,{candidate:w,branch_name:(($=x.release_branch)==null?void 0:$.name)??null,can_write:x.can_write&&!!r,local:!!m,org:Ce.org,onSelect:p,onRetry:O,onWrite:()=>P(!0)}):re?s.jsx(r6,{detail:C[re]??{state:"loading"},summary:x.releases.find(B=>B.version===re)??null,local:!!m,org:Ce.org,onSelect:p,onRetry:()=>te(re)}):(x.release_branch||m)&&w.state==="ready"?s.jsx(yL,{title:Me.title,text:Me.text}):null})]}):null,r&&w.state==="ready"&&w.value?r({candidate:w.value,open:z,notice:F,onOpenChange:B=>{B||H(null),P(B)},onStale:async B=>{H(B),await k()},onWritten:async B=>{P(!1),H(null),await Y(),y(B),await O()}}):null]})}function JL(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function e6({value:e,label:t,options:n,can_write:a,onChange:r}){const l=n.some(i=>i.id===e);return s.jsxs("div",{className:"grid w-56 gap-2",children:[s.jsx($e,{htmlFor:"release-branch",children:"Release branch"}),s.jsxs(pt,{value:e,onValueChange:r,disabled:!a,children:[s.jsx(ut,{id:"release-branch",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[l?null:s.jsx(Re,{value:e,children:t??"Unnamed branch"}),n.map(i=>s.jsx(Re,{value:i.id,children:i.label},i.id))]})]}),a?null:s.jsx(A1,{})]})}function A1(){return s.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 t6({can_write:e,options:t,onChoose:n}){return s.jsxs("section",{className:"flex flex-col items-center gap-3 py-16 text-center",children:[s.jsx(ku,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",children:"Choose a release branch"}),s.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."}),s.jsxs("div",{className:"grid w-64 gap-2 text-left",children:[s.jsx($e,{htmlFor:"release-branch-first",children:"Release branch"}),s.jsxs(pt,{onValueChange:n,disabled:!e,children:[s.jsx(ut,{id:"release-branch-first",children:s.jsx(xt,{placeholder:"Choose a branch"})}),s.jsx(dt,{children:t.map(a=>s.jsx(Re,{value:a.id,children:a.label},a.id))})]})]}),e?null:s.jsx(A1,{})]})}function M1({children:e}){return s.jsx("p",{className:"text-muted-foreground px-3 pt-3 text-xs font-medium tracking-wide uppercase",children:e})}function n6({list:e,candidate:t,shown:n,onSelect:a,roadmap:r,planned_ranges:l,can_load_older:i,older_error:o,onLoadOlder:c}){var h,m;const d=!!e.local,f=(t==null?void 0:t.state)==="ready"&&t.value?mo(t.value.changes):null;return s.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&&r?s.jsx(Yc,{active:n===gl,onClick:()=>a(gl),version:"Roadmap",badges:null,caption:r}):null,t&&(t.state!=="ready"||t.value)?s.jsx(Yc,{active:n===qs,onClick:()=>a(qs),version:t.state==="ready"&&t.value?t.value.version:"Next release",badges:s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:"info",children:"Candidate"}),f!=null&&f.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):t.state==="ready"&&((h=t.value)==null?void 0:h.app_changed)===!1?s.jsx(ue,{variant:"neutral",children:"App unchanged"}):t.state==="ready"&&((m=t.value)!=null&&m.classification)?s.jsx(ue,{variant:"neutral",children:t.value.classification.bump}):null]}),caption:t.state==="loading"?"Classifying…":t.state==="error"?"Could not be read":f1(t.value)}):null,d?s.jsx(s6,{list:e,shown:n,onSelect:a,ranges:l}):null,d&&e.releases.length>0?s.jsx(M1,{children:"Released"}):null,e.releases.map(x=>{const b=d?NL(x):null;return s.jsx(Yc,{active:n===x.version,onClick:()=>a(x.version),version:x.label??x.version,badges:(b==null?void 0:b.badges)??s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:"neutral",children:x.previous_release_id?x.bump??"patch":"First"}),x.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),caption:(b==null?void 0:b.caption)??zx(x.written_at)},x.version)}),i?s.jsx(V,{variant:"link",size:"sm",className:"self-start",onClick:c,children:"Show older Releases"}):null,o?s.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o}):null]})}function s6({list:e,shown:t,onSelect:n,ranges:a}){return!e.planned_error&&!(e.planned&&e.planned.length>0)?null:s.jsxs(s.Fragment,{children:[s.jsx(M1,{children:"Planned"}),e.planned_error?s.jsx(Fn,{title:"Planned Releases could not be read",error:e.planned_error}):null,(e.planned??[]).map((r,l)=>s.jsx(Yc,{active:t===ls(r.id),onClick:()=>n(ls(r.id)),version:r.name,badges:s.jsx(ue,{variant:"neutral",children:"Planned"}),caption:`${r.members===0?"no members":`${r.members} member${r.members===1?"":"s"}`}${l===0?" · next":""}${a!=null&&a.get(r.id)?` · ${a.get(r.id)}`:""}`},r.id))]})}function a6({candidate:e,branch_name:t,can_write:n,local:a,org:r,onSelect:l,onRetry:i,onWrite:o}){var m;if(e.state==="loading")return s.jsx(Gn,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Classifying the changes since the last Release…"})});if(e.state==="error")return s.jsx(Gn,{children:s.jsx(Fn,{error:e.error,onRetry:i})});const c=e.value;if(!c)return null;const d=mo(c.changes),f=!c.previous_release,h=t??"the release branch";return s.jsxs(Gn,{children:[s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:c.version}),s.jsx(ue,{variant:"info",children:"Candidate"}),d.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):c.app_changed===!1?s.jsx(ue,{variant:"neutral",children:"App unchanged"}):c.classification?s.jsx(ue,{variant:"neutral",children:c.classification.bump}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:[a?"What staging runs over production: ":`What the next Release holds at ${h}'s head: `,f1(c),". It is computed when you open it and never stored.",d.breaking&&c.next_version.startsWith("0.")?" Before 1.0.0 a major change raises the minor number.":""]}),f?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The first Release, ",c.next_version,", records the starting point and lists no changes."]}):s.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."}),(m=c.classification)!=null&&m.marks_approximate?s.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,c.commits_since===null?s.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?s.jsxs(V,{onClick:o,children:[s.jsx(ku,{className:"mr-2 size-4"}),"Write Release ",c.next_version]}):null]}),a?s.jsx(EL,{candidate:c,org:r,onSelect:l,notes:f?null:s.jsx(qu,{changes:c.changes})}):f?null:s.jsx(qu,{changes:c.changes})]})}function r6({detail:e,summary:t,local:n,org:a,onSelect:r,onRetry:l}){const[i,o]=u.useState(!1);if((t==null?void 0:t.state)==="unreadable")return s.jsxs(Gn,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:t.label??t.version}),s.jsx(Fn,{title:"This Release could not be read",error:t.error??"Its record cannot be read."})]});if(e.state==="loading")return s.jsx(Gn,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Release…"})});if(e.state==="error")return s.jsx(Gn,{children:s.jsx(Fn,{error:e.error,onRetry:l})});const c=e.value,d=!c.previous_release_id,f=c.bump&&c.computed_bump&&c.bump!==c.computed_bump,h=c.label??c.version,m=async()=>{await navigator.clipboard.writeText(gL(h,mo(c.changes))),o(!0)};return s.jsxs(Gn,{children:[s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n?s.jsx(AL,{release:c,onSelect:r}):s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:c.version}),s.jsx(ue,{variant:"neutral",children:d?"First":c.bump}),mo(c.changes).breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Written ",zx(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?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Released when production ran release batch ",s.jsx("code",{className:"font-mono",children:c.batch}),".",c.app_changed===!1?` The app's version stays ${c.app_version??c.version}.`:""]}):null,f?s.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?s.jsx("p",{className:"text-sm",children:c.version_line}):null,c.marks_approximate?s.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?s.jsx("p",{className:"text-muted-foreground text-xs",children:"The first Release records the starting point and lists no changes."}):c.source_judged?null:s.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:s.jsxs(V,{variant:"outline",onClick:m,children:[s.jsx(OR,{className:"mr-2 size-4"}),i?"Copied":"Copy notes"]})]}),n?s.jsx(ML,{release:c,org:a,onSelect:r,notes:d?null:s.jsx(qu,{changes:c.changes})}):d?null:s.jsx(qu,{changes:c.changes})]})}const l6=5,i6=e=>e.retry===!0||e.reason==="store_locked"||e.status===503;function o6({org:e,query:t,onSelect:n,home:a}){var A,M;const r=E1(),{href:l,Link:i}=Xe(),[o,c]=u.useState({state:"loading"}),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,b]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(!1),j=u.useCallback(async R=>{const T=y.current+=1;m(null);const k=await r.list(R?{fresh:!0}:void 0);if(T===y.current){if(k.ok){v.current=0,f(null),c({state:"ok",list:k.data});return}if(k.refusal.reason==="engine_missing"){c({state:"engine_missing",refusal:k.refusal});return}if(v.current+=1,v.current===1&&i6(k.refusal)){m(k.refusal.retry_after??l6);return}f(k.refusal)}},[r]);u.useEffect(()=>{j(!1)},[j]),u.useEffect(()=>{if(h===null)return;const R=setTimeout(()=>void j(!1),h*1e3);return()=>clearTimeout(R)},[h,j]),u.useEffect(()=>{var T;if(!p.current||o.state==="loading"||d||h!==null)return;p.current=!1;const R=(T=g.current)==null?void 0:T.querySelector("h1");R&&(R.tabIndex=-1,R.focus())});const w=()=>{p.current=!0,v.current=0,f(null),j(!0)},N=o.state==="ok"?o.list:null,C=t.roadmap?gl:t.planned!==null?t.planned===""?(A=N==null?void 0:N.planned)!=null&&A[0]?ls(N.planned[0].id):null:ls(t.planned):t.release,_=`${t.release??""}|${t.planned??""}|${t.roadmap?"roadmap":""}`,S=u.useRef(_);u.useEffect(()=>{S.current!==_&&(S.current=_,b(null))},[_]);const D=u.useRef(!1),z=u.useCallback(R=>{D.current=!0,b(R)},[]),P=!x&&o.state==="ok"&&D.current;if(u.useEffect(()=>{P&&(D.current=!1)},[P]),x)return s.jsx(Ga,{title:x.kind==="release"?`No Release ${x.id}`:`No open Planned Release ${x.id}`,description:"This project has no Release, candidate or open Planned Release by that name.",backHref:l(a),backLabel:"All Releases",link:i});const F=h!==null?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(Wt,{"aria-hidden":!0})," The release records are busy; reading again in ",h," s…"]}):null,H=d?s.jsxs(he,{variant:"destructive",children:[s.jsx(Qt,{}),s.jsx(ye,{children:"Releases could not be read"}),s.jsxs(xe,{className:"flex flex-col items-start gap-2",children:[s.jsxs("span",{children:[d.message,N?" The last Releases read stay below.":""]}),s.jsx(V,{variant:"outline",size:"sm",onClick:w,children:"Try again"})]})]}):null;return s.jsx("div",{ref:g,className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:o.state==="ok"?s.jsx(ZL,{initial:o.list,org:e,selection:{selected:C,onSelect:n},onReadAgain:w,onNotFound:z,notice:F||H?s.jsxs(s.Fragment,{children:[F,H]}):null,focusOnMount:P},((M=o.list.local)==null?void 0:M.read_at)??"list"):o.state==="engine_missing"?s.jsx(la,{page:"Releases"}):s.jsxs(s.Fragment,{children:[s.jsx(d1,{description:h1}),H??F??s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(Wt,{"aria-hidden":!0})," Loading Releases…"]})]})})}const c6={threads:"Threads",tasks:"Tasks",queues:"Queues",worktrees:"Worktrees",workspaces:"Workspaces",chart:"Org chart"},u6={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Fc(e,t){return e.kind==="home"?"Home":e.kind==="org"?c6[e.page]:e.kind==="project"?e.page?u6[e.page]:t??e.project:"Not found"}const d6="(max-width: 767px)";function f6(){const e=typeof window<"u"&&window.matchMedia?window.matchMedia(d6):null,[t,n]=u.useState((e==null?void 0:e.matches)??!1);return u.useEffect(()=>{if(!e)return;const a=()=>n(e.matches);return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[e]),t}function Nc({className:e=""}){return s.jsx("span",{"aria-hidden":"true",className:`block animate-pulse rounded-md bg-sidebar-accent ${e}`})}function py({label:e,children:t}){return s.jsxs("span",{role:"status",className:"flex flex-col gap-1",children:[s.jsx("span",{className:"sr-only",children:e}),t]})}function xy({item:e,collapsed:t}){const{Link:n}=Xe(),a=e.icon,r=e.title??(t?e.label:void 0),l=s.jsx("span",{className:"block",children:s.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:[s.jsx(a,{className:"size-4 shrink-0","aria-hidden":"true"}),!t&&s.jsx("span",{className:"truncate",children:e.label})]})});return s.jsx("li",{children:r?s.jsxs(Ck,{children:[s.jsx(Rk,{asChild:!0,children:l}),s.jsx(Nx,{side:"right",children:r})]}):l})}const gy="m-0 flex list-none flex-col gap-1 p-0";function vy({label:e,collapsed:t,children:n}){return s.jsxs("div",{className:"flex flex-col gap-1 p-2",role:"group","aria-label":e,children:[!t&&s.jsx("p",{className:"m-0 px-2 text-xs font-medium text-sidebar-foreground/70",children:e}),n]})}function yy({page:e,collapsed:t,sheet:n=!1}){var A;const{href:a}=Xe(),{worktrees:r}=mn(),l=On(),{org:i,projects:o,loading:c,none:d,about:f,aboutFailed:h,domains:m,engine:x}=l,b=x===null,v=i?`/org/${i.slug}`:"",y=o==null?void 0:o.find(M=>M.current),g=((A=i==null?void 0:i.source)==null?void 0:A.kind)==="folder"&&y!==void 0,p=M=>g&&y?`${M} · ${y.name}`:M,j=p("Workspaces"),w=p("Tasks"),N=p("Queues"),C=M=>g?M:void 0,_=[{label:"Home",href:a(v||"/"),icon:QR,current:e.kind==="home"},...b?[]:[{label:"Threads",href:a(`${v}/threads`),icon:dT,current:e.kind==="org"&&e.page==="threads"}],...m.includes("tasks")&&!b?[{label:w,title:C(w),href:a(`${v}/tasks`),icon:Pw,current:e.kind==="org"&&e.page==="tasks"}]:[],...b?[]:[{label:N,title:C(N),href:a(`${v}/queues`),icon:qw,current:e.kind==="org"&&e.page==="queues"}],...r&&!b?[{label:"Worktrees",href:a(`${v}/worktrees`),icon:Iw,current:e.kind==="org"&&e.page==="worktrees"}]:[],{label:j,title:C(j),href:a(`${v}/workspaces`),icon:qR,current:e.kind==="org"&&e.page==="workspaces"},{label:"Org chart",href:a(`${v}/chart`),icon:pT,current:e.kind==="org"&&e.page==="chart"}],S=c?null:d?"No organization":(i==null?void 0:i.name)??"Organization",D=i?GT(i):null,z=f==null?void 0:f.version,P=z?t?z:`sdlc ${z}`:h?Su:gd,F=h||(f==null?void 0:f.sync.state)==="unknown"?IT:f===void 0?HT:BT;let H;return c?H=s.jsx("div",{className:"px-2 py-1",children:s.jsxs(py,{label:"Loading projects",children:[s.jsx(Nc,{className:"h-4 w-32"}),s.jsx(Nc,{className:"h-4 w-24"})]})}):o?H=s.jsx("ul",{className:gy,children:o.map(M=>s.jsx(xy,{collapsed:t,item:{label:M.name,title:M.name,href:a(`/proj/${encodeURIComponent(M.id)}`),icon:IR,current:e.kind==="project"&&e.project===M.id}},M.id))}):H=s.jsx("p",{className:"m-0 px-2 text-sm text-sidebar-foreground/70",children:d?"No projects":Su}),s.jsxs("div",{className:"flex h-full flex-col bg-sidebar text-sidebar-foreground",children:[s.jsxs("div",{className:`flex items-center gap-2 p-2 ${n?"pr-11":""}`,role:"group","aria-label":"Current organization",children:[s.jsx("div",{className:"flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:s.jsx(jR,{className:"size-4","aria-hidden":"true"})}),!t&&s.jsx("div",{className:"grid min-w-0 flex-1 text-left text-sm leading-tight",children:S===null?s.jsxs(py,{label:"Loading organization",children:[s.jsx(Nc,{className:"h-4 w-28"}),s.jsx(Nc,{className:"h-3 w-24"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-semibold",title:S,children:S}),D&&s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/70",children:D})]})})]}),s.jsxs("nav",{"aria-label":"App",className:"min-h-0 flex-1 overflow-y-auto",children:[s.jsx(vy,{label:"Organization",collapsed:t,children:s.jsx("ul",{className:gy,children:_.map(M=>s.jsx(xy,{item:M,collapsed:t},M.label))})}),!t&&s.jsx(vy,{label:"Projects",collapsed:t,children:H})]}),f!==null&&s.jsxs("div",{className:"flex flex-col gap-1 border-t border-sidebar-border p-2 text-xs text-sidebar-foreground/70",children:[s.jsx("p",{className:"m-0 truncate px-2",title:z?`sdlc ${z}`:void 0,children:P}),!t&&s.jsxs("p",{className:"m-0 flex items-start gap-2 px-2",children:[s.jsx(YR,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:F})]})]})]})}const h6="outline-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring";function m6({page:e}){var c;const{href:t,Link:n}=Xe(),{org:a,projects:r,loading:l,none:i}=On(),o=[];if(l)o.push({label:gd});else if(i)o.push({label:"No organization"});else{const d=(a==null?void 0:a.name)??"Organization";if(o.push({label:d,href:e.kind==="home"?void 0:t(a?`/org/${a.slug}`:"/")}),e.kind==="project"){const f=((c=r==null?void 0:r.find(h=>h.id===e.project))==null?void 0:c.name)??e.project;o.push({label:f,href:e.page?t(`/proj/${encodeURIComponent(e.project)}`):void 0})}if(e.kind==="org"&&e.item!==void 0)o.push({label:Fc(e),href:a?t(`/org/${a.slug}/${e.page}`):void 0}),o.push({label:e.item});else if(e.kind==="project"&&e.page&&e.item!==void 0){const f=`/proj/${encodeURIComponent(e.project)}/${e.page}${e.list_query?`?${e.list_query}`:""}`;o.push({label:Fc(e),href:t(f)}),o.push({label:e.item})}else e.kind!=="home"&&!(e.kind==="project"&&!e.page)&&o.push({label:Fc(e)})}return s.jsx("nav",{"aria-label":"Breadcrumb",className:"min-w-0",children:s.jsx("ol",{className:"m-0 flex min-w-0 list-none items-center gap-1.5 p-0 text-sm text-muted-foreground",children:o.map((d,f)=>s.jsxs("li",{className:"flex min-w-0 items-center gap-1.5",children:[f>0&&s.jsx(fd,{className:"size-3.5 shrink-0","aria-hidden":"true"}),d.href?s.jsx(n,{href:d.href,className:`truncate text-muted-foreground no-underline hover:text-foreground ${h6}`,children:d.label}):s.jsx("span",{className:"truncate font-normal text-foreground","aria-current":f===o.length-1?"page":void 0,children:d.label})]},`${f}-${d.label}`))})})}function p6({page:e,children:t}){var g;const n=f6(),[a,r]=u.useState(!0),[l,i]=u.useState(!1),o=u.useRef(null),c=u.useRef(null),{org:d,projects:f,loading:h,none:m}=On(),x=e.kind==="project"?(g=f==null?void 0:f.find(p=>p.id===e.project))==null?void 0:g.name:void 0;u.useEffect(()=>{const p=h?gd:m?"No organization":(d==null?void 0:d.name)??"Organization",j=(e.kind==="org"||e.kind==="project")&&e.item!==void 0?`${e.item} · `:"";document.title=`${j}${Fc(e,x)} · ${p} · sdlc viewer`},[e,x,d,h,m]);const b=()=>{var p;i(!1),(p=o.current)==null||p.focus()};u.useEffect(()=>{n||i(!1)},[n]);const v=n&&l;u.useEffect(()=>{var w;const p=c.current;if(!v||!p)return;(w=p.querySelector("a, button"))==null||w.focus();const j=N=>{var z;if(N.key==="Escape"){i(!1),(z=o.current)==null||z.focus();return}if(N.key!=="Tab")return;const C=[...p.querySelectorAll("a[href], button:not([disabled])")];if(C.length===0)return;const _=C[0],S=C[C.length-1],D=p.contains(document.activeElement);N.shiftKey&&(document.activeElement===_||!D)?(N.preventDefault(),S.focus()):!N.shiftKey&&(document.activeElement===S||!D)&&(N.preventDefault(),_.focus())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[v]);const y=!n&&!a;return s.jsx(Sk,{children:s.jsxs("div",{className:"flex h-svh min-h-0 overflow-hidden bg-background text-foreground",children:[!n&&s.jsx("aside",{"aria-label":"Sidebar",className:`shrink-0 border-r border-sidebar-border transition-[width] ${y?"w-12":"w-64"}`,children:s.jsx(yy,{page:e,collapsed:y})}),v&&s.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[s.jsxs("aside",{ref:c,role:"dialog","aria-modal":"true","aria-label":"Sidebar",className:"relative w-72 max-w-[85vw] border-r border-sidebar-border",children:[s.jsx(yy,{page:e,collapsed:!1,sheet:!0}),s.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:b,children:s.jsx(xd,{className:"size-4","aria-hidden":"true"})})]}),s.jsx("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"flex-1 border-0 bg-black/80 outline-hidden",onClick:b})]}),s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:[s.jsxs("header",{className:`flex shrink-0 items-center gap-2 border-b border-border px-4 transition-[height] ${y?"h-12":"h-16"}`,children:[s.jsx("button",{ref:o,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":n?l:a,onClick:()=>n?i(p=>!p):r(p=>!p),children:s.jsx(gT,{className:"size-4","aria-hidden":"true"})}),s.jsx("span",{"aria-hidden":"true",className:"mr-2 h-4 w-px bg-border"}),s.jsx(m6,{page:e})]}),s.jsx("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden overflow-y-auto",children:t})]})]})})}const Hx="m-0 text-2xl font-semibold tracking-tight",Ix="outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",Px=`rounded-sm font-medium text-primary no-underline hover:underline ${Ix}`;function eh({children:e}){return s.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:s.jsx("code",{children:e})})}function x6({why:e}){return e.kind==="not_in_git"?s.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[s.jsx("p",{className:"m-0 text-sm",children:"This directory is not a Git repository. Start sdlc viewer inside one:"}),s.jsx(eh,{children:"sdlc viewer"})]}):e.kind==="unlisted"?s.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[s.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.`}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"To rejoin, leave the folder here:"}),s.jsx(eh,{children:"sdlc-agents folder leave"}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`then add it back from the folder's home repository, ${e.home}:`}),s.jsx(eh,{children:`sdlc-agents folder add ${e.member_path} --name ${e.repository}`}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"To work in this repository alone, leaving is enough."})]}):s.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[s.jsx("p",{className:"m-0 text-sm",children:e.cause}),e.kind==="moved_member"&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"Move this repository back to where the folder records it."}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:e.kind==="other"&&!e.fix?mr:qT})]})}const jy=`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 ${Ix}`;function g6(){return s.jsxs("div",{role:"status",className:"flex flex-col gap-2",children:[s.jsx("span",{className:"sr-only",children:"Loading projects"}),[0,1,2].map(e=>s.jsx("span",{"aria-hidden":"true",className:"block h-9 animate-pulse rounded-md bg-muted"},e))]})}function ei(){const{href:e,Link:t}=Xe(),{loading:n,projects:a,none:r,failure:l,readAt:i,refresh:o,reading:c}=On(),[d,f]=u.useState(""),h=s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:Hx,children:"Projects"}),!r&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:PT})]});if(r)return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[h,s.jsx(x6,{why:r==="not_in_git"?{kind:"not_in_git"}:KT(r)})]});const m=l!=null&&l.shown?l:null,x=(a??[]).filter(b=>b.name.toLowerCase().includes(d.trim().toLowerCase()));return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[h,m&&s.jsxs("div",{role:"alert",className:"flex flex-col gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-4",children:[s.jsx("p",{className:"m-0 text-sm font-medium text-destructive",children:"The projects could not be refreshed"}),s.jsx("p",{className:"m-0 text-sm",children:Vw(m.refusal,i)}),s.jsx("div",{children:s.jsx("button",{type:"button",className:jy,onClick:o,disabled:c,children:"Retry"})})]}),(a||n)&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"search","aria-label":"Filter projects",placeholder:"Filter projects",value:d,onChange:b=>f(b.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 ${Ix}`}),!m&&s.jsx("button",{type:"button",className:`${jy} ml-auto`,onClick:o,disabled:c||n,children:"Refresh"})]}),l&&!l.shown&&i&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`Showing the list read at ${yi(i)}; reading again in ${l.retryInSeconds??10} seconds.`})]}),n?s.jsx(g6,{}):a&&s.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:s.jsxs("table",{className:"w-full border-collapse text-sm",children:[s.jsx("thead",{className:"border-b border-border text-left text-muted-foreground",children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",className:"h-10 px-3 font-medium",children:"Name"}),s.jsx("th",{scope:"col",className:"h-10 px-3 font-medium",children:"Location"}),s.jsx("th",{scope:"col",className:"h-10 px-3",children:s.jsx("span",{className:"sr-only",children:"Where this viewer runs"})})]})}),s.jsxs("tbody",{children:[x.map(b=>s.jsxs("tr",{className:"border-b border-border last:border-0",children:[s.jsx("td",{className:"px-3 py-2",children:s.jsx(t,{href:e(`/proj/${encodeURIComponent(b.id)}`),className:Px,children:b.name})}),s.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:b.location??Su}),s.jsx("td",{className:"px-3 py-2 text-right",children:b.current&&s.jsx("span",{className:"inline-flex items-center rounded-md border border-border px-2 py-0.5 text-xs font-medium",children:"This repository"})})]},b.id)),x.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:3,className:"px-3 py-6 text-center text-muted-foreground",children:"No projects found."})})]})]})})]})}function $1({title:e,children:t}){const{href:n,Link:a}=Xe();return s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"flex max-w-xl flex-col gap-2 rounded-xl border border-border bg-card p-6 text-card-foreground",children:[s.jsx("h1",{className:Hx,children:e}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:t}),s.jsx("div",{children:s.jsx(a,{href:n("/"),className:`text-sm ${Px}`,children:"Back to the organization's Home"})})]})})}const v6={tasks:"Tasks",issues:"Issues",releases:"Releases"};function po({project:e}){const{href:t,Link:n}=Xe(),{org:a,projects:r,loading:l,domains:i}=On(),o=r==null?void 0:r.find(c=>c.id===e);return l?s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:gd}):r?o?s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:Hx,children:o.name}),s.jsx("p",{className:"m-0 font-mono text-sm text-muted-foreground",children:o.location??Su})]}),o.current?i.length>0?s.jsx("ul",{className:"m-0 flex list-none flex-col gap-1 p-0 text-sm",children:i.map(c=>s.jsx("li",{children:s.jsx(n,{href:t(c==="tasks"?`${a?`/org/${a.slug}`:""}/tasks`:`/proj/${encodeURIComponent(o.id)}/${c}`),className:Px,children:v6[c]})},c))}):null:s.jsx("p",{className:"m-0 max-w-2xl text-sm text-muted-foreground",children:`This viewer reads ${o.name}'s tasks, issues and Releases only from its own checkout: open it with sdlc viewer there.`})]}):s.jsx($1,{title:"Project not found",children:`There is no project '${e}' in this organization.`}):s.jsx(ei,{})}const Gd=e=>e instanceof Error?e.message:String(e);async function O1(e=!1){try{const t=await fetch(e?"api/threads?archived=1":"api/threads",{cache:"no-store"});return t.status===404?{none:!0}:t.ok?{data:await t.json()}:{error:await t.text()||`HTTP ${t.status}`}}catch(t){return{error:Gd(t)}}}async function y6(){var e;try{const t=await fetch("api/release-links?threads",{cache:"no-store"});if(!t.ok)return null;const n=await t.json(),a=(e=n==null?void 0:n.panel)==null?void 0:e.threads;if(!a||typeof a!="object"||Array.isArray(a))return null;const r={};for(const[l,i]of Object.entries(a)){const o=(Array.isArray(i)?i:[]).filter(c=>!!c&&typeof c.planned_release=="string"&&typeof c.name=="string"&&typeof c.level=="string");o.length&&(r[l]=o)}return r}catch{return null}}async function j6(){try{return(await fetch("api/pin",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function b6(){try{const e=await fetch("api/sessions",{cache:"no-store"});if(!e.ok)return 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 w6(){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:Gd(e)}}}async function _6(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})}),a=await n.text();let r={};try{r=JSON.parse(a)??{}}catch{}return n.ok?{done:r}:{refused:{reason:typeof r.reason=="string"?r.reason:"failed",error:typeof r.error=="string"?r.error:a||`HTTP ${n.status}`,...typeof r.where=="string"&&r.where?{where:r.where}:{}}}}catch(n){return{refused:{reason:"failed",error:Gd(n)}}}}async function N6(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?null:await n.text()||`HTTP ${n.status}`}catch(n){return Gd(n)}}const k6={probe:{source:async()=>{const e=await O1();if("error"in e)throw new Error(e.error);return{label:"Local workspace"}}}},D1={href:e=>e.replace(/^\/+/,"")||"./",Link:({href:e,className:t,children:n,...a})=>s.jsx("a",{href:e,className:t,...a,children:n})},S6={label:"Local viewer",can:()=>!1};function C6(){return u.useEffect(()=>{document.title="Shared app UI · SDLC Workspace Viewer"},[]),s.jsx("div",{className:"app-ui dark",children:s.jsx(Lw,{data:k6,router:D1,identity:S6,children:s.jsx(nR,{})})})}const R6="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.",T6=3e4,E6="Reading the workspaces. On a plan workspace this can take a few minutes.",A6="The read failed. Details are in the terminal running sdlc viewer.",M6={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"}},$6=e=>M6[e]??{label:e,tone:"neutral"},Sa=e=>e.slice(0,8),z1={human:"Human",ai:"AI"},Tm=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function O6(){const e=mn().workspaces;if(!e)throw new Error("The Workspaces page rendered without the workspaces seam.");return e}function D6(e){const t=O6(),[n,a]=u.useState(null),[r,l]=u.useState(null),[i,o]=u.useState(!1),c=u.useRef(null),d=u.useRef(!1),f=u.useRef(null),h=u.useCallback(()=>{if(f.current)return f.current;const y=(async()=>{const g=await t.overview();g.ok?(a(g.data),l(null),o(!1)):(l(g.refusal),o(!0))})().finally(()=>{f.current=null});return f.current=y,y},[t]);u.useEffect(()=>{h()},[h]),Uu(()=>void h(),T6),u.useEffect(()=>{var y;d.current&&(n||r)&&(d.current=!1,(y=c.current)==null||y.focus())},[n,r]);const m=()=>{d.current=!0,h()},x=n===null&&r===null,b=n===null&&r!==null,v=n?z6(n,i):null;return s.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:[s.jsx(en,{title:"Workspaces",description:R6,actions:s.jsxs(s.Fragment,{children:[v?s.jsx("p",{className:"text-muted-foreground text-xs",children:v}):null,s.jsxs(V,{type:"button",variant:"outline",size:"sm","aria-disabled":x||void 0,"aria-describedby":x?"workspaces-reading":void 0,className:"gap-2",onClick:x?void 0:()=>void h(),children:[s.jsx(kr,{className:"size-4","aria-hidden":"true"}),"Read again"]}),x?s.jsx("span",{id:"workspaces-reading",className:"sr-only",children:"Reading…"}):null,s.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n?L1(n,i):""})]})}),s.jsxs("div",{ref:c,tabIndex:-1,className:"outline-none",children:[x?s.jsx(L6,{}):null,b&&r?s.jsx(U6,{refusal:r,on_retry:m}):null,n?s.jsx(B6,{overview:n}):null]})]})}function L1(e,t){var n,a;return t||((n=e.stale)==null?void 0:n.reason)==="failed"?"a newer read failed":((a=e.stale)==null?void 0:a.reason)==="running"?"a newer read is still running":""}function z6(e,t){const n=`Read at ${cs(new Date(e.read_at).toISOString())}`,a=L1(e,t);return a?`${n} · ${a}`:n}function L6(){return s.jsxs("div",{className:"mt-6",children:[s.jsx("div",{className:"grid gap-2",role:"status","aria-label":"Loading workspaces",children:Array.from({length:6},(e,t)=>s.jsx(jt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))}),s.jsx("p",{className:"text-muted-foreground mt-3 text-sm","aria-live":"polite",children:E6})]})}function U6({refusal:e,on_retry:t}){const n=e.reason==="store_locked"?Vw(e,null):A6;return s.jsxs(he,{variant:"destructive",className:"mt-6",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not read workspaces"}),s.jsxs(xe,{children:[s.jsx("p",{children:n}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function B6({overview:e}){const{counts:t}=e,n=[Tm(t.workspaces,"workspace"),`${t.active} active`,`${t.queued} queued`,`${t.blocked} blocked`].join(" · ");return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status","aria-live":"polite",children:n}),s.jsxs("div",{className:"mt-4 grid gap-4 lg:grid-cols-[1.4fr_1fr]",children:[s.jsx(kc,{id:"workspaces-lineage",title:"Lineage",caption:"Each workspace under the one it forked from",children:s.jsx(H6,{rows:e.workspaces})}),s.jsx(kc,{id:"workspaces-authority",title:"Authority and resolver",caption:"What this checkout's workspace may change",children:s.jsx(I6,{authority:e.authority})})]}),s.jsx(kc,{id:"workspaces-activity",className:"mt-4",title:"Integration activity",caption:"Newest first",children:e.activity.length===0?s.jsx(by,{children:"No integration or reconciliation attempts yet."}):s.jsx(q6,{rows:e.activity})}),s.jsx(kc,{id:"workspaces-handoffs",className:"mt-4",title:"Handoffs",children:e.handoffs.length===0?s.jsx(by,{children:"No Handoffs prepared yet."}):s.jsx(G6,{rows:e.handoffs})})]})}function kc({id:e,title:t,caption:n,className:a,children:r}){return s.jsxs("section",{"aria-labelledby":e,className:ie("min-w-0",a),children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-baseline gap-x-2",children:[s.jsx("h2",{id:e,className:"text-lg font-semibold",children:t}),n?s.jsx("span",{className:"text-muted-foreground text-sm",children:n}):null]}),r]})}const by=({children:e})=>s.jsx("p",{className:"text-muted-foreground text-sm",children:e}),Gu=({children:e,tone:t})=>s.jsx("div",{className:ie("text-xs",t==="error"?"text-destructive":"text-muted-foreground"),children:e});function xo({status:e}){const t=$6(e);return s.jsx(ue,{variant:t.tone,children:t.label})}function Vd({label:e,children:t}){return s.jsx(ot,{role:"group","aria-label":e,tabIndex:0,className:"overflow-x-auto outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:t})}function H6({rows:e}){return s.jsx(Vd,{label:"Workspaces",children:s.jsxs(qe,{containerClassName:"overflow-visible",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Workspace"}),s.jsx(Z,{children:"Actor"}),s.jsx(Z,{children:"Forked from"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Projection"})]})}),s.jsx(Ge,{children:e.map(t=>s.jsxs(de,{"data-testid":"workspaces-row",children:[s.jsxs(K,{children:[s.jsx("div",{className:"font-mono font-medium",children:t.short_id}),s.jsx(Gu,{children:t.current?`${t.path} · This checkout`:t.path}),t.projection==="unreadable"&&t.projection_error&&s.jsx(Gu,{children:t.projection_error})]}),s.jsx(K,{children:z1[t.actor]}),s.jsx(K,{children:t.source_id?s.jsx("span",{className:"font-mono",children:Sa(t.source_id)}):s.jsx("span",{className:"text-muted-foreground",children:"No source"})}),s.jsx(K,{children:s.jsx(xo,{status:t.status})}),s.jsx(K,{children:s.jsx(xo,{status:t.projection})})]},t.id))})]})})}function I6({authority:e}){const t=e.resolver,n=[["Workspace",s.jsx("span",{className:"font-mono",children:Sa(e.workspace_id)},"id")],["Actor",z1[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"}`:s.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"?s.jsx("span",{className:"text-muted-foreground",children:"Not configured"},"resolver"):s.jsx(xo,{status:t.state==="ready"?"ready":"needs_attention"},"resolver")]),t.state==="needs_attention"&&t.issue&&n.push(["Resolver issue",t.issue]),s.jsx(Vd,{label:"Authority and resolver",children:s.jsx(qe,{containerClassName:"overflow-visible",children:s.jsx(Ge,{children:n.map(([a,r])=>s.jsxs(de,{children:[s.jsx(Z,{scope:"row",className:"text-muted-foreground font-normal",children:a}),s.jsx(K,{children:r})]},a))})})})}function P6(e){const t=[e.merge_attempts?Tm(e.merge_attempts,"merge attempt"):null,e.resolver_attempts?Tm(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 s.jsx("span",{className:"text-muted-foreground",children:n})}function q6({rows:e}){return s.jsx(Vd,{label:"Integration activity",children:s.jsxs(qe,{containerClassName:"overflow-visible",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Change"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Attempts"}),s.jsx(Z,{children:"Updated"})]})}),s.jsx(Ge,{children:e.map((t,n)=>s.jsxs(de,{children:[s.jsxs(K,{children:[s.jsx("div",{className:"font-medium",children:t.kind==="integration"?`Integrate ${Sa(t.child_id)} into ${Sa(t.other_id)}`:`Reconcile ${Sa(t.child_id)} from ${Sa(t.other_id)}`}),s.jsx(Gu,{children:t.kind==="integration"?"Integration":"Source reconciliation"})]}),s.jsx(K,{children:s.jsx(xo,{status:t.status})}),s.jsx(K,{children:P6(t)}),s.jsx(K,{children:Ak(t.updated_at)})]},`${t.kind}-${t.child_id}-${t.other_id}-${t.updated_at}-${n}`))})]})})}function G6({rows:e}){return s.jsx(Vd,{label:"Handoffs",children:s.jsxs(qe,{containerClassName:"overflow-visible",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"From"}),s.jsx(Z,{children:"To"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Pinned"})]})}),s.jsx(Ge,{children:e.map(t=>s.jsxs(de,{children:[s.jsxs(K,{children:[s.jsx("div",{className:"font-mono font-medium",children:Sa(t.child_id)}),t.error?s.jsx(Gu,{children:t.error}):null]}),s.jsx(K,{className:"font-mono",children:Sa(t.source_id)}),s.jsx(K,{children:s.jsx(xo,{status:t.status})}),s.jsx(K,{children:`${t.child_commit} onto ${t.source_commit}`})]},t.id))})]})})}const wy="This machine's worktrees of this repository.",V6="Merge sends one whose thread is at rest to the main queue.",Y6=3e4,F6=3e3,K6=6e5,th=[{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"}],mi={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"}},X6="no thread to land it",qx="its thread waits on you",U1="its thread is done",B1="its thread is retired",Gx=e=>e.archivable&&e.cleanup==="user",Q6=e=>e.queue!==null||e.merge.offered===!1&&e.merge.why==="already in a promotion queue",W6=e=>!e.merge.offered&&(e.merge.why===U1||e.merge.why.startsWith(B1)),Vx=e=>!e.merge.offered&&e.merge.why===X6||W6(e),nh=(e,t)=>t==="all"?!0:t==="decide"?Gx(e):(e.landed!==null?"landed":Q6(e)?"queued":Vx(e)?"orphan":"needs")===t,Z6=e=>e.landed!==null?e.threads.some(t=>t.phase!=="done"):e.threads.length>0&&!Vx(e);function Kc(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 H1(e){const t=e%100,n=t>=11&&t<=13?"th":{1:"st",2:"nd",3:"rd"}[e%10]??"th";return`${e}${n}`}function J6(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 sh=e=>cs(new Date(e*1e3).toISOString()),Ni=e=>e.charAt(0).toUpperCase()+e.slice(1);function e5(e,t){var r;const n=t.phase?Ni(t.phase):"No phase",a=e.merge;if(!a.offered&&a.why.startsWith(B1)){const l=(r=/; (.+) continues it$/.exec(a.why))==null?void 0:r[1];return l?`Retired · continued by ${l}`:"Retired"}return t.phase==="done"||!a.offered&&a.why===U1?e.landed===null?"Done · without landing this":"Done":a.offered?`${n} · at rest`:a.why.startsWith("its thread is at work")?`${n} · at work`:a.why===qx?`${n} · waits on you`:a.why.startsWith("its session is not running")?`${n} · session not running`:n}function t5(){const e=mn().worktrees;if(!e)throw new Error("The Worktrees page rendered without the worktrees seam.");return e}function n5({org:e}){var O,Y;const t=t5(),[n,a]=u.useState(null),[r,l]=u.useState(null),[i,o]=u.useState(null),[c,d]=u.useState(!1),[f,h]=u.useState("all"),[m,x]=u.useState(""),[b,v]=u.useState({}),y=u.useRef({}),{confirm:g,confirm_dialog:p}=Bo(),j=u.useRef(!1),w=u.useCallback(async()=>{if(j.current)return;j.current=!0;const E=await t.list();j.current=!1,E.ok?(a(E.data),l(null)):l(E.refusal)},[t]),N=u.useCallback(async()=>{const E=await t.sizes();d(!E.ok),E.ok&&o(E.data)},[t]);u.useEffect(()=>{w(),N()},[w,N]);const C=(n==null?void 0:n.rows.some(E=>{var I,Q;return((I=E.write)==null?void 0:I.state)==="waiting"||((Q=E.write)==null?void 0:Q.state)==="running"}))??!1;Uu(()=>void w(),C?F6:Y6),Uu(()=>void N(),K6);const _=(n==null?void 0:n.rows)??[],S=E=>i==null?void 0:i.sizes[E.path],D=_.filter(Gx),z=i?D.reduce((E,I)=>E+(S(I)??0),0):null,P=_.length===0?wy:`${wy} ${V6}${D.length?` ${D.length} ${D.length===1?"is":"are"} yours to decide${z!==null?`: removing them frees about ${Kc(z)}`:""}.`:""}`,F=m.trim().toLowerCase(),H=E=>!F||[E.name,E.path,E.branch??"",...E.threads.map(I=>I.title??I.thread)].some(I=>I.toLowerCase().includes(F)),A=_.filter(E=>nh(E,f)&&H(E)).sort((E,I)=>{if(f==="decide")return(S(I)??0)-(S(E)??0);const Q=te=>Z6(te)?te.merge.offered?0:1:2;return Q(E)-Q(I)||(E.idle_days??1/0)-(I.idle_days??1/0)}),M=async(E,I)=>{const Q=await(E==="merge"?t.merge(I.path):t.remove(I.path));Q.ok?v(({[I.path]:te,...ce})=>ce):v(te=>({...te,[I.path]:Q.refusal.message})),await w()},R=async E=>{if(!E.merge.offered)return;const I=E.threads.find(q=>q.thread===(E.merge.offered&&E.merge.thread)),Q=(I==null?void 0:I.title)??E.merge.thread,te=I!=null&&I.holds.length?`has ${I.holds.length} open hold(s) (${I.holds.join(", ")})`:"has no open holds",ce=E.merge.lands.by==="manager"?`on its turn the queue's merge manager, ${E.merge.lands.manager}, lands it on main`:"on its turn that thread lands it on main",X=E.merge.caveat?`
|
|
392
|
+
`}const qs="candidate";function zx(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}const yL="Versioned records of this project's release branch, with notes from its graph changes.";function f1({description:e=yL,actions:t}){return s.jsx(en,{title:"Releases",description:e,actions:t})}function h1(e){var l;if(!e)return"";const t=(l=e.previous_release)==null?void 0:l.version,n=Number(e.version.split("-rc.")[1]??0),a=e.commits_since??n,r=`${e.commits_since===null?"At least ":""}${a} commit${a===1?"":"s"}`;return t?`${r} since ${t}`:`${r} before the first Release`}function Yc({active:e,onClick:t,version:n,badges:a,caption:r,item_ref:l}){return s.jsxs("button",{ref:l,type:"button","aria-current":e?"true":void 0,onClick:t,className:ie("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:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[s.jsx("span",{className:"truncate",children:n}),a]}),s.jsx("span",{className:"text-muted-foreground text-xs",children:r})]})}function Gn({children:e}){return s.jsx("section",{className:"border-border flex flex-col gap-4 rounded-xl border p-4",children:e})}function Fn({title:e,error:t,onRetry:n}){return s.jsxs(he,{variant:"destructive",children:[s.jsx(Qt,{}),e?s.jsx(ye,{children:e}):null,s.jsxs(xe,{className:"flex flex-col items-start gap-2",children:[t,n?s.jsx(V,{variant:"outline",size:"sm",onClick:n,children:"Try again"}):null]})]})}function jL({title:e,text:t}){return s.jsx(Gn,{children:s.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[s.jsx(hd,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",tabIndex:-1,children:e}),s.jsx("p",{className:"text-muted-foreground max-w-md text-sm",children:t})]})})}function bL(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 qu({changes:e}){const t=u.useMemo(()=>po(e),[e]),[n,a]=u.useState(!1),r=t.unlisted_count+t.modeling_only_count;return s.jsxs("div",{className:"flex flex-col gap-4",children:[t.sections.map(l=>{const i=s.jsx("ul",{className:"flex flex-col gap-2",children:l.lines.map(o=>s.jsx(dy,{line:o},`${o.node_id}:${o.change}`))});return l.key==="breaking"?s.jsxs(he,{variant:"destructive",className:"border-destructive/40",children:[s.jsx(Qt,{}),s.jsx(ye,{children:s.jsx("h3",{className:"text-destructive text-sm font-semibold",children:l.label})}),s.jsx(xe,{className:"text-foreground",children:i})]},l.key):s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:l.label}),i]},l.key)}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Fixed"}),s.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?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No change affects the version."}):null,r>0?s.jsxs("p",{className:"text-muted-foreground text-sm",children:[r," more change",r===1?"":"s"," do",r===1?"es":""," not affect the version."]}):null,e.length>0?s.jsx(V,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":n,onClick:()=>a(l=>!l),children:n?"Hide all changes":"Show all changes"}):null,n?s.jsx("ul",{className:"flex flex-col gap-2",children:e.map(l=>s.jsx(dy,{line:l,detail:!0},`all:${l.node_id}:${l.change}:${l.modeling_only}`))}):null]})}function dy({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 s.jsxs("li",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[e.label,s.jsx(ue,{variant:"outline",children:d1(e.node_type)})]}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]})}const m1="Releases of this checkout: the roadmap of open Planned Releases, the next candidate, and each production release with its notes.",fy=5,Cm="Not available",Rm="planned:";function p1(){const e=ds();return s.jsx("p",{className:"text-muted-foreground text-sm",children:`${Cm}. ${e}`})}const ls=e=>`${Rm}${e}`,wL=e=>e!=null&&e.startsWith(Rm)?e.slice(Rm.length):null,Lx=e=>e?e.slice(0,7):"";function _L(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 NL(){return s.jsxs(he,{variant:"info",children:[s.jsx(Ts,{}),s.jsx(ye,{children:"This page only reads Releases"}),s.jsx(xe,{className:"text-info",children:"A Release is written when production runs a release candidate, once its commit is merged into origin/main."})]})}function kL(e){if(e.state==="unreadable")return{badges:s.jsx(ue,{variant:"error",children:"Could not be read"}),caption:""};if(e.state==="withdrawn")return{badges:s.jsx(ue,{variant:"warning",children:"Withdrawn"}),caption:e.replaced_by?`Replaced by ${e.replaced_by}`:"Withdrawn"};const t=s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:"neutral",children:e.app_changed===!1?"App unchanged":e.previous_release_id?e.bump??"patch":"First"}),e.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),n=e.written_at?zx(e.written_at):"",a=e.tracks&&e.tracks.length>0?` · ${e.tracks.join(", ")}`:"";return{badges:t,caption:`${n}${a}`}}function cr({query:e,select:t,onSelect:n,children:a,inline:r=!1}){return s.jsx("a",{href:`?${e}`,className:r?"text-primary underline":"text-primary hover:underline",onClick:l=>{l.preventDefault(),n(t)},children:a})}function Pd({pairs:e}){const t=e.filter(([,n])=>n!=null&&n!=="");return t.length===0?null:s.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1 text-sm",children:t.map(([n,a])=>s.jsxs(u.Fragment,{children:[s.jsx("dt",{className:"text-muted-foreground",children:n}),s.jsx("dd",{className:"min-w-0",children:a})]},n))})}const Rs=({children:e})=>s.jsx("code",{className:"font-mono text-xs",children:e});function x1(e,t){if(e.judged_commit&&t&&e.judged_commit!==t)return`Judged ${Lx(e.judged_commit)}, not this commit`;const n=e.verdict==="ready"?"Ready":e.verdict==="untested"?"Nothing tested yet":"Not ready",a=e.accepted>0?` · ${e.accepted} failed, accepted`:"";return`${n} · ${e.satisfied} of ${e.total} satisfied${a}`}function qd({title:e,count:t,heading_ref:n}){return s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{ref:n,tabIndex:-1,className:"text-lg font-semibold outline-none",children:e}),t!==void 0?s.jsx("span",{className:"text-muted-foreground text-xs",children:t}):null]})}const SL={ready:"success",verifying:"info",fixing:"warning",abandoned:"warning",ready_older:"neutral",none:"neutral",unknown:"neutral"};function CL({batch:e}){if(e.state==="loading")return s.jsxs(he,{children:[s.jsx(ku,{}),s.jsxs(xe,{className:"flex flex-row items-center gap-2",role:"status",children:[s.jsx(Wt,{"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 s.jsxs(he,{children:[s.jsx(ku,{}),s.jsxs(ye,{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:t.text}),s.jsx(ue,{variant:SL[t.state],children:t.chip})]}),t.help?s.jsx(xe,{children:t.help}):null]})}function RL(e,t,n){return`/org/${e}/issues/${encodeURIComponent(t)}?from=${encodeURIComponent(n)}`}function g1({issues:e,error:t}){return t?s.jsx(Fn,{title:"Known issues could not be read",error:t}):!e||e.length===0?null:s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(qd,{title:"Known issues",count:e.length}),s.jsx("ul",{className:"flex flex-col gap-2",children:e.map(n=>s.jsxs("li",{className:"flex flex-col gap-0.5 text-sm",children:[s.jsxs("span",{children:[n.id,": ",n.title]}),n.accepted_by?s.jsxs("span",{className:"text-muted-foreground text-xs",children:["accepted by ",n.accepted_by]}):null,n.file?s.jsx(Rs,{children:n.file}):null]},n.key))})]})}function v1({tracks:e,error:t}){return t?s.jsx(Fn,{title:"Tracks could not be read",error:t}):!e||e.length===0||e.length===1&&e[0].key==="app"?null:s.jsxs("section",{className:"flex flex-col gap-3",children:[s.jsx(qd,{title:"Tracks",count:e.length}),e.map(n=>n.key==="app"||n.released_by==="release_batch"?s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[n.label,n.version?s.jsx(Rs,{children:n.version}):null,n.bump?s.jsx(ue,{variant:"neutral",children:n.bump}):null]}),s.jsx("span",{className:"text-muted-foreground text-xs",children:"Released with the release batch"})]},n.key):s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[n.label,s.jsxs("span",{className:"text-muted-foreground text-xs",children:[n.packages.length," package",n.packages.length===1?"":"s"]})]}),s.jsx("ul",{className:"flex flex-col gap-1",children:n.packages.map(a=>s.jsxs("li",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Rs,{children:a.name}),s.jsxs(Rs,{children:[a.from??"—"," → ",a.to??"—"]})]}),a.changes.map((r,l)=>s.jsxs("span",{className:"text-muted-foreground text-xs",children:[r.feature,": ",r.entry]},l))]},a.name))}),n.published&&!n.published.recorded?s.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 y1({delivery:e,candidate:t,onSelect:n}){if(!e||e.planned.length===0&&e.outside===0)return null;const a=r=>r.length===0?"—":r.map(l=>l.went?`${l.label} (${l.went})`:l.label).join(", ");return s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(qd,{title:"Planned Releases",count:e.planned.length}),s.jsx("p",{className:"text-muted-foreground text-xs",children:t?"What this candidate would deliver":"What this Release delivered"}),e.planned.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Planned Releases",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Planned Release"}),s.jsx(Z,{children:"Delivered"}),s.jsx(Z,{children:"Not delivered"})]})}),s.jsx(Ge,{children:e.planned.map(r=>s.jsxs(de,{children:[s.jsx(K,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.open&&t?s.jsx(cr,{query:`planned=${encodeURIComponent(r.id)}`,select:ls(r.id),onSelect:n,children:r.name}):s.jsx("span",{children:r.name}),s.jsx(Rs,{children:r.id})]})}),s.jsx(K,{children:a(r.delivered)}),s.jsx(K,{children:a(r.not_delivered)})]},r.id))})]})}):null,e.outside>0?s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.outside," landing",e.outside===1?"":"s"," served no Planned Release."]}):null]})}const TL={thread:"Thread",task:"Task",issue:"Issue",test:"Test"};function j1({rows:e,org:t,from:n,untasked:a}){const{href:r,Link:l}=Xe(),[i,o]=u.useState(!1),c=i?e:e.slice(0,fy),d=f=>f.kind==="task"?s.jsx(l,{className:"text-primary font-mono text-xs hover:underline",href:r(`/org/${t}/tasks/${encodeURIComponent(f.id)}?from=${encodeURIComponent(n)}`),children:f.id}):f.kind==="issue"?s.jsx(l,{className:"text-primary font-mono text-xs hover:underline",href:r(RL(t,f.id,n)),children:f.id}):f.kind==="thread"?s.jsx(l,{className:"text-primary hover:underline",href:r(`${t?`/org/${t}`:""}/threads#thread-${encodeURIComponent(f.id)}`),children:f.label}):f.kind==="test"&&f.url?s.jsx("a",{className:"text-primary hover:underline",href:f.url,target:"_blank",rel:"noreferrer",children:f.label}):s.jsx("span",{children:f.label});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Related",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Kind"}),s.jsx(Z,{children:"Item"}),s.jsx(Z,{children:"How it relates"})]})}),s.jsx(Ge,{children:c.map(f=>s.jsxs(de,{children:[s.jsx(K,{children:TL[f.kind]}),s.jsx(K,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[d(f),f.state&&f.kind!=="thread"?s.jsx("span",{className:"text-muted-foreground text-xs",children:f.state}):null]})}),s.jsx(K,{children:f.relation})]},`${f.kind}:${f.id}`))})]})}),e.length>fy?s.jsx(V,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":i,onClick:()=>o(f=>!f),children:i?"Show fewer":`Show all ${e.length}`}):null,a?s.jsxs("p",{className:"text-muted-foreground text-xs",children:[a," landing",a===1?"":"s"," not tied to a task"]}):null]})}const b1=e=>(e==null?void 0:e.status)===409&&e.reason==="view_outdated";function w1(e){const t=Ux(),[n,a]=u.useState(t!=null&&t.related?{state:"loading"}:null),r=u.useRef(0),l=u.useCallback(async(i=!1)=>{if(!(t!=null&&t.related))return;const o=++r.current;a({state:"loading"});const c=await t.related(e,i?{fresh:!0}:void 0);o===r.current&&a(c.ok?{state:"ready",value:c.data}:{state:"error",error:c.refusal.message,refusal:c.refusal})},[t,e]);return u.useEffect(()=>{l()},[l]),{related:n,read:l}}function _1({related:e,org:t,from:n,onRetry:a}){const r=u.useRef(null),l=u.useRef(!1);if(u.useEffect(()=>{var o;l.current&&(e==null?void 0:e.state)!=="loading"&&(l.current=!1,(o=r.current)==null||o.focus())},[e]),!e)return null;const i=e.state==="ready"?e.value.rows.length:void 0;return s.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":"release-related",children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{id:"release-related",ref:r,tabIndex:-1,className:"text-lg font-semibold outline-none",children:"Related"}),i!==void 0?s.jsx("span",{className:"text-muted-foreground text-xs",children:i}):null]}),e.state==="loading"?s.jsxs("div",{className:"grid gap-2",role:"status","aria-label":"Loading related work",children:[s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-full"}),s.jsx(jt,{className:"h-8 w-2/3"})]}):e.state==="error"?b1(e.refusal)?s.jsx(p1,{}):s.jsx(Fn,{title:"Related work could not be read",error:e.error,onRetry:()=>{l.current=!0,a()}}):e.value.rows.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):s.jsx(j1,{rows:e.value.rows,org:t,from:n,untasked:e.value.untasked})]})}function EL(e){if(!e||e.of===0)return null;if(e.tasks===0)return s.jsx("span",{className:"text-muted-foreground",children:"none"});const t=Object.entries(e.outcomes);return s.jsxs("span",{children:[e.tasks," of ",e.of," tasks",t.map(([n,a])=>s.jsxs("span",{className:n==="failed"?"text-destructive":void 0,children:[" · ",a," ",n]},n))]})}function N1({planned:e,onSelect:t}){return e?e.open?s.jsx(cr,{query:`planned=${encodeURIComponent(e.id)}`,select:ls(e.id),onSelect:t,children:e.name}):s.jsxs("span",{children:[e.name," ",s.jsx(Rs,{children:e.id})]}):null}function AL({candidate:e,org:t,onSelect:n,notes:a}){const r=Ux(),{related:l,read:i}=w1("candidate"),[o,c]=u.useState(r!=null&&r.candidateBatch?{state:"loading"}:null);u.useEffect(()=>{if(!(r!=null&&r.candidateBatch))return;let f=!0;return r.candidateBatch().then(h=>{f&&(h.ok?c(h.data.batch===null?null:{state:"ready",value:h.data.batch}):c({state:"error",error:h.refusal.message}))}),()=>{f=!1}},[r]);const d=e.readiness??((l==null?void 0:l.state)==="ready"?l.value.readiness:null)??null;return s.jsxs(s.Fragment,{children:[s.jsx(Pd,{pairs:[["Environment",e.environment??"staging"],["Commit",s.jsx(Rs,{children:Lx(e.head_commit_id)},"commit")],["Readiness",d?x1(d,e.head_commit_id):null],["Planned",e.planned_release?s.jsx(N1,{planned:e.planned_release,onSelect:n}):null]]}),o?s.jsx(CL,{batch:o}):null,a,s.jsx(g1,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(v1,{tracks:e.tracks,error:e.tracks_error}),s.jsx(y1,{delivery:e.planned_delivery,candidate:!0,onSelect:n}),s.jsx(_1,{related:l,org:t,from:"release:candidate",onRetry:()=>i(!0)})]})}function ML({release:e,onSelect:t}){const n=e.label??e.version,a=!e.previous_release_id;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:n}),e.state==="withdrawn"?s.jsx(ue,{variant:"warning",children:"Withdrawn"}):s.jsx(ue,{variant:"neutral",children:e.app_changed===!1?"App unchanged":a?"First":e.bump}),e.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),e.state==="withdrawn"&&e.replaced_by?s.jsxs("p",{className:"text-sm",children:["Replaced by"," ",s.jsx(cr,{query:`release=${encodeURIComponent(e.replaced_by)}`,select:e.replaced_by,onSelect:t,inline:!0,children:e.replaced_by})]}):null]})}function $L({release:e,org:t,onSelect:n,notes:a}){const r=e.label??e.version,{related:l,read:i}=w1(r),o=(l==null?void 0:l.state)==="ready"?EL(l.value.previews):null;return s.jsxs(s.Fragment,{children:[s.jsx(Pd,{pairs:[["Environment",e.environment??"production"],["Commit",e.commit?s.jsx(Rs,{children:Lx(e.commit)},"commit"):null],["Readiness",e.readiness?`${x1(e.readiness)} on staging`:null],["Previews",o],["Planned",e.planned_release?s.jsx(N1,{planned:e.planned_release,onSelect:n}):null]]}),a,s.jsx(g1,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(v1,{tracks:e.tracks,error:e.tracks_error}),s.jsx(y1,{delivery:e.planned_delivery,candidate:!1,onSelect:n}),s.jsx(_1,{related:l,org:t,from:`release:${r}`,onRetry:()=>i(!0)})]})}function OL({id:e,summary:t,org:n,onNotFound:a,forecast:r}){var x,b;const l=Ux(),[i,o]=u.useState({state:"loading"}),c=u.useRef(0),d=u.useCallback(async(v=!1)=>{const y=++c.current;if(!(l!=null&&l.plannedRelease)){o({state:"error",error:Cm,refusal:{status:409,message:Cm,reason:"view_outdated"}});return}o({state:"loading"});const g=await l.plannedRelease(e,v?{fresh:!0}:void 0);y===c.current&&o(g.ok?{state:"ready",value:g.data}:{state:"error",error:g.refusal.message,refusal:g.refusal})},[l,e]);u.useEffect(()=>{d()},[d]);const f=i.state==="error"&&(((x=i.refusal)==null?void 0:x.status)===404||((b=i.refusal)==null?void 0:b.reason)==="not_found");if(u.useEffect(()=>{f&&a()},[f,a]),i.state==="loading")return s.jsxs(Gn,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),s.jsx(ue,{variant:"neutral",children:"Planned"})]}),s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Planned Release…"})]});if(i.state==="error")return s.jsxs(Gn,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),b1(i.refusal)?s.jsx(p1,{}):f?null:s.jsx(Fn,{error:i.error,onRetry:()=>void d(!0)})]});const h=i.value,m=h.order===null?null:h.order===1?`Next of ${h.open} open`:`${h.order} of ${h.open} open`;return s.jsxs(Gn,{children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:h.name}),s.jsx(ue,{variant:"neutral",children:"Planned"})]}),h.goal?s.jsx("p",{className:"text-muted-foreground text-sm",children:h.goal}):null]}),s.jsx(Pd,{pairs:[["Planned Release",s.jsx(Rs,{children:h.id},"id")],["Date",h.date],["Order",m],["Members",String(h.members.length)]]}),r,s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"A Planned Release changes through release_plan.py:"}),s.jsxs("pre",{className:"bg-muted rounded-md px-3 py-2 font-mono text-xs",children:["sdlc view --planned ",h.id]})]}),s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(qd,{title:"Members",count:h.members.length}),h.members.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Members",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Member"}),s.jsx(Z,{children:"Level"}),s.jsx(Z,{children:"Tasks"}),s.jsx(Z,{children:"State"})]})}),s.jsx(Ge,{children:h.members.map(v=>{const y=v.tasks.filter(p=>p.state==="done").length,g=v.tasks.filter(p=>p.state!=="done").map(p=>p.id);return s.jsxs(de,{children:[s.jsx(K,{children:v.label}),s.jsx(K,{children:v.level?s.jsx(ue,{variant:"neutral",children:DL(v.level)}):null}),s.jsx(K,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[v.tasks.length>0?s.jsxs("span",{children:[y," of ",v.tasks.length," done"]}):null,g.length>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Open: ",s.jsx(Rs,{children:g.join(", ")})]}):null,v.untracked>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[v.untracked," slice",v.untracked===1?" has":"s have"," no task yet"]}):null]})}),s.jsx(K,{children:v.state})]},v.item)})})]})}):null]}),s.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":"planned-related",children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{id:"planned-related",className:"text-lg font-semibold",children:"Related"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:h.related.length})]}),h.related.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):s.jsx(j1,{rows:h.related,org:n,from:`planned:${h.id}`})]})]})}const DL=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ux(){return mn().releases}const ts={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"},hy=3,zL=["in_progress","not_started","planned","blocked"],Bx="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),Rt=e=>e.charAt(0).toUpperCase()+e.slice(1);function Jf(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(e??""));return t?`${Number(t[3])} ${Bx[Number(t[2])-1]}`:String(e??"")}function k1(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${Bx[t.getMonth()]} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function LL(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${Bx[t.getMonth()]}`}function Gs(e){return e?e.from===e.to&&e.or_later?`${Jf(e.from)} or later`:`${Jf(e.from)} to ${Jf(e.to)}${e.or_later?", or later":""}`:""}function UL(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 S1(e){var h;const t=e??{},n=t.source??{},r=[t.no_date==="no date: no rate"&&n.rate_why?n.rate_why:"",/members estimated$/.test(t.no_date??"")?"":UL(t)].filter(Boolean).join(" · "),l=t.projected?Gs(t.projected):t.no_date??"",i=(h=t.projected)==null?void 0:h.raw,o=!!(i&&t.projected&&(i.from!==t.projected.from||i.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,f=[r,c,o&&i&&t.projected?`corrected for past estimates: raw ${Gs({...i,or_later:t.projected.or_later})}`:"",d?`past forecasts at this coverage: ${d.inside} of ${d.of} inside their range`:""].filter(Boolean);return{lead:l?Rt(l):"",caption:f}}function BL(e){const t=e.kinds??[];return[t.includes("range")?"Not promised":"",e.goal??(t.includes("major")?"No goal yet":"")].filter(Boolean).join(" · ")}function HL(e){var c,d,f,h;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`,a=(e.blocked??[]).length,r=(e.needs_user??[]).length,l=!a&&!r?["none blocked · none waiting on you"]:[a?`${a} blocked`:"",r?`${r} waiting on you`:""],i=((f=e.tasks)==null?void 0:f.untracked_slices)??0;i&&l.push(`${i} slice${i===1?"":"s"} not tasks yet`);const o=((h=e.not_a_member)==null?void 0:h.count)??0;return o&&l.push(`${o} not a member yet`),{lead:n,rest:l.filter(Boolean).join(" · ")}}const C1=e=>String(e??"").replace(/_/g," ");function IL(e){const t=e??{},n=t.kinds??[],a=n.includes("slipped"),r=!a&&t.was&&t.now?Gs(t.was)===Gs(t.now)?`, range still ${Gs(t.now)}`:`, range was ${Gs(t.was)}, now ${Gs(t.now)}`:"",l=[a&&t.was?`was ${Gs(t.was)}`:"",n.includes("scope changed")?`scope changed${r}`:""].filter(Boolean),i=(t.what??[]).slice(-3).map(o=>{const c=o.by&&(o.by.title||o.by.thread||o.by.person);return`${[o.kind,o.label||o.item].filter(Boolean).join(" ")}${c?` by ${c}`:""}${o.why?`: ${o.why}`:""}`});return{head:l.length?Rt(l.join(" · ")):"",what:i}}const gl="roadmap",my={reading:!1,value:null,refusal:null};function PL(e){const[t,n]=u.useState({all:my,mine:my}),a=u.useRef({all:0,mine:0}),r=u.useCallback(async(l,i=!1)=>{if(!(e!=null&&e.roadmap))return;const o=++a.current[l];n(d=>({...d,[l]:{...d[l],reading:!0}}));const c=await e.roadmap({...i?{fresh:!0}:{},...l==="mine"?{mine:!0}:{}});o===a.current[l]&&n(d=>({...d,[l]:c.ok?{reading:!1,value:c.data,refusal:null}:{reading:!1,value:d[l].value,refusal:c.refusal}}))},[e]);return{reads:t,read:r,available:!!(e!=null&&e.roadmap)}}function qL(e,t){return`${e} open${t.length?` · ${t.join(", ")} moved since you looked`:""}`}function Gi({children:e}){return s.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 R1=({level:e})=>e?s.jsx(ue,{variant:"neutral",children:Rt(e)}):null;function T1({state:e}){const t=Rt(C1(e));return zL.includes(String(e))?s.jsx("span",{className:"font-medium",children:t}):s.jsx("span",{children:t})}function GL({reads:e,scope:t,onScope:n,onRead:a,org:r,onSelect:l}){var x,b;const i=e[t],o=i.value,c=ds(),d=u.useRef(null),f=u.useRef(!1);u.useEffect(()=>{!i.reading&&!i.value&&!i.refusal&&a(t)},[t,i.reading,i.value,i.refusal,a]),u.useEffect(()=>{var v;f.current&&!i.reading&&(f.current=!1,(v=d.current)==null||v.focus())},[i.reading]);const h=()=>{f.current=!0,a(t,!0)},m=o?[o.as_of?`as of ${k1(o.as_of)}`:"",`${((x=o.source)==null?void 0:x.machine)||"this machine"}'s records`,((b=o.decider)==null?void 0:b.words)??""].filter(Boolean).join(" · "):"";return s.jsxs(Gn,{children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[s.jsx("h2",{ref:d,tabIndex:-1,className:"text-lg font-semibold outline-none",children:"Roadmap"}),m?s.jsx("p",{className:"text-muted-foreground text-xs",children:m}):null]}),s.jsx("div",{role:"group","aria-label":"Roadmap scope",className:"flex gap-2",children:["all","mine"].map(v=>s.jsx(V,{variant:"outline",size:"sm","aria-pressed":t===v,onClick:()=>n(v),children:v==="all"?"All":"Mine"},v))})]}),s.jsx("div",{"aria-live":"polite",children:i.reading?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[s.jsx(Wt,{"aria-hidden":!0,className:"size-4"})," ",Rt(ts.pending),"…"]}):null}),i.refusal&&!i.reading?i.refusal.reason==="no_roadmap"?s.jsx(Fn,{title:ts.failedLead,error:`${Rt(ts.noEngineLead)}. ${c}`}):i.refusal.reason==="refused"?s.jsx(Fn,{title:ts.failedLead,error:i.refusal.message}):s.jsx(Fn,{title:ts.failedLead,error:i.refusal.message,onRetry:h}):null,o?t==="mine"?s.jsx(WL,{mine:o.mine,org:r,onSelect:l}):s.jsx(YL,{read:o,org:r,onSelect:l}):null]})}function VL(e){if(!e||typeof e.seconds_per_day!="number")return"No rate";const t=LL(e.as_of);return`${Math.round(e.seconds_per_day/3600)} task hours a day over the ${e.days} days${t?` to ${t}`:""}`}function YL({read:e,org:t,onSelect:n}){var r,l;const a=e.releases??[];if(!a.length){const[i,o]=ts.noRelease.split(" Create one: ");return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("p",{className:"text-sm",children:i}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Create one in the terminal:"}),s.jsx(Gi,{children:o})]})}return s.jsxs(s.Fragment,{children:[s.jsx(Pd,{pairs:[["Forecast from",Rt(`${((r=e.source)==null?void 0:r.machine)||"this machine"}'s task records and rate`)],["Rate",VL(e.rate)],["Not counted",Rt(((l=e.source)==null?void 0:l.not_counted)||"other machines' work")]]}),a.map(i=>s.jsx(FL,{row:i,org:t,onSelect:n},i.id))]})}function FL({row:e,org:t,onSelect:n}){var h,m,x;const a=S1(e.forecast),r=HL(e),l=BL(e),i=`roadmap-${e.id}`,o=e.moved?IL(e.told):null,c=(((h=e.counts)==null?void 0:h.members)??0)===0,d=((m=e.not_a_member)==null?void 0:m.count)??0,f=[l,c&&d?`${d} not a member yet`:""].filter(Boolean).join(" · ");return s.jsxs("section",{"aria-labelledby":i,className:"flex flex-col gap-2 border-t pt-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h3",{id:i,className:"text-base font-semibold",children:s.jsx(cr,{query:`planned=${encodeURIComponent(e.id)}`,select:ls(e.id),onSelect:n,children:e.name})}),e.kinds.map(b=>s.jsx(ue,{variant:"neutral",children:b},b))]}),a.lead||a.caption.length?s.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.lead?s.jsx("p",{className:"text-sm",children:a.lead}):null,a.caption.length?s.jsx("p",{className:"text-muted-foreground text-xs",children:Rt(a.caption.join(" · "))}):null]}):null,f?s.jsx("p",{className:"text-muted-foreground text-sm",children:f}):null,o?s.jsxs(he,{variant:"info",children:[s.jsx(XR,{"aria-hidden":!0}),s.jsx(ye,{children:"Moved since you looked"}),s.jsxs(xe,{className:"text-info flex flex-col gap-0.5",children:[o.head?s.jsx("span",{children:o.head}):null,o.what.map((b,v)=>s.jsx("span",{className:"text-xs",children:b},v))]})]}):null,c?null:s.jsxs("p",{className:"text-sm",children:[r.lead,r.rest?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",r.rest]}):null]}),(x=e.stale_unchecked)!=null&&x.words?s.jsx("p",{className:"text-muted-foreground text-xs",children:Rt(e.stale_unchecked.words)}):null,e.for_you&&e.kinds.includes("major")?s.jsx(KL,{row:e}):null,s.jsx(QL,{row:e,org:t})]})}function KL({row:e}){const t=e.for_you;return!t||!t.proposals.length&&!t.committed_nobody_on.length&&!t.widens_most&&!t.set_goal?null:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h4",{className:"text-sm font-semibold",children:"For you"}),t.proposals.map(a=>{const r=[a.proposed_by_title||a.proposed_by?`by ${a.proposed_by_title||a.proposed_by}`:"",a.reason??""].filter(Boolean).join(": ");return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("p",{className:"text-sm",children:["Proposed: ",a.label||a.item]}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[r?`${Rt(r).replace(/\.$/,"")}. `:"","Accept or reject in the terminal:"]}),s.jsx(Gi,{children:a.accept}),s.jsx(Gi,{children:a.reject})]},a.item)}),t.committed_nobody_on.map(a=>s.jsxs("p",{className:"text-sm",children:["Nobody on this machine is on ",a.label||a.item,a.level?` (${a.level})`:""]},a.item)),t.widens_most?s.jsxs("p",{className:"text-sm",children:["Widens the range most: ",t.widens_most.label||t.widens_most.item,t.widens_most.high_seconds?s.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?s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("p",{className:"text-sm",children:"Set its goal:"}),s.jsx(Gi,{children:t.set_goal})]}):null]})}function E1({next:e,org:t}){const{href:n,Link:a}=Xe(),r=e.tasks[0],l=e.label||e.item;return r?s.jsx(a,{className:"text-primary hover:underline",href:n(`/org/${t}/tasks/${encodeURIComponent(r.id)}?from=roadmap`),children:l}):s.jsx("span",{children:l})}function XL(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?Rt(e.nobody):""}function QL({row:e,org:t}){const[n,a]=u.useState(!1),r=e.next??[];if(!r.length){const o=e.kinds.includes("range")?e.tagged_threads??[]:[];return o.length?s.jsx("p",{className:"text-muted-foreground text-sm",children:o.map(c=>`${c.title}: ${c.words}`).join(", ")}):null}const l=n?r:r.slice(0,hy),i=new Map((e.stale_estimates??[]).map(o=>[o.item,o]));return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h4",{className:"text-sm font-semibold",children:"Next"}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:`Next in ${e.name}`,children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Member"}),s.jsx(Z,{children:"Level"}),s.jsx(Z,{children:"State"}),s.jsx(Z,{children:"Who is on it"})]})}),s.jsx(Ge,{children:l.map(o=>{const c=i.get(o.item);return s.jsxs(de,{children:[s.jsx(K,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(E1,{next:o,org:t}),c?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[Rt(c.words),c.estimate_as_of?` (estimated ${k1(c.estimate_as_of)})`:""]}):null]})}),s.jsx(K,{children:s.jsx(R1,{level:o.level})}),s.jsx(K,{children:s.jsx(T1,{state:o.state})}),s.jsx(K,{children:XL(o,e)})]},o.item)})})]})}),r.length>hy&&!n?s.jsxs(V,{variant:"outline",size:"sm",className:"self-start",onClick:()=>a(!0),children:["Show all ",r.length]}):null,l.some(o=>i.has(o.item))?s.jsx("p",{className:"text-muted-foreground text-xs",children:"Re-forecast it in the terminal: task-record reforecast"}):null]})}function WL({mine:e,org:t,onSelect:n}){const{href:a,Link:r}=Xe();if(!e)return null;const l=e.tasks.filter(i=>i.propose);return s.jsxs(s.Fragment,{children:[s.jsxs("section",{"aria-labelledby":"roadmap-your-work",className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h3",{id:"roadmap-your-work",className:"text-base font-semibold",children:"Your work"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:e.title})]}),e.tasks.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:Rt(ts.noTask)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Your work",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Task"}),s.jsx(Z,{children:"Release"}),s.jsx(Z,{children:"Member"})]})}),s.jsx(Ge,{children:e.tasks.map(i=>{var o,c;return s.jsxs(de,{children:[s.jsx(K,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:a(`/org/${t}/tasks/${encodeURIComponent(i.id)}?from=roadmap`),children:i.id}),s.jsx("span",{className:"text-muted-foreground text-xs",children:[i.title||i.thread,Rt(C1(i.state))].filter(Boolean).join(" · ")})]})}),s.jsx(K,{children:(o=i.members)!=null&&o.length?i.members.map(d=>s.jsx("div",{children:s.jsx(cr,{query:`planned=${encodeURIComponent(d.planned_release)}`,select:ls(d.planned_release),onSelect:n,children:d.name})},d.planned_release)):i.release?s.jsx(cr,{query:`planned=${encodeURIComponent(i.release.planned_release)}`,select:ls(i.release.planned_release),onSelect:n,children:i.release.name}):s.jsx("span",{className:"text-muted-foreground",children:i.words?Rt(i.words):"—"})}),s.jsx(K,{children:(c=i.members)!=null&&c.length?i.members.map(d=>s.jsx(R1,{level:d.level},d.planned_release)):i.not_a_member?s.jsx("span",{className:"text-muted-foreground",children:"Not a member yet"}):null})]},i.id)})})]})}),l.map(i=>{var o;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Propose ",i.id,"'s plan to ",((o=i.release)==null?void 0:o.name)??"its release"," in the terminal:"]}),s.jsx(Gi,{children:i.propose??""})]},i.id)})]}),s.jsxs("section",{"aria-labelledby":"roadmap-your-next",className:"flex flex-col gap-2",children:[s.jsx("h3",{id:"roadmap-your-next",className:"text-base font-semibold",children:"Your next members"}),e.next.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:Rt(ts.noNext)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Your next members",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Release"}),s.jsx(Z,{children:"Member"}),s.jsx(Z,{children:"State"})]})}),s.jsx(Ge,{children:e.next.map(i=>s.jsxs(de,{children:[s.jsx(K,{children:s.jsx(cr,{query:`planned=${encodeURIComponent(i.release)}`,select:ls(i.release),onSelect:n,children:i.name})}),s.jsx(K,{children:s.jsx(E1,{next:i,org:t})}),s.jsx(K,{children:s.jsx(T1,{state:i.state})})]},`${i.release}:${i.item}`))})]})})]})]})}function ZL({state:e,id:t}){var l;const n=ds();if(!e)return null;const a=(l=e.value)==null?void 0:l.releases.find(i=>i.id===t);if(!a){if(e.reading)return s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[s.jsx(Wt,{"aria-hidden":!0,className:"size-4"})," ",Rt(ts.pending),"…"]});if(e.refusal){const i=e.refusal.reason==="no_roadmap"?`${Rt(ts.noEngineLead)}. ${n}`:e.refusal.message;return s.jsx("p",{className:"text-muted-foreground text-xs",children:`${ts.failedLead}: ${i}`})}return null}const r=S1(a.forecast);return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.lead?s.jsx("p",{className:"text-sm",children:r.lead}):null,r.caption.length?s.jsx("p",{className:"text-muted-foreground text-xs",children:Rt(r.caption.join(" · "))}):null]})}function A1(){const e=mn().releases;if(!e)throw new Error("The Releases page rendered without a Releases contract.");return e}function JL({initial:e,environments:t,branch_options:n,chooseBranch:a,renderWrite:r,selection:l,org:i,onReadAgain:o,onNotFound:c,notice:d,focusOnMount:f}){var nn,sn,zn,st,hs,Wn,ms,ps,U,$;const h=A1(),m=e.local??null,[x,b]=u.useState(e),[v,y]=u.useState(null),g=l?l.selected:v,p=l?l.onSelect:y,j=!!(m||x.release_branch),[w,N]=u.useState(m||e.release_branch?{state:"loading"}:{state:"ready",value:null}),[C,_]=u.useState({}),[S,D]=u.useState(null),[z,P]=u.useState(!1),[F,H]=u.useState(null),[A,M]=u.useState(null),R=u.useRef(null),T=m?{fresh:!0}:void 0,k=u.useCallback(async B=>{const W=await h.candidate(B);N(W.ok?{state:"ready",value:W.data.candidate}:{state:"error",error:W.refusal.message,refusal:W.refusal})},[h]),O=u.useCallback(async()=>{N({state:"loading"}),await k(T)},[k,m]),Y=u.useCallback(async()=>{const B=await h.list();B.ok&&b(B.data)},[h]),E=((nn=x.release_branch)==null?void 0:nn.id)??null;u.useEffect(()=>{if(!m&&!E)return;let B=!1;return h.candidate().then(W=>{B||N(W.ok?{state:"ready",value:W.data.candidate}:{state:"error",error:W.refusal.message,refusal:W.refusal})}),()=>{B=!0}},[E,h,m]);const I=u.useRef(new Set),Q=u.useCallback((B,W)=>_(ve=>({...ve,[B]:W.ok?{state:"ready",value:W.data.release}:{state:"error",error:W.refusal.message,refusal:W.refusal}})),[]),te=async B=>{_(W=>({...W,[B]:{state:"loading"}})),I.current.add(B),Q(B,await h.release(B,T))},ce=w.state!=="ready"||w.value!==null,X=wL(g),L=PL(m?h:void 0),q=L.available&&g===gl,[ne,ae]=u.useState("all"),je=x.release_branch||m?ce?qs:null:((sn=x.releases[0])==null?void 0:sn.version)??null,re=X!==null||q?null:g===qs?ce?qs:null:g??je,[we,se]=u.useState([]),tt=u.useRef(0);u.useEffect(()=>{if(!m||!h.roadmapMoved)return;let B=!0;const W=tt.current;return h.roadmapMoved().then(ve=>{B&&ve.ok&&W===tt.current&&se(ve.data.moved.map(Oe=>Oe.name))}),()=>{B=!1}},[h,m]);const ge=L.reads.all,He=L.read;u.useEffect(()=>{X===null||!L.available||!ge.value&&!ge.reading&&!ge.refusal&&He("all")},[X,L.available,ge,He]);const[J,ke]=u.useState(0),Ue=u.useRef(0),ft=B=>{B===gl&&ke(W=>W+1),p(B)};u.useEffect(()=>{if(J!==Ue.current){if(!q){Ue.current=J;return}ne!=="all"||ge.reading||!ge.value||!h.roadmapSeen||(Ue.current=J,h.roadmapSeen(ge.value.as_of).then(B=>{B.ok&&(tt.current+=1,se([]))}))}},[J,q,ne,ge,h]);const _e=new Map((((zn=ge.value)==null?void 0:zn.releases)??[]).map(B=>[B.id,[B.kinds.includes("range")?"range":"",B.forecast.projected?Gs(B.forecast.projected):"no date"].filter(Boolean).join(" · ")])),Ht=re===null||re===qs||x.releases.some(B=>B.version===re);u.useEffect(()=>{!m||!c||re!==null&&re!==qs&&!Ht&&c({kind:"release",id:re})},[m,c,re,Ht]),u.useEffect(()=>{!re||re===qs||I.current.has(re)||m&&!Ht||(I.current.add(re),h.release(re).then(B=>Q(re,B)))},[re,h,Q,Ht]);const wt=u.useRef(g),Et=u.useRef(!1),tn=u.useRef(!!f),_t=u.useRef(null);u.useEffect(()=>{var W,ve;if(!m)return;if(tn.current){const Oe=(W=_t.current)==null?void 0:W.querySelector('[aria-current="true"]');if(Oe){tn.current=!1,wt.current=g,Oe.focus();return}}if(wt.current!==g&&(wt.current=g,Et.current=!0),!Et.current)return;const B=(ve=R.current)==null?void 0:ve.querySelector("h2");B&&(Et.current=!1,B.tabIndex=-1,B.focus())});const Nt=async B=>{if(!a)return;D(null);const W=await a(B);if(!W.ok){D(W.error);return}y(null),N({state:"loading"}),await Y()},bn=async()=>{if(!x.next_before)return;M(null);const B=await h.list({before:x.next_before});if(!B.ok){M(B.refusal.message);return}b(W=>({...B.data,releases:[...W.releases,...B.data.releases]}))},Gt=x.release_branch?s.jsx(t6,{value:x.release_branch.id,label:x.release_branch.name,options:n??[],can_write:x.can_write,onChange:Nt}):null,le=m?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Read at ",e6(m.read_at)]}),o?s.jsxs(V,{variant:"ghost",size:"sm",onClick:o,children:[s.jsx(kr,{className:"mr-1 size-4","aria-hidden":!0}),"Read again"]}):null]}):Gt,Me=m?_L(((st=x.releases[0])==null?void 0:st.label)??((hs=x.releases[0])==null?void 0:hs.version)??null):bL(((Wn=x.releases[0])==null?void 0:Wn.version)??null,((ms=x.release_branch)==null?void 0:ms.name)??null),Ce={org:i??""};return s.jsxs(s.Fragment,{children:[s.jsx(f1,{description:m?m1:void 0,actions:le}),d,m?s.jsx(NL,{}):null,S?s.jsx(Fn,{error:S}):null,m?null:t,!m&&!x.release_branch?s.jsx(n6,{can_write:x.can_write,options:n??[],onChoose:Nt}):null,x.release_branch||x.releases.length>0||m?s.jsxs("div",{ref:_t,className:"flex flex-col gap-6 md:flex-row md:items-start",children:[s.jsx(s6,{list:x,candidate:j?w:null,shown:q?gl:X!==null?ls(X):re,onSelect:ft,roadmap:L.available?qL(((ps=x.planned)==null?void 0:ps.length)??0,we):null,planned_ranges:_e,can_load_older:!!x.next_before,older_error:A,onLoadOlder:bn}),s.jsx("div",{className:"min-w-0 flex-1",ref:R,children:q?s.jsx(GL,{reads:L.reads,scope:ne,onScope:ae,onRead:He,org:Ce.org,onSelect:p}):X!==null?s.jsx(OL,{id:X,summary:((U=x.planned)==null?void 0:U.find(B=>B.id===X))??null,org:Ce.org,onNotFound:()=>c==null?void 0:c({kind:"planned",id:X}),forecast:L.available?s.jsx(ZL,{state:ge,id:X}):null}):re===qs?s.jsx(r6,{candidate:w,branch_name:(($=x.release_branch)==null?void 0:$.name)??null,can_write:x.can_write&&!!r,local:!!m,org:Ce.org,onSelect:p,onRetry:O,onWrite:()=>P(!0)}):re?s.jsx(l6,{detail:C[re]??{state:"loading"},summary:x.releases.find(B=>B.version===re)??null,local:!!m,org:Ce.org,onSelect:p,onRetry:()=>te(re)}):(x.release_branch||m)&&w.state==="ready"?s.jsx(jL,{title:Me.title,text:Me.text}):null})]}):null,r&&w.state==="ready"&&w.value?r({candidate:w.value,open:z,notice:F,onOpenChange:B=>{B||H(null),P(B)},onStale:async B=>{H(B),await k()},onWritten:async B=>{P(!1),H(null),await Y(),y(B),await O()}}):null]})}function e6(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function t6({value:e,label:t,options:n,can_write:a,onChange:r}){const l=n.some(i=>i.id===e);return s.jsxs("div",{className:"grid w-56 gap-2",children:[s.jsx($e,{htmlFor:"release-branch",children:"Release branch"}),s.jsxs(pt,{value:e,onValueChange:r,disabled:!a,children:[s.jsx(ut,{id:"release-branch",children:s.jsx(xt,{})}),s.jsxs(dt,{children:[l?null:s.jsx(Re,{value:e,children:t??"Unnamed branch"}),n.map(i=>s.jsx(Re,{value:i.id,children:i.label},i.id))]})]}),a?null:s.jsx(M1,{})]})}function M1(){return s.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 n6({can_write:e,options:t,onChoose:n}){return s.jsxs("section",{className:"flex flex-col items-center gap-3 py-16 text-center",children:[s.jsx(ku,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",children:"Choose a release branch"}),s.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."}),s.jsxs("div",{className:"grid w-64 gap-2 text-left",children:[s.jsx($e,{htmlFor:"release-branch-first",children:"Release branch"}),s.jsxs(pt,{onValueChange:n,disabled:!e,children:[s.jsx(ut,{id:"release-branch-first",children:s.jsx(xt,{placeholder:"Choose a branch"})}),s.jsx(dt,{children:t.map(a=>s.jsx(Re,{value:a.id,children:a.label},a.id))})]})]}),e?null:s.jsx(M1,{})]})}function $1({children:e}){return s.jsx("p",{className:"text-muted-foreground px-3 pt-3 text-xs font-medium tracking-wide uppercase",children:e})}function s6({list:e,candidate:t,shown:n,onSelect:a,roadmap:r,planned_ranges:l,can_load_older:i,older_error:o,onLoadOlder:c}){var h,m;const d=!!e.local,f=(t==null?void 0:t.state)==="ready"&&t.value?po(t.value.changes):null;return s.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&&r?s.jsx(Yc,{active:n===gl,onClick:()=>a(gl),version:"Roadmap",badges:null,caption:r}):null,t&&(t.state!=="ready"||t.value)?s.jsx(Yc,{active:n===qs,onClick:()=>a(qs),version:t.state==="ready"&&t.value?t.value.version:"Next release",badges:s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:"info",children:"Candidate"}),f!=null&&f.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):t.state==="ready"&&((h=t.value)==null?void 0:h.app_changed)===!1?s.jsx(ue,{variant:"neutral",children:"App unchanged"}):t.state==="ready"&&((m=t.value)!=null&&m.classification)?s.jsx(ue,{variant:"neutral",children:t.value.classification.bump}):null]}),caption:t.state==="loading"?"Classifying…":t.state==="error"?"Could not be read":h1(t.value)}):null,d?s.jsx(a6,{list:e,shown:n,onSelect:a,ranges:l}):null,d&&e.releases.length>0?s.jsx($1,{children:"Released"}):null,e.releases.map(x=>{const b=d?kL(x):null;return s.jsx(Yc,{active:n===x.version,onClick:()=>a(x.version),version:x.label??x.version,badges:(b==null?void 0:b.badges)??s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:"neutral",children:x.previous_release_id?x.bump??"patch":"First"}),x.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),caption:(b==null?void 0:b.caption)??zx(x.written_at)},x.version)}),i?s.jsx(V,{variant:"link",size:"sm",className:"self-start",onClick:c,children:"Show older Releases"}):null,o?s.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o}):null]})}function a6({list:e,shown:t,onSelect:n,ranges:a}){return!e.planned_error&&!(e.planned&&e.planned.length>0)?null:s.jsxs(s.Fragment,{children:[s.jsx($1,{children:"Planned"}),e.planned_error?s.jsx(Fn,{title:"Planned Releases could not be read",error:e.planned_error}):null,(e.planned??[]).map((r,l)=>s.jsx(Yc,{active:t===ls(r.id),onClick:()=>n(ls(r.id)),version:r.name,badges:s.jsx(ue,{variant:"neutral",children:"Planned"}),caption:`${r.members===0?"no members":`${r.members} member${r.members===1?"":"s"}`}${l===0?" · next":""}${a!=null&&a.get(r.id)?` · ${a.get(r.id)}`:""}`},r.id))]})}function r6({candidate:e,branch_name:t,can_write:n,local:a,org:r,onSelect:l,onRetry:i,onWrite:o}){var m;if(e.state==="loading")return s.jsx(Gn,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Classifying the changes since the last Release…"})});if(e.state==="error")return s.jsx(Gn,{children:s.jsx(Fn,{error:e.error,onRetry:i})});const c=e.value;if(!c)return null;const d=po(c.changes),f=!c.previous_release,h=t??"the release branch";return s.jsxs(Gn,{children:[s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:c.version}),s.jsx(ue,{variant:"info",children:"Candidate"}),d.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):c.app_changed===!1?s.jsx(ue,{variant:"neutral",children:"App unchanged"}):c.classification?s.jsx(ue,{variant:"neutral",children:c.classification.bump}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:[a?"What staging runs over production: ":`What the next Release holds at ${h}'s head: `,h1(c),". It is computed when you open it and never stored.",d.breaking&&c.next_version.startsWith("0.")?" Before 1.0.0 a major change raises the minor number.":""]}),f?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The first Release, ",c.next_version,", records the starting point and lists no changes."]}):s.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."}),(m=c.classification)!=null&&m.marks_approximate?s.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,c.commits_since===null?s.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?s.jsxs(V,{onClick:o,children:[s.jsx(ku,{className:"mr-2 size-4"}),"Write Release ",c.next_version]}):null]}),a?s.jsx(AL,{candidate:c,org:r,onSelect:l,notes:f?null:s.jsx(qu,{changes:c.changes})}):f?null:s.jsx(qu,{changes:c.changes})]})}function l6({detail:e,summary:t,local:n,org:a,onSelect:r,onRetry:l}){const[i,o]=u.useState(!1);if((t==null?void 0:t.state)==="unreadable")return s.jsxs(Gn,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:t.label??t.version}),s.jsx(Fn,{title:"This Release could not be read",error:t.error??"Its record cannot be read."})]});if(e.state==="loading")return s.jsx(Gn,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Release…"})});if(e.state==="error")return s.jsx(Gn,{children:s.jsx(Fn,{error:e.error,onRetry:l})});const c=e.value,d=!c.previous_release_id,f=c.bump&&c.computed_bump&&c.bump!==c.computed_bump,h=c.label??c.version,m=async()=>{await navigator.clipboard.writeText(vL(h,po(c.changes))),o(!0)};return s.jsxs(Gn,{children:[s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n?s.jsx(ML,{release:c,onSelect:r}):s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:c.version}),s.jsx(ue,{variant:"neutral",children:d?"First":c.bump}),po(c.changes).breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Written ",zx(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?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Released when production ran release batch ",s.jsx("code",{className:"font-mono",children:c.batch}),".",c.app_changed===!1?` The app's version stays ${c.app_version??c.version}.`:""]}):null,f?s.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?s.jsx("p",{className:"text-sm",children:c.version_line}):null,c.marks_approximate?s.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?s.jsx("p",{className:"text-muted-foreground text-xs",children:"The first Release records the starting point and lists no changes."}):c.source_judged?null:s.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:s.jsxs(V,{variant:"outline",onClick:m,children:[s.jsx(DR,{className:"mr-2 size-4"}),i?"Copied":"Copy notes"]})]}),n?s.jsx($L,{release:c,org:a,onSelect:r,notes:d?null:s.jsx(qu,{changes:c.changes})}):d?null:s.jsx(qu,{changes:c.changes})]})}const i6=5,o6=e=>e.retry===!0||e.reason==="store_locked"||e.status===503;function c6({org:e,query:t,onSelect:n,home:a}){var A,M;const r=A1(),{href:l,Link:i}=Xe(),[o,c]=u.useState({state:"loading"}),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,b]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(!1),j=u.useCallback(async R=>{const T=y.current+=1;m(null);const k=await r.list(R?{fresh:!0}:void 0);if(T===y.current){if(k.ok){v.current=0,f(null),c({state:"ok",list:k.data});return}if(k.refusal.reason==="engine_missing"){c({state:"engine_missing",refusal:k.refusal});return}if(v.current+=1,v.current===1&&o6(k.refusal)){m(k.refusal.retry_after??i6);return}f(k.refusal)}},[r]);u.useEffect(()=>{j(!1)},[j]),u.useEffect(()=>{if(h===null)return;const R=setTimeout(()=>void j(!1),h*1e3);return()=>clearTimeout(R)},[h,j]),u.useEffect(()=>{var T;if(!p.current||o.state==="loading"||d||h!==null)return;p.current=!1;const R=(T=g.current)==null?void 0:T.querySelector("h1");R&&(R.tabIndex=-1,R.focus())});const w=()=>{p.current=!0,v.current=0,f(null),j(!0)},N=o.state==="ok"?o.list:null,C=t.roadmap?gl:t.planned!==null?t.planned===""?(A=N==null?void 0:N.planned)!=null&&A[0]?ls(N.planned[0].id):null:ls(t.planned):t.release,_=`${t.release??""}|${t.planned??""}|${t.roadmap?"roadmap":""}`,S=u.useRef(_);u.useEffect(()=>{S.current!==_&&(S.current=_,b(null))},[_]);const D=u.useRef(!1),z=u.useCallback(R=>{D.current=!0,b(R)},[]),P=!x&&o.state==="ok"&&D.current;if(u.useEffect(()=>{P&&(D.current=!1)},[P]),x)return s.jsx(Ga,{title:x.kind==="release"?`No Release ${x.id}`:`No open Planned Release ${x.id}`,description:"This project has no Release, candidate or open Planned Release by that name.",backHref:l(a),backLabel:"All Releases",link:i});const F=h!==null?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(Wt,{"aria-hidden":!0})," The release records are busy; reading again in ",h," s…"]}):null,H=d?s.jsxs(he,{variant:"destructive",children:[s.jsx(Qt,{}),s.jsx(ye,{children:"Releases could not be read"}),s.jsxs(xe,{className:"flex flex-col items-start gap-2",children:[s.jsxs("span",{children:[d.message,N?" The last Releases read stay below.":""]}),s.jsx(V,{variant:"outline",size:"sm",onClick:w,children:"Try again"})]})]}):null;return s.jsx("div",{ref:g,className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:o.state==="ok"?s.jsx(JL,{initial:o.list,org:e,selection:{selected:C,onSelect:n},onReadAgain:w,onNotFound:z,notice:F||H?s.jsxs(s.Fragment,{children:[F,H]}):null,focusOnMount:P},((M=o.list.local)==null?void 0:M.read_at)??"list"):o.state==="engine_missing"?s.jsx(la,{page:"Releases"}):s.jsxs(s.Fragment,{children:[s.jsx(f1,{description:m1}),H??F??s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(Wt,{"aria-hidden":!0})," Loading Releases…"]})]})})}const u6={threads:"Threads",tasks:"Tasks",queues:"Queues",worktrees:"Worktrees",workspaces:"Workspaces",chart:"Org chart"},d6={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Fc(e,t){return e.kind==="home"?"Home":e.kind==="org"?u6[e.page]:e.kind==="project"?e.page?d6[e.page]:t??e.project:"Not found"}const f6="(max-width: 767px)";function h6(){const e=typeof window<"u"&&window.matchMedia?window.matchMedia(f6):null,[t,n]=u.useState((e==null?void 0:e.matches)??!1);return u.useEffect(()=>{if(!e)return;const a=()=>n(e.matches);return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[e]),t}function Nc({className:e=""}){return s.jsx("span",{"aria-hidden":"true",className:`block animate-pulse rounded-md bg-sidebar-accent ${e}`})}function py({label:e,children:t}){return s.jsxs("span",{role:"status",className:"flex flex-col gap-1",children:[s.jsx("span",{className:"sr-only",children:e}),t]})}function xy({item:e,collapsed:t}){const{Link:n}=Xe(),a=e.icon,r=e.title??(t?e.label:void 0),l=s.jsx("span",{className:"block",children:s.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:[s.jsx(a,{className:"size-4 shrink-0","aria-hidden":"true"}),!t&&s.jsx("span",{className:"truncate",children:e.label})]})});return s.jsx("li",{children:r?s.jsxs(Rk,{children:[s.jsx(Tk,{asChild:!0,children:l}),s.jsx(Nx,{side:"right",children:r})]}):l})}const gy="m-0 flex list-none flex-col gap-1 p-0";function vy({label:e,collapsed:t,children:n}){return s.jsxs("div",{className:"flex flex-col gap-1 p-2",role:"group","aria-label":e,children:[!t&&s.jsx("p",{className:"m-0 px-2 text-xs font-medium text-sidebar-foreground/70",children:e}),n]})}function yy({page:e,collapsed:t,sheet:n=!1}){var A;const{href:a}=Xe(),{worktrees:r}=mn(),l=On(),{org:i,projects:o,loading:c,none:d,about:f,aboutFailed:h,domains:m,engine:x}=l,b=x===null,v=i?`/org/${i.slug}`:"",y=o==null?void 0:o.find(M=>M.current),g=((A=i==null?void 0:i.source)==null?void 0:A.kind)==="folder"&&y!==void 0,p=M=>g&&y?`${M} · ${y.name}`:M,j=p("Workspaces"),w=p("Tasks"),N=p("Queues"),C=M=>g?M:void 0,_=[{label:"Home",href:a(v||"/"),icon:WR,current:e.kind==="home"},...b?[]:[{label:"Threads",href:a(`${v}/threads`),icon:fT,current:e.kind==="org"&&e.page==="threads"}],...m.includes("tasks")&&!b?[{label:w,title:C(w),href:a(`${v}/tasks`),icon:q0,current:e.kind==="org"&&e.page==="tasks"}]:[],...b?[]:[{label:N,title:C(N),href:a(`${v}/queues`),icon:G0,current:e.kind==="org"&&e.page==="queues"}],...r&&!b?[{label:"Worktrees",href:a(`${v}/worktrees`),icon:P0,current:e.kind==="org"&&e.page==="worktrees"}]:[],{label:j,title:C(j),href:a(`${v}/workspaces`),icon:GR,current:e.kind==="org"&&e.page==="workspaces"},{label:"Org chart",href:a(`${v}/chart`),icon:xT,current:e.kind==="org"&&e.page==="chart"}],S=c?null:d?"No organization":(i==null?void 0:i.name)??"Organization",D=i?VT(i):null,z=f==null?void 0:f.version,P=z?t?z:`sdlc ${z}`:h?Su:gd,F=h||(f==null?void 0:f.sync.state)==="unknown"?PT:f===void 0?IT:HT;let H;return c?H=s.jsx("div",{className:"px-2 py-1",children:s.jsxs(py,{label:"Loading projects",children:[s.jsx(Nc,{className:"h-4 w-32"}),s.jsx(Nc,{className:"h-4 w-24"})]})}):o?H=s.jsx("ul",{className:gy,children:o.map(M=>s.jsx(xy,{collapsed:t,item:{label:M.name,title:M.name,href:a(`/proj/${encodeURIComponent(M.id)}`),icon:PR,current:e.kind==="project"&&e.project===M.id}},M.id))}):H=s.jsx("p",{className:"m-0 px-2 text-sm text-sidebar-foreground/70",children:d?"No projects":Su}),s.jsxs("div",{className:"flex h-full flex-col bg-sidebar text-sidebar-foreground",children:[s.jsxs("div",{className:`flex items-center gap-2 p-2 ${n?"pr-11":""}`,role:"group","aria-label":"Current organization",children:[s.jsx("div",{className:"flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:s.jsx(bR,{className:"size-4","aria-hidden":"true"})}),!t&&s.jsx("div",{className:"grid min-w-0 flex-1 text-left text-sm leading-tight",children:S===null?s.jsxs(py,{label:"Loading organization",children:[s.jsx(Nc,{className:"h-4 w-28"}),s.jsx(Nc,{className:"h-3 w-24"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-semibold",title:S,children:S}),D&&s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/70",children:D})]})})]}),s.jsxs("nav",{"aria-label":"App",className:"min-h-0 flex-1 overflow-y-auto",children:[s.jsx(vy,{label:"Organization",collapsed:t,children:s.jsx("ul",{className:gy,children:_.map(M=>s.jsx(xy,{item:M,collapsed:t},M.label))})}),!t&&s.jsx(vy,{label:"Projects",collapsed:t,children:H})]}),f!==null&&s.jsxs("div",{className:"flex flex-col gap-1 border-t border-sidebar-border p-2 text-xs text-sidebar-foreground/70",children:[s.jsx("p",{className:"m-0 truncate px-2",title:z?`sdlc ${z}`:void 0,children:P}),!t&&s.jsxs("p",{className:"m-0 flex items-start gap-2 px-2",children:[s.jsx(FR,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:F})]})]})]})}const m6="outline-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring";function p6({page:e}){var c;const{href:t,Link:n}=Xe(),{org:a,projects:r,loading:l,none:i}=On(),o=[];if(l)o.push({label:gd});else if(i)o.push({label:"No organization"});else{const d=(a==null?void 0:a.name)??"Organization";if(o.push({label:d,href:e.kind==="home"?void 0:t(a?`/org/${a.slug}`:"/")}),e.kind==="project"){const f=((c=r==null?void 0:r.find(h=>h.id===e.project))==null?void 0:c.name)??e.project;o.push({label:f,href:e.page?t(`/proj/${encodeURIComponent(e.project)}`):void 0})}if(e.kind==="org"&&e.item!==void 0)o.push({label:Fc(e),href:a?t(`/org/${a.slug}/${e.page}`):void 0}),o.push({label:e.item});else if(e.kind==="project"&&e.page&&e.item!==void 0){const f=`/proj/${encodeURIComponent(e.project)}/${e.page}${e.list_query?`?${e.list_query}`:""}`;o.push({label:Fc(e),href:t(f)}),o.push({label:e.item})}else e.kind!=="home"&&!(e.kind==="project"&&!e.page)&&o.push({label:Fc(e)})}return s.jsx("nav",{"aria-label":"Breadcrumb",className:"min-w-0",children:s.jsx("ol",{className:"m-0 flex min-w-0 list-none items-center gap-1.5 p-0 text-sm text-muted-foreground",children:o.map((d,f)=>s.jsxs("li",{className:"flex min-w-0 items-center gap-1.5",children:[f>0&&s.jsx(fd,{className:"size-3.5 shrink-0","aria-hidden":"true"}),d.href?s.jsx(n,{href:d.href,className:`truncate text-muted-foreground no-underline hover:text-foreground ${m6}`,children:d.label}):s.jsx("span",{className:"truncate font-normal text-foreground","aria-current":f===o.length-1?"page":void 0,children:d.label})]},`${f}-${d.label}`))})})}function x6({page:e,children:t}){var g;const n=h6(),[a,r]=u.useState(!0),[l,i]=u.useState(!1),o=u.useRef(null),c=u.useRef(null),{org:d,projects:f,loading:h,none:m}=On(),x=e.kind==="project"?(g=f==null?void 0:f.find(p=>p.id===e.project))==null?void 0:g.name:void 0;u.useEffect(()=>{const p=h?gd:m?"No organization":(d==null?void 0:d.name)??"Organization",j=(e.kind==="org"||e.kind==="project")&&e.item!==void 0?`${e.item} · `:"";document.title=`${j}${Fc(e,x)} · ${p} · sdlc viewer`},[e,x,d,h,m]);const b=()=>{var p;i(!1),(p=o.current)==null||p.focus()};u.useEffect(()=>{n||i(!1)},[n]);const v=n&&l;u.useEffect(()=>{var w;const p=c.current;if(!v||!p)return;(w=p.querySelector("a, button"))==null||w.focus();const j=N=>{var z;if(N.key==="Escape"){i(!1),(z=o.current)==null||z.focus();return}if(N.key!=="Tab")return;const C=[...p.querySelectorAll("a[href], button:not([disabled])")];if(C.length===0)return;const _=C[0],S=C[C.length-1],D=p.contains(document.activeElement);N.shiftKey&&(document.activeElement===_||!D)?(N.preventDefault(),S.focus()):!N.shiftKey&&(document.activeElement===S||!D)&&(N.preventDefault(),_.focus())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[v]);const y=!n&&!a;return s.jsx(Ck,{children:s.jsxs("div",{className:"flex h-svh min-h-0 overflow-hidden bg-background text-foreground",children:[!n&&s.jsx("aside",{"aria-label":"Sidebar",className:`shrink-0 border-r border-sidebar-border transition-[width] ${y?"w-12":"w-64"}`,children:s.jsx(yy,{page:e,collapsed:y})}),v&&s.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[s.jsxs("aside",{ref:c,role:"dialog","aria-modal":"true","aria-label":"Sidebar",className:"relative w-72 max-w-[85vw] border-r border-sidebar-border",children:[s.jsx(yy,{page:e,collapsed:!1,sheet:!0}),s.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:b,children:s.jsx(xd,{className:"size-4","aria-hidden":"true"})})]}),s.jsx("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"flex-1 border-0 bg-black/80 outline-hidden",onClick:b})]}),s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:[s.jsxs("header",{className:`flex shrink-0 items-center gap-2 border-b border-border px-4 transition-[height] ${y?"h-12":"h-16"}`,children:[s.jsx("button",{ref:o,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":n?l:a,onClick:()=>n?i(p=>!p):r(p=>!p),children:s.jsx(vT,{className:"size-4","aria-hidden":"true"})}),s.jsx("span",{"aria-hidden":"true",className:"mr-2 h-4 w-px bg-border"}),s.jsx(p6,{page:e})]}),s.jsx("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden overflow-y-auto",children:t})]})]})})}const Hx="m-0 text-2xl font-semibold tracking-tight",Ix="outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",Px=`rounded-sm font-medium text-primary no-underline hover:underline ${Ix}`;function eh({children:e}){return s.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:s.jsx("code",{children:e})})}function g6({why:e}){return e.kind==="not_in_git"?s.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[s.jsx("p",{className:"m-0 text-sm",children:"This directory is not a Git repository. Start sdlc viewer inside one:"}),s.jsx(eh,{children:"sdlc viewer"})]}):e.kind==="unlisted"?s.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[s.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.`}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"To rejoin, leave the folder here:"}),s.jsx(eh,{children:"sdlc-agents folder leave"}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`then add it back from the folder's home repository, ${e.home}:`}),s.jsx(eh,{children:`sdlc-agents folder add ${e.member_path} --name ${e.repository}`}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"To work in this repository alone, leaving is enough."})]}):s.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[s.jsx("p",{className:"m-0 text-sm",children:e.cause}),e.kind==="moved_member"&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"Move this repository back to where the folder records it."}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:e.kind==="other"&&!e.fix?mr:GT})]})}const jy=`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 ${Ix}`;function v6(){return s.jsxs("div",{role:"status",className:"flex flex-col gap-2",children:[s.jsx("span",{className:"sr-only",children:"Loading projects"}),[0,1,2].map(e=>s.jsx("span",{"aria-hidden":"true",className:"block h-9 animate-pulse rounded-md bg-muted"},e))]})}function ei(){const{href:e,Link:t}=Xe(),{loading:n,projects:a,none:r,failure:l,readAt:i,refresh:o,reading:c}=On(),[d,f]=u.useState(""),h=s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:Hx,children:"Projects"}),!r&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:qT})]});if(r)return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[h,s.jsx(g6,{why:r==="not_in_git"?{kind:"not_in_git"}:XT(r)})]});const m=l!=null&&l.shown?l:null,x=(a??[]).filter(b=>b.name.toLowerCase().includes(d.trim().toLowerCase()));return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[h,m&&s.jsxs("div",{role:"alert",className:"flex flex-col gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-4",children:[s.jsx("p",{className:"m-0 text-sm font-medium text-destructive",children:"The projects could not be refreshed"}),s.jsx("p",{className:"m-0 text-sm",children:Y0(m.refusal,i)}),s.jsx("div",{children:s.jsx("button",{type:"button",className:jy,onClick:o,disabled:c,children:"Retry"})})]}),(a||n)&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"search","aria-label":"Filter projects",placeholder:"Filter projects",value:d,onChange:b=>f(b.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 ${Ix}`}),!m&&s.jsx("button",{type:"button",className:`${jy} ml-auto`,onClick:o,disabled:c||n,children:"Refresh"})]}),l&&!l.shown&&i&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`Showing the list read at ${ji(i)}; reading again in ${l.retryInSeconds??10} seconds.`})]}),n?s.jsx(v6,{}):a&&s.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:s.jsxs("table",{className:"w-full border-collapse text-sm",children:[s.jsx("thead",{className:"border-b border-border text-left text-muted-foreground",children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",className:"h-10 px-3 font-medium",children:"Name"}),s.jsx("th",{scope:"col",className:"h-10 px-3 font-medium",children:"Location"}),s.jsx("th",{scope:"col",className:"h-10 px-3",children:s.jsx("span",{className:"sr-only",children:"Where this viewer runs"})})]})}),s.jsxs("tbody",{children:[x.map(b=>s.jsxs("tr",{className:"border-b border-border last:border-0",children:[s.jsx("td",{className:"px-3 py-2",children:s.jsx(t,{href:e(`/proj/${encodeURIComponent(b.id)}`),className:Px,children:b.name})}),s.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:b.location??Su}),s.jsx("td",{className:"px-3 py-2 text-right",children:b.current&&s.jsx("span",{className:"inline-flex items-center rounded-md border border-border px-2 py-0.5 text-xs font-medium",children:"This repository"})})]},b.id)),x.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:3,className:"px-3 py-6 text-center text-muted-foreground",children:"No projects found."})})]})]})})]})}function O1({title:e,children:t}){const{href:n,Link:a}=Xe();return s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"flex max-w-xl flex-col gap-2 rounded-xl border border-border bg-card p-6 text-card-foreground",children:[s.jsx("h1",{className:Hx,children:e}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:t}),s.jsx("div",{children:s.jsx(a,{href:n("/"),className:`text-sm ${Px}`,children:"Back to the organization's Home"})})]})})}const y6={tasks:"Tasks",issues:"Issues",releases:"Releases"};function xo({project:e}){const{href:t,Link:n}=Xe(),{org:a,projects:r,loading:l,domains:i}=On(),o=r==null?void 0:r.find(c=>c.id===e);return l?s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:gd}):r?o?s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:Hx,children:o.name}),s.jsx("p",{className:"m-0 font-mono text-sm text-muted-foreground",children:o.location??Su})]}),o.current?i.length>0?s.jsx("ul",{className:"m-0 flex list-none flex-col gap-1 p-0 text-sm",children:i.map(c=>s.jsx("li",{children:s.jsx(n,{href:t(c==="tasks"?`${a?`/org/${a.slug}`:""}/tasks`:`/proj/${encodeURIComponent(o.id)}/${c}`),className:Px,children:y6[c]})},c))}):null:s.jsx("p",{className:"m-0 max-w-2xl text-sm text-muted-foreground",children:`This viewer reads ${o.name}'s tasks, issues and Releases only from its own checkout: open it with sdlc viewer there.`})]}):s.jsx(O1,{title:"Project not found",children:`There is no project '${e}' in this organization.`}):s.jsx(ei,{})}const Gd=e=>e instanceof Error?e.message:String(e);async function D1(e=!1){try{const t=await fetch(e?"api/threads?archived=1":"api/threads",{cache:"no-store"});return t.status===404?{none:!0}:t.ok?{data:await t.json()}:{error:await t.text()||`HTTP ${t.status}`}}catch(t){return{error:Gd(t)}}}async function j6(){var e;try{const t=await fetch("api/release-links?threads",{cache:"no-store"});if(!t.ok)return null;const n=await t.json(),a=(e=n==null?void 0:n.panel)==null?void 0:e.threads;if(!a||typeof a!="object"||Array.isArray(a))return null;const r={};for(const[l,i]of Object.entries(a)){const o=(Array.isArray(i)?i:[]).filter(c=>!!c&&typeof c.planned_release=="string"&&typeof c.name=="string"&&typeof c.level=="string");o.length&&(r[l]=o)}return r}catch{return null}}async function b6(){try{return(await fetch("api/pin",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function w6(){try{const e=await fetch("api/sessions",{cache:"no-store"});if(!e.ok)return 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 _6(){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:Gd(e)}}}async function N6(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})}),a=await n.text();let r={};try{r=JSON.parse(a)??{}}catch{}return n.ok?{done:r}:{refused:{reason:typeof r.reason=="string"?r.reason:"failed",error:typeof r.error=="string"?r.error:a||`HTTP ${n.status}`,...typeof r.where=="string"&&r.where?{where:r.where}:{}}}}catch(n){return{refused:{reason:"failed",error:Gd(n)}}}}async function k6(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?null:await n.text()||`HTTP ${n.status}`}catch(n){return Gd(n)}}const S6={probe:{source:async()=>{const e=await D1();if("error"in e)throw new Error(e.error);return{label:"Local workspace"}}}},z1={href:e=>e.replace(/^\/+/,"")||"./",Link:({href:e,className:t,children:n,...a})=>s.jsx("a",{href:e,className:t,...a,children:n})},C6={label:"Local viewer",can:()=>!1};function R6(){return u.useEffect(()=>{document.title="Shared app UI · SDLC Workspace Viewer"},[]),s.jsx("div",{className:"app-ui dark",children:s.jsx(U0,{data:S6,router:z1,identity:C6,children:s.jsx(sR,{})})})}const T6="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.",E6=3e4,A6="Reading the workspaces. On a plan workspace this can take a few minutes.",M6="The read failed. Details are in the terminal running sdlc viewer.",$6={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"}},O6=e=>$6[e]??{label:e,tone:"neutral"},Sa=e=>e.slice(0,8),L1={human:"Human",ai:"AI"},Tm=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function D6(){const e=mn().workspaces;if(!e)throw new Error("The Workspaces page rendered without the workspaces seam.");return e}function z6(e){const t=D6(),[n,a]=u.useState(null),[r,l]=u.useState(null),[i,o]=u.useState(!1),c=u.useRef(null),d=u.useRef(!1),f=u.useRef(null),h=u.useCallback(()=>{if(f.current)return f.current;const y=(async()=>{const g=await t.overview();g.ok?(a(g.data),l(null),o(!1)):(l(g.refusal),o(!0))})().finally(()=>{f.current=null});return f.current=y,y},[t]);u.useEffect(()=>{h()},[h]),Uu(()=>void h(),E6),u.useEffect(()=>{var y;d.current&&(n||r)&&(d.current=!1,(y=c.current)==null||y.focus())},[n,r]);const m=()=>{d.current=!0,h()},x=n===null&&r===null,b=n===null&&r!==null,v=n?L6(n,i):null;return s.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:[s.jsx(en,{title:"Workspaces",description:T6,actions:s.jsxs(s.Fragment,{children:[v?s.jsx("p",{className:"text-muted-foreground text-xs",children:v}):null,s.jsxs(V,{type:"button",variant:"outline",size:"sm","aria-disabled":x||void 0,"aria-describedby":x?"workspaces-reading":void 0,className:"gap-2",onClick:x?void 0:()=>void h(),children:[s.jsx(kr,{className:"size-4","aria-hidden":"true"}),"Read again"]}),x?s.jsx("span",{id:"workspaces-reading",className:"sr-only",children:"Reading…"}):null,s.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n?U1(n,i):""})]})}),s.jsxs("div",{ref:c,tabIndex:-1,className:"outline-none",children:[x?s.jsx(U6,{}):null,b&&r?s.jsx(B6,{refusal:r,on_retry:m}):null,n?s.jsx(H6,{overview:n}):null]})]})}function U1(e,t){var n,a;return t||((n=e.stale)==null?void 0:n.reason)==="failed"?"a newer read failed":((a=e.stale)==null?void 0:a.reason)==="running"?"a newer read is still running":""}function L6(e,t){const n=`Read at ${cs(new Date(e.read_at).toISOString())}`,a=U1(e,t);return a?`${n} · ${a}`:n}function U6(){return s.jsxs("div",{className:"mt-6",children:[s.jsx("div",{className:"grid gap-2",role:"status","aria-label":"Loading workspaces",children:Array.from({length:6},(e,t)=>s.jsx(jt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))}),s.jsx("p",{className:"text-muted-foreground mt-3 text-sm","aria-live":"polite",children:A6})]})}function B6({refusal:e,on_retry:t}){const n=e.reason==="store_locked"?Y0(e,null):M6;return s.jsxs(he,{variant:"destructive",className:"mt-6",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not read workspaces"}),s.jsxs(xe,{children:[s.jsx("p",{children:n}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function H6({overview:e}){const{counts:t}=e,n=[Tm(t.workspaces,"workspace"),`${t.active} active`,`${t.queued} queued`,`${t.blocked} blocked`].join(" · ");return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status","aria-live":"polite",children:n}),s.jsxs("div",{className:"mt-4 grid gap-4 lg:grid-cols-[1.4fr_1fr]",children:[s.jsx(kc,{id:"workspaces-lineage",title:"Lineage",caption:"Each workspace under the one it forked from",children:s.jsx(I6,{rows:e.workspaces})}),s.jsx(kc,{id:"workspaces-authority",title:"Authority and resolver",caption:"What this checkout's workspace may change",children:s.jsx(P6,{authority:e.authority})})]}),s.jsx(kc,{id:"workspaces-activity",className:"mt-4",title:"Integration activity",caption:"Newest first",children:e.activity.length===0?s.jsx(by,{children:"No integration or reconciliation attempts yet."}):s.jsx(G6,{rows:e.activity})}),s.jsx(kc,{id:"workspaces-handoffs",className:"mt-4",title:"Handoffs",children:e.handoffs.length===0?s.jsx(by,{children:"No Handoffs prepared yet."}):s.jsx(V6,{rows:e.handoffs})})]})}function kc({id:e,title:t,caption:n,className:a,children:r}){return s.jsxs("section",{"aria-labelledby":e,className:ie("min-w-0",a),children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-baseline gap-x-2",children:[s.jsx("h2",{id:e,className:"text-lg font-semibold",children:t}),n?s.jsx("span",{className:"text-muted-foreground text-sm",children:n}):null]}),r]})}const by=({children:e})=>s.jsx("p",{className:"text-muted-foreground text-sm",children:e}),Gu=({children:e,tone:t})=>s.jsx("div",{className:ie("text-xs",t==="error"?"text-destructive":"text-muted-foreground"),children:e});function go({status:e}){const t=O6(e);return s.jsx(ue,{variant:t.tone,children:t.label})}function Vd({label:e,children:t}){return s.jsx(ot,{role:"group","aria-label":e,tabIndex:0,className:"overflow-x-auto outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:t})}function I6({rows:e}){return s.jsx(Vd,{label:"Workspaces",children:s.jsxs(qe,{containerClassName:"overflow-visible",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Workspace"}),s.jsx(Z,{children:"Actor"}),s.jsx(Z,{children:"Forked from"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Projection"})]})}),s.jsx(Ge,{children:e.map(t=>s.jsxs(de,{"data-testid":"workspaces-row",children:[s.jsxs(K,{children:[s.jsx("div",{className:"font-mono font-medium",children:t.short_id}),s.jsx(Gu,{children:t.current?`${t.path} · This checkout`:t.path}),t.projection==="unreadable"&&t.projection_error&&s.jsx(Gu,{children:t.projection_error})]}),s.jsx(K,{children:L1[t.actor]}),s.jsx(K,{children:t.source_id?s.jsx("span",{className:"font-mono",children:Sa(t.source_id)}):s.jsx("span",{className:"text-muted-foreground",children:"No source"})}),s.jsx(K,{children:s.jsx(go,{status:t.status})}),s.jsx(K,{children:s.jsx(go,{status:t.projection})})]},t.id))})]})})}function P6({authority:e}){const t=e.resolver,n=[["Workspace",s.jsx("span",{className:"font-mono",children:Sa(e.workspace_id)},"id")],["Actor",L1[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"}`:s.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"?s.jsx("span",{className:"text-muted-foreground",children:"Not configured"},"resolver"):s.jsx(go,{status:t.state==="ready"?"ready":"needs_attention"},"resolver")]),t.state==="needs_attention"&&t.issue&&n.push(["Resolver issue",t.issue]),s.jsx(Vd,{label:"Authority and resolver",children:s.jsx(qe,{containerClassName:"overflow-visible",children:s.jsx(Ge,{children:n.map(([a,r])=>s.jsxs(de,{children:[s.jsx(Z,{scope:"row",className:"text-muted-foreground font-normal",children:a}),s.jsx(K,{children:r})]},a))})})})}function q6(e){const t=[e.merge_attempts?Tm(e.merge_attempts,"merge attempt"):null,e.resolver_attempts?Tm(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 s.jsx("span",{className:"text-muted-foreground",children:n})}function G6({rows:e}){return s.jsx(Vd,{label:"Integration activity",children:s.jsxs(qe,{containerClassName:"overflow-visible",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"Change"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Attempts"}),s.jsx(Z,{children:"Updated"})]})}),s.jsx(Ge,{children:e.map((t,n)=>s.jsxs(de,{children:[s.jsxs(K,{children:[s.jsx("div",{className:"font-medium",children:t.kind==="integration"?`Integrate ${Sa(t.child_id)} into ${Sa(t.other_id)}`:`Reconcile ${Sa(t.child_id)} from ${Sa(t.other_id)}`}),s.jsx(Gu,{children:t.kind==="integration"?"Integration":"Source reconciliation"})]}),s.jsx(K,{children:s.jsx(go,{status:t.status})}),s.jsx(K,{children:q6(t)}),s.jsx(K,{children:Mk(t.updated_at)})]},`${t.kind}-${t.child_id}-${t.other_id}-${t.updated_at}-${n}`))})]})})}function V6({rows:e}){return s.jsx(Vd,{label:"Handoffs",children:s.jsxs(qe,{containerClassName:"overflow-visible",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{children:"From"}),s.jsx(Z,{children:"To"}),s.jsx(Z,{children:"Status"}),s.jsx(Z,{children:"Pinned"})]})}),s.jsx(Ge,{children:e.map(t=>s.jsxs(de,{children:[s.jsxs(K,{children:[s.jsx("div",{className:"font-mono font-medium",children:Sa(t.child_id)}),t.error?s.jsx(Gu,{children:t.error}):null]}),s.jsx(K,{className:"font-mono",children:Sa(t.source_id)}),s.jsx(K,{children:s.jsx(go,{status:t.status})}),s.jsx(K,{children:`${t.child_commit} onto ${t.source_commit}`})]},t.id))})]})})}const wy="This machine's worktrees of this repository.",Y6="Merge sends one whose thread is at rest to the main queue.",F6=3e4,K6=3e3,X6=6e5,th=[{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"}],pi={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"}},Q6="no thread to land it",qx="its thread waits on you",B1="its thread is done",H1="its thread is retired",Gx=e=>e.archivable&&e.cleanup==="user",W6=e=>e.queue!==null||e.merge.offered===!1&&e.merge.why==="already in a promotion queue",Z6=e=>!e.merge.offered&&(e.merge.why===B1||e.merge.why.startsWith(H1)),Vx=e=>!e.merge.offered&&e.merge.why===Q6||Z6(e),nh=(e,t)=>t==="all"?!0:t==="decide"?Gx(e):(e.landed!==null?"landed":W6(e)?"queued":Vx(e)?"orphan":"needs")===t,J6=e=>e.landed!==null?e.threads.some(t=>t.phase!=="done"):e.threads.length>0&&!Vx(e);function Kc(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 I1(e){const t=e%100,n=t>=11&&t<=13?"th":{1:"st",2:"nd",3:"rd"}[e%10]??"th";return`${e}${n}`}function e5(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 sh=e=>cs(new Date(e*1e3).toISOString()),ki=e=>e.charAt(0).toUpperCase()+e.slice(1);function t5(e,t){var r;const n=t.phase?ki(t.phase):"No phase",a=e.merge;if(!a.offered&&a.why.startsWith(H1)){const l=(r=/; (.+) continues it$/.exec(a.why))==null?void 0:r[1];return l?`Retired · continued by ${l}`:"Retired"}return t.phase==="done"||!a.offered&&a.why===B1?e.landed===null?"Done · without landing this":"Done":a.offered?`${n} · at rest`:a.why.startsWith("its thread is at work")?`${n} · at work`:a.why===qx?`${n} · waits on you`:a.why.startsWith("its session is not running")?`${n} · session not running`:n}function n5(){const e=mn().worktrees;if(!e)throw new Error("The Worktrees page rendered without the worktrees seam.");return e}function s5({org:e}){var O,Y;const t=n5(),[n,a]=u.useState(null),[r,l]=u.useState(null),[i,o]=u.useState(null),[c,d]=u.useState(!1),[f,h]=u.useState("all"),[m,x]=u.useState(""),[b,v]=u.useState({}),y=u.useRef({}),{confirm:g,confirm_dialog:p}=Bo(),j=u.useRef(!1),w=u.useCallback(async()=>{if(j.current)return;j.current=!0;const E=await t.list();j.current=!1,E.ok?(a(E.data),l(null)):l(E.refusal)},[t]),N=u.useCallback(async()=>{const E=await t.sizes();d(!E.ok),E.ok&&o(E.data)},[t]);u.useEffect(()=>{w(),N()},[w,N]);const C=(n==null?void 0:n.rows.some(E=>{var I,Q;return((I=E.write)==null?void 0:I.state)==="waiting"||((Q=E.write)==null?void 0:Q.state)==="running"}))??!1;Uu(()=>void w(),C?K6:F6),Uu(()=>void N(),X6);const _=(n==null?void 0:n.rows)??[],S=E=>i==null?void 0:i.sizes[E.path],D=_.filter(Gx),z=i?D.reduce((E,I)=>E+(S(I)??0),0):null,P=_.length===0?wy:`${wy} ${Y6}${D.length?` ${D.length} ${D.length===1?"is":"are"} yours to decide${z!==null?`: removing them frees about ${Kc(z)}`:""}.`:""}`,F=m.trim().toLowerCase(),H=E=>!F||[E.name,E.path,E.branch??"",...E.threads.map(I=>I.title??I.thread)].some(I=>I.toLowerCase().includes(F)),A=_.filter(E=>nh(E,f)&&H(E)).sort((E,I)=>{if(f==="decide")return(S(I)??0)-(S(E)??0);const Q=te=>J6(te)?te.merge.offered?0:1:2;return Q(E)-Q(I)||(E.idle_days??1/0)-(I.idle_days??1/0)}),M=async(E,I)=>{const Q=await(E==="merge"?t.merge(I.path):t.remove(I.path));Q.ok?v(({[I.path]:te,...ce})=>ce):v(te=>({...te,[I.path]:Q.refusal.message})),await w()},R=async E=>{if(!E.merge.offered)return;const I=E.threads.find(q=>q.thread===(E.merge.offered&&E.merge.thread)),Q=(I==null?void 0:I.title)??E.merge.thread,te=I!=null&&I.holds.length?`has ${I.holds.length} open hold(s) (${I.holds.join(", ")})`:"has no open holds",ce=E.merge.lands.by==="manager"?`on its turn the queue's merge manager, ${E.merge.lands.manager}, lands it on main`:"on its turn that thread lands it on main",X=E.merge.caveat?`
|
|
393
393
|
|
|
394
|
-
Its session could not be read: ${E.merge.caveat}. A turn it does not start passes on.`:"";await g({title:`Send ${E.name} to the main queue`,description:`This joins the main promotion queue for its thread, ${Q}, which ${te} and is told of the join. The queue checks the branch first, and ${ce}. Nothing reaches main before then.${X}`,action_label:"Join the main queue"})&&await M("merge",E)},T=async E=>{const I=S(E);await g({title:`Remove ${E.name}?`,description:`This deletes the folder ${E.path}${I!==void 0?` and frees about ${Kc(I)}`:""}.${E.branch?` Its branch ${E.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 ${E.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})&&(I!==void 0&&(y.current[E.path]=I),await M("remove",E))},k=async E=>{await t.dismiss(E),await w()};return(r==null?void 0:r.reason)==="engine_missing"?s.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.jsx(la,{page:"Worktrees"})}):s.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:[s.jsx(en,{title:"Worktrees",description:P}),!n&&!r&&s.jsx(s5,{}),r?s.jsx(a5,{refusal:r,read_at:n==null?void 0:n.read_at,on_retry:()=>void w()}):null,n!=null&&n.stale?s.jsxs(he,{variant:"destructive",className:"mt-4",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not read worktrees"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[n.stale.message," This list was read at ",cs(new Date(n.read_at).toISOString()),"."]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void w(),children:"Retry"})]})]}):null,n==null?void 0:n.removals.map(E=>s.jsxs(he,{variant:"success",className:"mt-4",role:"status",children:[s.jsx(ye,{children:y.current[E.path]!==void 0?`Removed ${E.name} and freed ${Kc(y.current[E.path])}`:`Removed ${E.name}`}),s.jsxs(xe,{children:[s.jsx("p",{children:E.branch?`Its branch ${E.branch} stays, and its records were saved.`:"Its records were saved."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void k({removal:E.path}),children:"Dismiss"})]})]},E.path)),n&&_.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(Iw,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Only the main checkout"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"No other worktrees. Agents make theirs in .sdlc-worktrees beside the main checkout."})]}):n?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[s.jsx(bt,{type:"search",className:"w-64","aria-label":"Search worktrees",placeholder:"Search worktrees",value:m,onChange:E=>x(E.target.value)}),s.jsxs("p",{className:"text-muted-foreground ml-auto text-xs",children:["Read at ",cs(new Date(n.read_at).toISOString())," · rereads every 30 s"]})]}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Worktree state",children:th.map(E=>s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":f===E.id,onClick:()=>h(E.id),children:[E.label," ",_.filter(I=>nh(I,E.id)).length]},E.id))}),A.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(pd,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No worktrees match"}),F?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(O=th.find(E=>E.id===f))==null?void 0:O.empty," matches “",m,"”. Clear the search to see all"," ",_.filter(E=>nh(E,f)).length,"."]}),s.jsx(V,{type:"button",variant:"outline",onClick:()=>x(""),children:"Clear search"})]}):s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(Y=th.find(E=>E.id===f))==null?void 0:Y.empty," right now."]})]}):s.jsx(ot,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Worktrees",className:"table-fixed",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{className:"w-[24%]",children:"Worktree"}),s.jsx(Z,{className:"w-[24%]",children:"Threads"}),s.jsx(Z,{className:"w-[12%]",children:"Landed"}),s.jsx(Z,{className:"w-[18%]",children:"Cleanup"}),s.jsx(Z,{className:"hidden w-[10%] md:table-cell",children:"Last commit"}),s.jsx(Z,{className:"w-[12%] text-right",children:"Actions"})]})}),s.jsx(Ge,{children:A.map(E=>s.jsx(r5,{org:e,row:E,size:S(E),sizes:i!==null?"read":c?"failed":"measuring",can_write:n.can_write,sent:b[E.path],on_merge:()=>void R(E),on_remove:()=>void T(E),on_dismiss:I=>void k(I),on_clear_sent:()=>v(({[E.path]:I,...Q})=>Q)},E.path))})]})})]}):null,p]})}function s5(){return s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading worktrees",children:Array.from({length:6},(e,t)=>s.jsx(jt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function a5({refusal:e,read_at:t,on_retry:n}){const a=ds();return e.reason==="view_outdated"?s.jsxs(he,{variant:"warning",className:"mt-6",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsx(xe,{children:a})]}):s.jsxs(he,{variant:"destructive",className:"mt-6",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not read worktrees"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[e.message,t?` This list was read at ${cs(new Date(t).toISOString())}.`:""]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function Sc({children:e,muted:t=!0}){return s.jsx("div",{className:ie("truncate text-xs",t&&"text-muted-foreground"),title:e,children:e})}function r5({org:e,row:t,size:n,sizes:a,can_write:r,sent:l,on_merge:i,on_remove:o,on_dismiss:c,on_clear_sent:d}){const{href:f,Link:h}=Xe(),m=e?`/org/${encodeURIComponent(e)}`:"",x=f(`${m}/threads`),b=f(`${m}/tasks`),v=mi[t.landed??"not_landed"],y=Gx(t),g=t.write,p=(g==null?void 0:g.state)==="waiting"||(g==null?void 0:g.state)==="running",j=t.threads.find(P=>"thread"in t.merge&&P.thread===t.merge.thread)??t.threads[0],w=t.merge,N=!w.offered&&w.why===qx,C=r&&t.landed===null&&!t.queue&&!N&&!Vx(t),_=n!==void 0?Kc(n):a==="measuring"?"Measuring size…":a==="failed"?"Size could not be read":null,S=y?{label:"Yours to decide",muted:!1,second:[_,t.cleanup_why[0]]}:t.archivable?{label:"The manager removes it",muted:!1,second:[_]}:{label:"Stays",muted:!0,second:[_,t.why[0]??null]},D=S.second.filter(Boolean).join(" · "),z=t.path.slice(0,t.path.length-t.name.length-1)||".";return s.jsxs(s.Fragment,{children:[s.jsxs(de,{"data-testid":"worktrees-row",children:[s.jsxs(K,{children:[s.jsx("div",{className:"truncate font-medium",title:t.name,children:t.name}),s.jsx(Sc,{children:t.branch??"Detached"}),z!==".sdlc-worktrees"?s.jsx(Sc,{children:`in ${z}`}):null]}),s.jsx(K,{children:j?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"truncate",title:j.title??j.thread,children:j.title??j.thread}),s.jsx(Sc,{children:`${e5(t,j)}${t.threads.length>1?` · ${t.threads.length-1} more`:""}`})]}):s.jsx("span",{className:"text-muted-foreground",children:"No thread"})}),s.jsx(K,{children:s.jsx(ue,{variant:v.tone,children:v.label})}),s.jsxs(K,{children:[s.jsx("div",{className:ie("truncate",S.muted&&"text-muted-foreground"),children:S.label}),D?s.jsx("div",{className:"hidden md:block",children:s.jsx(Sc,{children:D})}):null]}),s.jsx(K,{className:"hidden md:table-cell",children:J6(t.idle_days)}),s.jsx(K,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[p?s.jsx(V,{type:"button",variant:"outline",size:"sm",loading:!0,disabled:!0,children:(g==null?void 0:g.kind)==="merge"?g.state==="waiting"?"Waiting to join…":"Joining main…":(g==null?void 0:g.state)==="waiting"?"Waiting to remove…":"Removing…"}):t.queue?s.jsx(ue,{variant:mi.queued.tone,children:`${mi.queued.label} · ${H1(t.queue.position)}`}):N?s.jsx(h,{href:b,"aria-label":`${t.name}: its thread waits on you, in Waiting on you`,children:s.jsx(ue,{variant:mi.needs_you.tone,children:mi.needs_you.label})}):C?s.jsx(V,{type:"button",variant:"outline",size:"sm",title:w.offered?void 0:w.why,"aria-disabled":!w.offered||void 0,className:ie(!w.offered&&"cursor-not-allowed opacity-50"),"aria-label":`Send ${t.name} to the main queue`,"aria-describedby":w.offered?void 0:`why-${t.name}`,onClick:w.offered?i:void 0,children:"Merge"}):null,y&&r&&!p?s.jsx(V,{type:"button",variant:"outline",size:"sm","aria-label":`Remove ${t.name}`,onClick:o,children:"Remove"}):null]})})]}),s.jsx(l5,{row:t,threads:x,tasks:b,merge_shown:C,sent:l,on_dismiss:c,on_clear_sent:d})]})}function l5({row:e,threads:t,tasks:n,merge_shown:a,sent:r,on_dismiss:l,on_clear_sent:i}){var b,v,y,g;const{Link:o}=Xe(),c=(p="Open in Threads")=>s.jsx(o,{className:"text-primary text-sm hover:underline",href:t,children:p}),d=p=>s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:p,children:"Dismiss"}),f=e.write,h=e.threads.find(p=>p.thread===("thread"in e.merge?e.merge.thread:void 0))??e.threads[0],m=(h==null?void 0:h.title)??"Its thread";let x=null;if(r)x=s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"It was not sent"}),s.jsxs(xe,{children:[s.jsx("p",{children:r}),d(i)]})]});else if((f==null?void 0:f.state)==="waiting")x=s.jsxs("p",{className:"text-muted-foreground text-sm",role:"status",children:["Another worktree's write runs first; ",e.name," ",f.kind==="merge"?"joins":"is removed"," next."]});else if((f==null?void 0:f.state)==="running")x=s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:f.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((f==null?void 0:f.state)==="joined"){const p=((b=f.lands)==null?void 0:b.by)==="manager"?`the merge manager, ${f.lands.manager}, lands it`:"it lands it on its turn";x=s.jsxs(he,{variant:f.told?"success":"warning",role:"status",children:[s.jsx(ye,{children:`${e.name} joined the main queue, ${H1(f.position)}`}),s.jsxs(xe,{children:[s.jsx("p",{children:f.told?`${m} was left a notice, and ${p}.`:"Its thread could not be told, so it does not know its turn is coming. Tell it from Threads; the join itself is unchanged."}),((v=e.queue)==null?void 0:v.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?s.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 ${sh(e.queue.passes_at)}.`}):null,s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({write:e.path})),!f.told||((y=e.queue)==null?void 0:y.position)===1?s.jsx("span",{className:"mt-2",children:c()}):null]})]})]})}else if(f&&(f.state==="refused"||f.state==="failed")){const p=f.kind==="merge"?`The main queue refused ${e.name}`:`${e.name} was not removed`;x=s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:f.kind==="merge"&&f.state==="failed"?`${e.name} did not join`:p}),s.jsxs(xe,{children:[s.jsx("p",{children:`${Ni(f.message)}${f.kind==="merge"?" Nothing was queued.":" Nothing was deleted."}`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({write:e.path})),f.kind==="merge"?s.jsx("span",{className:"mt-2",children:c()}):null]})]})]})}else if(e.last_turn){const p=e.last_turn;x=s.jsxs(he,{variant:"warning",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:`${e.name}'s turn ${p.outcome==="failed"?"failed":"passed on"} at ${sh(p.left_at)}`}),s.jsxs(xe,{children:[s.jsx("p",{children:`${Ni(p.reason)}. Continue the thread in its session; Merge sends it again once it is at rest.`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({turn:{execution:p.execution,left_at:p.left_at}})),s.jsx("span",{className:"mt-2",children:c()})]})]})]})}else((g=e.queue)==null?void 0:g.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?x=s.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 ${sh(e.queue.passes_at)}. `,c()]}):!e.merge.offered&&e.merge.why===qx?x=s.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:["Its thread waits on you. Merge comes back once you answer it. ",s.jsx(o,{className:"text-primary hover:underline",href:n,children:"In Waiting on you"})]}):!e.merge.offered&&e.merge.successor&&!e.queue&&e.landed===null?x=s.jsx("p",{className:"text-sm",children:c("Open its successor in Threads")}):a&&!e.merge.offered?x=s.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:[`${Ni(e.merge.why)}. `,e.merge.thread&&!e.merge.why.startsWith("its thread is at work")?c():null]}):e.merge.offered&&e.merge.caveat&&(x=s.jsx("p",{className:"text-muted-foreground text-sm",children:`${Ni(e.merge.caveat)}.`}));return x?s.jsx(de,{className:"hover:bg-transparent",children:s.jsx(K,{colSpan:6,className:"pt-0",children:x})}):null}const i5=["reason","since","store","repository","folder","home","member_path"];function I1(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 a of i5){const r=t==null?void 0:t[a];typeof r=="string"&&(n[a]=r)}return n}function Rr({base:e="",fetcher:t=fetch}){return async(n,a={})=>{const r=new URLSearchParams;for(const[c,d]of Object.entries(a))if(Array.isArray(d))for(const f of d)r.append(c,f);else d!==void 0&&d!==!1&&d!==""&&r.set(c,String(d));const l=r.size>0?`?${r.toString()}`:"";let i;try{i=await t(`${e}api/app/${n}${l}`,{cache:"no-store"})}catch{return{ok:!1,refusal:{status:0,message:"The viewer did not answer. Is sdlc viewer still running?"}}}const o=await i.json().catch(()=>null);return i.ok?{ok:!0,data:o}:{ok:!1,refusal:I1(i.status,o)}}}function o5(e={}){const t=Rr(e),n=r=>async()=>{const l=await t("access");return l.ok?{ok:!0,data:l.data[r]}:l},a=encodeURIComponent;return{tasks:{access:n("tasks"),configuration:()=>t("tasks/configuration"),listTasks:r=>t(`tasks/lists/${a(r)}/tasks`),task:r=>t(`tasks/tasks/${a(r)}`)},issues:{access:n("issues"),list:(r={})=>t("issues",r),issue:r=>t(`issues/${a(r)}`),issueSections:r=>t(`issues/${a(r)}/sections`),issueRelated:r=>t(`issues/${a(r)}/related`)},releases:{access:n("releases"),list:()=>t("releases"),release:r=>t(`releases/${a(r)}`),candidate:()=>t("releases/candidate")},organizations:{access:n("organizations"),list:()=>t("orgs")},projects:{access:n("projects"),list:()=>t("projects")},about:{about:()=>t("about")}}}function c5(e={}){const t=Rr(e);return{listQueues:()=>t("queues"),queue:n=>t(`queues/${encodeURIComponent(n)}`),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 ki=e=>({ok:!1,refusal:{status:0,message:e}});function Yx({base:e="",fetcher:t=fetch}){return async(n,a)=>{let r;try{r=await t(`${e}api/${n}`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch{return ki("The viewer did not answer. Is sdlc viewer still running?")}const l=await r.json().catch(()=>null);return r.ok?{ok:!0,data:l}:{ok:!1,refusal:I1(r.status,l)}}}function u5(e={}){const t=Rr(e),n=Yx(e);return{chart:()=>t("org"),change:a=>n("org-change",a)}}function d5(e={}){const t=Rr(e),n=o=>`tasks/tasks/${encodeURIComponent(o)}`,{base:a="",fetcher:r=fetch}=e;return{access:async()=>{const o=await t("access");return o.ok?{ok:!0,data:o.data.tasks}:o},availability:async()=>{const o=await t("tasks/configuration");if(!o.ok)return o.refusal.reason==="engine_missing"?{state:"off",refusal:o.refusal}:{state:"error",refusal:o.refusal};const c=o.data;if(c.state!=="active")return{state:"available"};const d=c.workspaces.find(h=>h.is_default)??c.workspaces[0],f=d==null?void 0:d.lists[0];return!d||!f?{state:"error"}:{state:"active",configuration:c,workspace:d,list:f}},listTasks:(o,c={})=>{var d,f,h;return c.state==="archived"?Promise.resolve(ki("This checkout keeps no archived tasks.")):c.assigned_to_me?Promise.resolve(ki("Assigned to you is a status group here.")):t(`tasks/lists/${encodeURIComponent(o)}/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:(f=c.closed_groups)!=null&&f.length?c.closed_groups.join(","):void 0,all:(h=c.all_groups)!=null&&h.length?c.all_groups.join(","):void 0})},members:()=>t("tasks/members"),waitingOnYou:()=>t("tasks/waiting-on-you"),task:o=>t(n(o)),taskSections:o=>t(`${n(o)}/sections`),taskRelated:o=>t(`${n(o)}/related`),hierarchyRevision:async()=>({ok:!0,data:0}),commands:{run:async()=>ki("The local viewer changes tasks only with Done."),complete:async o=>{const c="task"in o?{task:o.task}:{hold:o.hold};let d;try{d=await r(`${a}api/task-done`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})}catch{return ki("The viewer did not answer. Is sdlc viewer still running?")}if(d.ok)return{ok:!0,data:null};const f=await d.text().catch(()=>"");return{ok:!1,refusal:{status:d.status,message:f||`It was not recorded (HTTP ${d.status}).`}}}}}}function f5(e={}){const t=Rr(e),n=Yx(e),a=encodeURIComponent,r=l=>l!=null&&l.fresh?{fresh:1}:{};return{access:async()=>{const l=await t("access");return l.ok?{ok:!0,data:l.data.releases}:l},list:(l={})=>t("releases",r(l)),release:(l,i)=>t(`releases/${a(l)}`,r(i)),candidate:l=>t("releases/candidate",r(l)),candidateBatch:l=>t("releases/candidate/batch",r(l)),related:(l,i)=>t(`releases/${a(l)}/related`,r(i)),plannedRelease:(l,i)=>t(`releases/planned/${a(l)}`,r(i)),roadmap:l=>t("releases/roadmap",{...r(l),...l!=null&&l.mine?{mine:1}:{}}),roadmapMoved:l=>t("releases/roadmap/moved",r(l)),roadmapSeen:l=>n("roadmap/seen",{at:l})}}function h5(e={}){const t=Rr(e),n=Yx(e);return{list:()=>t("worktrees"),sizes:()=>t("worktree-sizes"),merge:a=>n("worktree-merge",{path:a}),remove:a=>n("worktree-remove",{path:a}),dismiss:a=>n("worktree-dismiss",a)}}function m5(e={}){const t=Rr(e);return{overview:()=>t("workspaces")}}const P1=[["stage","Stage"],["blocker","Blocker"],["recent","Recent"]],p5=10,q1="Threads you pinned; they stay first in every order";function Em(e,t,n){var F,H;const{order:a,folded:r,showAll:l,narrowed:i,max:o=p5}=n,c=new Map(e.map(A=>[A.key,A])),d=A=>A.pinned===!0,f=A=>{var R;if(d(A)||!A.blockedBy||!c.has(A.blockedBy))return!1;const M=new Set([A.key]);for(let T=A.blockedBy;T&&c.has(T);T=(R=c.get(T))==null?void 0:R.blockedBy){if(M.has(T))return!1;M.add(T)}return!0},h=new Map;for(const A of e){if(!f(A))continue;const M=h.get(A.blockedBy)??[];M.push(A),h.set(A.blockedBy,M)}const m=A=>h.get(A.key)??[],x=A=>Math.max(A.mtimeMs??0,...m(A).map(x)),b=A=>!!A.needsYou||m(A).some(b),v=A=>A.activeSince!==void 0,y=(A,M)=>v(A)!==v(M)?v(A)?-1:1:b(A)!==b(M)?b(A)?-1:1:v(A)?A.activeSince-M.activeSince||A.key.localeCompare(M.key):x(M)-x(A),g=(A,M)=>Number(v(M))-Number(v(A))||(v(A)?M.activeSince-A.activeSince:(M.mtimeMs??0)-(A.mtimeMs??0))||A.key.localeCompare(M.key),p=l||i,j=!i,w=(A,M=0)=>a==="blocker"?[{row:A,depth:M},...m(A).flatMap(R=>w(R,M+1))]:[{row:A,depth:0}],N=A=>a==="blocker"?1+m(A).reduce((M,R)=>M+N(R),0):1,C=A=>A.reduce((M,R)=>M+N(R),0),_=(A,M,R,T,k,O)=>{const Y=!k||!r.has(A);return{key:A,label:M,...O?{hint:O}:{},count:T,folds:k,open:Y,rows:Y?R.flatMap(E=>w(E)):[]}},S=e.filter(d),D=e.filter(A=>!d(A)),z=[];S.length&&z.push(_("pinned","Pinned",S,C(S),j,q1));let P=null;if(a==="stage"){const A=new Set(t.map(([T])=>T)),M=new Map(t.map(([T])=>[T,[]]));for(const T of D)(F=M.get(T.stage&&A.has(T.stage)?T.stage:"none"))==null||F.push(T);for(const[T,k,O]of t){const Y=(M.get(T)??[]).sort(y);if(!Y.length)continue;const E=T==="none"&&!p?Y.slice(0,o):Y;z.push({..._(T,k,E,Y.length,j&&T!=="none",O),count:Y.length})}const R=((H=M.get("none"))==null?void 0:H.length)??0;!i&&R>o&&(P={total:R,unstaged:!0})}else{const A=a==="recent"?[...D].sort(g):D.filter(M=>!f(M)).sort(y);if(A.length){const M=p?A:A.slice(0,o),R=_("others",S.length?"Other threads":null,M,C(A),!!S.length&&j);z.push(R),!i&&R.open&&A.length>o&&(P={total:A.length,unstaged:!1})}}return{groups:z,more:P}}function x5(e,t,n,a){const l=Em(e,t,{...n,folded:new Set,showAll:!0}).groups.find(c=>c.rows.some(d=>d.row.key===a));if(!l)return null;const o=!Em(e,t,{...n,folded:new Set}).groups.some(c=>c.rows.some(d=>d.row.key===a));return{group:l.key,capped:o}}const g5=15e3,v5=10,_y="idle-sessions-list",Ny="idle-sessions-heading",ky="idle-sessions-confirm-text";function G1(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const y5=e=>`${Number.isInteger(e)?e:e.toFixed(1)} h`,V1=e=>e===1?"1 session":`${e} sessions`;function j5(e){const t=e.released.length?`Closed ${V1(e.released.length)}.`:"Closed no sessions.";return e.kept.length?`${t} Kept ${e.kept.length}:`:t}function b5({row:e}){const t=[e.name,e.retired?"continued in another session":"",`idle ${y5(e.idle_hours)}`,G1(e.memory_mb)].filter(Boolean).join(" · ");return s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:e.title}),s.jsxs("p",{className:"caption",children:[s.jsxs("span",{className:"muted",children:[t,e.unfinished&&" ·"]}),e.unfinished&&s.jsx("span",{className:"idle-unfinished",children:" unfinished work"})]})]})}function w5(){const[e,t]=u.useState(null),[n,a]=u.useState(!1),[r,l]=u.useState(!1),[i,o]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(""),m=u.useRef(""),x=u.useRef(null),b=u.useRef(null),v=u.useRef(null),y=u.useRef(null),g=u.useRef(0),p=u.useRef(0),j=u.useCallback(async()=>{const H=++g.current,A=await b6();if(!A||H<p.current)return;p.current=H,h("");const M=JSON.stringify(A);M!==m.current&&(m.current=M,t(A))},[]);u.useEffect(()=>{const H=setTimeout(j,0),A=setInterval(j,g5);return()=>{clearTimeout(H),clearInterval(A)}},[j]),u.useEffect(()=>{var A;const H=y.current;H&&(y.current=null,(A={cancel:b,close:x,dismiss:v}[H].current)==null||A.focus())});const w=(e==null?void 0:e.sessions.length)??0;if(u.useEffect(()=>{r&&!w&&i===null&&l(!1)},[r,w,i]),!w&&!c&&!f&&i===null)return null;const N=()=>{i===null&&(l(!0),y.current="cancel")},C=()=>{i===null&&(l(!1),y.current="close")},_=async()=>{if(i!==null)return;o(w),d(null),h("");const H=await w6();p.current=g.current+1,await j(),o(null),l(!1),a(!1),"error"in H?(h(`The sessions were not closed: ${H.error.replace(/\.+$/,"")}.`),y.current="close"):(d(H.done),y.current="dismiss")},S=()=>{d(null),y.current="close"},D=H=>{H.key==="Escape"&&(H.preventDefault(),C())},z=i!==null?`Closing ${V1(i)}…`:c?j5(c):"",P=(e==null?void 0:e.sessions.slice(0,v5))??[],F=w-P.length;return s.jsxs("div",{className:"idle",role:"group",...w?{"aria-labelledby":Ny}:{"aria-label":"Idle sessions"},children:[f&&s.jsx("div",{className:"alert",role:"alert",children:f}),w>0&&e&&s.jsxs("div",{className:"idle-head",children:[s.jsxs("div",{className:"idle-title",children:[s.jsxs("h2",{className:"group",id:Ny,"aria-label":`Idle sessions, ${w}`,children:["Idle sessions",s.jsx("span",{className:"count",children:w})]}),s.jsxs("p",{className:"caption muted",children:["over ",e.idle_over," h · ",G1(e.memory_mb)]})]}),s.jsxs("div",{className:"tools",children:[s.jsx("button",{type:"button",className:"pin","aria-expanded":n,"aria-controls":_y,"aria-label":n?"Hide the idle sessions list":"Show the idle sessions list",onClick:()=>a(H=>!H),children:n?"Hide":"Show"}),s.jsx("button",{type:"button",className:"pin",ref:x,"aria-expanded":r,"aria-label":"Close idle sessions…",onClick:N,children:"Close idle…"})]})]}),w>0&&s.jsxs("ul",{className:"idle-list",id:_y,hidden:!n,"aria-label":`Sessions idle over ${e==null?void 0:e.idle_over} hours, longest idle first`,children:[P.map(H=>s.jsx(b5,{row:H},H.session)),F>0&&s.jsx("li",{children:s.jsxs("p",{className:"caption muted",children:["…and ",F," more"]})})]}),r&&w>0&&s.jsxs("div",{className:"idle-confirm",role:"group","aria-label":"Close idle sessions","aria-describedby":ky,onKeyDown:D,children:[s.jsxs("p",{id:ky,children:[w===1?"Close this session?":`Close these ${w} 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."]}),s.jsxs("div",{className:"tools start",children:[s.jsx("button",{type:"button",className:"pin","aria-disabled":i!==null?!0:void 0,"aria-busy":i!==null?!0:void 0,onClick:_,children:i!==null?`Closing ${i}…`:`Close ${w}`}),s.jsx("button",{type:"button",className:"pin",ref:b,"aria-disabled":i!==null?!0:void 0,onClick:C,children:"Cancel"})]})]}),s.jsx("p",{className:"idle-status",role:"status",children:z}),c&&s.jsxs(s.Fragment,{children:[c.kept.length>0&&s.jsx("ul",{className:"idle-list","aria-label":"Kept sessions",children:c.kept.map(H=>s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:H.title}),s.jsx("p",{className:"caption muted",children:H.why})]},H.session))}),s.jsx("div",{className:"tools start",children:s.jsx("button",{type:"button",className:"pin",ref:v,"aria-label":"Dismiss the close result",onClick:S,children:"Dismiss"})})]})]})}const Sy={ok:"lime",you:"amber",alert:"red",waiting:"blue",blocked:"purple",muted:"grey",plain:"grey"};function go(e){return e&&Object.hasOwn(Sy,e)?Sy[e]:"grey"}const _5=1e4,N5=6e4,k5=2,ah="#thread-",S5=["pin","details-toggle"],C5=Yw("Threads"),R5={working:"▶",prod:"↑",planned:"○"},Cy=3,Ry=["working","ready","prod","waiting","blocked","paused","planned"],T5={ready:"results ready",prod:"ready for prod"};function E5(e){const t=Ry.map(a=>[a,e.filter(r=>r.state===a).length]),n=[...new Set(e.map(a=>a.state).filter(a=>!Ry.includes(a)))].map(a=>[a,e.filter(r=>r.state===a).length]);return[...t,...n].filter(([,a])=>a>0).map(([a,r])=>`${r} ${T5[a]??a}`).join(" · ")}const A5={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 M5(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 Am=[["running","Running"],["you","Needs you"],["blocked","Blocked"],["paused","Paused"],["idle","Idle"]],Mm=[["claude","Claude"],["codex","Codex"]],Ty={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"},Ey=e=>e.kind??"idle",Ay=e=>e.agent==="Codex"?"codex":"claude";function My(e,t,n,a){const r=n.toLowerCase().split(/\s+/).filter(Boolean),l=Am.map(([v])=>v).filter(v=>a.has(v)),i=Mm.map(([v])=>v).filter(v=>a.has(v)),o=v=>!l.length||l.includes(Ey(v)),c=v=>!i.length||i.includes(Ay(v)),d=v=>{if(!r.length)return!0;const y=v.search??v.title.toLowerCase();return r.every(g=>y.includes(g))},f=e.filter(d),h={};for(const[v]of Am)h[v]=f.filter(y=>c(y)&&Ey(y)===v).length;for(const[v]of Mm)h[v]=f.filter(y=>o(y)&&Ay(y)===v).length;const m=[],x=[],b=[];return e.forEach((v,y)=>{b.length=Math.min(b.length,v.depth);const g=v.depth>0?b[v.depth-1]??null:null,p=d(v)&&o(v)&&c(v);let j=null;p&&(j=g?{depth:g.depth+1,pinned:g.pinned}:{depth:0,pinned:y<t&&v.pinned!==!1},(j.pinned?m:x).push({row:v,depth:j.depth})),b.push(j)}),{rows:[...m,...x],pinned:m.length,counts:h,narrowed:r.length+l.length+i.length>0}}const Y1="sdlc-viewer:threads-arrange",$y={order:"blocker",compact:!1,folded:[],showAll:!1,archived:!1};function $5(){try{const e=JSON.parse(window.localStorage.getItem(Y1)??"{}");return{order:P1.some(([t])=>t===e.order)?e.order:$y.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 $y}}function O5(e){try{window.localStorage.setItem(Y1,JSON.stringify(e))}catch{}}const D5=new Set(["not_terminal","another_process","continued","no_open","pending"]);function rh({label:e,count:t,hint:n,fold:a}){const r=n?`hint-${e.toLowerCase().replace(/\W+/g,"-")}`:void 0;return s.jsxs(s.Fragment,{children:[a?s.jsx("h2",{className:"group",children:s.jsxs("button",{type:"button",className:"group-fold","aria-expanded":a.open,"aria-label":`${e}, ${t}`,"aria-describedby":r,onClick:a.onToggle,children:[s.jsx("span",{className:"chevron","aria-hidden":"true",children:a.open?"▾":"▸"}),e,s.jsx("span",{className:"count",children:t})]})}):s.jsxs("h2",{className:"group","aria-label":`${e}, ${t}`,"aria-describedby":r,children:[e,s.jsx("span",{className:"count",children:t})]}),n&&s.jsx("span",{className:"sr-only",id:r,children:n})]})}function Cc({text:e,role:t}){return s.jsx("span",{className:`badge tone-${go(t)}`,children:e})}function z5({serves:e}){const t=e.slice(0,k5),n=e.length-t.length;return s.jsxs("p",{className:"caption muted serves",children:[t.map((a,r)=>s.jsxs("span",{children:[r>0&&", ",s.jsxs("a",{href:`releases?planned=${encodeURIComponent(a.planned_release)}`,"aria-label":`serves ${a.name}, ${a.level}: open it in Planned releases`,children:["serves ",a.name," (",a.level,")"]})]},a.planned_release)),n>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{"aria-hidden":"true",children:[", +",n," more"]}),s.jsxs("span",{className:"sr-only",children:[", and ",n," more planned releases"]})]})]})}const L5=4;function Oy({track:e}){return s.jsxs("span",{className:"track",children:[s.jsx("span",{className:"track-dots","aria-hidden":"true",children:Array.from({length:L5},(t,n)=>s.jsx("span",{className:["track-dot",n<=e.reached?"reached":"",n===e.target?"target":""].filter(Boolean).join(" ")},n))}),e.label,e.detail&&s.jsxs("span",{className:"sr-only",children:[". ",e.detail]})]})}function U5({tags:e,track:t,brief:n=!1}){const a=t?Math.min(Math.max(t.at??e.length,0),e.length):-1,r=n?e.filter(i=>!i.full):e,l=t?a-(n?e.slice(0,a).filter(i=>i.full).length:0):-1;return s.jsxs(s.Fragment,{children:[r.map((i,o)=>s.jsxs(u.Fragment,{children:[o===l&&t&&s.jsxs(s.Fragment,{children:[" ",s.jsx(Oy,{track:t})]})," · ",s.jsxs("span",{className:`tag tone-${go(i.role)}`,children:[i.text,i.detail&&s.jsxs("span",{className:"sr-only",children:[". ",i.detail]})]})]},`t${o}`)),l===r.length&&t&&s.jsxs(s.Fragment,{children:[" ",s.jsx(Oy,{track:t})]})]})}function Dy({id:e,href:t}){return t?s.jsx("a",{className:"id-link",href:t,children:e}):s.jsx("span",{className:"id-text",children:e})}function B5({onConnection:e,org:t=null,project:n=null}){const[a,r]=u.useState(null),[l,i]=u.useState(!1),[o,c]=u.useState(""),[d,f]=u.useState(!1),[h,m]=u.useState(null),[x,b]=u.useState(""),[v,y]=u.useState(null),[g,p]=u.useState(null),[j,w]=u.useState(null),[N,C]=u.useState(""),[_,S]=u.useState(()=>new Set),[D,z]=u.useState(null),[P,F]=u.useState($5),H=$=>F(B=>{const W={...B,...$};return O5(W),W}),[A,M]=u.useState({groups:[],all:!1}),[R,T]=u.useState(()=>new Set),k=u.useRef(P.archived),O=u.useRef(0),Y=u.useRef(null),E=u.useRef(""),I=u.useRef(""),Q=u.useRef(""),te=u.useRef(null),ce=u.useRef(null),X=u.useRef(null),L=$=>{var W;if(!($ instanceof HTMLButtonElement)||!((W=te.current)!=null&&W.contains($))||!$.dataset.key)return null;const B=S5.find(ve=>$.classList.contains(ve));return B?`${B} ${$.dataset.key}`:null},q=$=>{X.current=L($.target)},ne=()=>{setTimeout(()=>{L(document.activeElement)||(X.current=null)},0)},ae=u.useCallback(async()=>{const $=++O.current,B=await O1(k.current);if($!==O.current)return;if("none"in B){i(!0),c(""),e("live");return}if("error"in B){c(B.error),e("disconnected");return}i(!1),c(""),b(""),e("live");const W=JSON.stringify(B.data);W!==E.current&&(E.current=W,r(B.data))},[e]);u.useEffect(()=>{let $=!0;j6().then(ve=>$&&f(ve));const B=setTimeout(ae,0),W=setInterval(ae,_5);return()=>{$=!1,clearTimeout(B),clearInterval(W)}},[ae]),u.useEffect(()=>{let $=!0;const B=()=>y6().then(ve=>{$&&ve&&y(Oe=>JSON.stringify(Oe)===JSON.stringify(ve)?Oe:ve)});B();const W=setInterval(B,N5);return()=>{$=!1,clearInterval(W)}},[]),u.useEffect(()=>{const $=()=>{var an,Xa,Tr;const W=window.location.hash;if(!W.startsWith(ah)){w(null);return}if(W===I.current)return;let ve;try{ve=decodeURIComponent(W.slice(ah.length))}catch{ve=W.slice(ah.length)}const Oe=document.getElementById(`thread-${ve}`);if(!Oe||!((an=te.current)!=null&&an.contains(Oe))){if(!te.current||!a)return;const ti=Q.current!==W;if(Q.current=W,a.threads.some(ni=>ni.key===ve)){const ni=(N||_.size)&&!My(a.threads,a.pinnedCount??0,N,_).rows.some(ia=>ia.row.key===ve),xs=a.stages&&(ti||!ni)?x5(a.threads,a.stages,{order:P.order,folded:new Set,showAll:!1,narrowed:!1},ve):null,zs=xs!==null&&P.folded.includes(xs.group)&&!A.groups.includes(xs.group),Er=xs!==null&&xs.capped&&!P.showAll&&!A.all;ti&&(N||_.size)&&(C(""),S(new Set)),ti&&(N||_.size)||zs||Er?(zs||Er)&&M(ia=>({groups:zs&&xs?[...ia.groups,xs.group]:ia.groups,all:ia.all||Er})):I.current=W,w(null);return}w(ve);return}I.current=W,w(null),p(ve),(Xa=Oe.querySelector(".thread-title"))==null||Xa.focus({preventScroll:!0}),(Tr=Oe.scrollIntoView)==null||Tr.call(Oe,{block:"center"})},B=()=>{I.current="",Q.current="",$()};return $(),window.addEventListener("hashchange",B),()=>window.removeEventListener("hashchange",B)},[a,N,_,P,A]),u.useEffect(()=>{if(!g)return;const $=()=>p(null);return document.addEventListener("pointerdown",$,!0),document.addEventListener("keydown",$,!0),()=>{document.removeEventListener("pointerdown",$,!0),document.removeEventListener("keydown",$,!0)}},[g]),u.useLayoutEffect(()=>{const $=X.current??(ce.current?`pin ${ce.current}`:null);if(!$||!te.current)return;const[B,W]=[$.slice(0,$.indexOf(" ")),$.slice($.indexOf(" ")+1)],ve=document.activeElement;if(ve&&ve!==document.body&&!te.current.contains(ve)){X.current=null;return}const Oe=[...te.current.querySelectorAll(`button.${B}`)].find(an=>an.dataset.key===W);Oe?ve!==Oe&&Oe.focus({preventScroll:W!==ce.current}):X.current=null});const je=async $=>{if(h)return;const B=!$.pinned;ce.current=$.key,m($.key);const W=await N6($.key,B);m(null),W||r(ve=>ve&&{...ve,threads:ve.threads.map(Oe=>Oe.key===$.key?{...Oe,pinned:B}:Oe)}),await ae(),b(W?`The pin was not saved: ${W}`:""),ce.current===$.key&&(ce.current=null)},[re,we]=u.useState(()=>new Set),[se,tt]=u.useState({}),ge=ds(),{confirm:He,confirm_dialog:J}=Bo(),ke=($,B)=>tt(W=>{const{[$]:ve,...Oe}=W;return B?{...Oe,[$]:B}:Oe}),Ue=($,B)=>we(W=>{const ve=new Set(W);return B?ve.add($):ve.delete($),ve}),ft=Object.keys(se).some($=>!re.has($));u.useEffect(()=>{if(!ft)return;const $=()=>tt(B=>Object.fromEntries(Object.entries(B).filter(([W])=>re.has(W))));return document.addEventListener("pointerdown",$,!0),document.addEventListener("click",$,!0),()=>{document.removeEventListener("pointerdown",$,!0),document.removeEventListener("click",$,!0)}},[ft,re]);const _e=$=>setTimeout(()=>{var B,W;return(W=[...((B=te.current)==null?void 0:B.querySelectorAll("button.open-thread"))??[]].find(ve=>ve.dataset.key===$))==null?void 0:W.focus()},0),Ht=async($,B)=>{const W=await He({title:`Reopen ${$.title} in Terminal?`,description:`Its session is closed. It opens in a new Terminal window in ${B??"the thread's folder"}, running claude --resume.`,action_label:"Reopen"});return _e($.key),W},wt=async $=>{if(re.has($.key))return;let B=!1;for(;;){Ue($.key,!0),ke($.key,{key:$.key,text:A5[$.where??""]??"Opening.",role:"waiting"});const W=await _6($.key,B);if(Ue($.key,!1),"done"in W){ke($.key,null);return}const{reason:ve,error:Oe,where:an}=W.refused;if(ve==="closed"&&!B){if(ke($.key,null),!await Ht($,an))return;B=!0;continue}const Xa=ve==="outdated"?`${Oe.replace(/\.*$/,".")} ${ge}`:Oe.replace(/\.*$/,"."),Tr=ve==="terminal_denied"?"you":D5.has(ve)?"muted":"alert";ke($.key,{key:$.key,text:Xa,role:Tr});return}},Et=(a==null?void 0:a.threads)??[],tn=!l&&Et.length>0,_t=My(Et,(a==null?void 0:a.pinnedCount)??0,N,_),Nt=_t.pinned,bn=_t.rows,Gt=Array.isArray(a==null?void 0:a.stages)?a.stages:null,le=new Set(P.folded.filter($=>!A.groups.includes($))),Me=P.showAll||A.all,Ce=Gt?Em(bn.map($=>$.row),Gt,{order:P.order,folded:le,showAll:Me,narrowed:_t.narrowed}):null,nn=Gt?(a==null?void 0:a.archived)??0:0,sn=$=>{M(B=>({...B,groups:B.groups.filter(W=>W!==$)})),H({folded:le.has($)?P.folded.filter(B=>B!==$):[...P.folded.filter(B=>B!==$),$]})},zn=()=>{M($=>({...$,all:!1})),H({showAll:!Me})},st=()=>{const $=!P.archived;k.current=$,H({archived:$}),ae()},hs=$=>T(B=>{const W=new Set(B);return W.has($)?W.delete($):W.add($),W}),Wn=($,B)=>s.jsx(H5,{depth:B,row:v!=null&&v[$.key]?{...$,serves:v[$.key]}:$,arrived:g===$.key,pinnable:d&&typeof $.pinned=="boolean",pinning:h,onPin:()=>je($),opening:re.has($.key),note:se[$.key]??null,onOpen:()=>wt($),org:t,project:n,compact:!!Gt&&P.compact,detailsOpen:R.has($.key),onDetails:()=>hs($.key)});u.useEffect(()=>{if(!tn)return;const $=B=>{var ve,Oe;if(B.key!=="/"||B.ctrlKey||B.metaKey||B.altKey||B.defaultPrevented)return;const W=document.activeElement;W&&(/^(INPUT|TEXTAREA|SELECT)$/.test(W.tagName)||W.isContentEditable)||document.querySelector('[role="dialog"], [role="alertdialog"], dialog[open]')||(B.preventDefault(),(ve=Y.current)==null||ve.focus(),(Oe=Y.current)==null||Oe.select())};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[tn]);const ms=$=>S(B=>{const W=new Set(B);return W.has($)?W.delete($):W.add($),W}),ps=()=>{var $;C(""),S(new Set),($=Y.current)==null||$.focus()},U=($,B)=>{const W=_t.counts[$]??0,ve=_.has($),Oe=Ty[$];return s.jsxs("button",{type:"button",className:"filter-chip","aria-pressed":ve,"aria-describedby":Oe?`chip-hint-${$}`:void 0,disabled:W===0&&!ve&&D!==$,onFocus:()=>z($),onBlur:()=>z(an=>an===$?null:an),onClick:()=>ms($),children:[B," ",W]},$)};return s.jsxs(s.Fragment,{children:[J,s.jsxs("header",{className:"main-head",children:[s.jsx("h1",{children:"Threads"}),a&&!l&&s.jsx("p",{className:"muted",children:a.line})]}),s.jsxs("section",{className:"card threads","aria-label":"Threads",children:[s.jsx(w5,{}),o&&s.jsxs("div",{className:"alert",role:"alert",children:["Threads unavailable: ",o.replace(/\.+$/,""),". Retrying every 10 s."]}),x&&s.jsx("div",{className:"alert",role:"alert",children:x}),s.jsx("p",{className:"caption muted not-listed",role:"status",children:j!==null&&!l?Gt?s.jsxs(s.Fragment,{children:["Thread ",j," is not in this list.",!P.archived&&nn>0?" Show archived lists archived threads.":null]}):s.jsxs(s.Fragment,{children:["Thread ",j," is not in this list. ",s.jsx("code",{children:"sdlc view --all"})," lists older threads."]}):null}),tn&&s.jsxs("div",{className:"threads-toolbar",children:[s.jsxs("div",{className:"threads-find",children:[s.jsxs("div",{className:"search-field",children:[s.jsx("input",{ref:Y,type:"search",placeholder:"Search threads","aria-label":"Search threads","aria-keyshortcuts":"/",value:N,onChange:$=>C($.target.value),onKeyDown:$=>{$.key==="Escape"&&($.preventDefault(),N?C(""):$.currentTarget.blur())}}),N&&s.jsx("button",{type:"button",className:"search-clear","aria-label":"Clear search",onClick:()=>{var $;C(""),($=Y.current)==null||$.focus()},children:s.jsx("span",{"aria-hidden":"true",children:"×"})})]}),Gt&&s.jsx("select",{className:"order-select","aria-label":"Order threads",value:P.order,onChange:$=>H({order:$.target.value}),children:P1.map(([$,B])=>s.jsx("option",{value:$,children:B},$))})]}),s.jsxs("div",{className:"filter-row",children:[s.jsx("div",{className:"filter-group",role:"group","aria-label":"Status",children:Am.map(([$,B])=>U($,B))}),s.jsx("div",{className:"filter-group",role:"group","aria-label":"Agent",children:Mm.map(([$,B])=>U($,B))}),Gt&&s.jsx("button",{type:"button",className:"filter-chip","aria-pressed":P.compact,onClick:()=>H({compact:!P.compact}),children:"Compact"})]}),Object.entries(Ty).map(([$,B])=>s.jsx("span",{className:"sr-only",id:`chip-hint-${$}`,children:B},$)),s.jsx("p",{className:"caption muted narrowed",role:"status",children:_t.narrowed?s.jsxs(s.Fragment,{children:[bn.length," of ",Et.length," threads ·"," ",s.jsx("button",{type:"button",className:"clear-filters","aria-label":"Clear search and filters",onClick:ps,children:"Clear"})]}):null})]}),l?s.jsx("p",{className:"muted",children:C5}):s.jsxs("div",{className:"thread-list",ref:te,onFocus:q,onBlur:ne,children:[Ce==null?void 0:Ce.groups.map($=>s.jsxs("div",{children:[$.label!==null&&s.jsx(rh,{label:$.label,count:$.count,hint:$.hint,fold:$.folds?{open:$.open,onToggle:()=>sn($.key)}:void 0}),$.rows.map(({row:B,depth:W})=>s.jsx("div",{children:Wn(B,W)},B.key))]},`group-${$.key}`)),!Ce&&bn.map(({row:$,depth:B},W)=>s.jsxs("div",{children:[Nt>0&&W===0&&s.jsx(rh,{label:"Pinned",count:Nt,hint:q1}),Nt>0&&W===Nt&&s.jsx(rh,{label:"Other threads",count:bn.length-Nt}),Wn($,B)]},$.key)),a&&!Et.length&&s.jsx("p",{className:"muted empty",children:"No threads at work or waiting."}),Et.length>0&&!bn.length&&s.jsx("p",{className:"muted empty",children:"No threads match."}),a&&a.hidden>0&&s.jsxs("p",{className:"caption muted",children:[a.hidden," older thread(s) not shown; sdlc view --all lists them."]}),(Ce==null?void 0:Ce.more)&&s.jsx("button",{type:"button",className:"list-more","aria-expanded":Me,onClick:zn,children:Ce.more.unstaged?Me?"Show fewer without a stage":`Show all without a stage (${Ce.more.total})`:Me?"Show fewer":`Show all (${Ce.more.total})`}),nn>0&&s.jsx("button",{type:"button",className:"list-more",onClick:st,children:P.archived?"Hide archived":`Show ${nn} archived`})]})]})]})}function H5({row:e,depth:t,arrived:n,pinnable:a,pinning:r,onPin:l,opening:i,note:o,onOpen:c,org:d,project:f,compact:h=!1,detailsOpen:m=!1,onDetails:x}){const b=h&&!m,v=C=>d?`org/${encodeURIComponent(d)}/tasks/${encodeURIComponent(C)}`:null,y=C=>f?`proj/${encodeURIComponent(f)}/issues/${encodeURIComponent(C)}`:null,g=[e.where||e.agent,e.phase,e.age,e.waitsOn?`waits on ${e.waitsOn}`:""].filter(Boolean).join(" · "),p=M5(e),j=`open-note-${e.key}`,[w,N]=u.useState(!1);return s.jsxs("article",{className:["thread",n?"arrived":"",h?"compact-card":""].filter(Boolean).join(" "),id:`thread-${e.key}`,style:{marginLeft:Math.min(t*22,110)},children:[h&&s.jsx("button",{type:"button",className:"details-toggle","data-key":e.key,"aria-label":`Details of ${e.title}`,"aria-expanded":m,onClick:x,children:s.jsx("span",{"aria-hidden":"true",children:m?"▾":"▸"})}),s.jsxs("div",{className:"thread-head",children:[s.jsx("p",{className:"thread-title",tabIndex:-1,children:e.title}),s.jsxs("div",{className:"tools",children:[e.carried?s.jsxs(s.Fragment,{children:[s.jsx(Cc,{text:e.carried,role:"waiting"}),e.carriedBatch&&s.jsx(Cc,{text:e.carriedBatch.text,role:e.carriedBatch.role})]}):s.jsx(Cc,{text:e.status,role:e.role}),e.archived&&s.jsx(Cc,{text:"archived",role:"muted"}),p&&s.jsx("button",{type:"button",className:"open-thread","data-key":e.key,"aria-label":`${p}: ${e.title}`,"aria-describedby":j,"aria-disabled":i?!0:void 0,"aria-busy":i?!0:void 0,onClick:()=>{i||c()},children:i?"Opening…":p}),a&&s.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":r?!0:void 0,"aria-busy":r===e.key?!0:void 0,onClick:()=>{r||l()},children:e.pinned?"Unpin":"Pin"})]})]}),s.jsxs("p",{className:b?"caption muted meta one-line":"caption muted meta",children:[g,s.jsx(U5,{tags:e.tags??[],track:e.track,brief:b})]}),p&&s.jsx("p",{id:j,className:`caption open-note tone-${go((o==null?void 0:o.role)??"muted")}`,role:(o==null?void 0:o.role)==="alert"||(o==null?void 0:o.role)==="you"?"alert":"status",children:(o==null?void 0:o.text)??null}),!b&&e.serves&&e.serves.length>0&&s.jsx(z5,{serves:e.serves}),!b&&e.summary&&s.jsx("p",{className:"caption muted",children:e.summary}),!b&&e.carriedDetail&&s.jsx("p",{className:"line",children:e.carriedDetail}),!b&&e.step&&s.jsxs("p",{className:"caption muted",children:["step: ",e.step]}),e.lines.length>0&&s.jsx("p",{className:"caption muted lines-summary",children:E5(e.lines)}),b?null:s.jsx(I5,{t:e,allLines:w,setAllLines:N,taskHref:v,issueHref:y})]})}function I5({t:e,allLines:t,setAllLines:n,taskHref:a,issueHref:r}){return s.jsxs(s.Fragment,{children:[(t?e.lines:e.lines.slice(0,Cy)).map((l,i)=>s.jsxs("p",{className:`line tone-${go(l.role)}`,children:[s.jsxs("span",{"aria-hidden":"true",children:[R5[l.state]??"•"," "]}),l.state==="working"&&s.jsx("span",{className:"sr-only",children:"Working: "}),l.task!==void 0&&s.jsx(Dy,{id:l.task,href:a(l.task)}),l.task!==void 0&&l.text?" ":null,l.text]},`l${i}`)),e.lines.length>Cy&&s.jsx("button",{type:"button",className:"lines-more","aria-expanded":t,"aria-label":t?`Show fewer lines of work of ${e.title}`:`Show all ${e.lines.length} lines of work of ${e.title}`,onClick:()=>n(l=>!l),children:t?"Show fewer":`Show all ${e.lines.length}`}),(e.routed??[]).map(l=>s.jsxs("p",{className:"line",children:["routed ",s.jsx(Dy,{id:l.issue,href:r(l.issue)}),l.title?` ${l.title}`:null]},`r${l.issue}`)),e.holds.map((l,i)=>s.jsx("p",{className:`line tone-${go(l.role)}`,children:l.text},`h${i}`)),e.plan&&s.jsx("p",{className:"caption muted",children:e.plan})]})}const P5=5e3;function q5(){const[e,t]=u.useState([]),n=u.useRef(0),a=u.useRef(new Map),r=u.useCallback(c=>{const d=a.current.get(c);d&&clearTimeout(d),a.current.delete(c),t(f=>f.filter(h=>h.id!==c))},[]),l=u.useCallback((c,d)=>{const f=n.current+=1;t(h=>[...h.filter(m=>m.tone!=="error").slice(-2),{id:f,tone:c,message:d}]),c==="success"&&a.current.set(f,setTimeout(()=>r(f),P5))},[r]);u.useEffect(()=>{const c=a.current;return()=>{for(const d of c.values())clearTimeout(d)}},[]);const i=u.useMemo(()=>({success:c=>l("success",c),error:c=>l("error",c)}),[l]),o=s.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=>s.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:[s.jsx("span",{className:"min-w-0 flex-1 break-words",children:c.message}),s.jsx(V,{type:"button",variant:"ghost",size:"control",className:"shrink-0",onClick:()=>r(c.id),children:"Dismiss"})]},c.id))});return{notify:i,toasts:o}}const F1=/^#(?:(releases)|release=(.+)|planned(?:=(.+))?)$/,G5=/^#task=(.+)$/,V5=/^#issue=(.+)$/,Y5=/^iss-\d{1,9}$/;function K1(e){return e.split("/").filter(Boolean).slice(1).join("/")}function F5(e,t=""){const n=e.split("/").filter(Boolean);if(n.length===0)return{page:{kind:"home"}};if(n.length===1){const[o]=n;return o==="threads"?{page:{kind:"org",page:"threads"},threads:!0}:o==="chat"?{forward:"threads"}:o==="tasks"?{page:{kind:"org",page:"tasks"},tasks:!0}:o==="issues"?{page:{kind:"home"},issues:!0}:o==="chart"?{page:{kind:"org",page:"chart"},chart:!0}:o==="worktrees"?{page:{kind:"org",page:"worktrees"},worktrees:!0}:o==="workspaces"?{page:{kind:"org",page:"workspaces"},workspaces:!0}:o==="queues"?{page:{kind:"org",page:"queues"},queues:!0}:o==="releases"?{page:{kind:"home"},releasesForward:!0}:{page:{kind:"not_found"}}}const[a,r,l,i]=n;if(a==="org"&&l==="tasks"&&i==="queues"&&n.length===4)return{forward:`org/${r}/queues${t}`};if(a==="org"&&l==="chat"&&n.length<=4)return{forward:`org/${r}/threads${i===void 0?"":`#thread-${i}`}`};if(a==="org"&&l==="tasks"&&n.length===4){const o=decodeURIComponent(i);return{page:{kind:"org",page:"tasks",item:o},org:decodeURIComponent(r),task:o}}if(a==="org"&&l==="issues"&&n.length<=4){const o=decodeURIComponent(r);return i===void 0?{page:{kind:"home"},org:o,issues:!0}:{page:{kind:"home"},org:o,issues:!0,issue:decodeURIComponent(i)}}if(a==="proj"&&l==="issues"&&n.length<=4){const o=decodeURIComponent(r),c={kind:"project",project:o,page:"issues"};if(i===void 0)return{page:c,issues:!0,project:o};const d=decodeURIComponent(i),f=new URLSearchParams(t);f.delete("from");const h=f.toString();return{page:{...c,item:d,...h?{list_query:h}:{}},issues:!0,project:o,issue:d}}if(a==="org"&&n.length<=3){const o=decodeURIComponent(r);if(l===void 0)return{page:{kind:"home"},org:o};if(l==="threads")return{page:{kind:"org",page:"threads"},org:o,threads:!0};if(l==="tasks")return{page:{kind:"org",page:"tasks"},org:o,tasks:!0};if(l==="chart")return{page:{kind:"org",page:"chart"},org:o,chart:!0};if(l==="worktrees")return{page:{kind:"org",page:"worktrees"},org:o,worktrees:!0};if(l==="workspaces")return{page:{kind:"org",page:"workspaces"},org:o,workspaces:!0};if(l==="queues")return{page:{kind:"org",page:"queues"},org:o,queues:!0};if(l==="releases")return{page:{kind:"home"},org:o,releasesForward:!0}}if(a==="proj"&&n.length<=3){const o=decodeURIComponent(r);if(l===void 0)return{page:{kind:"project",project:o}};if(l==="tasks")return{page:{kind:"project",project:o,page:"tasks"},tasks:!0};if(l==="releases")return{page:{kind:"project",project:o,page:"releases"},releases:!0}}return{page:{kind:"not_found"}}}const K5={label:"Local viewer",can:()=>!1},X5={connecting:"Connecting…",live:"Live · refreshes every 10s",disconnected:"Disconnected"},zy=()=>s.jsx($1,{title:"Page not found",children:"There is no page at this address in this viewer."});function Q5({routeOrg:e}){const{org:t,engine:n}=On(),{project:a}=Fo(),[r,l]=u.useState("connecting");return n===null?s.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.jsx(la,{page:"Threads"})}):s.jsxs("div",{className:"main viewer-panel",children:[s.jsxs("p",{className:"connection",role:"status",children:[s.jsx("span",{className:`dot ${r}`,"aria-hidden":"true"}),X5[r]]}),s.jsx(B5,{onConnection:l,org:(t==null?void 0:t.slug)??e??null,project:a})]})}const Ka=()=>s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"});function W5({route:e,navigate:t}){var f;const{org:n,projects:a,loading:r,none:l}=On(),i=e.page.kind==="project"?e.page.project:null,o=i!==null&&a!==null&&!((f=a.find(h=>h.id===i))!=null&&f.current),c=e.org===void 0&&!o&&!r&&n!==null?`org/${encodeURIComponent(n.slug)}/tasks`:null;if(u.useEffect(()=>{c&&t(c)},[c,t]),i!==null&&o)return s.jsx(po,{project:i});if(c||e.org===void 0&&r)return s.jsx(Ka,{});const d=(n==null?void 0:n.slug)??e.org;return d===void 0&&i!==null?s.jsx(po,{project:i}):d===void 0&&l?s.jsx(ei,{}):d===void 0?s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Tasks open once the organization reads."}):s.jsx(jD,{org:d})}function Z5({route:e,navigate:t}){const{org:n,loading:a,none:r}=On(),l=e.org===void 0&&!a&&n!==null?`org/${encodeURIComponent(n.slug)}/queues${window.location.search}`:null;if(u.useEffect(()=>{l&&t(l)},[l,t]),l||e.org===void 0&&a)return s.jsx(Ka,{});const i=(n==null?void 0:n.slug)??e.org;if(i===void 0&&r)return s.jsx(ei,{});if(i===void 0)return s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Queues open once the organization reads."});const o=new URLSearchParams(window.location.search).get("queue");return s.jsx(t3,{org:i,open:o,path:`/org/${encodeURIComponent(i)}/queues`})}function J5({route:e,navigate:t}){var b;const{org:n,projects:a}=On(),{project:r,settled:l}=Fo(),i=e.project??null,o=i!==null&&a!==null&&!((b=a.find(v=>v.id===i))!=null&&b.current),c=window.location.search,d=i===null&&r!==null?`proj/${encodeURIComponent(r)}/issues${e.issue?`/${encodeURIComponent(e.issue)}`:""}${c}`:null;u.useEffect(()=>{d&&t(d)},[d,t]);const[f,h]=u.useState(()=>window.location.search.replace(/^\?/,"")),m=u.useCallback(v=>{window.history.replaceState(window.history.state,"",`${window.location.pathname}${v?`?${v}`:""}`),h(v)},[]);if(i!==null&&o)return s.jsx(po,{project:i});if(d||i===null&&!l)return s.jsx(Ka,{});if(i===null)return s.jsx(ei,{});const x=encodeURIComponent((n==null?void 0:n.slug)??e.org??"");if(e.issue!==void 0){const v=new URLSearchParams(f).get("from");return s.jsx(qz,{org:x,project:i,issue_id:e.issue,from:v,query:f})}return s.jsx(Ez,{org:x,project:i,query:f,onQuery:m})}function e8({issue:e,navigate:t,home:n}){const{project:a,settled:r}=Fo(),l=a!==null?`proj/${encodeURIComponent(a)}/issues/${encodeURIComponent(e)}`:null;return u.useEffect(()=>{l&&t(l)},[l,t]),l||!r?s.jsx(Ka,{}):n}function Fo(){var l;const{projects:e,loading:t,none:n,failure:a}=On();return{project:((l=e==null?void 0:e.find(i=>i.current))==null?void 0:l.id)??null,settled:!t&&(e!==null||n!==null||!!(a!=null&&a.shown))}}function t8({navigate:e}){const{project:t,settled:n}=Fo(),a=t!==null?`proj/${encodeURIComponent(t)}/releases${window.location.search}`:null;return u.useEffect(()=>{a&&e(a)},[a,e]),a||!n?s.jsx(Ka,{}):s.jsx(ei,{})}function Ly(e){const t=new URLSearchParams(e);return{release:t.get("release"),planned:t.has("planned")?t.get("planned")??"":null}}function n8({route:e}){var f;const{org:t,projects:n,loading:a}=On(),r=e.page.kind==="project"?e.page.project:"",[l,i]=u.useState(()=>Ly(window.location.search));if(a)return s.jsx(Ka,{});if(n!==null&&!((f=n.find(h=>h.id===r))!=null&&f.current))return s.jsx(po,{project:r});const c=`/proj/${encodeURIComponent(r)}/releases`,d=h=>{const m=new URLSearchParams;h!=null&&h.startsWith("planned:")?m.set("planned",h.slice(8)):h&&m.set("release",h);const x=m.size>0?`?${m.toString()}`:"";window.history.replaceState(window.history.state,"",`${window.location.pathname}${x}`),i(Ly(x))};return s.jsx(o6,{org:(t==null?void 0:t.slug)??"",query:l,onSelect:d,home:c})}function s8({hash:e,navigate:t,home:n}){const{project:a,settled:r}=Fo(),l=F1.exec(e),i=l!=null&&l[2]?Vu(l[2]):null,o=l!=null&&l[3]?Vu(l[3]):null,c=i!==null?`?release=${encodeURIComponent(i)}`:e.startsWith("#planned")?`?planned${o!==null?`=${encodeURIComponent(o)}`:""}`:"",d=a!==null?`proj/${encodeURIComponent(a)}/releases${c}`:null;return u.useEffect(()=>{d&&t(d)},[d,t]),d||!r?s.jsx(Ka,{}):n}function lh({route:e,navigate:t}){const{org:n}=On();let a=e.page;const r=e.org!==void 0&&n!==null&&e.org!==n.slug;r&&(a={kind:"not_found"});let l;if(r)l=s.jsx(zy,{});else if("threads"in e)l=s.jsx(Q5,{routeOrg:e.org});else if("task"in e){const i=new URLSearchParams(window.location.search).get("from");l=s.jsx(WD,{org:encodeURIComponent(e.org),task_id:e.task,from:i})}else"tasks"in e?l=s.jsx(W5,{route:e,navigate:t}):"issues"in e?l=s.jsx(J5,{route:e,navigate:t}):"chart"in e?l=s.jsx(z3,{}):"worktrees"in e?l=s.jsx(n5,{org:(n==null?void 0:n.slug)??e.org}):"workspaces"in e?l=s.jsx(D6,{org:(n==null?void 0:n.slug)??e.org}):"queues"in e?l=s.jsx(Z5,{route:e,navigate:t}):"releasesForward"in e?l=s.jsx(t8,{navigate:t}):"releases"in e?l=s.jsx(n8,{route:e}):a.kind==="home"?l=s.jsx(ei,{}):a.kind==="project"?l=s.jsx(po,{project:a.project}):l=s.jsx(zy,{});return s.jsx(p6,{page:a,children:l})}function a8({task:e,navigate:t,home:n}){const{org:a,loading:r,none:l,failure:i}=On(),o=a!==null?`org/${encodeURIComponent(a.slug)}/tasks/${encodeURIComponent(e)}`:null,c=!r&&(l!==null||!!(i!=null&&i.shown));return u.useEffect(()=>{o&&t(o)},[o,t]),o||!c?s.jsx(Ka,{}):n}const r8=e=>window.location.replace(e);function Vu(e){try{return decodeURIComponent(e)}catch{return null}}function l8({navigate:e=r8,data:t}){const n=F5(K1(window.location.pathname),window.location.search),[a,r]=u.useState(null),{notify:l,toasts:i}=q5(),o=G5.exec(window.location.hash),c=o?Vu(o[1]):null,d=V5.exec(window.location.hash),f=d?Vu(d[1]):null,h=f!==null&&Y5.test(f)?f:null,m=F1.test(window.location.hash)?window.location.hash:null,x=o!==null&&c===null||d!==null&&h===null,b="forward"in n?n.forward:null;u.useEffect(()=>{b&&e(b)},[b,e]);const v=u.useMemo(()=>{if(t)return t;const g=o5();return{probe:{source:async()=>({label:"Local workspace"})},shell:g,issues:g.issues,tasks:d5(),org:u5(),worktrees:h5(),workspaces:m5(),queues:c5(),releases:f5()}},[t]);if(b||"forward"in n||!v.shell)return null;const y=s.jsx(lh,{route:{page:{kind:"home"}},navigate:e});return s.jsx("div",{className:"app-ui dark",ref:r,children:s.jsxs(uM,{container:a,children:[s.jsx(Lw,{data:v,router:D1,identity:K5,notify:l,children:s.jsx(ZT,{shell:v.shell,children:x?s.jsx(lh,{route:{page:{kind:"not_found"}},navigate:e}):c!==null?s.jsx(a8,{task:c,navigate:e,home:y}):h!==null?s.jsx(e8,{issue:h,navigate:e,home:y}):m!==null?s.jsx(s8,{hash:m,navigate:e,home:y}):s.jsx(lh,{route:n,navigate:e})})}),i]})})}eR.createRoot(document.getElementById("root")).render(s.jsx(u.StrictMode,{children:K1(window.location.pathname)==="app-ui-probe"?s.jsx(C6,{}):s.jsx(l8,{})}));
|
|
394
|
+
Its session could not be read: ${E.merge.caveat}. A turn it does not start passes on.`:"";await g({title:`Send ${E.name} to the main queue`,description:`This joins the main promotion queue for its thread, ${Q}, which ${te} and is told of the join. The queue checks the branch first, and ${ce}. Nothing reaches main before then.${X}`,action_label:"Join the main queue"})&&await M("merge",E)},T=async E=>{const I=S(E);await g({title:`Remove ${E.name}?`,description:`This deletes the folder ${E.path}${I!==void 0?` and frees about ${Kc(I)}`:""}.${E.branch?` Its branch ${E.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 ${E.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})&&(I!==void 0&&(y.current[E.path]=I),await M("remove",E))},k=async E=>{await t.dismiss(E),await w()};return(r==null?void 0:r.reason)==="engine_missing"?s.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.jsx(la,{page:"Worktrees"})}):s.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:[s.jsx(en,{title:"Worktrees",description:P}),!n&&!r&&s.jsx(a5,{}),r?s.jsx(r5,{refusal:r,read_at:n==null?void 0:n.read_at,on_retry:()=>void w()}):null,n!=null&&n.stale?s.jsxs(he,{variant:"destructive",className:"mt-4",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not read worktrees"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[n.stale.message," This list was read at ",cs(new Date(n.read_at).toISOString()),"."]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void w(),children:"Retry"})]})]}):null,n==null?void 0:n.removals.map(E=>s.jsxs(he,{variant:"success",className:"mt-4",role:"status",children:[s.jsx(ye,{children:y.current[E.path]!==void 0?`Removed ${E.name} and freed ${Kc(y.current[E.path])}`:`Removed ${E.name}`}),s.jsxs(xe,{children:[s.jsx("p",{children:E.branch?`Its branch ${E.branch} stays, and its records were saved.`:"Its records were saved."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void k({removal:E.path}),children:"Dismiss"})]})]},E.path)),n&&_.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(P0,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Only the main checkout"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"No other worktrees. Agents make theirs in .sdlc-worktrees beside the main checkout."})]}):n?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[s.jsx(bt,{type:"search",className:"w-64","aria-label":"Search worktrees",placeholder:"Search worktrees",value:m,onChange:E=>x(E.target.value)}),s.jsxs("p",{className:"text-muted-foreground ml-auto text-xs",children:["Read at ",cs(new Date(n.read_at).toISOString())," · rereads every 30 s"]})]}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Worktree state",children:th.map(E=>s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:hl,"aria-pressed":f===E.id,onClick:()=>h(E.id),children:[E.label," ",_.filter(I=>nh(I,E.id)).length]},E.id))}),A.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(pd,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No worktrees match"}),F?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(O=th.find(E=>E.id===f))==null?void 0:O.empty," matches “",m,"”. Clear the search to see all"," ",_.filter(E=>nh(E,f)).length,"."]}),s.jsx(V,{type:"button",variant:"outline",onClick:()=>x(""),children:"Clear search"})]}):s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(Y=th.find(E=>E.id===f))==null?void 0:Y.empty," right now."]})]}):s.jsx(ot,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(qe,{containerAriaLabel:"Worktrees",className:"table-fixed",children:[s.jsx(Ke,{children:s.jsxs(de,{children:[s.jsx(Z,{className:"w-[24%]",children:"Worktree"}),s.jsx(Z,{className:"w-[24%]",children:"Threads"}),s.jsx(Z,{className:"w-[12%]",children:"Landed"}),s.jsx(Z,{className:"w-[18%]",children:"Cleanup"}),s.jsx(Z,{className:"hidden w-[10%] md:table-cell",children:"Last commit"}),s.jsx(Z,{className:"w-[12%] text-right",children:"Actions"})]})}),s.jsx(Ge,{children:A.map(E=>s.jsx(l5,{org:e,row:E,size:S(E),sizes:i!==null?"read":c?"failed":"measuring",can_write:n.can_write,sent:b[E.path],on_merge:()=>void R(E),on_remove:()=>void T(E),on_dismiss:I=>void k(I),on_clear_sent:()=>v(({[E.path]:I,...Q})=>Q)},E.path))})]})})]}):null,p]})}function a5(){return s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading worktrees",children:Array.from({length:6},(e,t)=>s.jsx(jt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function r5({refusal:e,read_at:t,on_retry:n}){const a=ds();return e.reason==="view_outdated"?s.jsxs(he,{variant:"warning",className:"mt-6",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:Pl}),s.jsx(xe,{children:a})]}):s.jsxs(he,{variant:"destructive",className:"mt-6",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"Could not read worktrees"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[e.message,t?` This list was read at ${cs(new Date(t).toISOString())}.`:""]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function Sc({children:e,muted:t=!0}){return s.jsx("div",{className:ie("truncate text-xs",t&&"text-muted-foreground"),title:e,children:e})}function l5({org:e,row:t,size:n,sizes:a,can_write:r,sent:l,on_merge:i,on_remove:o,on_dismiss:c,on_clear_sent:d}){const{href:f,Link:h}=Xe(),m=e?`/org/${encodeURIComponent(e)}`:"",x=f(`${m}/threads`),b=f(`${m}/tasks`),v=pi[t.landed??"not_landed"],y=Gx(t),g=t.write,p=(g==null?void 0:g.state)==="waiting"||(g==null?void 0:g.state)==="running",j=t.threads.find(P=>"thread"in t.merge&&P.thread===t.merge.thread)??t.threads[0],w=t.merge,N=!w.offered&&w.why===qx,C=r&&t.landed===null&&!t.queue&&!N&&!Vx(t),_=n!==void 0?Kc(n):a==="measuring"?"Measuring size…":a==="failed"?"Size could not be read":null,S=y?{label:"Yours to decide",muted:!1,second:[_,t.cleanup_why[0]]}:t.archivable?{label:"The manager removes it",muted:!1,second:[_]}:{label:"Stays",muted:!0,second:[_,t.why[0]??null]},D=S.second.filter(Boolean).join(" · "),z=t.path.slice(0,t.path.length-t.name.length-1)||".";return s.jsxs(s.Fragment,{children:[s.jsxs(de,{"data-testid":"worktrees-row",children:[s.jsxs(K,{children:[s.jsx("div",{className:"truncate font-medium",title:t.name,children:t.name}),s.jsx(Sc,{children:t.branch??"Detached"}),z!==".sdlc-worktrees"?s.jsx(Sc,{children:`in ${z}`}):null]}),s.jsx(K,{children:j?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"truncate",title:j.title??j.thread,children:j.title??j.thread}),s.jsx(Sc,{children:`${t5(t,j)}${t.threads.length>1?` · ${t.threads.length-1} more`:""}`})]}):s.jsx("span",{className:"text-muted-foreground",children:"No thread"})}),s.jsx(K,{children:s.jsx(ue,{variant:v.tone,children:v.label})}),s.jsxs(K,{children:[s.jsx("div",{className:ie("truncate",S.muted&&"text-muted-foreground"),children:S.label}),D?s.jsx("div",{className:"hidden md:block",children:s.jsx(Sc,{children:D})}):null]}),s.jsx(K,{className:"hidden md:table-cell",children:e5(t.idle_days)}),s.jsx(K,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[p?s.jsx(V,{type:"button",variant:"outline",size:"sm",loading:!0,disabled:!0,children:(g==null?void 0:g.kind)==="merge"?g.state==="waiting"?"Waiting to join…":"Joining main…":(g==null?void 0:g.state)==="waiting"?"Waiting to remove…":"Removing…"}):t.queue?s.jsx(ue,{variant:pi.queued.tone,children:`${pi.queued.label} · ${I1(t.queue.position)}`}):N?s.jsx(h,{href:b,"aria-label":`${t.name}: its thread waits on you, in Waiting on you`,children:s.jsx(ue,{variant:pi.needs_you.tone,children:pi.needs_you.label})}):C?s.jsx(V,{type:"button",variant:"outline",size:"sm",title:w.offered?void 0:w.why,"aria-disabled":!w.offered||void 0,className:ie(!w.offered&&"cursor-not-allowed opacity-50"),"aria-label":`Send ${t.name} to the main queue`,"aria-describedby":w.offered?void 0:`why-${t.name}`,onClick:w.offered?i:void 0,children:"Merge"}):null,y&&r&&!p?s.jsx(V,{type:"button",variant:"outline",size:"sm","aria-label":`Remove ${t.name}`,onClick:o,children:"Remove"}):null]})})]}),s.jsx(i5,{row:t,threads:x,tasks:b,merge_shown:C,sent:l,on_dismiss:c,on_clear_sent:d})]})}function i5({row:e,threads:t,tasks:n,merge_shown:a,sent:r,on_dismiss:l,on_clear_sent:i}){var b,v,y,g;const{Link:o}=Xe(),c=(p="Open in Threads")=>s.jsx(o,{className:"text-primary text-sm hover:underline",href:t,children:p}),d=p=>s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:p,children:"Dismiss"}),f=e.write,h=e.threads.find(p=>p.thread===("thread"in e.merge?e.merge.thread:void 0))??e.threads[0],m=(h==null?void 0:h.title)??"Its thread";let x=null;if(r)x=s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:"It was not sent"}),s.jsxs(xe,{children:[s.jsx("p",{children:r}),d(i)]})]});else if((f==null?void 0:f.state)==="waiting")x=s.jsxs("p",{className:"text-muted-foreground text-sm",role:"status",children:["Another worktree's write runs first; ",e.name," ",f.kind==="merge"?"joins":"is removed"," next."]});else if((f==null?void 0:f.state)==="running")x=s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:f.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((f==null?void 0:f.state)==="joined"){const p=((b=f.lands)==null?void 0:b.by)==="manager"?`the merge manager, ${f.lands.manager}, lands it`:"it lands it on its turn";x=s.jsxs(he,{variant:f.told?"success":"warning",role:"status",children:[s.jsx(ye,{children:`${e.name} joined the main queue, ${I1(f.position)}`}),s.jsxs(xe,{children:[s.jsx("p",{children:f.told?`${m} was left a notice, and ${p}.`:"Its thread could not be told, so it does not know its turn is coming. Tell it from Threads; the join itself is unchanged."}),((v=e.queue)==null?void 0:v.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?s.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 ${sh(e.queue.passes_at)}.`}):null,s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({write:e.path})),!f.told||((y=e.queue)==null?void 0:y.position)===1?s.jsx("span",{className:"mt-2",children:c()}):null]})]})]})}else if(f&&(f.state==="refused"||f.state==="failed")){const p=f.kind==="merge"?`The main queue refused ${e.name}`:`${e.name} was not removed`;x=s.jsxs(he,{variant:"destructive",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:f.kind==="merge"&&f.state==="failed"?`${e.name} did not join`:p}),s.jsxs(xe,{children:[s.jsx("p",{children:`${ki(f.message)}${f.kind==="merge"?" Nothing was queued.":" Nothing was deleted."}`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({write:e.path})),f.kind==="merge"?s.jsx("span",{className:"mt-2",children:c()}):null]})]})]})}else if(e.last_turn){const p=e.last_turn;x=s.jsxs(he,{variant:"warning",children:[s.jsx(et,{className:"size-4","aria-hidden":"true"}),s.jsx(ye,{children:`${e.name}'s turn ${p.outcome==="failed"?"failed":"passed on"} at ${sh(p.left_at)}`}),s.jsxs(xe,{children:[s.jsx("p",{children:`${ki(p.reason)}. Continue the thread in its session; Merge sends it again once it is at rest.`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({turn:{execution:p.execution,left_at:p.left_at}})),s.jsx("span",{className:"mt-2",children:c()})]})]})]})}else((g=e.queue)==null?void 0:g.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?x=s.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 ${sh(e.queue.passes_at)}. `,c()]}):!e.merge.offered&&e.merge.why===qx?x=s.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:["Its thread waits on you. Merge comes back once you answer it. ",s.jsx(o,{className:"text-primary hover:underline",href:n,children:"In Waiting on you"})]}):!e.merge.offered&&e.merge.successor&&!e.queue&&e.landed===null?x=s.jsx("p",{className:"text-sm",children:c("Open its successor in Threads")}):a&&!e.merge.offered?x=s.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:[`${ki(e.merge.why)}. `,e.merge.thread&&!e.merge.why.startsWith("its thread is at work")?c():null]}):e.merge.offered&&e.merge.caveat&&(x=s.jsx("p",{className:"text-muted-foreground text-sm",children:`${ki(e.merge.caveat)}.`}));return x?s.jsx(de,{className:"hover:bg-transparent",children:s.jsx(K,{colSpan:6,className:"pt-0",children:x})}):null}const o5=["reason","since","store","repository","folder","home","member_path"];function P1(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 a of o5){const r=t==null?void 0:t[a];typeof r=="string"&&(n[a]=r)}return n}function Rr({base:e="",fetcher:t=fetch}){return async(n,a={})=>{const r=new URLSearchParams;for(const[c,d]of Object.entries(a))if(Array.isArray(d))for(const f of d)r.append(c,f);else d!==void 0&&d!==!1&&d!==""&&r.set(c,String(d));const l=r.size>0?`?${r.toString()}`:"";let i;try{i=await t(`${e}api/app/${n}${l}`,{cache:"no-store"})}catch{return{ok:!1,refusal:{status:0,message:"The viewer did not answer. Is sdlc viewer still running?"}}}const o=await i.json().catch(()=>null);return i.ok?{ok:!0,data:o}:{ok:!1,refusal:P1(i.status,o)}}}function c5(e={}){const t=Rr(e),n=r=>async()=>{const l=await t("access");return l.ok?{ok:!0,data:l.data[r]}:l},a=encodeURIComponent;return{tasks:{access:n("tasks"),configuration:()=>t("tasks/configuration"),listTasks:r=>t(`tasks/lists/${a(r)}/tasks`),task:r=>t(`tasks/tasks/${a(r)}`)},issues:{access:n("issues"),list:(r={})=>t("issues",r),issue:r=>t(`issues/${a(r)}`),issueSections:r=>t(`issues/${a(r)}/sections`),issueRelated:r=>t(`issues/${a(r)}/related`)},releases:{access:n("releases"),list:()=>t("releases"),release:r=>t(`releases/${a(r)}`),candidate:()=>t("releases/candidate")},organizations:{access:n("organizations"),list:()=>t("orgs")},projects:{access:n("projects"),list:()=>t("projects")},about:{about:()=>t("about")}}}function u5(e={}){const t=Rr(e);return{listQueues:()=>t("queues"),queue:n=>t(`queues/${encodeURIComponent(n)}`),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 Si=e=>({ok:!1,refusal:{status:0,message:e}});function Yx({base:e="",fetcher:t=fetch}){return async(n,a)=>{let r;try{r=await t(`${e}api/${n}`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch{return Si("The viewer did not answer. Is sdlc viewer still running?")}const l=await r.json().catch(()=>null);return r.ok?{ok:!0,data:l}:{ok:!1,refusal:P1(r.status,l)}}}function d5(e={}){const t=Rr(e),n=Yx(e);return{chart:()=>t("org"),change:a=>n("org-change",a)}}function f5(e={}){const t=Rr(e),n=o=>`tasks/tasks/${encodeURIComponent(o)}`,{base:a="",fetcher:r=fetch}=e;return{access:async()=>{const o=await t("access");return o.ok?{ok:!0,data:o.data.tasks}:o},availability:async()=>{const o=await t("tasks/configuration");if(!o.ok)return o.refusal.reason==="engine_missing"?{state:"off",refusal:o.refusal}:{state:"error",refusal:o.refusal};const c=o.data;if(c.state!=="active")return{state:"available"};const d=c.workspaces.find(h=>h.is_default)??c.workspaces[0],f=d==null?void 0:d.lists[0];return!d||!f?{state:"error"}:{state:"active",configuration:c,workspace:d,list:f}},listTasks:(o,c={})=>{var d,f,h;return c.state==="archived"?Promise.resolve(Si("This checkout keeps no archived tasks.")):c.assigned_to_me?Promise.resolve(Si("Assigned to you is a status group here.")):t(`tasks/lists/${encodeURIComponent(o)}/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:(f=c.closed_groups)!=null&&f.length?c.closed_groups.join(","):void 0,all:(h=c.all_groups)!=null&&h.length?c.all_groups.join(","):void 0})},members:()=>t("tasks/members"),waitingOnYou:()=>t("tasks/waiting-on-you"),task:o=>t(n(o)),taskSections:o=>t(`${n(o)}/sections`),taskRelated:o=>t(`${n(o)}/related`),hierarchyRevision:async()=>({ok:!0,data:0}),commands:{run:async()=>Si("The local viewer changes tasks only with Done."),complete:async o=>{const c="task"in o?{task:o.task}:{hold:o.hold};let d;try{d=await r(`${a}api/task-done`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})}catch{return Si("The viewer did not answer. Is sdlc viewer still running?")}if(d.ok)return{ok:!0,data:null};const f=await d.text().catch(()=>"");return{ok:!1,refusal:{status:d.status,message:f||`It was not recorded (HTTP ${d.status}).`}}}}}}function h5(e={}){const t=Rr(e),n=Yx(e),a=encodeURIComponent,r=l=>l!=null&&l.fresh?{fresh:1}:{};return{access:async()=>{const l=await t("access");return l.ok?{ok:!0,data:l.data.releases}:l},list:(l={})=>t("releases",r(l)),release:(l,i)=>t(`releases/${a(l)}`,r(i)),candidate:l=>t("releases/candidate",r(l)),candidateBatch:l=>t("releases/candidate/batch",r(l)),related:(l,i)=>t(`releases/${a(l)}/related`,r(i)),plannedRelease:(l,i)=>t(`releases/planned/${a(l)}`,r(i)),roadmap:l=>t("releases/roadmap",{...r(l),...l!=null&&l.mine?{mine:1}:{}}),roadmapMoved:l=>t("releases/roadmap/moved",r(l)),roadmapSeen:l=>n("roadmap/seen",{at:l})}}function m5(e={}){const t=Rr(e),n=Yx(e);return{list:()=>t("worktrees"),sizes:()=>t("worktree-sizes"),merge:a=>n("worktree-merge",{path:a}),remove:a=>n("worktree-remove",{path:a}),dismiss:a=>n("worktree-dismiss",a)}}function p5(e={}){const t=Rr(e);return{overview:()=>t("workspaces")}}const q1=[["stage","Stage"],["blocker","Blocker"],["recent","Recent"]],x5=10,G1="Threads you pinned; they stay first in every order";function Em(e,t,n){var F,H;const{order:a,folded:r,showAll:l,narrowed:i,max:o=x5}=n,c=new Map(e.map(A=>[A.key,A])),d=A=>A.pinned===!0,f=A=>{var R;if(d(A)||!A.blockedBy||!c.has(A.blockedBy))return!1;const M=new Set([A.key]);for(let T=A.blockedBy;T&&c.has(T);T=(R=c.get(T))==null?void 0:R.blockedBy){if(M.has(T))return!1;M.add(T)}return!0},h=new Map;for(const A of e){if(!f(A))continue;const M=h.get(A.blockedBy)??[];M.push(A),h.set(A.blockedBy,M)}const m=A=>h.get(A.key)??[],x=A=>Math.max(A.mtimeMs??0,...m(A).map(x)),b=A=>!!A.needsYou||m(A).some(b),v=A=>A.activeSince!==void 0,y=(A,M)=>v(A)!==v(M)?v(A)?-1:1:b(A)!==b(M)?b(A)?-1:1:v(A)?A.activeSince-M.activeSince||A.key.localeCompare(M.key):x(M)-x(A),g=(A,M)=>Number(v(M))-Number(v(A))||(v(A)?M.activeSince-A.activeSince:(M.mtimeMs??0)-(A.mtimeMs??0))||A.key.localeCompare(M.key),p=l||i,j=!i,w=(A,M=0)=>a==="blocker"?[{row:A,depth:M},...m(A).flatMap(R=>w(R,M+1))]:[{row:A,depth:0}],N=A=>a==="blocker"?1+m(A).reduce((M,R)=>M+N(R),0):1,C=A=>A.reduce((M,R)=>M+N(R),0),_=(A,M,R,T,k,O)=>{const Y=!k||!r.has(A);return{key:A,label:M,...O?{hint:O}:{},count:T,folds:k,open:Y,rows:Y?R.flatMap(E=>w(E)):[]}},S=e.filter(d),D=e.filter(A=>!d(A)),z=[];S.length&&z.push(_("pinned","Pinned",S,C(S),j,G1));let P=null;if(a==="stage"){const A=new Set(t.map(([T])=>T)),M=new Map(t.map(([T])=>[T,[]]));for(const T of D)(F=M.get(T.stage&&A.has(T.stage)?T.stage:"none"))==null||F.push(T);for(const[T,k,O]of t){const Y=(M.get(T)??[]).sort(y);if(!Y.length)continue;const E=T==="none"&&!p?Y.slice(0,o):Y;z.push({..._(T,k,E,Y.length,j&&T!=="none",O),count:Y.length})}const R=((H=M.get("none"))==null?void 0:H.length)??0;!i&&R>o&&(P={total:R,unstaged:!0})}else{const A=a==="recent"?[...D].sort(g):D.filter(M=>!f(M)).sort(y);if(A.length){const M=p?A:A.slice(0,o),R=_("others",S.length?"Other threads":null,M,C(A),!!S.length&&j);z.push(R),!i&&R.open&&A.length>o&&(P={total:A.length,unstaged:!1})}}return{groups:z,more:P}}function g5(e,t,n,a){const l=Em(e,t,{...n,folded:new Set,showAll:!0}).groups.find(c=>c.rows.some(d=>d.row.key===a));if(!l)return null;const o=!Em(e,t,{...n,folded:new Set}).groups.some(c=>c.rows.some(d=>d.row.key===a));return{group:l.key,capped:o}}const v5=15e3,y5=10,_y="idle-sessions-list",Ny="idle-sessions-heading",ky="idle-sessions-confirm-text";function V1(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const j5=e=>`${Number.isInteger(e)?e:e.toFixed(1)} h`,Y1=e=>e===1?"1 session":`${e} sessions`;function b5(e){const t=e.released.length?`Closed ${Y1(e.released.length)}.`:"Closed no sessions.";return e.kept.length?`${t} Kept ${e.kept.length}:`:t}function w5({row:e}){const t=[e.name,e.retired?"continued in another session":"",`idle ${j5(e.idle_hours)}`,V1(e.memory_mb)].filter(Boolean).join(" · ");return s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:e.title}),s.jsxs("p",{className:"caption",children:[s.jsxs("span",{className:"muted",children:[t,e.unfinished&&" ·"]}),e.unfinished&&s.jsx("span",{className:"idle-unfinished",children:" unfinished work"})]})]})}function _5(){const[e,t]=u.useState(null),[n,a]=u.useState(!1),[r,l]=u.useState(!1),[i,o]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(""),m=u.useRef(""),x=u.useRef(null),b=u.useRef(null),v=u.useRef(null),y=u.useRef(null),g=u.useRef(0),p=u.useRef(0),j=u.useCallback(async()=>{const H=++g.current,A=await w6();if(!A||H<p.current)return;p.current=H,h("");const M=JSON.stringify(A);M!==m.current&&(m.current=M,t(A))},[]);u.useEffect(()=>{const H=setTimeout(j,0),A=setInterval(j,v5);return()=>{clearTimeout(H),clearInterval(A)}},[j]),u.useEffect(()=>{var A;const H=y.current;H&&(y.current=null,(A={cancel:b,close:x,dismiss:v}[H].current)==null||A.focus())});const w=(e==null?void 0:e.sessions.length)??0;if(u.useEffect(()=>{r&&!w&&i===null&&l(!1)},[r,w,i]),!w&&!c&&!f&&i===null)return null;const N=()=>{i===null&&(l(!0),y.current="cancel")},C=()=>{i===null&&(l(!1),y.current="close")},_=async()=>{if(i!==null)return;o(w),d(null),h("");const H=await _6();p.current=g.current+1,await j(),o(null),l(!1),a(!1),"error"in H?(h(`The sessions were not closed: ${H.error.replace(/\.+$/,"")}.`),y.current="close"):(d(H.done),y.current="dismiss")},S=()=>{d(null),y.current="close"},D=H=>{H.key==="Escape"&&(H.preventDefault(),C())},z=i!==null?`Closing ${Y1(i)}…`:c?b5(c):"",P=(e==null?void 0:e.sessions.slice(0,y5))??[],F=w-P.length;return s.jsxs("div",{className:"idle",role:"group",...w?{"aria-labelledby":Ny}:{"aria-label":"Idle sessions"},children:[f&&s.jsx("div",{className:"alert",role:"alert",children:f}),w>0&&e&&s.jsxs("div",{className:"idle-head",children:[s.jsxs("div",{className:"idle-title",children:[s.jsxs("h2",{className:"group",id:Ny,"aria-label":`Idle sessions, ${w}`,children:["Idle sessions",s.jsx("span",{className:"count",children:w})]}),s.jsxs("p",{className:"caption muted",children:["over ",e.idle_over," h · ",V1(e.memory_mb)]})]}),s.jsxs("div",{className:"tools",children:[s.jsx("button",{type:"button",className:"pin","aria-expanded":n,"aria-controls":_y,"aria-label":n?"Hide the idle sessions list":"Show the idle sessions list",onClick:()=>a(H=>!H),children:n?"Hide":"Show"}),s.jsx("button",{type:"button",className:"pin",ref:x,"aria-expanded":r,"aria-label":"Close idle sessions…",onClick:N,children:"Close idle…"})]})]}),w>0&&s.jsxs("ul",{className:"idle-list",id:_y,hidden:!n,"aria-label":`Sessions idle over ${e==null?void 0:e.idle_over} hours, longest idle first`,children:[P.map(H=>s.jsx(w5,{row:H},H.session)),F>0&&s.jsx("li",{children:s.jsxs("p",{className:"caption muted",children:["…and ",F," more"]})})]}),r&&w>0&&s.jsxs("div",{className:"idle-confirm",role:"group","aria-label":"Close idle sessions","aria-describedby":ky,onKeyDown:D,children:[s.jsxs("p",{id:ky,children:[w===1?"Close this session?":`Close these ${w} 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."]}),s.jsxs("div",{className:"tools start",children:[s.jsx("button",{type:"button",className:"pin","aria-disabled":i!==null?!0:void 0,"aria-busy":i!==null?!0:void 0,onClick:_,children:i!==null?`Closing ${i}…`:`Close ${w}`}),s.jsx("button",{type:"button",className:"pin",ref:b,"aria-disabled":i!==null?!0:void 0,onClick:C,children:"Cancel"})]})]}),s.jsx("p",{className:"idle-status",role:"status",children:z}),c&&s.jsxs(s.Fragment,{children:[c.kept.length>0&&s.jsx("ul",{className:"idle-list","aria-label":"Kept sessions",children:c.kept.map(H=>s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:H.title}),s.jsx("p",{className:"caption muted",children:H.why})]},H.session))}),s.jsx("div",{className:"tools start",children:s.jsx("button",{type:"button",className:"pin",ref:v,"aria-label":"Dismiss the close result",onClick:S,children:"Dismiss"})})]})]})}const Sy={ok:"lime",you:"amber",alert:"red",waiting:"blue",blocked:"purple",muted:"grey",plain:"grey"};function ti(e){return e&&Object.hasOwn(Sy,e)?Sy[e]:"grey"}const N5=1e4,k5=6e4,S5=2,ah="#thread-",C5=["pin","details-toggle"],R5=F0("Threads"),T5={working:"▶",prod:"↑",planned:"○"},Cy=3,Ry=["working","ready","prod","waiting","blocked","paused","planned"],E5={ready:"results ready",prod:"ready for prod"};function A5(e){const t=Ry.map(a=>[a,e.filter(r=>r.state===a).length]),n=[...new Set(e.map(a=>a.state).filter(a=>!Ry.includes(a)))].map(a=>[a,e.filter(r=>r.state===a).length]);return[...t,...n].filter(([,a])=>a>0).map(([a,r])=>`${r} ${E5[a]??a}`).join(" · ")}const M5={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 $5(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 Am=[["running","Running"],["you","Needs you"],["blocked","Blocked"],["paused","Paused"],["idle","Idle"]],Mm=[["claude","Claude"],["codex","Codex"]],Ty={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"},Ey=e=>e.kind??"idle",Ay=e=>e.agent==="Codex"?"codex":"claude";function My(e,t,n,a){const r=n.toLowerCase().split(/\s+/).filter(Boolean),l=Am.map(([v])=>v).filter(v=>a.has(v)),i=Mm.map(([v])=>v).filter(v=>a.has(v)),o=v=>!l.length||l.includes(Ey(v)),c=v=>!i.length||i.includes(Ay(v)),d=v=>{if(!r.length)return!0;const y=v.search??v.title.toLowerCase();return r.every(g=>y.includes(g))},f=e.filter(d),h={};for(const[v]of Am)h[v]=f.filter(y=>c(y)&&Ey(y)===v).length;for(const[v]of Mm)h[v]=f.filter(y=>o(y)&&Ay(y)===v).length;const m=[],x=[],b=[];return e.forEach((v,y)=>{b.length=Math.min(b.length,v.depth);const g=v.depth>0?b[v.depth-1]??null:null,p=d(v)&&o(v)&&c(v);let j=null;p&&(j=g?{depth:g.depth+1,pinned:g.pinned}:{depth:0,pinned:y<t&&v.pinned!==!1},(j.pinned?m:x).push({row:v,depth:j.depth})),b.push(j)}),{rows:[...m,...x],pinned:m.length,counts:h,narrowed:r.length+l.length+i.length>0}}const F1="sdlc-viewer:threads-arrange",$y={order:"blocker",compact:!1,folded:[],showAll:!1,archived:!1};function O5(){try{const e=JSON.parse(window.localStorage.getItem(F1)??"{}");return{order:q1.some(([t])=>t===e.order)?e.order:$y.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 $y}}function D5(e){try{window.localStorage.setItem(F1,JSON.stringify(e))}catch{}}const z5=new Set(["not_terminal","another_process","continued","no_open","pending"]);function rh({label:e,count:t,hint:n,fold:a}){const r=n?`hint-${e.toLowerCase().replace(/\W+/g,"-")}`:void 0;return s.jsxs(s.Fragment,{children:[a?s.jsx("h2",{className:"group",children:s.jsxs("button",{type:"button",className:"group-fold","aria-expanded":a.open,"aria-label":`${e}, ${t}`,"aria-describedby":r,onClick:a.onToggle,children:[s.jsx("span",{className:"chevron","aria-hidden":"true",children:a.open?"▾":"▸"}),e,s.jsx("span",{className:"count",children:t})]})}):s.jsxs("h2",{className:"group","aria-label":`${e}, ${t}`,"aria-describedby":r,children:[e,s.jsx("span",{className:"count",children:t})]}),n&&s.jsx("span",{className:"sr-only",id:r,children:n})]})}function Cc({text:e,role:t}){return s.jsx("span",{className:`badge tone-${ti(t)}`,children:e})}function L5({serves:e}){const t=e.slice(0,S5),n=e.length-t.length;return s.jsxs("p",{className:"caption muted serves",children:[t.map((a,r)=>s.jsxs("span",{children:[r>0&&", ",s.jsxs("a",{href:`releases?planned=${encodeURIComponent(a.planned_release)}`,"aria-label":`serves ${a.name}, ${a.level}: open it in Planned releases`,children:["serves ",a.name," (",a.level,")"]})]},a.planned_release)),n>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{"aria-hidden":"true",children:[", +",n," more"]}),s.jsxs("span",{className:"sr-only",children:[", and ",n," more planned releases"]})]})]})}const U5=4;function Oy({track:e}){return s.jsxs("span",{className:"track",children:[s.jsx("span",{className:"track-dots","aria-hidden":"true",children:Array.from({length:U5},(t,n)=>s.jsx("span",{className:["track-dot",n<=e.reached?"reached":"",n===e.target?"target":""].filter(Boolean).join(" ")},n))}),e.label,e.detail&&s.jsxs("span",{className:"sr-only",children:[". ",e.detail]})]})}function B5({tags:e,track:t,brief:n=!1}){const a=t?Math.min(Math.max(t.at??e.length,0),e.length):-1,r=n?e.filter(i=>!i.full):e,l=t?a-(n?e.slice(0,a).filter(i=>i.full).length:0):-1;return s.jsxs(s.Fragment,{children:[r.map((i,o)=>s.jsxs(u.Fragment,{children:[o===l&&t&&s.jsxs(s.Fragment,{children:[" ",s.jsx(Oy,{track:t})]})," · ",s.jsxs("span",{className:`tag tone-${ti(i.role)}`,children:[i.text,i.detail&&s.jsxs("span",{className:"sr-only",children:[". ",i.detail]})]})]},`t${o}`)),l===r.length&&t&&s.jsxs(s.Fragment,{children:[" ",s.jsx(Oy,{track:t})]})]})}function Dy({id:e,href:t}){return t?s.jsx("a",{className:"id-link",href:t,children:e}):s.jsx("span",{className:"id-text",children:e})}function H5({onConnection:e,org:t=null,project:n=null}){const[a,r]=u.useState(null),[l,i]=u.useState(!1),[o,c]=u.useState(""),[d,f]=u.useState(!1),[h,m]=u.useState(null),[x,b]=u.useState(""),[v,y]=u.useState(null),[g,p]=u.useState(null),[j,w]=u.useState(null),[N,C]=u.useState(""),[_,S]=u.useState(()=>new Set),[D,z]=u.useState(null),[P,F]=u.useState(O5),H=$=>F(B=>{const W={...B,...$};return D5(W),W}),[A,M]=u.useState({groups:[],all:!1}),[R,T]=u.useState(()=>new Set),k=u.useRef(P.archived),O=u.useRef(0),Y=u.useRef(null),E=u.useRef(""),I=u.useRef(""),Q=u.useRef(""),te=u.useRef(null),ce=u.useRef(null),X=u.useRef(null),L=$=>{var W;if(!($ instanceof HTMLButtonElement)||!((W=te.current)!=null&&W.contains($))||!$.dataset.key)return null;const B=C5.find(ve=>$.classList.contains(ve));return B?`${B} ${$.dataset.key}`:null},q=$=>{X.current=L($.target)},ne=()=>{setTimeout(()=>{L(document.activeElement)||(X.current=null)},0)},ae=u.useCallback(async()=>{const $=++O.current,B=await D1(k.current);if($!==O.current)return;if("none"in B){i(!0),c(""),e("live");return}if("error"in B){c(B.error),e("disconnected");return}i(!1),c(""),b(""),e("live");const W=JSON.stringify(B.data);W!==E.current&&(E.current=W,r(B.data))},[e]);u.useEffect(()=>{let $=!0;b6().then(ve=>$&&f(ve));const B=setTimeout(ae,0),W=setInterval(ae,N5);return()=>{$=!1,clearTimeout(B),clearInterval(W)}},[ae]),u.useEffect(()=>{let $=!0;const B=()=>j6().then(ve=>{$&&ve&&y(Oe=>JSON.stringify(Oe)===JSON.stringify(ve)?Oe:ve)});B();const W=setInterval(B,k5);return()=>{$=!1,clearInterval(W)}},[]),u.useEffect(()=>{const $=()=>{var an,Xa,Tr;const W=window.location.hash;if(!W.startsWith(ah)){w(null);return}if(W===I.current)return;let ve;try{ve=decodeURIComponent(W.slice(ah.length))}catch{ve=W.slice(ah.length)}const Oe=document.getElementById(`thread-${ve}`);if(!Oe||!((an=te.current)!=null&&an.contains(Oe))){if(!te.current||!a)return;const ni=Q.current!==W;if(Q.current=W,a.threads.some(si=>si.key===ve)){const si=(N||_.size)&&!My(a.threads,a.pinnedCount??0,N,_).rows.some(ia=>ia.row.key===ve),xs=a.stages&&(ni||!si)?g5(a.threads,a.stages,{order:P.order,folded:new Set,showAll:!1,narrowed:!1},ve):null,zs=xs!==null&&P.folded.includes(xs.group)&&!A.groups.includes(xs.group),Er=xs!==null&&xs.capped&&!P.showAll&&!A.all;ni&&(N||_.size)&&(C(""),S(new Set)),ni&&(N||_.size)||zs||Er?(zs||Er)&&M(ia=>({groups:zs&&xs?[...ia.groups,xs.group]:ia.groups,all:ia.all||Er})):I.current=W,w(null);return}w(ve);return}I.current=W,w(null),p(ve),(Xa=Oe.querySelector(".thread-title"))==null||Xa.focus({preventScroll:!0}),(Tr=Oe.scrollIntoView)==null||Tr.call(Oe,{block:"center"})},B=()=>{I.current="",Q.current="",$()};return $(),window.addEventListener("hashchange",B),()=>window.removeEventListener("hashchange",B)},[a,N,_,P,A]),u.useEffect(()=>{if(!g)return;const $=()=>p(null);return document.addEventListener("pointerdown",$,!0),document.addEventListener("keydown",$,!0),()=>{document.removeEventListener("pointerdown",$,!0),document.removeEventListener("keydown",$,!0)}},[g]),u.useLayoutEffect(()=>{const $=X.current??(ce.current?`pin ${ce.current}`:null);if(!$||!te.current)return;const[B,W]=[$.slice(0,$.indexOf(" ")),$.slice($.indexOf(" ")+1)],ve=document.activeElement;if(ve&&ve!==document.body&&!te.current.contains(ve)){X.current=null;return}const Oe=[...te.current.querySelectorAll(`button.${B}`)].find(an=>an.dataset.key===W);Oe?ve!==Oe&&Oe.focus({preventScroll:W!==ce.current}):X.current=null});const je=async $=>{if(h)return;const B=!$.pinned;ce.current=$.key,m($.key);const W=await k6($.key,B);m(null),W||r(ve=>ve&&{...ve,threads:ve.threads.map(Oe=>Oe.key===$.key?{...Oe,pinned:B}:Oe)}),await ae(),b(W?`The pin was not saved: ${W}`:""),ce.current===$.key&&(ce.current=null)},[re,we]=u.useState(()=>new Set),[se,tt]=u.useState({}),ge=ds(),{confirm:He,confirm_dialog:J}=Bo(),ke=($,B)=>tt(W=>{const{[$]:ve,...Oe}=W;return B?{...Oe,[$]:B}:Oe}),Ue=($,B)=>we(W=>{const ve=new Set(W);return B?ve.add($):ve.delete($),ve}),ft=Object.keys(se).some($=>!re.has($));u.useEffect(()=>{if(!ft)return;const $=()=>tt(B=>Object.fromEntries(Object.entries(B).filter(([W])=>re.has(W))));return document.addEventListener("pointerdown",$,!0),document.addEventListener("click",$,!0),()=>{document.removeEventListener("pointerdown",$,!0),document.removeEventListener("click",$,!0)}},[ft,re]);const _e=$=>setTimeout(()=>{var B,W;return(W=[...((B=te.current)==null?void 0:B.querySelectorAll("button.open-thread"))??[]].find(ve=>ve.dataset.key===$))==null?void 0:W.focus()},0),Ht=async($,B)=>{const W=await He({title:`Reopen ${$.title} in Terminal?`,description:`Its session is closed. It opens in a new Terminal window in ${B??"the thread's folder"}, running claude --resume.`,action_label:"Reopen"});return _e($.key),W},wt=async $=>{if(re.has($.key))return;let B=!1;for(;;){Ue($.key,!0),ke($.key,{key:$.key,text:M5[$.where??""]??"Opening.",role:"waiting"});const W=await N6($.key,B);if(Ue($.key,!1),"done"in W){ke($.key,null);return}const{reason:ve,error:Oe,where:an}=W.refused;if(ve==="closed"&&!B){if(ke($.key,null),!await Ht($,an))return;B=!0;continue}const Xa=ve==="outdated"?`${Oe.replace(/\.*$/,".")} ${ge}`:Oe.replace(/\.*$/,"."),Tr=ve==="terminal_denied"?"you":z5.has(ve)?"muted":"alert";ke($.key,{key:$.key,text:Xa,role:Tr});return}},Et=(a==null?void 0:a.threads)??[],tn=!l&&Et.length>0,_t=My(Et,(a==null?void 0:a.pinnedCount)??0,N,_),Nt=_t.pinned,bn=_t.rows,Gt=Array.isArray(a==null?void 0:a.stages)?a.stages:null,le=new Set(P.folded.filter($=>!A.groups.includes($))),Me=P.showAll||A.all,Ce=Gt?Em(bn.map($=>$.row),Gt,{order:P.order,folded:le,showAll:Me,narrowed:_t.narrowed}):null,nn=Gt?(a==null?void 0:a.archived)??0:0,sn=$=>{M(B=>({...B,groups:B.groups.filter(W=>W!==$)})),H({folded:le.has($)?P.folded.filter(B=>B!==$):[...P.folded.filter(B=>B!==$),$]})},zn=()=>{M($=>({...$,all:!1})),H({showAll:!Me})},st=()=>{const $=!P.archived;k.current=$,H({archived:$}),ae()},hs=$=>T(B=>{const W=new Set(B);return W.has($)?W.delete($):W.add($),W}),Wn=($,B)=>s.jsx(I5,{depth:B,row:v!=null&&v[$.key]?{...$,serves:v[$.key]}:$,arrived:g===$.key,pinnable:d&&typeof $.pinned=="boolean",pinning:h,onPin:()=>je($),opening:re.has($.key),note:se[$.key]??null,onOpen:()=>wt($),org:t,project:n,compact:!!Gt&&P.compact,detailsOpen:R.has($.key),onDetails:()=>hs($.key)});u.useEffect(()=>{if(!tn)return;const $=B=>{var ve,Oe;if(B.key!=="/"||B.ctrlKey||B.metaKey||B.altKey||B.defaultPrevented)return;const W=document.activeElement;W&&(/^(INPUT|TEXTAREA|SELECT)$/.test(W.tagName)||W.isContentEditable)||document.querySelector('[role="dialog"], [role="alertdialog"], dialog[open]')||(B.preventDefault(),(ve=Y.current)==null||ve.focus(),(Oe=Y.current)==null||Oe.select())};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[tn]);const ms=$=>S(B=>{const W=new Set(B);return W.has($)?W.delete($):W.add($),W}),ps=()=>{var $;C(""),S(new Set),($=Y.current)==null||$.focus()},U=($,B)=>{const W=_t.counts[$]??0,ve=_.has($),Oe=Ty[$];return s.jsxs("button",{type:"button",className:"filter-chip","aria-pressed":ve,"aria-describedby":Oe?`chip-hint-${$}`:void 0,disabled:W===0&&!ve&&D!==$,onFocus:()=>z($),onBlur:()=>z(an=>an===$?null:an),onClick:()=>ms($),children:[B," ",W]},$)};return s.jsxs(s.Fragment,{children:[J,s.jsxs("header",{className:"main-head",children:[s.jsx("h1",{children:"Threads"}),a&&!l&&s.jsx("p",{className:"muted",children:a.line})]}),s.jsxs("section",{className:"card threads","aria-label":"Threads",children:[s.jsx(_5,{}),o&&s.jsxs("div",{className:"alert",role:"alert",children:["Threads unavailable: ",o.replace(/\.+$/,""),". Retrying every 10 s."]}),x&&s.jsx("div",{className:"alert",role:"alert",children:x}),s.jsx("p",{className:"caption muted not-listed",role:"status",children:j!==null&&!l?Gt?s.jsxs(s.Fragment,{children:["Thread ",j," is not in this list.",!P.archived&&nn>0?" Show archived lists archived threads.":null]}):s.jsxs(s.Fragment,{children:["Thread ",j," is not in this list. ",s.jsx("code",{children:"sdlc view --all"})," lists older threads."]}):null}),tn&&s.jsxs("div",{className:"threads-toolbar",children:[s.jsxs("div",{className:"threads-find",children:[s.jsxs("div",{className:"search-field",children:[s.jsx("input",{ref:Y,type:"search",placeholder:"Search threads","aria-label":"Search threads","aria-keyshortcuts":"/",value:N,onChange:$=>C($.target.value),onKeyDown:$=>{$.key==="Escape"&&($.preventDefault(),N?C(""):$.currentTarget.blur())}}),N&&s.jsx("button",{type:"button",className:"search-clear","aria-label":"Clear search",onClick:()=>{var $;C(""),($=Y.current)==null||$.focus()},children:s.jsx("span",{"aria-hidden":"true",children:"×"})})]}),Gt&&s.jsx("select",{className:"order-select","aria-label":"Order threads",value:P.order,onChange:$=>H({order:$.target.value}),children:q1.map(([$,B])=>s.jsx("option",{value:$,children:B},$))})]}),s.jsxs("div",{className:"filter-row",children:[s.jsx("div",{className:"filter-group",role:"group","aria-label":"Status",children:Am.map(([$,B])=>U($,B))}),s.jsx("div",{className:"filter-group",role:"group","aria-label":"Agent",children:Mm.map(([$,B])=>U($,B))}),Gt&&s.jsx("button",{type:"button",className:"filter-chip","aria-pressed":P.compact,onClick:()=>H({compact:!P.compact}),children:"Compact"})]}),Object.entries(Ty).map(([$,B])=>s.jsx("span",{className:"sr-only",id:`chip-hint-${$}`,children:B},$)),s.jsx("p",{className:"caption muted narrowed",role:"status",children:_t.narrowed?s.jsxs(s.Fragment,{children:[bn.length," of ",Et.length," threads ·"," ",s.jsx("button",{type:"button",className:"clear-filters","aria-label":"Clear search and filters",onClick:ps,children:"Clear"})]}):null})]}),l?s.jsx("p",{className:"muted",children:R5}):s.jsxs("div",{className:"thread-list",ref:te,onFocus:q,onBlur:ne,children:[Ce==null?void 0:Ce.groups.map($=>s.jsxs("div",{children:[$.label!==null&&s.jsx(rh,{label:$.label,count:$.count,hint:$.hint,fold:$.folds?{open:$.open,onToggle:()=>sn($.key)}:void 0}),$.rows.map(({row:B,depth:W})=>s.jsx("div",{children:Wn(B,W)},B.key))]},`group-${$.key}`)),!Ce&&bn.map(({row:$,depth:B},W)=>s.jsxs("div",{children:[Nt>0&&W===0&&s.jsx(rh,{label:"Pinned",count:Nt,hint:G1}),Nt>0&&W===Nt&&s.jsx(rh,{label:"Other threads",count:bn.length-Nt}),Wn($,B)]},$.key)),a&&!Et.length&&s.jsx("p",{className:"muted empty",children:"No threads at work or waiting."}),Et.length>0&&!bn.length&&s.jsx("p",{className:"muted empty",children:"No threads match."}),a&&a.hidden>0&&s.jsxs("p",{className:"caption muted",children:[a.hidden," older thread(s) not shown; sdlc view --all lists them."]}),(Ce==null?void 0:Ce.more)&&s.jsx("button",{type:"button",className:"list-more","aria-expanded":Me,onClick:zn,children:Ce.more.unstaged?Me?"Show fewer without a stage":`Show all without a stage (${Ce.more.total})`:Me?"Show fewer":`Show all (${Ce.more.total})`}),nn>0&&s.jsx("button",{type:"button",className:"list-more",onClick:st,children:P.archived?"Hide archived":`Show ${nn} archived`})]})]})]})}function I5({row:e,depth:t,arrived:n,pinnable:a,pinning:r,onPin:l,opening:i,note:o,onOpen:c,org:d,project:f,compact:h=!1,detailsOpen:m=!1,onDetails:x}){const b=h&&!m,v=C=>d?`org/${encodeURIComponent(d)}/tasks/${encodeURIComponent(C)}`:null,y=C=>f?`proj/${encodeURIComponent(f)}/issues/${encodeURIComponent(C)}`:null,g=[e.where||e.agent,e.phase,e.age,e.waitsOn?`waits on ${e.waitsOn}`:""].filter(Boolean).join(" · "),p=$5(e),j=`open-note-${e.key}`,[w,N]=u.useState(!1);return s.jsxs("article",{className:["thread",n?"arrived":"",h?"compact-card":""].filter(Boolean).join(" "),id:`thread-${e.key}`,style:{marginLeft:Math.min(t*22,110)},children:[h&&s.jsx("button",{type:"button",className:"details-toggle","data-key":e.key,"aria-label":`Details of ${e.title}`,"aria-expanded":m,onClick:x,children:s.jsx("span",{"aria-hidden":"true",children:m?"▾":"▸"})}),s.jsxs("div",{className:"thread-head",children:[s.jsx("p",{className:"thread-title",tabIndex:-1,children:e.title}),s.jsxs("div",{className:"tools",children:[e.carried?s.jsxs(s.Fragment,{children:[s.jsx(Cc,{text:e.carried,role:"waiting"}),e.carriedBatch&&s.jsx(Cc,{text:e.carriedBatch.text,role:e.carriedBatch.role})]}):s.jsx(Cc,{text:e.status,role:e.role}),e.archived&&s.jsx(Cc,{text:"archived",role:"muted"}),p&&s.jsx("button",{type:"button",className:"open-thread","data-key":e.key,"aria-label":`${p}: ${e.title}`,"aria-describedby":j,"aria-disabled":i?!0:void 0,"aria-busy":i?!0:void 0,onClick:()=>{i||c()},children:i?"Opening…":p}),a&&s.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":r?!0:void 0,"aria-busy":r===e.key?!0:void 0,onClick:()=>{r||l()},children:e.pinned?"Unpin":"Pin"})]})]}),s.jsxs("p",{className:b?"caption muted meta one-line":"caption muted meta",children:[g,s.jsx(B5,{tags:e.tags??[],track:e.track,brief:b})]}),p&&s.jsx("p",{id:j,className:`caption open-note tone-${ti((o==null?void 0:o.role)??"muted")}`,role:(o==null?void 0:o.role)==="alert"||(o==null?void 0:o.role)==="you"?"alert":"status",children:(o==null?void 0:o.text)??null}),!b&&e.serves&&e.serves.length>0&&s.jsx(L5,{serves:e.serves}),!b&&e.summary&&s.jsx("p",{className:"caption muted",children:e.summary}),!b&&e.carriedDetail&&s.jsx("p",{className:"line",children:e.carriedDetail}),!b&&e.step&&s.jsx(P5,{t:e}),e.lines.length>0&&s.jsx("p",{className:"caption muted lines-summary",children:A5(e.lines)}),b?null:s.jsx(q5,{t:e,nested:t>0,allLines:w,setAllLines:N,taskHref:v,issueHref:y})]})}function P5({t:e}){return s.jsxs("p",{className:`caption tone-${ti(e.stepRole??"muted")}`,children:["step: ",e.step,e.stepEvidence&&s.jsxs(s.Fragment,{children:[" · ",s.jsx("span",{className:"id-text",children:e.stepEvidence})]}),e.stepRecent&&e.stepRecent.length>0&&s.jsxs("span",{className:"sr-only",children:[". Recent steps, newest first: ",e.stepRecent.join("; ")]})]})}function zy({text:e,role:t,under:n,detail:a,nested:r}){const l=r&&n?n:void 0,i=[l?e:"",a??""].filter(Boolean).join(". ");return s.jsxs("p",{className:`line tone-${ti(t)}`,children:[l??e,i&&s.jsxs("span",{className:"sr-only",children:[". ",i]})]})}function q5({t:e,nested:t,allLines:n,setAllLines:a,taskHref:r,issueHref:l}){return s.jsxs(s.Fragment,{children:[(n?e.lines:e.lines.slice(0,Cy)).map((i,o)=>s.jsxs("p",{className:`line tone-${ti(i.role)}`,children:[s.jsxs("span",{"aria-hidden":"true",children:[T5[i.state]??"•"," "]}),i.state==="working"&&s.jsx("span",{className:"sr-only",children:"Working: "}),i.task!==void 0&&s.jsx(Dy,{id:i.task,href:r(i.task)}),i.task!==void 0&&i.text?" ":null,i.text]},`l${o}`)),e.lines.length>Cy&&s.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:()=>a(i=>!i),children:n?"Show fewer":`Show all ${e.lines.length}`}),(e.routed??[]).map(i=>s.jsxs("p",{className:"line",children:["routed ",s.jsx(Dy,{id:i.issue,href:l(i.issue)}),i.title?` ${i.title}`:null]},`r${i.issue}`)),e.next&&s.jsxs("p",{className:"caption tone-amber",children:[s.jsx("span",{"aria-hidden":"true",children:"▸ "}),"next (",e.next.state,"): ",e.next.text,s.jsx("span",{className:"sr-only",children:". Say “nn” or approve it in the thread to start it."})]}),e.plannedFor&&s.jsxs("p",{className:"caption tone-grey",children:[s.jsx("span",{"aria-hidden":"true",children:"▸ "}),"planned for ",e.plannedFor.tag,": ",e.plannedFor.text]}),e.reason&&s.jsx(zy,{...e.reason,nested:t}),e.holds.map((i,o)=>s.jsx(zy,{...i,nested:t},`h${o}`)),(e.holdsMore??0)>0&&s.jsxs("p",{className:"caption tone-grey",children:["+",e.holdsMore," more holds"]}),e.plan&&s.jsx("p",{className:"caption muted",children:e.plan})]})}const G5=5e3;function V5(){const[e,t]=u.useState([]),n=u.useRef(0),a=u.useRef(new Map),r=u.useCallback(c=>{const d=a.current.get(c);d&&clearTimeout(d),a.current.delete(c),t(f=>f.filter(h=>h.id!==c))},[]),l=u.useCallback((c,d)=>{const f=n.current+=1;t(h=>[...h.filter(m=>m.tone!=="error").slice(-2),{id:f,tone:c,message:d}]),c==="success"&&a.current.set(f,setTimeout(()=>r(f),G5))},[r]);u.useEffect(()=>{const c=a.current;return()=>{for(const d of c.values())clearTimeout(d)}},[]);const i=u.useMemo(()=>({success:c=>l("success",c),error:c=>l("error",c)}),[l]),o=s.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=>s.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:[s.jsx("span",{className:"min-w-0 flex-1 break-words",children:c.message}),s.jsx(V,{type:"button",variant:"ghost",size:"control",className:"shrink-0",onClick:()=>r(c.id),children:"Dismiss"})]},c.id))});return{notify:i,toasts:o}}const K1=/^#(?:(releases)|release=(.+)|planned(?:=(.+))?)$/,Y5=/^#task=(.+)$/,F5=/^#issue=(.+)$/,K5=/^iss-\d{1,9}$/;function X1(e){return e.split("/").filter(Boolean).slice(1).join("/")}function X5(e,t=""){const n=e.split("/").filter(Boolean);if(n.length===0)return{page:{kind:"home"}};if(n.length===1){const[o]=n;return o==="threads"?{page:{kind:"org",page:"threads"},threads:!0}:o==="chat"?{forward:"threads"}:o==="tasks"?{page:{kind:"org",page:"tasks"},tasks:!0}:o==="issues"?{page:{kind:"home"},issues:!0}:o==="chart"?{page:{kind:"org",page:"chart"},chart:!0}:o==="worktrees"?{page:{kind:"org",page:"worktrees"},worktrees:!0}:o==="workspaces"?{page:{kind:"org",page:"workspaces"},workspaces:!0}:o==="queues"?{page:{kind:"org",page:"queues"},queues:!0}:o==="releases"?{page:{kind:"home"},releasesForward:!0}:{page:{kind:"not_found"}}}const[a,r,l,i]=n;if(a==="org"&&l==="tasks"&&i==="queues"&&n.length===4)return{forward:`org/${r}/queues${t}`};if(a==="org"&&l==="chat"&&n.length<=4)return{forward:`org/${r}/threads${i===void 0?"":`#thread-${i}`}`};if(a==="org"&&l==="tasks"&&n.length===4){const o=decodeURIComponent(i);return{page:{kind:"org",page:"tasks",item:o},org:decodeURIComponent(r),task:o}}if(a==="org"&&l==="issues"&&n.length<=4){const o=decodeURIComponent(r);return i===void 0?{page:{kind:"home"},org:o,issues:!0}:{page:{kind:"home"},org:o,issues:!0,issue:decodeURIComponent(i)}}if(a==="proj"&&l==="issues"&&n.length<=4){const o=decodeURIComponent(r),c={kind:"project",project:o,page:"issues"};if(i===void 0)return{page:c,issues:!0,project:o};const d=decodeURIComponent(i),f=new URLSearchParams(t);f.delete("from");const h=f.toString();return{page:{...c,item:d,...h?{list_query:h}:{}},issues:!0,project:o,issue:d}}if(a==="org"&&n.length<=3){const o=decodeURIComponent(r);if(l===void 0)return{page:{kind:"home"},org:o};if(l==="threads")return{page:{kind:"org",page:"threads"},org:o,threads:!0};if(l==="tasks")return{page:{kind:"org",page:"tasks"},org:o,tasks:!0};if(l==="chart")return{page:{kind:"org",page:"chart"},org:o,chart:!0};if(l==="worktrees")return{page:{kind:"org",page:"worktrees"},org:o,worktrees:!0};if(l==="workspaces")return{page:{kind:"org",page:"workspaces"},org:o,workspaces:!0};if(l==="queues")return{page:{kind:"org",page:"queues"},org:o,queues:!0};if(l==="releases")return{page:{kind:"home"},org:o,releasesForward:!0}}if(a==="proj"&&n.length<=3){const o=decodeURIComponent(r);if(l===void 0)return{page:{kind:"project",project:o}};if(l==="tasks")return{page:{kind:"project",project:o,page:"tasks"},tasks:!0};if(l==="releases")return{page:{kind:"project",project:o,page:"releases"},releases:!0}}return{page:{kind:"not_found"}}}const Q5={label:"Local viewer",can:()=>!1},W5={connecting:"Connecting…",live:"Live · refreshes every 10s",disconnected:"Disconnected"},Ly=()=>s.jsx(O1,{title:"Page not found",children:"There is no page at this address in this viewer."});function Z5({routeOrg:e}){const{org:t,engine:n}=On(),{project:a}=Fo(),[r,l]=u.useState("connecting");return n===null?s.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.jsx(la,{page:"Threads"})}):s.jsxs("div",{className:"main viewer-panel",children:[s.jsxs("p",{className:"connection",role:"status",children:[s.jsx("span",{className:`dot ${r}`,"aria-hidden":"true"}),W5[r]]}),s.jsx(H5,{onConnection:l,org:(t==null?void 0:t.slug)??e??null,project:a})]})}const Ka=()=>s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"});function J5({route:e,navigate:t}){var f;const{org:n,projects:a,loading:r,none:l}=On(),i=e.page.kind==="project"?e.page.project:null,o=i!==null&&a!==null&&!((f=a.find(h=>h.id===i))!=null&&f.current),c=e.org===void 0&&!o&&!r&&n!==null?`org/${encodeURIComponent(n.slug)}/tasks`:null;if(u.useEffect(()=>{c&&t(c)},[c,t]),i!==null&&o)return s.jsx(xo,{project:i});if(c||e.org===void 0&&r)return s.jsx(Ka,{});const d=(n==null?void 0:n.slug)??e.org;return d===void 0&&i!==null?s.jsx(xo,{project:i}):d===void 0&&l?s.jsx(ei,{}):d===void 0?s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Tasks open once the organization reads."}):s.jsx(bD,{org:d})}function e8({route:e,navigate:t}){const{org:n,loading:a,none:r}=On(),l=e.org===void 0&&!a&&n!==null?`org/${encodeURIComponent(n.slug)}/queues${window.location.search}`:null;if(u.useEffect(()=>{l&&t(l)},[l,t]),l||e.org===void 0&&a)return s.jsx(Ka,{});const i=(n==null?void 0:n.slug)??e.org;if(i===void 0&&r)return s.jsx(ei,{});if(i===void 0)return s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Queues open once the organization reads."});const o=new URLSearchParams(window.location.search).get("queue");return s.jsx(n3,{org:i,open:o,path:`/org/${encodeURIComponent(i)}/queues`})}function t8({route:e,navigate:t}){var b;const{org:n,projects:a}=On(),{project:r,settled:l}=Fo(),i=e.project??null,o=i!==null&&a!==null&&!((b=a.find(v=>v.id===i))!=null&&b.current),c=window.location.search,d=i===null&&r!==null?`proj/${encodeURIComponent(r)}/issues${e.issue?`/${encodeURIComponent(e.issue)}`:""}${c}`:null;u.useEffect(()=>{d&&t(d)},[d,t]);const[f,h]=u.useState(()=>window.location.search.replace(/^\?/,"")),m=u.useCallback(v=>{window.history.replaceState(window.history.state,"",`${window.location.pathname}${v?`?${v}`:""}`),h(v)},[]);if(i!==null&&o)return s.jsx(xo,{project:i});if(d||i===null&&!l)return s.jsx(Ka,{});if(i===null)return s.jsx(ei,{});const x=encodeURIComponent((n==null?void 0:n.slug)??e.org??"");if(e.issue!==void 0){const v=new URLSearchParams(f).get("from");return s.jsx(Gz,{org:x,project:i,issue_id:e.issue,from:v,query:f})}return s.jsx(Az,{org:x,project:i,query:f,onQuery:m})}function n8({issue:e,navigate:t,home:n}){const{project:a,settled:r}=Fo(),l=a!==null?`proj/${encodeURIComponent(a)}/issues/${encodeURIComponent(e)}`:null;return u.useEffect(()=>{l&&t(l)},[l,t]),l||!r?s.jsx(Ka,{}):n}function Fo(){var l;const{projects:e,loading:t,none:n,failure:a}=On();return{project:((l=e==null?void 0:e.find(i=>i.current))==null?void 0:l.id)??null,settled:!t&&(e!==null||n!==null||!!(a!=null&&a.shown))}}function s8({navigate:e}){const{project:t,settled:n}=Fo(),a=t!==null?`proj/${encodeURIComponent(t)}/releases${window.location.search}`:null;return u.useEffect(()=>{a&&e(a)},[a,e]),a||!n?s.jsx(Ka,{}):s.jsx(ei,{})}function Uy(e){const t=new URLSearchParams(e);return{release:t.get("release"),planned:t.has("planned")?t.get("planned")??"":null}}function a8({route:e}){var f;const{org:t,projects:n,loading:a}=On(),r=e.page.kind==="project"?e.page.project:"",[l,i]=u.useState(()=>Uy(window.location.search));if(a)return s.jsx(Ka,{});if(n!==null&&!((f=n.find(h=>h.id===r))!=null&&f.current))return s.jsx(xo,{project:r});const c=`/proj/${encodeURIComponent(r)}/releases`,d=h=>{const m=new URLSearchParams;h!=null&&h.startsWith("planned:")?m.set("planned",h.slice(8)):h&&m.set("release",h);const x=m.size>0?`?${m.toString()}`:"";window.history.replaceState(window.history.state,"",`${window.location.pathname}${x}`),i(Uy(x))};return s.jsx(c6,{org:(t==null?void 0:t.slug)??"",query:l,onSelect:d,home:c})}function r8({hash:e,navigate:t,home:n}){const{project:a,settled:r}=Fo(),l=K1.exec(e),i=l!=null&&l[2]?Vu(l[2]):null,o=l!=null&&l[3]?Vu(l[3]):null,c=i!==null?`?release=${encodeURIComponent(i)}`:e.startsWith("#planned")?`?planned${o!==null?`=${encodeURIComponent(o)}`:""}`:"",d=a!==null?`proj/${encodeURIComponent(a)}/releases${c}`:null;return u.useEffect(()=>{d&&t(d)},[d,t]),d||!r?s.jsx(Ka,{}):n}function lh({route:e,navigate:t}){const{org:n}=On();let a=e.page;const r=e.org!==void 0&&n!==null&&e.org!==n.slug;r&&(a={kind:"not_found"});let l;if(r)l=s.jsx(Ly,{});else if("threads"in e)l=s.jsx(Z5,{routeOrg:e.org});else if("task"in e){const i=new URLSearchParams(window.location.search).get("from");l=s.jsx(ZD,{org:encodeURIComponent(e.org),task_id:e.task,from:i})}else"tasks"in e?l=s.jsx(J5,{route:e,navigate:t}):"issues"in e?l=s.jsx(t8,{route:e,navigate:t}):"chart"in e?l=s.jsx(L3,{}):"worktrees"in e?l=s.jsx(s5,{org:(n==null?void 0:n.slug)??e.org}):"workspaces"in e?l=s.jsx(z6,{org:(n==null?void 0:n.slug)??e.org}):"queues"in e?l=s.jsx(e8,{route:e,navigate:t}):"releasesForward"in e?l=s.jsx(s8,{navigate:t}):"releases"in e?l=s.jsx(a8,{route:e}):a.kind==="home"?l=s.jsx(ei,{}):a.kind==="project"?l=s.jsx(xo,{project:a.project}):l=s.jsx(Ly,{});return s.jsx(x6,{page:a,children:l})}function l8({task:e,navigate:t,home:n}){const{org:a,loading:r,none:l,failure:i}=On(),o=a!==null?`org/${encodeURIComponent(a.slug)}/tasks/${encodeURIComponent(e)}`:null,c=!r&&(l!==null||!!(i!=null&&i.shown));return u.useEffect(()=>{o&&t(o)},[o,t]),o||!c?s.jsx(Ka,{}):n}const i8=e=>window.location.replace(e);function Vu(e){try{return decodeURIComponent(e)}catch{return null}}function o8({navigate:e=i8,data:t}){const n=X5(X1(window.location.pathname),window.location.search),[a,r]=u.useState(null),{notify:l,toasts:i}=V5(),o=Y5.exec(window.location.hash),c=o?Vu(o[1]):null,d=F5.exec(window.location.hash),f=d?Vu(d[1]):null,h=f!==null&&K5.test(f)?f:null,m=K1.test(window.location.hash)?window.location.hash:null,x=o!==null&&c===null||d!==null&&h===null,b="forward"in n?n.forward:null;u.useEffect(()=>{b&&e(b)},[b,e]);const v=u.useMemo(()=>{if(t)return t;const g=c5();return{probe:{source:async()=>({label:"Local workspace"})},shell:g,issues:g.issues,tasks:f5(),org:d5(),worktrees:m5(),workspaces:p5(),queues:u5(),releases:h5()}},[t]);if(b||"forward"in n||!v.shell)return null;const y=s.jsx(lh,{route:{page:{kind:"home"}},navigate:e});return s.jsx("div",{className:"app-ui dark",ref:r,children:s.jsxs(dM,{container:a,children:[s.jsx(U0,{data:v,router:z1,identity:Q5,notify:l,children:s.jsx(JT,{shell:v.shell,children:x?s.jsx(lh,{route:{page:{kind:"not_found"}},navigate:e}):c!==null?s.jsx(l8,{task:c,navigate:e,home:y}):h!==null?s.jsx(n8,{issue:h,navigate:e,home:y}):m!==null?s.jsx(r8,{hash:m,navigate:e,home:y}):s.jsx(lh,{route:n,navigate:e})})}),i]})})}tR.createRoot(document.getElementById("root")).render(s.jsx(u.StrictMode,{children:X1(window.location.pathname)==="app-ui-probe"?s.jsx(R6,{}):s.jsx(o8,{})}));
|