@software-dlc/cli 0.191.1 → 0.191.2

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(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const l in a)if(l!=="default"&&!(l in e)){const r=Object.getOwnPropertyDescriptor(a,l);r&&Object.defineProperty(e,l,r.get?r:{enumerable:!0,get:()=>a[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function ey(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ty={exports:{}},Eu={};/**
1
+ function N1(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const l in a)if(l!=="default"&&!(l in e)){const r=Object.getOwnPropertyDescriptor(a,l);r&&Object.defineProperty(e,l,r.get?r:{enumerable:!0,get:()=>a[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function ny(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sy={exports:{}},Eu={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@ function _1(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 w1=Symbol.for("react.transitional.element"),N1=Symbol.for("react.fragment");function ny(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 l in t)l!=="key"&&(n[l]=t[l])}else n=t;return t=n.ref,{$$typeof:w1,type:e,key:a,ref:t!==void 0?t:null,props:n}}Eu.Fragment=N1;Eu.jsx=ny;Eu.jsxs=ny;ty.exports=Eu;var s=ty.exports,sy={exports:{}},Se={};/**
9
+ */var k1=Symbol.for("react.transitional.element"),S1=Symbol.for("react.fragment");function ay(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 l in t)l!=="key"&&(n[l]=t[l])}else n=t;return t=n.ref,{$$typeof:k1,type:e,key:a,ref:t!==void 0?t:null,props:n}}Eu.Fragment=S1;Eu.jsx=ay;Eu.jsxs=ay;sy.exports=Eu;var s=sy.exports,ly={exports:{}},Se={};/**
10
10
  * @license React
11
11
  * react.production.js
12
12
  *
@@ -14,7 +14,7 @@ function _1(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 fm=Symbol.for("react.transitional.element"),k1=Symbol.for("react.portal"),S1=Symbol.for("react.fragment"),C1=Symbol.for("react.strict_mode"),T1=Symbol.for("react.profiler"),R1=Symbol.for("react.consumer"),E1=Symbol.for("react.context"),A1=Symbol.for("react.forward_ref"),M1=Symbol.for("react.suspense"),O1=Symbol.for("react.memo"),ay=Symbol.for("react.lazy"),yx=Symbol.iterator;function $1(e){return e===null||typeof e!="object"?null:(e=yx&&e[yx]||e["@@iterator"],typeof e=="function"?e:null)}var ly={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ry=Object.assign,iy={};function wr(e,t,n){this.props=e,this.context=t,this.refs=iy,this.updater=n||ly}wr.prototype.isReactComponent={};wr.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")};wr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function oy(){}oy.prototype=wr.prototype;function hm(e,t,n){this.props=e,this.context=t,this.refs=iy,this.updater=n||ly}var mm=hm.prototype=new oy;mm.constructor=hm;ry(mm,wr.prototype);mm.isPureReactComponent=!0;var bx=Array.isArray,tt={H:null,A:null,T:null,S:null,V:null},cy=Object.prototype.hasOwnProperty;function pm(e,t,n,a,l,r){return n=r.ref,{$$typeof:fm,type:e,key:t,ref:n!==void 0?n:null,props:r}}function D1(e,t){return pm(e.type,t,void 0,void 0,void 0,e.props)}function xm(e){return typeof e=="object"&&e!==null&&e.$$typeof===fm}function z1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var jx=/\/+/g;function $d(e,t){return typeof e=="object"&&e!==null&&e.key!=null?z1(""+e.key):t.toString(36)}function _x(){}function L1(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(_x,_x):(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 Ml(e,t,n,a,l){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(r){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case fm:case k1:i=!0;break;case ay:return i=e._init,Ml(i(e._payload),t,n,a,l)}}if(i)return l=l(e),i=a===""?"."+$d(e,0):a,bx(l)?(n="",i!=null&&(n=i.replace(jx,"$&/")+"/"),Ml(l,t,n,"",function(d){return d})):l!=null&&(xm(l)&&(l=D1(l,n+(l.key==null||e&&e.key===l.key?"":(""+l.key).replace(jx,"$&/")+"/")+i)),t.push(l)),1;i=0;var o=a===""?".":a+":";if(bx(e))for(var c=0;c<e.length;c++)a=e[c],r=o+$d(a,c),i+=Ml(a,t,n,r,l);else if(c=$1(e),typeof c=="function")for(e=c.call(e),c=0;!(a=e.next()).done;)a=a.value,r=o+$d(a,c++),i+=Ml(a,t,n,r,l);else if(r==="object"){if(typeof e.then=="function")return Ml(L1(e),t,n,a,l);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 Do(e,t,n){if(e==null)return e;var a=[],l=0;return Ml(e,a,"","",function(r){return t.call(n,r,l++)}),a}function U1(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 wx=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 B1(){}Se.Children={map:Do,forEach:function(e,t,n){Do(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Do(e,function(){t++}),t},toArray:function(e){return Do(e,function(t){return t})||[]},only:function(e){if(!xm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Se.Component=wr;Se.Fragment=S1;Se.Profiler=T1;Se.PureComponent=hm;Se.StrictMode=C1;Se.Suspense=M1;Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=tt;Se.__COMPILER_RUNTIME={__proto__:null,c:function(e){return tt.H.useMemoCache(e)}};Se.cache=function(e){return function(){return e.apply(null,arguments)}};Se.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var a=ry({},e.props),l=e.key,r=void 0;if(t!=null)for(i in t.ref!==void 0&&(r=void 0),t.key!==void 0&&(l=""+t.key),t)!cy.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 pm(e.type,l,void 0,void 0,r,a)};Se.createContext=function(e){return e={$$typeof:E1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:R1,_context:e},e};Se.createElement=function(e,t,n){var a,l={},r=null;if(t!=null)for(a in t.key!==void 0&&(r=""+t.key),t)cy.call(t,a)&&a!=="key"&&a!=="__self"&&a!=="__source"&&(l[a]=t[a]);var i=arguments.length-2;if(i===1)l.children=n;else if(1<i){for(var o=Array(i),c=0;c<i;c++)o[c]=arguments[c+2];l.children=o}if(e&&e.defaultProps)for(a in i=e.defaultProps,i)l[a]===void 0&&(l[a]=i[a]);return pm(e,r,void 0,void 0,null,l)};Se.createRef=function(){return{current:null}};Se.forwardRef=function(e){return{$$typeof:A1,render:e}};Se.isValidElement=xm;Se.lazy=function(e){return{$$typeof:ay,_payload:{_status:-1,_result:e},_init:U1}};Se.memo=function(e,t){return{$$typeof:O1,type:e,compare:t===void 0?null:t}};Se.startTransition=function(e){var t=tt.T,n={};tt.T=n;try{var a=e(),l=tt.S;l!==null&&l(n,a),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a.then(B1,wx)}catch(r){wx(r)}finally{tt.T=t}};Se.unstable_useCacheRefresh=function(){return tt.H.useCacheRefresh()};Se.use=function(e){return tt.H.use(e)};Se.useActionState=function(e,t,n){return tt.H.useActionState(e,t,n)};Se.useCallback=function(e,t){return tt.H.useCallback(e,t)};Se.useContext=function(e){return tt.H.useContext(e)};Se.useDebugValue=function(){};Se.useDeferredValue=function(e,t){return tt.H.useDeferredValue(e,t)};Se.useEffect=function(e,t,n){var a=tt.H;if(typeof n=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return a.useEffect(e,t)};Se.useId=function(){return tt.H.useId()};Se.useImperativeHandle=function(e,t,n){return tt.H.useImperativeHandle(e,t,n)};Se.useInsertionEffect=function(e,t){return tt.H.useInsertionEffect(e,t)};Se.useLayoutEffect=function(e,t){return tt.H.useLayoutEffect(e,t)};Se.useMemo=function(e,t){return tt.H.useMemo(e,t)};Se.useOptimistic=function(e,t){return tt.H.useOptimistic(e,t)};Se.useReducer=function(e,t,n){return tt.H.useReducer(e,t,n)};Se.useRef=function(e){return tt.H.useRef(e)};Se.useState=function(e){return tt.H.useState(e)};Se.useSyncExternalStore=function(e,t,n){return tt.H.useSyncExternalStore(e,t,n)};Se.useTransition=function(){return tt.H.useTransition()};Se.version="19.1.0";sy.exports=Se;var u=sy.exports;const ra=ey(u),uy=_1({__proto__:null,default:ra},[u]);var dy={exports:{}},Au={},fy={exports:{}},hy={};/**
17
+ */var fm=Symbol.for("react.transitional.element"),C1=Symbol.for("react.portal"),R1=Symbol.for("react.fragment"),T1=Symbol.for("react.strict_mode"),E1=Symbol.for("react.profiler"),A1=Symbol.for("react.consumer"),M1=Symbol.for("react.context"),O1=Symbol.for("react.forward_ref"),$1=Symbol.for("react.suspense"),D1=Symbol.for("react.memo"),ry=Symbol.for("react.lazy"),yx=Symbol.iterator;function z1(e){return e===null||typeof e!="object"?null:(e=yx&&e[yx]||e["@@iterator"],typeof e=="function"?e:null)}var iy={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oy=Object.assign,cy={};function wr(e,t,n){this.props=e,this.context=t,this.refs=cy,this.updater=n||iy}wr.prototype.isReactComponent={};wr.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")};wr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function uy(){}uy.prototype=wr.prototype;function hm(e,t,n){this.props=e,this.context=t,this.refs=cy,this.updater=n||iy}var mm=hm.prototype=new uy;mm.constructor=hm;oy(mm,wr.prototype);mm.isPureReactComponent=!0;var bx=Array.isArray,tt={H:null,A:null,T:null,S:null,V:null},dy=Object.prototype.hasOwnProperty;function pm(e,t,n,a,l,r){return n=r.ref,{$$typeof:fm,type:e,key:t,ref:n!==void 0?n:null,props:r}}function L1(e,t){return pm(e.type,t,void 0,void 0,void 0,e.props)}function xm(e){return typeof e=="object"&&e!==null&&e.$$typeof===fm}function U1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var jx=/\/+/g;function $d(e,t){return typeof e=="object"&&e!==null&&e.key!=null?U1(""+e.key):t.toString(36)}function _x(){}function B1(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(_x,_x):(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 Ml(e,t,n,a,l){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(r){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case fm:case C1:i=!0;break;case ry:return i=e._init,Ml(i(e._payload),t,n,a,l)}}if(i)return l=l(e),i=a===""?"."+$d(e,0):a,bx(l)?(n="",i!=null&&(n=i.replace(jx,"$&/")+"/"),Ml(l,t,n,"",function(d){return d})):l!=null&&(xm(l)&&(l=L1(l,n+(l.key==null||e&&e.key===l.key?"":(""+l.key).replace(jx,"$&/")+"/")+i)),t.push(l)),1;i=0;var o=a===""?".":a+":";if(bx(e))for(var c=0;c<e.length;c++)a=e[c],r=o+$d(a,c),i+=Ml(a,t,n,r,l);else if(c=z1(e),typeof c=="function")for(e=c.call(e),c=0;!(a=e.next()).done;)a=a.value,r=o+$d(a,c++),i+=Ml(a,t,n,r,l);else if(r==="object"){if(typeof e.then=="function")return Ml(B1(e),t,n,a,l);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 Do(e,t,n){if(e==null)return e;var a=[],l=0;return Ml(e,a,"","",function(r){return t.call(n,r,l++)}),a}function H1(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 wx=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 I1(){}Se.Children={map:Do,forEach:function(e,t,n){Do(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Do(e,function(){t++}),t},toArray:function(e){return Do(e,function(t){return t})||[]},only:function(e){if(!xm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Se.Component=wr;Se.Fragment=R1;Se.Profiler=E1;Se.PureComponent=hm;Se.StrictMode=T1;Se.Suspense=$1;Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=tt;Se.__COMPILER_RUNTIME={__proto__:null,c:function(e){return tt.H.useMemoCache(e)}};Se.cache=function(e){return function(){return e.apply(null,arguments)}};Se.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var a=oy({},e.props),l=e.key,r=void 0;if(t!=null)for(i in t.ref!==void 0&&(r=void 0),t.key!==void 0&&(l=""+t.key),t)!dy.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 pm(e.type,l,void 0,void 0,r,a)};Se.createContext=function(e){return e={$$typeof:M1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:A1,_context:e},e};Se.createElement=function(e,t,n){var a,l={},r=null;if(t!=null)for(a in t.key!==void 0&&(r=""+t.key),t)dy.call(t,a)&&a!=="key"&&a!=="__self"&&a!=="__source"&&(l[a]=t[a]);var i=arguments.length-2;if(i===1)l.children=n;else if(1<i){for(var o=Array(i),c=0;c<i;c++)o[c]=arguments[c+2];l.children=o}if(e&&e.defaultProps)for(a in i=e.defaultProps,i)l[a]===void 0&&(l[a]=i[a]);return pm(e,r,void 0,void 0,null,l)};Se.createRef=function(){return{current:null}};Se.forwardRef=function(e){return{$$typeof:O1,render:e}};Se.isValidElement=xm;Se.lazy=function(e){return{$$typeof:ry,_payload:{_status:-1,_result:e},_init:H1}};Se.memo=function(e,t){return{$$typeof:D1,type:e,compare:t===void 0?null:t}};Se.startTransition=function(e){var t=tt.T,n={};tt.T=n;try{var a=e(),l=tt.S;l!==null&&l(n,a),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a.then(I1,wx)}catch(r){wx(r)}finally{tt.T=t}};Se.unstable_useCacheRefresh=function(){return tt.H.useCacheRefresh()};Se.use=function(e){return tt.H.use(e)};Se.useActionState=function(e,t,n){return tt.H.useActionState(e,t,n)};Se.useCallback=function(e,t){return tt.H.useCallback(e,t)};Se.useContext=function(e){return tt.H.useContext(e)};Se.useDebugValue=function(){};Se.useDeferredValue=function(e,t){return tt.H.useDeferredValue(e,t)};Se.useEffect=function(e,t,n){var a=tt.H;if(typeof n=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return a.useEffect(e,t)};Se.useId=function(){return tt.H.useId()};Se.useImperativeHandle=function(e,t,n){return tt.H.useImperativeHandle(e,t,n)};Se.useInsertionEffect=function(e,t){return tt.H.useInsertionEffect(e,t)};Se.useLayoutEffect=function(e,t){return tt.H.useLayoutEffect(e,t)};Se.useMemo=function(e,t){return tt.H.useMemo(e,t)};Se.useOptimistic=function(e,t){return tt.H.useOptimistic(e,t)};Se.useReducer=function(e,t,n){return tt.H.useReducer(e,t,n)};Se.useRef=function(e){return tt.H.useRef(e)};Se.useState=function(e){return tt.H.useState(e)};Se.useSyncExternalStore=function(e,t,n){return tt.H.useSyncExternalStore(e,t,n)};Se.useTransition=function(){return tt.H.useTransition()};Se.version="19.1.0";ly.exports=Se;var u=ly.exports;const ra=ny(u),fy=N1({__proto__:null,default:ra},[u]);var hy={exports:{}},Au={},my={exports:{}},py={};/**
18
18
  * @license React
19
19
  * scheduler.production.js
20
20
  *
@@ -22,7 +22,7 @@ function _1(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(T,z){var S=T.length;T.push(z);e:for(;0<S;){var O=S-1>>>1,Z=T[O];if(0<l(Z,z))T[O]=z,T[S]=Z,S=O;else break e}}function n(T){return T.length===0?null:T[0]}function a(T){if(T.length===0)return null;var z=T[0],S=T.pop();if(S!==z){T[0]=S;e:for(var O=0,Z=T.length,E=Z>>>1;O<E;){var I=2*(O+1)-1,ne=T[I],ee=I+1,ge=T[ee];if(0>l(ne,S))ee<Z&&0>l(ge,ne)?(T[O]=ge,T[ee]=S,O=ee):(T[O]=ne,T[I]=S,O=I);else if(ee<Z&&0>l(ge,S))T[O]=ge,T[ee]=S,O=ee;else break e}}return z}function l(T,z){var S=T.sortIndex-z.sortIndex;return S!==0?S:T.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;e.unstable_now=function(){return r.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],d=[],f=1,h=null,m=3,x=!1,j=!1,v=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function _(T){for(var z=n(d);z!==null;){if(z.callback===null)a(d);else if(z.startTime<=T)a(d),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(d)}}function N(T){if(v=!1,_(T),!j)if(n(c)!==null)j=!0,C||(C=!0,Y());else{var z=n(d);z!==null&&R(N,z.startTime-T)}}var C=!1,w=-1,k=5,A=-1;function $(){return y?!0:!(e.unstable_now()-A<k)}function X(){if(y=!1,C){var T=e.unstable_now();A=T;var z=!0;try{e:{j=!1,v&&(v=!1,p(w),w=-1),x=!0;var S=m;try{t:{for(_(T),h=n(c);h!==null&&!(h.expirationTime>T&&$());){var O=h.callback;if(typeof O=="function"){h.callback=null,m=h.priorityLevel;var Z=O(h.expirationTime<=T);if(T=e.unstable_now(),typeof Z=="function"){h.callback=Z,_(T),z=!0;break t}h===n(c)&&a(c),_(T)}else a(c);h=n(c)}if(h!==null)z=!0;else{var E=n(d);E!==null&&R(N,E.startTime-T),z=!1}}break e}finally{h=null,m=S,x=!1}z=void 0}}finally{z?Y():C=!1}}}var Y;if(typeof b=="function")Y=function(){b(X)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,H=L.port2;L.port1.onmessage=X,Y=function(){H.postMessage(null)}}else Y=function(){g(X,0)};function R(T,z){w=g(function(){T(e.unstable_now())},z)}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(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(T){switch(m){case 1:case 2:case 3:var z=3;break;default:z=m}var S=m;m=z;try{return T()}finally{m=S}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(T,z){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var S=m;m=T;try{return z()}finally{m=S}},e.unstable_scheduleCallback=function(T,z,S){var O=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?O+S:O):S=O,T){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=S+Z,T={id:f++,callback:z,priorityLevel:T,startTime:S,expirationTime:Z,sortIndex:-1},S>O?(T.sortIndex=S,t(d,T),n(c)===null&&T===n(d)&&(v?(p(w),w=-1):v=!0,R(N,S-O))):(T.sortIndex=Z,t(c,T),j||x||(j=!0,C||(C=!0,Y()))),T},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(T){var z=m;return function(){var S=m;m=z;try{return T.apply(this,arguments)}finally{m=S}}}})(hy);fy.exports=hy;var H1=fy.exports,my={exports:{}},Vt={};/**
25
+ */(function(e){function t(R,z){var S=R.length;R.push(z);e:for(;0<S;){var O=S-1>>>1,Z=R[O];if(0<l(Z,z))R[O]=z,R[S]=Z,S=O;else break e}}function n(R){return R.length===0?null:R[0]}function a(R){if(R.length===0)return null;var z=R[0],S=R.pop();if(S!==z){R[0]=S;e:for(var O=0,Z=R.length,E=Z>>>1;O<E;){var I=2*(O+1)-1,ne=R[I],ee=I+1,ge=R[ee];if(0>l(ne,S))ee<Z&&0>l(ge,ne)?(R[O]=ge,R[ee]=S,O=ee):(R[O]=ne,R[I]=S,O=I);else if(ee<Z&&0>l(ge,S))R[O]=ge,R[ee]=S,O=ee;else break e}}return z}function l(R,z){var S=R.sortIndex-z.sortIndex;return S!==0?S:R.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;e.unstable_now=function(){return r.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],d=[],f=1,h=null,m=3,g=!1,j=!1,v=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function _(R){for(var z=n(d);z!==null;){if(z.callback===null)a(d);else if(z.startTime<=R)a(d),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(d)}}function N(R){if(v=!1,_(R),!j)if(n(c)!==null)j=!0,C||(C=!0,Y());else{var z=n(d);z!==null&&T(N,z.startTime-R)}}var C=!1,w=-1,k=5,A=-1;function $(){return y?!0:!(e.unstable_now()-A<k)}function X(){if(y=!1,C){var R=e.unstable_now();A=R;var z=!0;try{e:{j=!1,v&&(v=!1,p(w),w=-1),g=!0;var S=m;try{t:{for(_(R),h=n(c);h!==null&&!(h.expirationTime>R&&$());){var O=h.callback;if(typeof O=="function"){h.callback=null,m=h.priorityLevel;var Z=O(h.expirationTime<=R);if(R=e.unstable_now(),typeof Z=="function"){h.callback=Z,_(R),z=!0;break t}h===n(c)&&a(c),_(R)}else a(c);h=n(c)}if(h!==null)z=!0;else{var E=n(d);E!==null&&T(N,E.startTime-R),z=!1}}break e}finally{h=null,m=S,g=!1}z=void 0}}finally{z?Y():C=!1}}}var Y;if(typeof b=="function")Y=function(){b(X)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,H=L.port2;L.port1.onmessage=X,Y=function(){H.postMessage(null)}}else Y=function(){x(X,0)};function T(R,z){w=x(function(){R(e.unstable_now())},z)}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"):k=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 z=3;break;default:z=m}var S=m;m=z;try{return R()}finally{m=S}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(R,z){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var S=m;m=R;try{return z()}finally{m=S}},e.unstable_scheduleCallback=function(R,z,S){var O=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?O+S:O):S=O,R){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=S+Z,R={id:f++,callback:z,priorityLevel:R,startTime:S,expirationTime:Z,sortIndex:-1},S>O?(R.sortIndex=S,t(d,R),n(c)===null&&R===n(d)&&(v?(p(w),w=-1):v=!0,T(N,S-O))):(R.sortIndex=Z,t(c,R),j||g||(j=!0,C||(C=!0,Y()))),R},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(R){var z=m;return function(){var S=m;m=z;try{return R.apply(this,arguments)}finally{m=S}}}})(py);my.exports=py;var P1=my.exports,xy={exports:{}},Vt={};/**
26
26
  * @license React
27
27
  * react-dom.production.js
28
28
  *
@@ -30,7 +30,7 @@ function _1(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 I1=u;function py(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 na(){}var Gt={d:{f:na,r:function(){throw Error(py(522))},D:na,C:na,L:na,m:na,X:na,S:na,M:na},p:0,findDOMNode:null},P1=Symbol.for("react.portal");function q1(e,t,n){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P1,key:a==null?null:""+a,children:e,containerInfo:t,implementation:n}}var di=I1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Mu(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Vt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Gt;Vt.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(py(299));return q1(e,t,null,n)};Vt.flushSync=function(e){var t=di.T,n=Gt.p;try{if(di.T=null,Gt.p=2,e)return e()}finally{di.T=t,Gt.p=n,Gt.d.f()}};Vt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Gt.d.C(e,t))};Vt.prefetchDNS=function(e){typeof e=="string"&&Gt.d.D(e)};Vt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,a=Mu(n,t.crossOrigin),l=typeof t.integrity=="string"?t.integrity:void 0,r=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Gt.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:a,integrity:l,fetchPriority:r}):n==="script"&&Gt.d.X(e,{crossOrigin:a,integrity:l,fetchPriority:r,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Vt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Mu(t.as,t.crossOrigin);Gt.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&&Gt.d.M(e)};Vt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,a=Mu(n,t.crossOrigin);Gt.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})}};Vt.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Mu(t.as,t.crossOrigin);Gt.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 Gt.d.m(e)};Vt.requestFormReset=function(e){Gt.d.r(e)};Vt.unstable_batchedUpdates=function(e,t){return e(t)};Vt.useFormState=function(e,t,n){return di.H.useFormState(e,t,n)};Vt.useFormStatus=function(){return di.H.useHostTransitionStatus()};Vt.version="19.1.0";function xy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xy)}catch(e){console.error(e)}}xy(),my.exports=Vt;var Nr=my.exports;const G1=ey(Nr);/**
33
+ */var q1=u;function gy(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 na(){}var Gt={d:{f:na,r:function(){throw Error(gy(522))},D:na,C:na,L:na,m:na,X:na,S:na,M:na},p:0,findDOMNode:null},G1=Symbol.for("react.portal");function V1(e,t,n){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:G1,key:a==null?null:""+a,children:e,containerInfo:t,implementation:n}}var di=q1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Mu(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Vt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Gt;Vt.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(gy(299));return V1(e,t,null,n)};Vt.flushSync=function(e){var t=di.T,n=Gt.p;try{if(di.T=null,Gt.p=2,e)return e()}finally{di.T=t,Gt.p=n,Gt.d.f()}};Vt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Gt.d.C(e,t))};Vt.prefetchDNS=function(e){typeof e=="string"&&Gt.d.D(e)};Vt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,a=Mu(n,t.crossOrigin),l=typeof t.integrity=="string"?t.integrity:void 0,r=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Gt.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:a,integrity:l,fetchPriority:r}):n==="script"&&Gt.d.X(e,{crossOrigin:a,integrity:l,fetchPriority:r,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Vt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Mu(t.as,t.crossOrigin);Gt.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&&Gt.d.M(e)};Vt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,a=Mu(n,t.crossOrigin);Gt.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})}};Vt.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Mu(t.as,t.crossOrigin);Gt.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 Gt.d.m(e)};Vt.requestFormReset=function(e){Gt.d.r(e)};Vt.unstable_batchedUpdates=function(e,t){return e(t)};Vt.useFormState=function(e,t,n){return di.H.useFormState(e,t,n)};Vt.useFormStatus=function(){return di.H.useHostTransitionStatus()};Vt.version="19.1.0";function vy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vy)}catch(e){console.error(e)}}vy(),xy.exports=Vt;var Nr=xy.exports;const Y1=ny(Nr);/**
34
34
  * @license React
35
35
  * react-dom-client.production.js
36
36
  *
@@ -38,306 +38,306 @@ function _1(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 kt=H1,gy=u,V1=Nr;function Q(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 vy(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function eo(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 yy(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 Nx(e){if(eo(e)!==e)throw Error(Q(188))}function Y1(e){var t=e.alternate;if(!t){if(t=eo(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var n=e,a=t;;){var l=n.return;if(l===null)break;var r=l.alternate;if(r===null){if(a=l.return,a!==null){n=a;continue}break}if(l.child===r.child){for(r=l.child;r;){if(r===n)return Nx(l),e;if(r===a)return Nx(l),t;r=r.sibling}throw Error(Q(188))}if(n.return!==a.return)n=l,a=r;else{for(var i=!1,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){for(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)throw Error(Q(189))}}if(n.alternate!==a)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function by(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=by(e),t!==null)return t;e=e.sibling}return null}var Je=Object.assign,F1=Symbol.for("react.element"),zo=Symbol.for("react.transitional.element"),ti=Symbol.for("react.portal"),zl=Symbol.for("react.fragment"),jy=Symbol.for("react.strict_mode"),Gf=Symbol.for("react.profiler"),X1=Symbol.for("react.provider"),_y=Symbol.for("react.consumer"),Bs=Symbol.for("react.context"),gm=Symbol.for("react.forward_ref"),Vf=Symbol.for("react.suspense"),Yf=Symbol.for("react.suspense_list"),vm=Symbol.for("react.memo"),ca=Symbol.for("react.lazy"),Ff=Symbol.for("react.activity"),K1=Symbol.for("react.memo_cache_sentinel"),kx=Symbol.iterator;function qr(e){return e===null||typeof e!="object"?null:(e=kx&&e[kx]||e["@@iterator"],typeof e=="function"?e:null)}var Q1=Symbol.for("react.client.reference");function Xf(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Q1?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case zl:return"Fragment";case Gf:return"Profiler";case jy:return"StrictMode";case Vf:return"Suspense";case Yf:return"SuspenseList";case Ff:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case ti:return"Portal";case Bs:return(e.displayName||"Context")+".Provider";case _y:return(e._context.displayName||"Context")+".Consumer";case gm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case vm:return t=e.displayName||null,t!==null?t:Xf(e.type)||"Memo";case ca:t=e._payload,e=e._init;try{return Xf(e(t))}catch{}}return null}var ni=Array.isArray,je=gy.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ue=V1.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Qa={pending:!1,data:null,method:null,action:null},Kf=[],Ll=-1;function js(e){return{current:e}}function Mt(e){0>Ll||(e.current=Kf[Ll],Kf[Ll]=null,Ll--)}function nt(e,t){Ll++,Kf[Ll]=e.current,e.current=t}var ms=js(null),Ri=js(null),ja=js(null),$c=js(null);function Dc(e,t){switch(nt(ja,t),nt(Ri,e),nt(ms,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Eg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Eg(t),e=Bj(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Mt(ms),nt(ms,e)}function or(){Mt(ms),Mt(Ri),Mt(ja)}function Qf(e){e.memoizedState!==null&&nt($c,e);var t=ms.current,n=Bj(t,e.type);t!==n&&(nt(Ri,e),nt(ms,n))}function zc(e){Ri.current===e&&(Mt(ms),Mt(Ri)),$c.current===e&&(Mt($c),Bi._currentValue=Qa)}var Zf=Object.prototype.hasOwnProperty,ym=kt.unstable_scheduleCallback,Dd=kt.unstable_cancelCallback,Z1=kt.unstable_shouldYield,W1=kt.unstable_requestPaint,ps=kt.unstable_now,J1=kt.unstable_getCurrentPriorityLevel,wy=kt.unstable_ImmediatePriority,Ny=kt.unstable_UserBlockingPriority,Lc=kt.unstable_NormalPriority,eS=kt.unstable_LowPriority,ky=kt.unstable_IdlePriority,tS=kt.log,nS=kt.unstable_setDisableYieldValue,to=null,un=null;function pa(e){if(typeof tS=="function"&&nS(e),un&&typeof un.setStrictMode=="function")try{un.setStrictMode(to,e)}catch{}}var dn=Math.clz32?Math.clz32:lS,sS=Math.log,aS=Math.LN2;function lS(e){return e>>>=0,e===0?32:31-(sS(e)/aS|0)|0}var Lo=256,Uo=4194304;function Ya(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 Ou(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var l=0,r=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var o=a&134217727;return o!==0?(a=o&~r,a!==0?l=Ya(a):(i&=o,i!==0?l=Ya(i):n||(n=o&~e,n!==0&&(l=Ya(n))))):(o=a&~r,o!==0?l=Ya(o):i!==0?l=Ya(i):n||(n=a&~e,n!==0&&(l=Ya(n)))),l===0?0:t!==0&&t!==l&&!(t&r)&&(r=l&-l,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:l}function no(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function rS(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 Sy(){var e=Lo;return Lo<<=1,!(Lo&4194048)&&(Lo=256),e}function Cy(){var e=Uo;return Uo<<=1,!(Uo&62914560)&&(Uo=4194304),e}function zd(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function so(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function iS(e,t,n,a,l,r){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-dn(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&&Ty(e,a,0),r!==0&&l===0&&e.tag!==0&&(e.suspendedLanes|=r&~(i&~t))}function Ty(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-dn(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&4194090}function Ry(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-dn(n),l=1<<a;l&t|e[a]&t&&(e[a]|=t),n&=~l}}function bm(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 jm(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ey(){var e=Ue.p;return e!==0?e:(e=window.event,e===void 0?32:Kj(e.type))}function oS(e,t){var n=Ue.p;try{return Ue.p=e,t()}finally{Ue.p=n}}var za=Math.random().toString(36).slice(2),Ht="__reactFiber$"+za,Wt="__reactProps$"+za,kr="__reactContainer$"+za,Wf="__reactEvents$"+za,cS="__reactListeners$"+za,uS="__reactHandles$"+za,Sx="__reactResources$"+za,ao="__reactMarker$"+za;function _m(e){delete e[Ht],delete e[Wt],delete e[Wf],delete e[cS],delete e[uS]}function Ul(e){var t=e[Ht];if(t)return t;for(var n=e.parentNode;n;){if(t=n[kr]||n[Ht]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Og(e);e!==null;){if(n=e[Ht])return n;e=Og(e)}return t}e=n,n=e.parentNode}return null}function Sr(e){if(e=e[Ht]||e[kr]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function si(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Q(33))}function Kl(e){var t=e[Sx];return t||(t=e[Sx]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Et(e){e[ao]=!0}var Ay=new Set,My={};function ml(e,t){cr(e,t),cr(e+"Capture",t)}function cr(e,t){for(My[e]=t,e=0;e<t.length;e++)Ay.add(t[e])}var dS=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]*$"),Cx={},Tx={};function fS(e){return Zf.call(Tx,e)?!0:Zf.call(Cx,e)?!1:dS.test(e)?Tx[e]=!0:(Cx[e]=!0,!1)}function fc(e,t,n){if(fS(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 Bo(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 As(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 Ld,Rx;function Ol(e){if(Ld===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ld=t&&t[1]||"",Rx=-1<n.stack.indexOf(`
41
+ */var kt=P1,yy=u,F1=Nr;function Q(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 by(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function eo(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 jy(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 Nx(e){if(eo(e)!==e)throw Error(Q(188))}function X1(e){var t=e.alternate;if(!t){if(t=eo(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var n=e,a=t;;){var l=n.return;if(l===null)break;var r=l.alternate;if(r===null){if(a=l.return,a!==null){n=a;continue}break}if(l.child===r.child){for(r=l.child;r;){if(r===n)return Nx(l),e;if(r===a)return Nx(l),t;r=r.sibling}throw Error(Q(188))}if(n.return!==a.return)n=l,a=r;else{for(var i=!1,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){for(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)throw Error(Q(189))}}if(n.alternate!==a)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function _y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=_y(e),t!==null)return t;e=e.sibling}return null}var Je=Object.assign,K1=Symbol.for("react.element"),zo=Symbol.for("react.transitional.element"),ti=Symbol.for("react.portal"),zl=Symbol.for("react.fragment"),wy=Symbol.for("react.strict_mode"),Gf=Symbol.for("react.profiler"),Q1=Symbol.for("react.provider"),Ny=Symbol.for("react.consumer"),Bs=Symbol.for("react.context"),gm=Symbol.for("react.forward_ref"),Vf=Symbol.for("react.suspense"),Yf=Symbol.for("react.suspense_list"),vm=Symbol.for("react.memo"),ca=Symbol.for("react.lazy"),Ff=Symbol.for("react.activity"),Z1=Symbol.for("react.memo_cache_sentinel"),kx=Symbol.iterator;function qr(e){return e===null||typeof e!="object"?null:(e=kx&&e[kx]||e["@@iterator"],typeof e=="function"?e:null)}var W1=Symbol.for("react.client.reference");function Xf(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===W1?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case zl:return"Fragment";case Gf:return"Profiler";case wy:return"StrictMode";case Vf:return"Suspense";case Yf:return"SuspenseList";case Ff:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case ti:return"Portal";case Bs:return(e.displayName||"Context")+".Provider";case Ny:return(e._context.displayName||"Context")+".Consumer";case gm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case vm:return t=e.displayName||null,t!==null?t:Xf(e.type)||"Memo";case ca:t=e._payload,e=e._init;try{return Xf(e(t))}catch{}}return null}var ni=Array.isArray,je=yy.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ue=F1.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Qa={pending:!1,data:null,method:null,action:null},Kf=[],Ll=-1;function js(e){return{current:e}}function Mt(e){0>Ll||(e.current=Kf[Ll],Kf[Ll]=null,Ll--)}function nt(e,t){Ll++,Kf[Ll]=e.current,e.current=t}var ms=js(null),Ti=js(null),ja=js(null),$c=js(null);function Dc(e,t){switch(nt(ja,t),nt(Ti,e),nt(ms,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Eg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Eg(t),e=Ij(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Mt(ms),nt(ms,e)}function or(){Mt(ms),Mt(Ti),Mt(ja)}function Qf(e){e.memoizedState!==null&&nt($c,e);var t=ms.current,n=Ij(t,e.type);t!==n&&(nt(Ti,e),nt(ms,n))}function zc(e){Ti.current===e&&(Mt(ms),Mt(Ti)),$c.current===e&&(Mt($c),Bi._currentValue=Qa)}var Zf=Object.prototype.hasOwnProperty,ym=kt.unstable_scheduleCallback,Dd=kt.unstable_cancelCallback,J1=kt.unstable_shouldYield,eS=kt.unstable_requestPaint,ps=kt.unstable_now,tS=kt.unstable_getCurrentPriorityLevel,ky=kt.unstable_ImmediatePriority,Sy=kt.unstable_UserBlockingPriority,Lc=kt.unstable_NormalPriority,nS=kt.unstable_LowPriority,Cy=kt.unstable_IdlePriority,sS=kt.log,aS=kt.unstable_setDisableYieldValue,to=null,un=null;function pa(e){if(typeof sS=="function"&&aS(e),un&&typeof un.setStrictMode=="function")try{un.setStrictMode(to,e)}catch{}}var dn=Math.clz32?Math.clz32:iS,lS=Math.log,rS=Math.LN2;function iS(e){return e>>>=0,e===0?32:31-(lS(e)/rS|0)|0}var Lo=256,Uo=4194304;function Ya(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 Ou(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var l=0,r=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var o=a&134217727;return o!==0?(a=o&~r,a!==0?l=Ya(a):(i&=o,i!==0?l=Ya(i):n||(n=o&~e,n!==0&&(l=Ya(n))))):(o=a&~r,o!==0?l=Ya(o):i!==0?l=Ya(i):n||(n=a&~e,n!==0&&(l=Ya(n)))),l===0?0:t!==0&&t!==l&&!(t&r)&&(r=l&-l,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:l}function no(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function oS(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 Ry(){var e=Lo;return Lo<<=1,!(Lo&4194048)&&(Lo=256),e}function Ty(){var e=Uo;return Uo<<=1,!(Uo&62914560)&&(Uo=4194304),e}function zd(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function so(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function cS(e,t,n,a,l,r){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-dn(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 g=m[f];g!==null&&(g.lane&=-536870913)}n&=~h}a!==0&&Ey(e,a,0),r!==0&&l===0&&e.tag!==0&&(e.suspendedLanes|=r&~(i&~t))}function Ey(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-dn(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&4194090}function Ay(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-dn(n),l=1<<a;l&t|e[a]&t&&(e[a]|=t),n&=~l}}function bm(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 jm(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function My(){var e=Ue.p;return e!==0?e:(e=window.event,e===void 0?32:Zj(e.type))}function uS(e,t){var n=Ue.p;try{return Ue.p=e,t()}finally{Ue.p=n}}var za=Math.random().toString(36).slice(2),Ht="__reactFiber$"+za,Wt="__reactProps$"+za,kr="__reactContainer$"+za,Wf="__reactEvents$"+za,dS="__reactListeners$"+za,fS="__reactHandles$"+za,Sx="__reactResources$"+za,ao="__reactMarker$"+za;function _m(e){delete e[Ht],delete e[Wt],delete e[Wf],delete e[dS],delete e[fS]}function Ul(e){var t=e[Ht];if(t)return t;for(var n=e.parentNode;n;){if(t=n[kr]||n[Ht]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Og(e);e!==null;){if(n=e[Ht])return n;e=Og(e)}return t}e=n,n=e.parentNode}return null}function Sr(e){if(e=e[Ht]||e[kr]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function si(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Q(33))}function Kl(e){var t=e[Sx];return t||(t=e[Sx]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Et(e){e[ao]=!0}var Oy=new Set,$y={};function ml(e,t){cr(e,t),cr(e+"Capture",t)}function cr(e,t){for($y[e]=t,e=0;e<t.length;e++)Oy.add(t[e])}var hS=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]*$"),Cx={},Rx={};function mS(e){return Zf.call(Rx,e)?!0:Zf.call(Cx,e)?!1:hS.test(e)?Rx[e]=!0:(Cx[e]=!0,!1)}function fc(e,t,n){if(mS(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 Bo(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 As(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 Ld,Tx;function Ol(e){if(Ld===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ld=t&&t[1]||"",Tx=-1<n.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+Ld+e+Rx}var Ud=!1;function Bd(e,t){if(!e||Ud)return"";Ud=!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 l=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");l&&l.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=a.DetermineComponentFrameRoot(),i=r[0],o=r[1];if(i&&o){var c=i.split(`
43
+ `+Ld+e+Tx}var Ud=!1;function Bd(e,t){if(!e||Ud)return"";Ud=!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(g){var m=g}Reflect.construct(e,[],h)}else{try{h.call()}catch(g){m=g}e.call(h.prototype)}}else{try{throw Error()}catch(g){m=g}(h=e())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(g){if(g&&m&&typeof g.stack=="string")return[g.stack,m.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var l=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");l&&l.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=a.DetermineComponentFrameRoot(),i=r[0],o=r[1];if(i&&o){var c=i.split(`
44
44
  `),d=o.split(`
45
45
  `);for(l=a=0;a<c.length&&!c[a].includes("DetermineComponentFrameRoot");)a++;for(;l<d.length&&!d[l].includes("DetermineComponentFrameRoot");)l++;if(a===c.length||l===d.length)for(a=c.length-1,l=d.length-1;1<=a&&0<=l&&c[a]!==d[l];)l--;for(;1<=a&&0<=l;a--,l--)if(c[a]!==d[l]){if(a!==1||l!==1)do if(a--,l--,0>l||c[a]!==d[l]){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<=l);break}}}finally{Ud=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ol(n):""}function hS(e){switch(e.tag){case 26:case 27:case 5:return Ol(e.type);case 16:return Ol("Lazy");case 13:return Ol("Suspense");case 19:return Ol("SuspenseList");case 0:case 15:return Bd(e.type,!1);case 11:return Bd(e.type.render,!1);case 1:return Bd(e.type,!0);case 31:return Ol("Activity");default:return""}}function Ex(e){try{var t="";do t+=hS(e),e=e.return;while(e);return t}catch(n){return`
46
+ `+c[a].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),f}while(1<=a&&0<=l);break}}}finally{Ud=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ol(n):""}function pS(e){switch(e.tag){case 26:case 27:case 5:return Ol(e.type);case 16:return Ol("Lazy");case 13:return Ol("Suspense");case 19:return Ol("SuspenseList");case 0:case 15:return Bd(e.type,!1);case 11:return Bd(e.type.render,!1);case 1:return Bd(e.type,!0);case 31:return Ol("Activity");default:return""}}function Ex(e){try{var t="";do t+=pS(e),e=e.return;while(e);return t}catch(n){return`
47
47
  Error generating stack: `+n.message+`
48
- `+n.stack}}function _n(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Oy(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function mS(e){var t=Oy(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 l=n.get,r=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){a=""+i,r.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 Uc(e){e._valueTracker||(e._valueTracker=mS(e))}function $y(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=Oy(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function Bc(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 pS=/[\n"\\]/g;function kn(e){return e.replace(pS,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Jf(e,t,n,a,l,r,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=""+_n(t)):e.value!==""+_n(t)&&(e.value=""+_n(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?eh(e,i,_n(t)):n!=null?eh(e,i,_n(n)):a!=null&&e.removeAttribute("value"),l==null&&r!=null&&(e.defaultChecked=!!r),l!=null&&(e.checked=l&&typeof l!="function"&&typeof l!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+_n(o):e.removeAttribute("name")}function Dy(e,t,n,a,l,r,i,o){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null))return;n=n!=null?""+_n(n):"",t=t!=null?""+_n(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}a=a??l,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 eh(e,t,n){t==="number"&&Bc(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ql(e,t,n,a){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&a&&(e[n].defaultSelected=!0)}else{for(n=""+_n(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,a&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function zy(e,t,n){if(t!=null&&(t=""+_n(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+_n(n):""}function Ly(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(Q(92));if(ni(a)){if(1<a.length)throw Error(Q(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=_n(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a)}function ur(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xS=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 Ax(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||xS.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Uy(e,t,n){if(t!=null&&typeof t!="object")throw Error(Q(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 l in t)a=t[l],t.hasOwnProperty(l)&&n[l]!==a&&Ax(e,l,a)}else for(var r in t)t.hasOwnProperty(r)&&Ax(e,r,t[r])}function wm(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 gS=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"]]),vS=/^[\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 hc(e){return vS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var th=null;function Nm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bl=null,Zl=null;function Mx(e){var t=Sr(e);if(t&&(e=t.stateNode)){var n=e[Wt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Jf(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="'+kn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var l=a[Wt]||null;if(!l)throw Error(Q(90));Jf(a,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&$y(a)}break e;case"textarea":zy(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ql(e,!!n.multiple,t,!1)}}}var Hd=!1;function By(e,t,n){if(Hd)return e(t,n);Hd=!0;try{var a=e(t);return a}finally{if(Hd=!1,(Bl!==null||Zl!==null)&&(qu(),Bl&&(t=Bl,e=Zl,Zl=Bl=null,Mx(t),e)))for(t=0;t<e.length;t++)Mx(e[t])}}function Ei(e,t){var n=e.stateNode;if(n===null)return null;var a=n[Wt]||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(Q(231,t,typeof n));return n}var Ys=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),nh=!1;if(Ys)try{var Gr={};Object.defineProperty(Gr,"passive",{get:function(){nh=!0}}),window.addEventListener("test",Gr,Gr),window.removeEventListener("test",Gr,Gr)}catch{nh=!1}var xa=null,km=null,mc=null;function Hy(){if(mc)return mc;var e,t=km,n=t.length,a,l="value"in xa?xa.value:xa.textContent,r=l.length;for(e=0;e<n&&t[e]===l[e];e++);var i=n-e;for(a=1;a<=i&&t[n-a]===l[r-a];a++);return mc=l.slice(e,1<a?1-a:void 0)}function pc(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 Ho(){return!0}function Ox(){return!1}function Jt(e){function t(n,a,l,r,i){this._reactName=n,this._targetInst=l,this.type=a,this.nativeEvent=r,this.target=i,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(r):r[o]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?Ho:Ox,this.isPropagationStopped=Ox,this}return Je(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=Ho)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ho)},persist:function(){},isPersistent:Ho}),t}var pl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$u=Jt(pl),lo=Je({},pl,{view:0,detail:0}),yS=Jt(lo),Id,Pd,Vr,Du=Je({},lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sm,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!==Vr&&(Vr&&e.type==="mousemove"?(Id=e.screenX-Vr.screenX,Pd=e.screenY-Vr.screenY):Pd=Id=0,Vr=e),Id)},movementY:function(e){return"movementY"in e?e.movementY:Pd}}),$x=Jt(Du),bS=Je({},Du,{dataTransfer:0}),jS=Jt(bS),_S=Je({},lo,{relatedTarget:0}),qd=Jt(_S),wS=Je({},pl,{animationName:0,elapsedTime:0,pseudoElement:0}),NS=Jt(wS),kS=Je({},pl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),SS=Jt(kS),CS=Je({},pl,{data:0}),Dx=Jt(CS),TS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},RS={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"},ES={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function AS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ES[e])?!!t[e]:!1}function Sm(){return AS}var MS=Je({},lo,{key:function(e){if(e.key){var t=TS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=pc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?RS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sm,charCode:function(e){return e.type==="keypress"?pc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?pc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),OS=Jt(MS),$S=Je({},Du,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zx=Jt($S),DS=Je({},lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sm}),zS=Jt(DS),LS=Je({},pl,{propertyName:0,elapsedTime:0,pseudoElement:0}),US=Jt(LS),BS=Je({},Du,{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}),HS=Jt(BS),IS=Je({},pl,{newState:0,oldState:0}),PS=Jt(IS),qS=[9,13,27,32],Cm=Ys&&"CompositionEvent"in window,fi=null;Ys&&"documentMode"in document&&(fi=document.documentMode);var GS=Ys&&"TextEvent"in window&&!fi,Iy=Ys&&(!Cm||fi&&8<fi&&11>=fi),Lx=" ",Ux=!1;function Py(e,t){switch(e){case"keyup":return qS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qy(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hl=!1;function VS(e,t){switch(e){case"compositionend":return qy(t);case"keypress":return t.which!==32?null:(Ux=!0,Lx);case"textInput":return e=t.data,e===Lx&&Ux?null:e;default:return null}}function YS(e,t){if(Hl)return e==="compositionend"||!Cm&&Py(e,t)?(e=Hy(),mc=km=xa=null,Hl=!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 Iy&&t.locale!=="ko"?null:t.data;default:return null}}var FS={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 Bx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!FS[e.type]:t==="textarea"}function Gy(e,t,n,a){Bl?Zl?Zl.push(a):Zl=[a]:Bl=a,t=su(t,"onChange"),0<t.length&&(n=new $u("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var hi=null,Ai=null;function XS(e){zj(e,0)}function zu(e){var t=si(e);if($y(t))return e}function Hx(e,t){if(e==="change")return t}var Vy=!1;if(Ys){var Gd;if(Ys){var Vd="oninput"in document;if(!Vd){var Ix=document.createElement("div");Ix.setAttribute("oninput","return;"),Vd=typeof Ix.oninput=="function"}Gd=Vd}else Gd=!1;Vy=Gd&&(!document.documentMode||9<document.documentMode)}function Px(){hi&&(hi.detachEvent("onpropertychange",Yy),Ai=hi=null)}function Yy(e){if(e.propertyName==="value"&&zu(Ai)){var t=[];Gy(t,Ai,e,Nm(e)),By(XS,t)}}function KS(e,t,n){e==="focusin"?(Px(),hi=t,Ai=n,hi.attachEvent("onpropertychange",Yy)):e==="focusout"&&Px()}function QS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return zu(Ai)}function ZS(e,t){if(e==="click")return zu(t)}function WS(e,t){if(e==="input"||e==="change")return zu(t)}function JS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pn=typeof Object.is=="function"?Object.is:JS;function Mi(e,t){if(pn(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 l=n[a];if(!Zf.call(t,l)||!pn(e[l],t[l]))return!1}return!0}function qx(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gx(e,t){var n=qx(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=qx(n)}}function Fy(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fy(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Xy(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bc(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=Bc(e.document)}return t}function Tm(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 e2=Ys&&"documentMode"in document&&11>=document.documentMode,Il=null,sh=null,mi=null,ah=!1;function Vx(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ah||Il==null||Il!==Bc(a)||(a=Il,"selectionStart"in a&&Tm(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}),mi&&Mi(mi,a)||(mi=a,a=su(sh,"onSelect"),0<a.length&&(t=new $u("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Il)))}function Ga(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Pl={animationend:Ga("Animation","AnimationEnd"),animationiteration:Ga("Animation","AnimationIteration"),animationstart:Ga("Animation","AnimationStart"),transitionrun:Ga("Transition","TransitionRun"),transitionstart:Ga("Transition","TransitionStart"),transitioncancel:Ga("Transition","TransitionCancel"),transitionend:Ga("Transition","TransitionEnd")},Yd={},Ky={};Ys&&(Ky=document.createElement("div").style,"AnimationEvent"in window||(delete Pl.animationend.animation,delete Pl.animationiteration.animation,delete Pl.animationstart.animation),"TransitionEvent"in window||delete Pl.transitionend.transition);function xl(e){if(Yd[e])return Yd[e];if(!Pl[e])return e;var t=Pl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ky)return Yd[e]=t[n];return e}var Qy=xl("animationend"),Zy=xl("animationiteration"),Wy=xl("animationstart"),t2=xl("transitionrun"),n2=xl("transitionstart"),s2=xl("transitioncancel"),Jy=xl("transitionend"),eb=new Map,lh="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(" ");lh.push("scrollEnd");function Zn(e,t){eb.set(e,t),ml(t,[e])}var Yx=new WeakMap;function Sn(e,t){if(typeof e=="object"&&e!==null){var n=Yx.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Ex(t)},Yx.set(e,t),t)}return{value:e,source:t,stack:Ex(t)}}var jn=[],ql=0,Rm=0;function Lu(){for(var e=ql,t=Rm=ql=0;t<e;){var n=jn[t];jn[t++]=null;var a=jn[t];jn[t++]=null;var l=jn[t];jn[t++]=null;var r=jn[t];if(jn[t++]=null,a!==null&&l!==null){var i=a.pending;i===null?l.next=l:(l.next=i.next,i.next=l),a.pending=l}r!==0&&tb(n,l,r)}}function Uu(e,t,n,a){jn[ql++]=e,jn[ql++]=t,jn[ql++]=n,jn[ql++]=a,Rm|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Em(e,t,n,a){return Uu(e,t,n,a),Hc(e)}function Cr(e,t){return Uu(e,null,null,t),Hc(e)}function tb(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var l=!1,r=e.return;r!==null;)r.childLanes|=n,a=r.alternate,a!==null&&(a.childLanes|=n),r.tag===22&&(e=r.stateNode,e===null||e._visibility&1||(l=!0)),e=r,r=r.return;return e.tag===3?(r=e.stateNode,l&&t!==null&&(l=31-dn(n),e=r.hiddenUpdates,a=e[l],a===null?e[l]=[t]:a.push(t),t.lane=n|536870912),r):null}function Hc(e){if(50<Ni)throw Ni=0,Sh=null,Error(Q(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Gl={};function a2(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 a2(e,t,n,a)}function Am(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Gs(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 nb(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 xc(e,t,n,a,l,r){var i=0;if(a=e,typeof e=="function")Am(e)&&(i=1);else if(typeof e=="string")i=rC(e,n,ms.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Ff:return e=cn(31,n,t,l),e.elementType=Ff,e.lanes=r,e;case zl:return Za(n.children,l,r,t);case jy:i=8,l|=24;break;case Gf:return e=cn(12,n,t,l|2),e.elementType=Gf,e.lanes=r,e;case Vf:return e=cn(13,n,t,l),e.elementType=Vf,e.lanes=r,e;case Yf:return e=cn(19,n,t,l),e.elementType=Yf,e.lanes=r,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case X1:case Bs:i=10;break e;case _y:i=9;break e;case gm:i=11;break e;case vm:i=14;break e;case ca:i=16,a=null;break e}i=29,n=Error(Q(130,e===null?"null":typeof e,"")),a=null}return t=cn(i,n,t,l),t.elementType=e,t.type=a,t.lanes=r,t}function Za(e,t,n,a){return e=cn(7,e,a,t),e.lanes=n,e}function Fd(e,t,n){return e=cn(6,e,null,t),e.lanes=n,e}function Xd(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 Vl=[],Yl=0,Ic=null,Pc=0,wn=[],Nn=0,Wa=null,Hs=1,Is="";function Fa(e,t){Vl[Yl++]=Pc,Vl[Yl++]=Ic,Ic=e,Pc=t}function sb(e,t,n){wn[Nn++]=Hs,wn[Nn++]=Is,wn[Nn++]=Wa,Wa=e;var a=Hs;e=Is;var l=32-dn(a)-1;a&=~(1<<l),n+=1;var r=32-dn(t)+l;if(30<r){var i=l-l%5;r=(a&(1<<i)-1).toString(32),a>>=i,l-=i,Hs=1<<32-dn(t)+l|n<<l|a,Is=r+e}else Hs=1<<r|n<<l|a,Is=e}function Mm(e){e.return!==null&&(Fa(e,1),sb(e,1,0))}function Om(e){for(;e===Ic;)Ic=Vl[--Yl],Vl[Yl]=null,Pc=Vl[--Yl],Vl[Yl]=null;for(;e===Wa;)Wa=wn[--Nn],wn[Nn]=null,Is=wn[--Nn],wn[Nn]=null,Hs=wn[--Nn],wn[Nn]=null}var qt=null,ct=null,Le=!1,Ja=null,os=!1,rh=Error(Q(519));function al(e){var t=Error(Q(418,""));throw Oi(Sn(t,e)),rh}function Fx(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[Ht]=e,t[Wt]=a,n){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(n=0;n<zi.length;n++)Ee(zi[n],t);break;case"source":Ee("error",t);break;case"img":case"image":case"link":Ee("error",t),Ee("load",t);break;case"details":Ee("toggle",t);break;case"input":Ee("invalid",t),Dy(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0),Uc(t);break;case"select":Ee("invalid",t);break;case"textarea":Ee("invalid",t),Ly(t,a.value,a.defaultValue,a.children),Uc(t)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||Uj(t.textContent,n)?(a.popover!=null&&(Ee("beforetoggle",t),Ee("toggle",t)),a.onScroll!=null&&Ee("scroll",t),a.onScrollEnd!=null&&Ee("scrollend",t),a.onClick!=null&&(t.onclick=Yu),t=!0):t=!1,t||al(e)}function Xx(e){for(qt=e.return;qt;)switch(qt.tag){case 5:case 13:os=!1;return;case 27:case 3:os=!0;return;default:qt=qt.return}}function Yr(e){if(e!==qt)return!1;if(!Le)return Xx(e),Le=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Mh(e.type,e.memoizedProps)),n=!n),n&&ct&&al(e),Xx(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(n=e.data,n==="/$"){if(t===0){ct=Gn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++;e=e.nextSibling}ct=null}}else t===27?(t=ct,La(e.type)?(e=Dh,Dh=null,ct=e):ct=t):ct=qt?Gn(e.stateNode.nextSibling):null;return!0}function ro(){ct=qt=null,Le=!1}function Kx(){var e=Ja;return e!==null&&(Zt===null?Zt=e:Zt.push.apply(Zt,e),Ja=null),e}function Oi(e){Ja===null?Ja=[e]:Ja.push(e)}var ih=js(null),gl=null,Ps=null;function da(e,t,n){nt(ih,t._currentValue),t._currentValue=n}function Vs(e){e._currentValue=ih.current,Mt(ih)}function oh(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 ch(e,t,n,a){var l=e.child;for(l!==null&&(l.return=e);l!==null;){var r=l.dependencies;if(r!==null){var i=l.child;r=r.firstContext;e:for(;r!==null;){var o=r;r=l;for(var c=0;c<t.length;c++)if(o.context===t[c]){r.lanes|=n,o=r.alternate,o!==null&&(o.lanes|=n),oh(r.return,n,e),a||(i=null);break e}r=o.next}}else if(l.tag===18){if(i=l.return,i===null)throw Error(Q(341));i.lanes|=n,r=i.alternate,r!==null&&(r.lanes|=n),oh(i,n,e),i=null}else i=l.child;if(i!==null)i.return=l;else for(i=l;i!==null;){if(i===e){i=null;break}if(l=i.sibling,l!==null){l.return=i.return,i=l;break}i=i.return}l=i}}function io(e,t,n,a){e=null;for(var l=t,r=!1;l!==null;){if(!r){if(l.flags&524288)r=!0;else if(l.flags&262144)break}if(l.tag===10){var i=l.alternate;if(i===null)throw Error(Q(387));if(i=i.memoizedProps,i!==null){var o=l.type;pn(l.pendingProps.value,i.value)||(e!==null?e.push(o):e=[o])}}else if(l===$c.current){if(i=l.alternate,i===null)throw Error(Q(387));i.memoizedState.memoizedState!==l.memoizedState.memoizedState&&(e!==null?e.push(Bi):e=[Bi])}l=l.return}e!==null&&ch(t,e,n,a),t.flags|=262144}function qc(e){for(e=e.firstContext;e!==null;){if(!pn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ll(e){gl=e,Ps=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function It(e){return ab(gl,e)}function Io(e,t){return gl===null&&ll(e),ab(e,t)}function ab(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ps===null){if(e===null)throw Error(Q(308));Ps=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ps=Ps.next=t;return n}var l2=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()})}},r2=kt.unstable_scheduleCallback,i2=kt.unstable_NormalPriority,wt={$$typeof:Bs,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $m(){return{controller:new l2,data:new Map,refCount:0}}function oo(e){e.refCount--,e.refCount===0&&r2(i2,function(){e.controller.abort()})}var pi=null,uh=0,dr=0,Wl=null;function o2(e,t){if(pi===null){var n=pi=[];uh=0,dr=sp(),Wl={status:"pending",value:void 0,then:function(a){n.push(a)}}}return uh++,t.then(Qx,Qx),t}function Qx(){if(--uh===0&&pi!==null){Wl!==null&&(Wl.status="fulfilled");var e=pi;pi=null,dr=0,Wl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function c2(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(l){n.push(l)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var l=0;l<n.length;l++)(0,n[l])(t)},function(l){for(a.status="rejected",a.reason=l,l=0;l<n.length;l++)(0,n[l])(void 0)}),a}var Zx=je.S;je.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&o2(e,t),Zx!==null&&Zx(e,t)};var el=js(null);function Dm(){var e=el.current;return e!==null?e:We.pooledCache}function gc(e,t){t===null?nt(el,el.current):nt(el,t.pool)}function lb(){var e=Dm();return e===null?null:{parent:wt._currentValue,pool:e}}var co=Error(Q(460)),rb=Error(Q(474)),Bu=Error(Q(542)),dh={then:function(){}};function Wx(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Po(){}function ib(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Po,Po),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(Po,Po);else{if(e=We,e!==null&&100<e.shellSuspendCounter)throw Error(Q(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var l=t;l.status="fulfilled",l.value=a}},function(a){if(t.status==="pending"){var l=t;l.status="rejected",l.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,eg(e),e}throw xi=t,co}}var xi=null;function Jx(){if(xi===null)throw Error(Q(459));var e=xi;return xi=null,e}function eg(e){if(e===co||e===Bu)throw Error(Q(483))}var ua=!1;function zm(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function fh(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 _a(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wa(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,qe&2){var l=a.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),a.pending=t,t=Hc(e),tb(e,null,n),t}return Uu(e,a,t,n),Hc(e)}function gi(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,Ry(e,n)}}function Kd(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var l=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?l=r=i:r=r.next=i,n=n.next}while(n!==null);r===null?l=r=t:r=r.next=t}else l=r=t;n={baseState:a.baseState,firstBaseUpdate:l,lastBaseUpdate:r,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 hh=!1;function vi(){if(hh){var e=Wl;if(e!==null)throw e}}function yi(e,t,n,a){hh=!1;var l=e.updateQueue;ua=!1;var r=l.firstBaseUpdate,i=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var c=o,d=c.next;c.next=null,i===null?r=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(r!==null){var h=l.baseState;i=0,f=d=c=null,o=r;do{var m=o.lane&-536870913,x=m!==o.lane;if(x?($e&m)===m:(a&m)===m){m!==0&&m===dr&&(hh=!0),f!==null&&(f=f.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var j=e,v=o;m=t;var y=n;switch(v.tag){case 1:if(j=v.payload,typeof j=="function"){h=j.call(y,h,m);break e}h=j;break e;case 3:j.flags=j.flags&-65537|128;case 0:if(j=v.payload,m=typeof j=="function"?j.call(y,h,m):j,m==null)break e;h=Je({},h,m);break e;case 2:ua=!0}}m=o.callback,m!==null&&(e.flags|=64,x&&(e.flags|=8192),x=l.callbacks,x===null?l.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=l.shared.pending,o===null)break;x=o,o=x.next,x.next=null,l.lastBaseUpdate=x,l.shared.pending=null}}while(!0);f===null&&(c=h),l.baseState=c,l.firstBaseUpdate=d,l.lastBaseUpdate=f,r===null&&(l.shared.lanes=0),Ma|=i,e.lanes=i,e.memoizedState=h}}function ob(e,t){if(typeof e!="function")throw Error(Q(191,e));e.call(t)}function cb(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)ob(n[e],t)}var fr=js(null),Gc=js(0);function tg(e,t){e=Ks,nt(Gc,e),nt(fr,t),Ks=e|t.baseLanes}function mh(){nt(Gc,Ks),nt(fr,fr.current)}function Lm(){Ks=Gc.current,Mt(fr),Mt(Gc)}var Ea=0,Re=null,Xe=null,gt=null,Vc=!1,Jl=!1,rl=!1,Yc=0,$i=0,er=null,u2=0;function ht(){throw Error(Q(321))}function Um(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!pn(e[n],t[n]))return!1;return!0}function Bm(e,t,n,a,l,r){return Ea=r,Re=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,je.H=e===null||e.memoizedState===null?Hb:Ib,rl=!1,r=n(a,l),rl=!1,Jl&&(r=db(t,n,a,l)),ub(e),r}function ub(e){je.H=Fc;var t=Xe!==null&&Xe.next!==null;if(Ea=0,gt=Xe=Re=null,Vc=!1,$i=0,er=null,t)throw Error(Q(300));e===null||At||(e=e.dependencies,e!==null&&qc(e)&&(At=!0))}function db(e,t,n,a){Re=e;var l=0;do{if(Jl&&(er=null),$i=0,Jl=!1,25<=l)throw Error(Q(301));if(l+=1,gt=Xe=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}je.H=g2,r=t(n,a)}while(Jl);return r}function d2(){var e=je.H,t=e.useState()[0];return t=typeof t.then=="function"?uo(t):t,e=e.useState()[0],(Xe!==null?Xe.memoizedState:null)!==e&&(Re.flags|=1024),t}function Hm(){var e=Yc!==0;return Yc=0,e}function Im(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Pm(e){if(Vc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Vc=!1}Ea=0,gt=Xe=Re=null,Jl=!1,$i=Yc=0,er=null}function Kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?Re.memoizedState=gt=e:gt=gt.next=e,gt}function bt(){if(Xe===null){var e=Re.alternate;e=e!==null?e.memoizedState:null}else e=Xe.next;var t=gt===null?Re.memoizedState:gt.next;if(t!==null)gt=t,Xe=e;else{if(e===null)throw Re.alternate===null?Error(Q(467)):Error(Q(310));Xe=e,e={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},gt===null?Re.memoizedState=gt=e:gt=gt.next=e}return gt}function qm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function uo(e){var t=$i;return $i+=1,er===null&&(er=[]),e=ib(er,e,t),t=Re,(gt===null?t.memoizedState:gt.next)===null&&(t=t.alternate,je.H=t===null||t.memoizedState===null?Hb:Ib),e}function Hu(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return uo(e);if(e.$$typeof===Bs)return It(e)}throw Error(Q(438,String(e)))}function Gm(e){var t=null,n=Re.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Re.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(l){return l.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=qm(),Re.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]=K1;return t.index++,n}function Fs(e,t){return typeof t=="function"?t(e):t}function vc(e){var t=bt();return Vm(t,Xe,e)}function Vm(e,t,n){var a=e.queue;if(a===null)throw Error(Q(311));a.lastRenderedReducer=n;var l=e.baseQueue,r=a.pending;if(r!==null){if(l!==null){var i=l.next;l.next=r.next,r.next=i}t.baseQueue=l=r,a.pending=null}if(r=e.baseState,l===null)e.memoizedState=r;else{t=l.next;var o=i=null,c=null,d=t,f=!1;do{var h=d.lane&-536870913;if(h!==d.lane?($e&h)===h:(Ea&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===dr&&(f=!0);else if((Ea&m)===m){d=d.next,m===dr&&(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=r):c=c.next=h,Re.lanes|=m,Ma|=m;h=d.action,rl&&n(r,h),r=d.hasEagerState?d.eagerState:n(r,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=r):c=c.next=m,Re.lanes|=h,Ma|=h;d=d.next}while(d!==null&&d!==t);if(c===null?i=r:c.next=o,!pn(r,e.memoizedState)&&(At=!0,f&&(n=Wl,n!==null)))throw n;e.memoizedState=r,e.baseState=i,e.baseQueue=c,a.lastRenderedState=r}return l===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function Qd(e){var t=bt(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var a=n.dispatch,l=n.pending,r=t.memoizedState;if(l!==null){n.pending=null;var i=l=l.next;do r=e(r,i.action),i=i.next;while(i!==l);pn(r,t.memoizedState)||(At=!0),t.memoizedState=r,t.baseQueue===null&&(t.baseState=r),n.lastRenderedState=r}return[r,a]}function fb(e,t,n){var a=Re,l=bt(),r=Le;if(r){if(n===void 0)throw Error(Q(407));n=n()}else n=t();var i=!pn((Xe||l).memoizedState,n);i&&(l.memoizedState=n,At=!0),l=l.queue;var o=pb.bind(null,a,l,e);if(fo(2048,8,o,[e]),l.getSnapshot!==t||i||gt!==null&&gt.memoizedState.tag&1){if(a.flags|=2048,hr(9,Iu(),mb.bind(null,a,l,n,t),null),We===null)throw Error(Q(349));r||Ea&124||hb(a,t,n)}return n}function hb(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Re.updateQueue,t===null?(t=qm(),Re.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function mb(e,t,n,a){t.value=n,t.getSnapshot=a,xb(t)&&gb(e)}function pb(e,t,n){return n(function(){xb(t)&&gb(e)})}function xb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!pn(e,n)}catch{return!0}}function gb(e){var t=Cr(e,2);t!==null&&hn(t,e,2)}function ph(e){var t=Kt();if(typeof e=="function"){var n=e;if(e=n(),rl){pa(!0);try{n()}finally{pa(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:e},t}function vb(e,t,n,a){return e.baseState=n,Vm(e,Xe,typeof a=="function"?a:Fs)}function f2(e,t,n,a,l){if(Pu(e))throw Error(Q(485));if(e=t.action,e!==null){var r={payload:l,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){r.listeners.push(i)}};je.T!==null?n(!0):r.isTransition=!1,a(r),n=t.pending,n===null?(r.next=t.pending=r,yb(t,r)):(r.next=n.next,t.pending=n.next=r)}}function yb(e,t){var n=t.action,a=t.payload,l=e.state;if(t.isTransition){var r=je.T,i={};je.T=i;try{var o=n(l,a),c=je.S;c!==null&&c(i,o),ng(e,t,o)}catch(d){xh(e,t,d)}finally{je.T=r}}else try{r=n(l,a),ng(e,t,r)}catch(d){xh(e,t,d)}}function ng(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){sg(e,t,a)},function(a){return xh(e,t,a)}):sg(e,t,n)}function sg(e,t,n){t.status="fulfilled",t.value=n,bb(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,yb(e,n)))}function xh(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,bb(t),t=t.next;while(t!==a)}e.action=null}function bb(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function jb(e,t){return t}function ag(e,t){if(Le){var n=We.formState;if(n!==null){e:{var a=Re;if(Le){if(ct){t:{for(var l=ct,r=os;l.nodeType!==8;){if(!r){l=null;break t}if(l=Gn(l.nextSibling),l===null){l=null;break t}}r=l.data,l=r==="F!"||r==="F"?l:null}if(l){ct=Gn(l.nextSibling),a=l.data==="F!";break e}}al(a)}a=!1}a&&(t=n[0])}}return n=Kt(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jb,lastRenderedState:t},n.queue=a,n=Lb.bind(null,Re,a),a.dispatch=n,a=ph(!1),r=Km.bind(null,Re,!1,a.queue),a=Kt(),l={state:t,dispatch:null,action:e,pending:null},a.queue=l,n=f2.bind(null,Re,l,r,n),l.dispatch=n,a.memoizedState=e,[t,n,!1]}function lg(e){var t=bt();return _b(t,Xe,e)}function _b(e,t,n){if(t=Vm(e,t,jb)[0],e=vc(Fs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=uo(t)}catch(i){throw i===co?Bu:i}else a=t;t=bt();var l=t.queue,r=l.dispatch;return n!==t.memoizedState&&(Re.flags|=2048,hr(9,Iu(),h2.bind(null,l,n),null)),[a,r,e]}function h2(e,t){e.action=t}function rg(e){var t=bt(),n=Xe;if(n!==null)return _b(t,n,e);bt(),t=t.memoizedState,n=bt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function hr(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Re.updateQueue,t===null&&(t=qm(),Re.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 Iu(){return{destroy:void 0,resource:void 0}}function wb(){return bt().memoizedState}function yc(e,t,n,a){var l=Kt();a=a===void 0?null:a,Re.flags|=e,l.memoizedState=hr(1|t,Iu(),n,a)}function fo(e,t,n,a){var l=bt();a=a===void 0?null:a;var r=l.memoizedState.inst;Xe!==null&&a!==null&&Um(a,Xe.memoizedState.deps)?l.memoizedState=hr(t,r,n,a):(Re.flags|=e,l.memoizedState=hr(1|t,r,n,a))}function ig(e,t){yc(8390656,8,e,t)}function Nb(e,t){fo(2048,8,e,t)}function kb(e,t){return fo(4,2,e,t)}function Sb(e,t){return fo(4,4,e,t)}function Cb(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 Tb(e,t,n){n=n!=null?n.concat([e]):null,fo(4,4,Cb.bind(null,t,e),n)}function Ym(){}function Rb(e,t){var n=bt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&Um(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function Eb(e,t){var n=bt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&Um(t,a[1]))return a[0];if(a=e(),rl){pa(!0);try{e()}finally{pa(!1)}}return n.memoizedState=[a,t],a}function Fm(e,t,n){return n===void 0||Ea&1073741824?e.memoizedState=t:(e.memoizedState=n,e=bj(),Re.lanes|=e,Ma|=e,n)}function Ab(e,t,n,a){return pn(n,t)?n:fr.current!==null?(e=Fm(e,n,a),pn(e,t)||(At=!0),e):Ea&42?(e=bj(),Re.lanes|=e,Ma|=e,t):(At=!0,e.memoizedState=n)}function Mb(e,t,n,a,l){var r=Ue.p;Ue.p=r!==0&&8>r?r:8;var i=je.T,o={};je.T=o,Km(e,!1,t,n);try{var c=l(),d=je.S;if(d!==null&&d(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=c2(c,a);bi(e,t,f,fn(e))}else bi(e,t,a,fn(e))}catch(h){bi(e,t,{then:function(){},status:"rejected",reason:h},fn())}finally{Ue.p=r,je.T=i}}function m2(){}function gh(e,t,n,a){if(e.tag!==5)throw Error(Q(476));var l=Ob(e).queue;Mb(e,l,t,Qa,n===null?m2:function(){return $b(e),n(a)})}function Ob(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Qa,baseState:Qa,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:Qa},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function $b(e){var t=Ob(e).next.queue;bi(e,t,{},fn())}function Xm(){return It(Bi)}function Db(){return bt().memoizedState}function zb(){return bt().memoizedState}function p2(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=fn();e=_a(n);var a=wa(t,e,n);a!==null&&(hn(a,t,n),gi(a,t,n)),t={cache:$m()},e.payload=t;return}t=t.return}}function x2(e,t,n){var a=fn();n={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},Pu(e)?Ub(t,n):(n=Em(e,t,n,a),n!==null&&(hn(n,e,a),Bb(n,t,a)))}function Lb(e,t,n){var a=fn();bi(e,t,n,a)}function bi(e,t,n,a){var l={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(Pu(e))Ub(t,l);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var i=t.lastRenderedState,o=r(i,n);if(l.hasEagerState=!0,l.eagerState=o,pn(o,i))return Uu(e,t,l,0),We===null&&Lu(),!1}catch{}finally{}if(n=Em(e,t,l,a),n!==null)return hn(n,e,a),Bb(n,t,a),!0}return!1}function Km(e,t,n,a){if(a={lane:2,revertLane:sp(),action:a,hasEagerState:!1,eagerState:null,next:null},Pu(e)){if(t)throw Error(Q(479))}else t=Em(e,n,a,2),t!==null&&hn(t,e,2)}function Pu(e){var t=e.alternate;return e===Re||t!==null&&t===Re}function Ub(e,t){Jl=Vc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bb(e,t,n){if(n&4194048){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Ry(e,n)}}var Fc={readContext:It,use:Hu,useCallback:ht,useContext:ht,useEffect:ht,useImperativeHandle:ht,useLayoutEffect:ht,useInsertionEffect:ht,useMemo:ht,useReducer:ht,useRef:ht,useState:ht,useDebugValue:ht,useDeferredValue:ht,useTransition:ht,useSyncExternalStore:ht,useId:ht,useHostTransitionStatus:ht,useFormState:ht,useActionState:ht,useOptimistic:ht,useMemoCache:ht,useCacheRefresh:ht},Hb={readContext:It,use:Hu,useCallback:function(e,t){return Kt().memoizedState=[e,t===void 0?null:t],e},useContext:It,useEffect:ig,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,yc(4194308,4,Cb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return yc(4194308,4,e,t)},useInsertionEffect:function(e,t){yc(4,2,e,t)},useMemo:function(e,t){var n=Kt();t=t===void 0?null:t;var a=e();if(rl){pa(!0);try{e()}finally{pa(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=Kt();if(n!==void 0){var l=n(t);if(rl){pa(!0);try{n(t)}finally{pa(!1)}}}else l=t;return a.memoizedState=a.baseState=l,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:l},a.queue=e,e=e.dispatch=x2.bind(null,Re,e),[a.memoizedState,e]},useRef:function(e){var t=Kt();return e={current:e},t.memoizedState=e},useState:function(e){e=ph(e);var t=e.queue,n=Lb.bind(null,Re,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ym,useDeferredValue:function(e,t){var n=Kt();return Fm(n,e,t)},useTransition:function(){var e=ph(!1);return e=Mb.bind(null,Re,e.queue,!0,!1),Kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Re,l=Kt();if(Le){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),We===null)throw Error(Q(349));$e&124||hb(a,t,n)}l.memoizedState=n;var r={value:n,getSnapshot:t};return l.queue=r,ig(pb.bind(null,a,r,e),[e]),a.flags|=2048,hr(9,Iu(),mb.bind(null,a,r,n,t),null),n},useId:function(){var e=Kt(),t=We.identifierPrefix;if(Le){var n=Is,a=Hs;n=(a&~(1<<32-dn(a)-1)).toString(32)+n,t="«"+t+"R"+n,n=Yc++,0<n&&(t+="H"+n.toString(32)),t+="»"}else n=u2++,t="«"+t+"r"+n.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:Xm,useFormState:ag,useActionState:ag,useOptimistic:function(e){var t=Kt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Km.bind(null,Re,!0,n),n.dispatch=t,[e,t]},useMemoCache:Gm,useCacheRefresh:function(){return Kt().memoizedState=p2.bind(null,Re)}},Ib={readContext:It,use:Hu,useCallback:Rb,useContext:It,useEffect:Nb,useImperativeHandle:Tb,useInsertionEffect:kb,useLayoutEffect:Sb,useMemo:Eb,useReducer:vc,useRef:wb,useState:function(){return vc(Fs)},useDebugValue:Ym,useDeferredValue:function(e,t){var n=bt();return Ab(n,Xe.memoizedState,e,t)},useTransition:function(){var e=vc(Fs)[0],t=bt().memoizedState;return[typeof e=="boolean"?e:uo(e),t]},useSyncExternalStore:fb,useId:Db,useHostTransitionStatus:Xm,useFormState:lg,useActionState:lg,useOptimistic:function(e,t){var n=bt();return vb(n,Xe,e,t)},useMemoCache:Gm,useCacheRefresh:zb},g2={readContext:It,use:Hu,useCallback:Rb,useContext:It,useEffect:Nb,useImperativeHandle:Tb,useInsertionEffect:kb,useLayoutEffect:Sb,useMemo:Eb,useReducer:Qd,useRef:wb,useState:function(){return Qd(Fs)},useDebugValue:Ym,useDeferredValue:function(e,t){var n=bt();return Xe===null?Fm(n,e,t):Ab(n,Xe.memoizedState,e,t)},useTransition:function(){var e=Qd(Fs)[0],t=bt().memoizedState;return[typeof e=="boolean"?e:uo(e),t]},useSyncExternalStore:fb,useId:Db,useHostTransitionStatus:Xm,useFormState:rg,useActionState:rg,useOptimistic:function(e,t){var n=bt();return Xe!==null?vb(n,Xe,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Gm,useCacheRefresh:zb},tr=null,Di=0;function qo(e){var t=Di;return Di+=1,tr===null&&(tr=[]),ib(tr,e,t)}function Fr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Go(e,t){throw t.$$typeof===F1?Error(Q(525)):(e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function og(e){var t=e._init;return t(e._payload)}function Pb(e){function t(g,p){if(e){var b=g.deletions;b===null?(g.deletions=[p],g.flags|=16):b.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 l(g,p){return g=Gs(g,p),g.index=0,g.sibling=null,g}function r(g,p,b){return g.index=b,e?(b=g.alternate,b!==null?(b=b.index,b<p?(g.flags|=67108866,p):b):(g.flags|=67108866,p)):(g.flags|=1048576,p)}function i(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function o(g,p,b,_){return p===null||p.tag!==6?(p=Fd(b,g.mode,_),p.return=g,p):(p=l(p,b),p.return=g,p)}function c(g,p,b,_){var N=b.type;return N===zl?f(g,p,b.props.children,_,b.key):p!==null&&(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ca&&og(N)===p.type)?(p=l(p,b.props),Fr(p,b),p.return=g,p):(p=xc(b.type,b.key,b.props,null,g.mode,_),Fr(p,b),p.return=g,p)}function d(g,p,b,_){return p===null||p.tag!==4||p.stateNode.containerInfo!==b.containerInfo||p.stateNode.implementation!==b.implementation?(p=Xd(b,g.mode,_),p.return=g,p):(p=l(p,b.children||[]),p.return=g,p)}function f(g,p,b,_,N){return p===null||p.tag!==7?(p=Za(b,g.mode,_,N),p.return=g,p):(p=l(p,b),p.return=g,p)}function h(g,p,b){if(typeof p=="string"&&p!==""||typeof p=="number"||typeof p=="bigint")return p=Fd(""+p,g.mode,b),p.return=g,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case zo:return b=xc(p.type,p.key,p.props,null,g.mode,b),Fr(b,p),b.return=g,b;case ti:return p=Xd(p,g.mode,b),p.return=g,p;case ca:var _=p._init;return p=_(p._payload),h(g,p,b)}if(ni(p)||qr(p))return p=Za(p,g.mode,b,null),p.return=g,p;if(typeof p.then=="function")return h(g,qo(p),b);if(p.$$typeof===Bs)return h(g,Io(g,p),b);Go(g,p)}return null}function m(g,p,b,_){var N=p!==null?p.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return N!==null?null:o(g,p,""+b,_);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case zo:return b.key===N?c(g,p,b,_):null;case ti:return b.key===N?d(g,p,b,_):null;case ca:return N=b._init,b=N(b._payload),m(g,p,b,_)}if(ni(b)||qr(b))return N!==null?null:f(g,p,b,_,null);if(typeof b.then=="function")return m(g,p,qo(b),_);if(b.$$typeof===Bs)return m(g,p,Io(g,b),_);Go(g,b)}return null}function x(g,p,b,_,N){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return g=g.get(b)||null,o(p,g,""+_,N);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case zo:return g=g.get(_.key===null?b:_.key)||null,c(p,g,_,N);case ti:return g=g.get(_.key===null?b:_.key)||null,d(p,g,_,N);case ca:var C=_._init;return _=C(_._payload),x(g,p,b,_,N)}if(ni(_)||qr(_))return g=g.get(b)||null,f(p,g,_,N,null);if(typeof _.then=="function")return x(g,p,b,qo(_),N);if(_.$$typeof===Bs)return x(g,p,b,Io(p,_),N);Go(p,_)}return null}function j(g,p,b,_){for(var N=null,C=null,w=p,k=p=0,A=null;w!==null&&k<b.length;k++){w.index>k?(A=w,w=null):A=w.sibling;var $=m(g,w,b[k],_);if($===null){w===null&&(w=A);break}e&&w&&$.alternate===null&&t(g,w),p=r($,p,k),C===null?N=$:C.sibling=$,C=$,w=A}if(k===b.length)return n(g,w),Le&&Fa(g,k),N;if(w===null){for(;k<b.length;k++)w=h(g,b[k],_),w!==null&&(p=r(w,p,k),C===null?N=w:C.sibling=w,C=w);return Le&&Fa(g,k),N}for(w=a(w);k<b.length;k++)A=x(w,g,k,b[k],_),A!==null&&(e&&A.alternate!==null&&w.delete(A.key===null?k:A.key),p=r(A,p,k),C===null?N=A:C.sibling=A,C=A);return e&&w.forEach(function(X){return t(g,X)}),Le&&Fa(g,k),N}function v(g,p,b,_){if(b==null)throw Error(Q(151));for(var N=null,C=null,w=p,k=p=0,A=null,$=b.next();w!==null&&!$.done;k++,$=b.next()){w.index>k?(A=w,w=null):A=w.sibling;var X=m(g,w,$.value,_);if(X===null){w===null&&(w=A);break}e&&w&&X.alternate===null&&t(g,w),p=r(X,p,k),C===null?N=X:C.sibling=X,C=X,w=A}if($.done)return n(g,w),Le&&Fa(g,k),N;if(w===null){for(;!$.done;k++,$=b.next())$=h(g,$.value,_),$!==null&&(p=r($,p,k),C===null?N=$:C.sibling=$,C=$);return Le&&Fa(g,k),N}for(w=a(w);!$.done;k++,$=b.next())$=x(w,g,k,$.value,_),$!==null&&(e&&$.alternate!==null&&w.delete($.key===null?k:$.key),p=r($,p,k),C===null?N=$:C.sibling=$,C=$);return e&&w.forEach(function(Y){return t(g,Y)}),Le&&Fa(g,k),N}function y(g,p,b,_){if(typeof b=="object"&&b!==null&&b.type===zl&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case zo:e:{for(var N=b.key;p!==null;){if(p.key===N){if(N=b.type,N===zl){if(p.tag===7){n(g,p.sibling),_=l(p,b.props.children),_.return=g,g=_;break e}}else if(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ca&&og(N)===p.type){n(g,p.sibling),_=l(p,b.props),Fr(_,b),_.return=g,g=_;break e}n(g,p);break}else t(g,p);p=p.sibling}b.type===zl?(_=Za(b.props.children,g.mode,_,b.key),_.return=g,g=_):(_=xc(b.type,b.key,b.props,null,g.mode,_),Fr(_,b),_.return=g,g=_)}return i(g);case ti:e:{for(N=b.key;p!==null;){if(p.key===N)if(p.tag===4&&p.stateNode.containerInfo===b.containerInfo&&p.stateNode.implementation===b.implementation){n(g,p.sibling),_=l(p,b.children||[]),_.return=g,g=_;break e}else{n(g,p);break}else t(g,p);p=p.sibling}_=Xd(b,g.mode,_),_.return=g,g=_}return i(g);case ca:return N=b._init,b=N(b._payload),y(g,p,b,_)}if(ni(b))return j(g,p,b,_);if(qr(b)){if(N=qr(b),typeof N!="function")throw Error(Q(150));return b=N.call(b),v(g,p,b,_)}if(typeof b.then=="function")return y(g,p,qo(b),_);if(b.$$typeof===Bs)return y(g,p,Io(g,b),_);Go(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,p!==null&&p.tag===6?(n(g,p.sibling),_=l(p,b),_.return=g,g=_):(n(g,p),_=Fd(b,g.mode,_),_.return=g,g=_),i(g)):n(g,p)}return function(g,p,b,_){try{Di=0;var N=y(g,p,b,_);return tr=null,N}catch(w){if(w===co||w===Bu)throw w;var C=cn(29,w,null,g.mode);return C.lanes=_,C.return=g,C}finally{}}}var mr=Pb(!0),qb=Pb(!1),Mn=js(null),xs=null;function fa(e){var t=e.alternate;nt(Nt,Nt.current&1),nt(Mn,e),xs===null&&(t===null||fr.current!==null||t.memoizedState!==null)&&(xs=e)}function Gb(e){if(e.tag===22){if(nt(Nt,Nt.current),nt(Mn,e),xs===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(xs=e)}}else ha()}function ha(){nt(Nt,Nt.current),nt(Mn,Mn.current)}function qs(e){Mt(Mn),xs===e&&(xs=null),Mt(Nt)}var Nt=js(0);function Xc(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==="$?"||$h(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 Zd(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:Je({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vh={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=fn(),l=_a(a);l.payload=t,n!=null&&(l.callback=n),t=wa(e,l,a),t!==null&&(hn(t,e,a),gi(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=fn(),l=_a(a);l.tag=1,l.payload=t,n!=null&&(l.callback=n),t=wa(e,l,a),t!==null&&(hn(t,e,a),gi(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fn(),a=_a(n);a.tag=2,t!=null&&(a.callback=t),t=wa(e,a,n),t!==null&&(hn(t,e,n),gi(t,e,n))}};function cg(e,t,n,a,l,r,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,r,i):t.prototype&&t.prototype.isPureReactComponent?!Mi(n,a)||!Mi(l,r):!0}function ug(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&&vh.enqueueReplaceState(t,t.state,null)}function il(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=Je({},n));for(var l in e)n[l]===void 0&&(n[l]=e[l])}return n}var Kc=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 Vb(e){Kc(e)}function Yb(e){console.error(e)}function Fb(e){Kc(e)}function Qc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function dg(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(l){setTimeout(function(){throw l})}}function yh(e,t,n){return n=_a(n),n.tag=3,n.payload={element:null},n.callback=function(){Qc(e,t)},n}function Xb(e){return e=_a(e),e.tag=3,e}function Kb(e,t,n,a){var l=n.type.getDerivedStateFromError;if(typeof l=="function"){var r=a.value;e.payload=function(){return l(r)},e.callback=function(){dg(t,n,a)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){dg(t,n,a),typeof l!="function"&&(Na===null?Na=new Set([this]):Na.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function v2(e,t,n,a,l){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&io(t,n,l,!0),n=Mn.current,n!==null){switch(n.tag){case 13:return xs===null?Ch():n.alternate===null&&ut===0&&(ut=3),n.flags&=-257,n.flags|=65536,n.lanes=l,a===dh?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),cf(e,a,l)),!1;case 22:return n.flags|=65536,a===dh?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,l)),!1}throw Error(Q(435,n.tag))}return cf(e,a,l),Ch(),!1}if(Le)return t=Mn.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=l,a!==rh&&(e=Error(Q(422),{cause:a}),Oi(Sn(e,n)))):(a!==rh&&(t=Error(Q(423),{cause:a}),Oi(Sn(t,n))),e=e.current.alternate,e.flags|=65536,l&=-l,e.lanes|=l,a=Sn(a,n),l=yh(e.stateNode,a,l),Kd(e,l),ut!==4&&(ut=2)),!1;var r=Error(Q(520),{cause:a});if(r=Sn(r,n),wi===null?wi=[r]:wi.push(r),ut!==4&&(ut=2),t===null)return!0;a=Sn(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=l&-l,n.lanes|=e,e=yh(n.stateNode,a,e),Kd(n,e),!1;case 1:if(t=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(Na===null||!Na.has(r))))return n.flags|=65536,l&=-l,n.lanes|=l,l=Xb(l),Kb(l,e,n,a),Kd(n,l),!1}n=n.return}while(n!==null);return!1}var Qb=Error(Q(461)),At=!1;function $t(e,t,n,a){t.child=e===null?qb(t,null,n,a):mr(t,e.child,n,a)}function fg(e,t,n,a,l){n=n.render;var r=t.ref;if("ref"in a){var i={};for(var o in a)o!=="ref"&&(i[o]=a[o])}else i=a;return ll(t),a=Bm(e,t,n,i,r,l),o=Hm(),e!==null&&!At?(Im(e,t,l),Xs(e,t,l)):(Le&&o&&Mm(t),t.flags|=1,$t(e,t,a,l),t.child)}function hg(e,t,n,a,l){if(e===null){var r=n.type;return typeof r=="function"&&!Am(r)&&r.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=r,Zb(e,t,r,a,l)):(e=xc(n.type,null,a,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(r=e.child,!Qm(e,l)){var i=r.memoizedProps;if(n=n.compare,n=n!==null?n:Mi,n(i,a)&&e.ref===t.ref)return Xs(e,t,l)}return t.flags|=1,e=Gs(r,a),e.ref=t.ref,e.return=t,t.child=e}function Zb(e,t,n,a,l){if(e!==null){var r=e.memoizedProps;if(Mi(r,a)&&e.ref===t.ref)if(At=!1,t.pendingProps=a=r,Qm(e,l))e.flags&131072&&(At=!0);else return t.lanes=e.lanes,Xs(e,t,l)}return bh(e,t,n,a,l)}function Wb(e,t,n){var a=t.pendingProps,l=a.children,r=e!==null?e.memoizedState:null;if(a.mode==="hidden"){if(t.flags&128){if(a=r!==null?r.baseLanes|n:n,e!==null){for(l=t.child=e.child,r=0;l!==null;)r=r|l.lanes|l.childLanes,l=l.sibling;t.childLanes=r&~a}else t.childLanes=0,t.child=null;return mg(e,t,a,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&gc(t,r!==null?r.cachePool:null),r!==null?tg(t,r):mh(),Gb(t);else return t.lanes=t.childLanes=536870912,mg(e,t,r!==null?r.baseLanes|n:n,n)}else r!==null?(gc(t,r.cachePool),tg(t,r),ha(),t.memoizedState=null):(e!==null&&gc(t,null),mh(),ha());return $t(e,t,l,n),t.child}function mg(e,t,n,a){var l=Dm();return l=l===null?null:{parent:wt._currentValue,pool:l},t.memoizedState={baseLanes:n,cachePool:l},e!==null&&gc(t,null),mh(),Gb(t),e!==null&&io(e,t,a,!0),null}function bc(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(Q(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function bh(e,t,n,a,l){return ll(t),n=Bm(e,t,n,a,void 0,l),a=Hm(),e!==null&&!At?(Im(e,t,l),Xs(e,t,l)):(Le&&a&&Mm(t),t.flags|=1,$t(e,t,n,l),t.child)}function pg(e,t,n,a,l,r){return ll(t),t.updateQueue=null,n=db(t,a,n,l),ub(e),a=Hm(),e!==null&&!At?(Im(e,t,r),Xs(e,t,r)):(Le&&a&&Mm(t),t.flags|=1,$t(e,t,n,r),t.child)}function xg(e,t,n,a,l){if(ll(t),t.stateNode===null){var r=Gl,i=n.contextType;typeof i=="object"&&i!==null&&(r=It(i)),r=new n(a,r),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=vh,t.stateNode=r,r._reactInternals=t,r=t.stateNode,r.props=a,r.state=t.memoizedState,r.refs={},zm(t),i=n.contextType,r.context=typeof i=="object"&&i!==null?It(i):Gl,r.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(Zd(t,n,i,a),r.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(i=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),i!==r.state&&vh.enqueueReplaceState(r,r.state,null),yi(t,a,r,l),vi(),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){r=t.stateNode;var o=t.memoizedProps,c=il(n,o);r.props=c;var d=r.context,f=n.contextType;i=Gl,typeof f=="object"&&f!==null&&(i=It(f));var h=n.getDerivedStateFromProps;f=typeof h=="function"||typeof r.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,f||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(o||d!==i)&&ug(t,r,a,i),ua=!1;var m=t.memoizedState;r.state=m,yi(t,a,r,l),vi(),d=t.memoizedState,o||m!==d||ua?(typeof h=="function"&&(Zd(t,n,h,a),d=t.memoizedState),(c=ua||cg(t,n,c,a,m,d,i))?(f||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(t.flags|=4194308)):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=d),r.props=a,r.state=d,r.context=i,a=c):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{r=t.stateNode,fh(e,t),i=t.memoizedProps,f=il(n,i),r.props=f,h=t.pendingProps,m=r.context,d=n.contextType,c=Gl,typeof d=="object"&&d!==null&&(c=It(d)),o=n.getDerivedStateFromProps,(d=typeof o=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(i!==h||m!==c)&&ug(t,r,a,c),ua=!1,m=t.memoizedState,r.state=m,yi(t,a,r,l),vi();var x=t.memoizedState;i!==h||m!==x||ua||e!==null&&e.dependencies!==null&&qc(e.dependencies)?(typeof o=="function"&&(Zd(t,n,o,a),x=t.memoizedState),(f=ua||cg(t,n,f,a,m,x,c)||e!==null&&e.dependencies!==null&&qc(e.dependencies))?(d||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(a,x,c),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(a,x,c)),typeof r.componentDidUpdate=="function"&&(t.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof r.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=x),r.props=a,r.state=x,r.context=c,a=f):(typeof r.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),a=!1)}return r=a,bc(e,t),a=(t.flags&128)!==0,r||a?(r=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:r.render(),t.flags|=1,e!==null&&a?(t.child=mr(t,e.child,null,l),t.child=mr(t,null,n,l)):$t(e,t,n,l),t.memoizedState=r.state,e=t.child):e=Xs(e,t,l),e}function gg(e,t,n,a){return ro(),t.flags|=256,$t(e,t,n,a),t.child}var Wd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jd(e){return{baseLanes:e,cachePool:lb()}}function ef(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Cn),e}function Jb(e,t,n){var a=t.pendingProps,l=!1,r=(t.flags&128)!==0,i;if((i=r)||(i=e!==null&&e.memoizedState===null?!1:(Nt.current&2)!==0),i&&(l=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(Le){if(l?fa(t):ha(),Le){var o=ct,c;if(c=o){e:{for(c=o,o=os;c.nodeType!==8;){if(!o){o=null;break e}if(c=Gn(c.nextSibling),c===null){o=null;break e}}o=c}o!==null?(t.memoizedState={dehydrated:o,treeContext:Wa!==null?{id:Hs,overflow:Is}:null,retryLane:536870912,hydrationErrors:null},c=cn(18,null,null,0),c.stateNode=o,c.return=t,t.child=c,qt=t,ct=null,c=!0):c=!1}c||al(t)}if(o=t.memoizedState,o!==null&&(o=o.dehydrated,o!==null))return $h(o)?t.lanes=32:t.lanes=536870912,null;qs(t)}return o=a.children,a=a.fallback,l?(ha(),l=t.mode,o=Zc({mode:"hidden",children:o},l),a=Za(a,l,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,l=t.child,l.memoizedState=Jd(n),l.childLanes=ef(e,i,n),t.memoizedState=Wd,a):(fa(t),jh(t,o))}if(c=e.memoizedState,c!==null&&(o=c.dehydrated,o!==null)){if(r)t.flags&256?(fa(t),t.flags&=-257,t=tf(e,t,n)):t.memoizedState!==null?(ha(),t.child=e.child,t.flags|=128,t=null):(ha(),l=a.fallback,o=t.mode,a=Zc({mode:"visible",children:a.children},o),l=Za(l,o,n,null),l.flags|=2,a.return=t,l.return=t,a.sibling=l,t.child=a,mr(t,e.child,null,n),a=t.child,a.memoizedState=Jd(n),a.childLanes=ef(e,i,n),t.memoizedState=Wd,t=l);else if(fa(t),$h(o)){if(i=o.nextSibling&&o.nextSibling.dataset,i)var d=i.dgst;i=d,a=Error(Q(419)),a.stack="",a.digest=i,Oi({value:a,source:null,stack:null}),t=tf(e,t,n)}else if(At||io(e,t,n,!1),i=(n&e.childLanes)!==0,At||i){if(i=We,i!==null&&(a=n&-n,a=a&42?1:bm(a),a=a&(i.suspendedLanes|n)?0:a,a!==0&&a!==c.retryLane))throw c.retryLane=a,Cr(e,a),hn(i,e,a),Qb;o.data==="$?"||Ch(),t=tf(e,t,n)}else o.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,ct=Gn(o.nextSibling),qt=t,Le=!0,Ja=null,os=!1,e!==null&&(wn[Nn++]=Hs,wn[Nn++]=Is,wn[Nn++]=Wa,Hs=e.id,Is=e.overflow,Wa=t),t=jh(t,a.children),t.flags|=4096);return t}return l?(ha(),l=a.fallback,o=t.mode,c=e.child,d=c.sibling,a=Gs(c,{mode:"hidden",children:a.children}),a.subtreeFlags=c.subtreeFlags&65011712,d!==null?l=Gs(d,l):(l=Za(l,o,n,null),l.flags|=2),l.return=t,a.return=t,a.sibling=l,t.child=a,a=l,l=t.child,o=e.child.memoizedState,o===null?o=Jd(n):(c=o.cachePool,c!==null?(d=wt._currentValue,c=c.parent!==d?{parent:d,pool:d}:c):c=lb(),o={baseLanes:o.baseLanes|n,cachePool:c}),l.memoizedState=o,l.childLanes=ef(e,i,n),t.memoizedState=Wd,a):(fa(t),n=e.child,e=n.sibling,n=Gs(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 jh(e,t){return t=Zc({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Zc(e,t){return e=cn(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function tf(e,t,n){return mr(t,e.child,null,n),e=jh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function vg(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),oh(e.return,t,n)}function nf(e,t,n,a,l){var r=e.memoizedState;r===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:l}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=a,r.tail=n,r.tailMode=l)}function ej(e,t,n){var a=t.pendingProps,l=a.revealOrder,r=a.tail;if($t(e,t,a.children,n),a=Nt.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&&vg(e,n,t);else if(e.tag===19)vg(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(nt(Nt,a),l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Xc(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),nf(t,!1,l,n,r);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Xc(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}nf(t,!0,n,null,r);break;case"together":nf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Xs(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ma|=t.lanes,!(n&t.childLanes))if(e!==null){if(io(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,n=Gs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Gs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Qm(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&qc(e)))}function y2(e,t,n){switch(t.tag){case 3:Dc(t,t.stateNode.containerInfo),da(t,wt,e.memoizedState.cache),ro();break;case 27:case 5:Qf(t);break;case 4:Dc(t,t.stateNode.containerInfo);break;case 10:da(t,t.type,t.memoizedProps.value);break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(fa(t),t.flags|=128,null):n&t.child.childLanes?Jb(e,t,n):(fa(t),e=Xs(e,t,n),e!==null?e.sibling:null);fa(t);break;case 19:var l=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(io(e,t,n,!1),a=(n&t.childLanes)!==0),l){if(a)return ej(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),nt(Nt,Nt.current),a)break;return null;case 22:case 23:return t.lanes=0,Wb(e,t,n);case 24:da(t,wt,e.memoizedState.cache)}return Xs(e,t,n)}function tj(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)At=!0;else{if(!Qm(e,n)&&!(t.flags&128))return At=!1,y2(e,t,n);At=!!(e.flags&131072)}else At=!1,Le&&t.flags&1048576&&sb(t,Pc,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var a=t.elementType,l=a._init;if(a=l(a._payload),t.type=a,typeof a=="function")Am(a)?(e=il(a,e),t.tag=1,t=xg(null,t,a,e,n)):(t.tag=0,t=bh(null,t,a,e,n));else{if(a!=null){if(l=a.$$typeof,l===gm){t.tag=11,t=fg(null,t,a,e,n);break e}else if(l===vm){t.tag=14,t=hg(null,t,a,e,n);break e}}throw t=Xf(a)||a,Error(Q(306,t,""))}}return t;case 0:return bh(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,l=il(a,t.pendingProps),xg(e,t,a,l,n);case 3:e:{if(Dc(t,t.stateNode.containerInfo),e===null)throw Error(Q(387));a=t.pendingProps;var r=t.memoizedState;l=r.element,fh(e,t),yi(t,a,null,n);var i=t.memoizedState;if(a=i.cache,da(t,wt,a),a!==r.cache&&ch(t,[wt],n,!0),vi(),a=i.element,r.isDehydrated)if(r={element:a,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=gg(e,t,a,n);break e}else if(a!==l){l=Sn(Error(Q(424)),t),Oi(l),t=gg(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(ct=Gn(e.firstChild),qt=t,Le=!0,Ja=null,os=!0,n=qb(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ro(),a===l){t=Xs(e,t,n);break e}$t(e,t,a,n)}t=t.child}return t;case 26:return bc(e,t),e===null?(n=Dg(t.type,null,t.pendingProps,null))?t.memoizedState=n:Le||(n=t.type,e=t.pendingProps,a=au(ja.current).createElement(n),a[Ht]=t,a[Wt]=e,zt(a,n,e),Et(a),t.stateNode=a):t.memoizedState=Dg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Qf(t),e===null&&Le&&(a=t.stateNode=Ij(t.type,t.pendingProps,ja.current),qt=t,os=!0,l=ct,La(t.type)?(Dh=l,ct=Gn(a.firstChild)):ct=l),$t(e,t,t.pendingProps.children,n),bc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Le&&((l=a=ct)&&(a=F2(a,t.type,t.pendingProps,os),a!==null?(t.stateNode=a,qt=t,ct=Gn(a.firstChild),os=!1,l=!0):l=!1),l||al(t)),Qf(t),l=t.type,r=t.pendingProps,i=e!==null?e.memoizedProps:null,a=r.children,Mh(l,r)?a=null:i!==null&&Mh(l,i)&&(t.flags|=32),t.memoizedState!==null&&(l=Bm(e,t,d2,null,null,n),Bi._currentValue=l),bc(e,t),$t(e,t,a,n),t.child;case 6:return e===null&&Le&&((e=n=ct)&&(n=X2(n,t.pendingProps,os),n!==null?(t.stateNode=n,qt=t,ct=null,e=!0):e=!1),e||al(t)),null;case 13:return Jb(e,t,n);case 4:return Dc(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=mr(t,null,a,n):$t(e,t,a,n),t.child;case 11:return fg(e,t,t.type,t.pendingProps,n);case 7:return $t(e,t,t.pendingProps,n),t.child;case 8:return $t(e,t,t.pendingProps.children,n),t.child;case 12:return $t(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,da(t,t.type,a.value),$t(e,t,a.children,n),t.child;case 9:return l=t.type._context,a=t.pendingProps.children,ll(t),l=It(l),a=a(l),t.flags|=1,$t(e,t,a,n),t.child;case 14:return hg(e,t,t.type,t.pendingProps,n);case 15:return Zb(e,t,t.type,t.pendingProps,n);case 19:return ej(e,t,n);case 31:return a=t.pendingProps,n=t.mode,a={mode:a.mode,children:a.children},e===null?(n=Zc(a,n),n.ref=t.ref,t.child=n,n.return=t,t=n):(n=Gs(e.child,a),n.ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Wb(e,t,n);case 24:return ll(t),a=It(wt),e===null?(l=Dm(),l===null&&(l=We,r=$m(),l.pooledCache=r,r.refCount++,r!==null&&(l.pooledCacheLanes|=n),l=r),t.memoizedState={parent:a,cache:l},zm(t),da(t,wt,l)):(e.lanes&n&&(fh(e,t),yi(t,null,null,n),vi()),l=e.memoizedState,r=t.memoizedState,l.parent!==a?(l={parent:a,cache:a},t.memoizedState=l,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=l),da(t,wt,a)):(a=r.cache,da(t,wt,a),a!==l.cache&&ch(t,[wt],n,!0))),$t(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(Q(156,t.tag))}function Ms(e){e.flags|=4}function yg(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Gj(t)){if(t=Mn.current,t!==null&&(($e&4194048)===$e?xs!==null:($e&62914560)!==$e&&!($e&536870912)||t!==xs))throw xi=dh,rb;e.flags|=8192}}function Vo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Cy():536870912,e.lanes|=t,pr|=t)}function Xr(e,t){if(!Le)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 lt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,a|=l.subtreeFlags&65011712,a|=l.flags&65011712,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,a|=l.subtreeFlags,a|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function b2(e,t,n){var a=t.pendingProps;switch(Om(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lt(t),null;case 1:return lt(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Vs(wt),or(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Yr(t)?Ms(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Kx())),lt(t),null;case 26:return n=t.memoizedState,e===null?(Ms(t),n!==null?(lt(t),yg(t,n)):(lt(t),t.flags&=-16777217)):n?n!==e.memoizedState?(Ms(t),lt(t),yg(t,n)):(lt(t),t.flags&=-16777217):(e.memoizedProps!==a&&Ms(t),lt(t),t.flags&=-16777217),null;case 27:zc(t),n=ja.current;var l=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Ms(t);else{if(!a){if(t.stateNode===null)throw Error(Q(166));return lt(t),null}e=ms.current,Yr(t)?Fx(t):(e=Ij(l,a,n),t.stateNode=e,Ms(t))}return lt(t),null;case 5:if(zc(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Ms(t);else{if(!a){if(t.stateNode===null)throw Error(Q(166));return lt(t),null}if(e=ms.current,Yr(t))Fx(t);else{switch(l=au(ja.current),e){case 1:e=l.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=l.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=l.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=l.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":e=l.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof a.is=="string"?l.createElement("select",{is:a.is}):l.createElement("select"),a.multiple?e.multiple=!0:a.size&&(e.size=a.size);break;default:e=typeof a.is=="string"?l.createElement(n,{is:a.is}):l.createElement(n)}}e[Ht]=t,e[Wt]=a;e:for(l=t.child;l!==null;){if(l.tag===5||l.tag===6)e.appendChild(l.stateNode);else if(l.tag!==4&&l.tag!==27&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===t)break e;for(;l.sibling===null;){if(l.return===null||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}t.stateNode=e;e:switch(zt(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&&Ms(t)}}return lt(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Ms(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(Q(166));if(e=ja.current,Yr(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,l=qt,l!==null)switch(l.tag){case 27:case 5:a=l.memoizedProps}e[Ht]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||Uj(e.nodeValue,n)),e||al(t)}else e=au(e).createTextNode(a),e[Ht]=t,t.stateNode=e}return lt(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(l=Yr(t),a!==null&&a.dehydrated!==null){if(e===null){if(!l)throw Error(Q(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(Q(317));l[Ht]=t}else ro(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;lt(t),l=!1}else l=Kx(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),l=!0;if(!l)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,l=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(l=a.alternate.memoizedState.cachePool.pool);var r=null;a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==l&&(a.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),Vo(t,t.updateQueue),lt(t),null;case 4:return or(),e===null&&ap(t.stateNode.containerInfo),lt(t),null;case 10:return Vs(t.type),lt(t),null;case 19:if(Mt(Nt),l=t.memoizedState,l===null)return lt(t),null;if(a=(t.flags&128)!==0,r=l.rendering,r===null)if(a)Xr(l,!1);else{if(ut!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(r=Xc(e),r!==null){for(t.flags|=128,Xr(l,!1),e=r.updateQueue,t.updateQueue=e,Vo(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)nb(n,e),n=n.sibling;return nt(Nt,Nt.current&1|2),t.child}e=e.sibling}l.tail!==null&&ps()>Jc&&(t.flags|=128,a=!0,Xr(l,!1),t.lanes=4194304)}else{if(!a)if(e=Xc(r),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Vo(t,e),Xr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!r.alternate&&!Le)return lt(t),null}else 2*ps()-l.renderingStartTime>Jc&&n!==536870912&&(t.flags|=128,a=!0,Xr(l,!1),t.lanes=4194304);l.isBackwards?(r.sibling=t.child,t.child=r):(e=l.last,e!==null?e.sibling=r:t.child=r,l.last=r)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=ps(),t.sibling=null,e=Nt.current,nt(Nt,a?e&1|2:e&1),t):(lt(t),null);case 22:case 23:return qs(t),Lm(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?n&536870912&&!(t.flags&128)&&(lt(t),t.subtreeFlags&6&&(t.flags|=8192)):lt(t),n=t.updateQueue,n!==null&&Vo(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&&Mt(el),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Vs(wt),lt(t),null;case 25:return null;case 30:return null}throw Error(Q(156,t.tag))}function j2(e,t){switch(Om(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vs(wt),or(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return zc(t),null;case 13:if(qs(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));ro()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Mt(Nt),null;case 4:return or(),null;case 10:return Vs(t.type),null;case 22:case 23:return qs(t),Lm(),e!==null&&Mt(el),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vs(wt),null;case 25:return null;default:return null}}function nj(e,t){switch(Om(t),t.tag){case 3:Vs(wt),or();break;case 26:case 27:case 5:zc(t);break;case 4:or();break;case 13:qs(t);break;case 19:Mt(Nt);break;case 10:Vs(t.type);break;case 22:case 23:qs(t),Lm(),e!==null&&Mt(el);break;case 24:Vs(wt)}}function ho(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var l=a.next;n=l;do{if((n.tag&e)===e){a=void 0;var r=n.create,i=n.inst;a=r(),i.destroy=a}n=n.next}while(n!==l)}}catch(o){Ke(t,t.return,o)}}function Aa(e,t,n){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var r=l.next;a=r;do{if((a.tag&e)===e){var i=a.inst,o=i.destroy;if(o!==void 0){i.destroy=void 0,l=t;var c=n,d=o;try{d()}catch(f){Ke(l,c,f)}}}a=a.next}while(a!==r)}}catch(f){Ke(t,t.return,f)}}function sj(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{cb(t,n)}catch(a){Ke(e,e.return,a)}}}function aj(e,t,n){n.props=il(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){Ke(e,t,a)}}function ji(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(l){Ke(e,t,l)}}function ds(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(l){Ke(e,t,l)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(l){Ke(e,t,l)}else n.current=null}function lj(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(l){Ke(e,e.return,l)}}function sf(e,t,n){try{var a=e.stateNode;P2(a,e.type,n,t),a[Wt]=t}catch(l){Ke(e,e.return,l)}}function rj(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&La(e.type)||e.tag===4}function af(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rj(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&&La(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 _h(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=Yu));else if(a!==4&&(a===27&&La(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(_h(e,t,n),e=e.sibling;e!==null;)_h(e,t,n),e=e.sibling}function Wc(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&&La(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function ij(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,l=t.attributes;l.length;)t.removeAttributeNode(l[0]);zt(t,a,n),t[Ht]=e,t[Wt]=n}catch(r){Ke(e,e.return,r)}}var Us=!1,mt=!1,lf=!1,bg=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function _2(e,t){if(e=e.containerInfo,Eh=ou,e=Xy(e),Tm(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 l=a.anchorOffset,r=a.focusNode;a=a.focusOffset;try{n.nodeType,r.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||l!==0&&h.nodeType!==3||(o=i+l),h!==r||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===l&&(o=i),m===r&&++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(Ah={focusedElem:e,selectionRange:n},ou=!1,Rt=t;Rt!==null;)if(t=Rt,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,Rt=e;else for(;Rt!==null;){switch(t=Rt,r=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if(e&1024&&r!==null){e=void 0,n=t,l=r.memoizedProps,r=r.memoizedState,a=n.stateNode;try{var j=il(n.type,l,n.elementType===n.type);e=a.getSnapshotBeforeUpdate(j,r),a.__reactInternalSnapshotBeforeUpdate=e}catch(v){Ke(n,n.return,v)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Oh(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Oh(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(Q(163))}if(e=t.sibling,e!==null){e.return=t.return,Rt=e;break}Rt=t.return}}function oj(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:sa(e,n),a&4&&ho(5,n);break;case 1:if(sa(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){Ke(n,n.return,i)}else{var l=il(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(l,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){Ke(n,n.return,i)}}a&64&&sj(n),a&512&&ji(n,n.return);break;case 3:if(sa(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{cb(e,t)}catch(i){Ke(n,n.return,i)}}break;case 27:t===null&&a&4&&ij(n);case 26:case 5:sa(e,n),t===null&&a&4&&lj(n),a&512&&ji(n,n.return);break;case 12:sa(e,n);break;case 13:sa(e,n),a&4&&dj(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=A2.bind(null,n),K2(e,n))));break;case 22:if(a=n.memoizedState!==null||Us,!a){t=t!==null&&t.memoizedState!==null||mt,l=Us;var r=mt;Us=a,(mt=t)&&!r?ia(e,n,(n.subtreeFlags&8772)!==0):sa(e,n),Us=l,mt=r}break;case 30:break;default:sa(e,n)}}function cj(e){var t=e.alternate;t!==null&&(e.alternate=null,cj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_m(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 et=null,Qt=!1;function Os(e,t,n){for(n=n.child;n!==null;)uj(e,t,n),n=n.sibling}function uj(e,t,n){if(un&&typeof un.onCommitFiberUnmount=="function")try{un.onCommitFiberUnmount(to,n)}catch{}switch(n.tag){case 26:mt||ds(n,t),Os(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:mt||ds(n,t);var a=et,l=Qt;La(n.type)&&(et=n.stateNode,Qt=!1),Os(e,t,n),ki(n.stateNode),et=a,Qt=l;break;case 5:mt||ds(n,t);case 6:if(a=et,l=Qt,et=null,Os(e,t,n),et=a,Qt=l,et!==null)if(Qt)try{(et.nodeType===9?et.body:et.nodeName==="HTML"?et.ownerDocument.body:et).removeChild(n.stateNode)}catch(r){Ke(n,t,r)}else try{et.removeChild(n.stateNode)}catch(r){Ke(n,t,r)}break;case 18:et!==null&&(Qt?(e=et,Mg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Pi(e)):Mg(et,n.stateNode));break;case 4:a=et,l=Qt,et=n.stateNode.containerInfo,Qt=!0,Os(e,t,n),et=a,Qt=l;break;case 0:case 11:case 14:case 15:mt||Aa(2,n,t),mt||Aa(4,n,t),Os(e,t,n);break;case 1:mt||(ds(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&aj(n,t,a)),Os(e,t,n);break;case 21:Os(e,t,n);break;case 22:mt=(a=mt)||n.memoizedState!==null,Os(e,t,n),mt=a;break;default:Os(e,t,n)}}function dj(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Pi(e)}catch(n){Ke(t,t.return,n)}}function w2(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new bg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new bg),t;default:throw Error(Q(435,e.tag))}}function rf(e,t){var n=w2(e);t.forEach(function(a){var l=M2.bind(null,e,a);n.has(a)||(n.add(a),a.then(l,l))})}function sn(e,t){var n=t.deletions;if(n!==null)for(var a=0;a<n.length;a++){var l=n[a],r=e,i=t,o=i;e:for(;o!==null;){switch(o.tag){case 27:if(La(o.type)){et=o.stateNode,Qt=!1;break e}break;case 5:et=o.stateNode,Qt=!1;break e;case 3:case 4:et=o.stateNode.containerInfo,Qt=!0;break e}o=o.return}if(et===null)throw Error(Q(160));uj(r,i,l),et=null,Qt=!1,r=l.alternate,r!==null&&(r.return=null),l.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)fj(t,e),t=t.sibling}var Bn=null;function fj(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:sn(t,e),an(e),a&4&&(Aa(3,e,e.return),ho(3,e),Aa(5,e,e.return));break;case 1:sn(t,e),an(e),a&512&&(mt||n===null||ds(n,n.return)),a&64&&Us&&(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 l=Bn;if(sn(t,e),an(e),a&512&&(mt||n===null||ds(n,n.return)),a&4){var r=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,l=l.ownerDocument||l;t:switch(a){case"title":r=l.getElementsByTagName("title")[0],(!r||r[ao]||r[Ht]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=l.createElement(a),l.head.insertBefore(r,l.querySelector("head > title"))),zt(r,a,n),r[Ht]=e,Et(r),a=r;break e;case"link":var i=Lg("link","href",l).get(a+(n.href||""));if(i){for(var o=0;o<i.length;o++)if(r=i[o],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){i.splice(o,1);break t}}r=l.createElement(a),zt(r,a,n),l.head.appendChild(r);break;case"meta":if(i=Lg("meta","content",l).get(a+(n.content||""))){for(o=0;o<i.length;o++)if(r=i[o],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){i.splice(o,1);break t}}r=l.createElement(a),zt(r,a,n),l.head.appendChild(r);break;default:throw Error(Q(468,a))}r[Ht]=e,Et(r),a=r}e.stateNode=a}else Ug(l,e.type,e.stateNode);else e.stateNode=zg(l,a,e.memoizedProps);else r!==a?(r===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):r.count--,a===null?Ug(l,e.type,e.stateNode):zg(l,a,e.memoizedProps)):a===null&&e.stateNode!==null&&sf(e,e.memoizedProps,n.memoizedProps)}break;case 27:sn(t,e),an(e),a&512&&(mt||n===null||ds(n,n.return)),n!==null&&a&4&&sf(e,e.memoizedProps,n.memoizedProps);break;case 5:if(sn(t,e),an(e),a&512&&(mt||n===null||ds(n,n.return)),e.flags&32){l=e.stateNode;try{ur(l,"")}catch(x){Ke(e,e.return,x)}}a&4&&e.stateNode!=null&&(l=e.memoizedProps,sf(e,l,n!==null?n.memoizedProps:l)),a&1024&&(lf=!0);break;case 6:if(sn(t,e),an(e),a&4){if(e.stateNode===null)throw Error(Q(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(x){Ke(e,e.return,x)}}break;case 3:if(wc=null,l=Bn,Bn=lu(t.containerInfo),sn(t,e),Bn=l,an(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{Pi(t.containerInfo)}catch(x){Ke(e,e.return,x)}lf&&(lf=!1,hj(e));break;case 4:a=Bn,Bn=lu(e.stateNode.containerInfo),sn(t,e),an(e),Bn=a;break;case 12:sn(t,e),an(e);break;case 13:sn(t,e),an(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(tp=ps()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,rf(e,a)));break;case 22:l=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,d=Us,f=mt;if(Us=d||l,mt=f||c,sn(t,e),mt=f,Us=d,an(e),a&8192)e:for(t=e.stateNode,t._visibility=l?t._visibility&-2:t._visibility|1,l&&(n===null||c||Us||mt||Xa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(r=c.stateNode,l)i=r.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){Ke(c,c.return,x)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=l?"":c.memoizedProps}catch(x){Ke(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,rf(e,n))));break;case 19:sn(t,e),an(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,rf(e,a)));break;case 30:break;case 21:break;default:sn(t,e),an(e)}}function an(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(rj(a)){n=a;break}a=a.return}if(n==null)throw Error(Q(160));switch(n.tag){case 27:var l=n.stateNode,r=af(e);Wc(e,r,l);break;case 5:var i=n.stateNode;n.flags&32&&(ur(i,""),n.flags&=-33);var o=af(e);Wc(e,o,i);break;case 3:case 4:var c=n.stateNode.containerInfo,d=af(e);_h(e,d,c);break;default:throw Error(Q(161))}}catch(f){Ke(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function hj(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;hj(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function sa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)oj(e,t.alternate,t),t=t.sibling}function Xa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Aa(4,t,t.return),Xa(t);break;case 1:ds(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&aj(t,t.return,n),Xa(t);break;case 27:ki(t.stateNode);case 26:case 5:ds(t,t.return),Xa(t);break;case 22:t.memoizedState===null&&Xa(t);break;case 30:Xa(t);break;default:Xa(t)}e=e.sibling}}function ia(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,l=e,r=t,i=r.flags;switch(r.tag){case 0:case 11:case 15:ia(l,r,n),ho(4,r);break;case 1:if(ia(l,r,n),a=r,l=a.stateNode,typeof l.componentDidMount=="function")try{l.componentDidMount()}catch(d){Ke(a,a.return,d)}if(a=r,l=a.updateQueue,l!==null){var o=a.stateNode;try{var c=l.shared.hiddenCallbacks;if(c!==null)for(l.shared.hiddenCallbacks=null,l=0;l<c.length;l++)ob(c[l],o)}catch(d){Ke(a,a.return,d)}}n&&i&64&&sj(r),ji(r,r.return);break;case 27:ij(r);case 26:case 5:ia(l,r,n),n&&a===null&&i&4&&lj(r),ji(r,r.return);break;case 12:ia(l,r,n);break;case 13:ia(l,r,n),n&&i&4&&dj(l,r);break;case 22:r.memoizedState===null&&ia(l,r,n),ji(r,r.return);break;case 30:break;default:ia(l,r,n)}t=t.sibling}}function Zm(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&&oo(n))}function Wm(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oo(e))}function is(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)mj(e,t,n,a),t=t.sibling}function mj(e,t,n,a){var l=t.flags;switch(t.tag){case 0:case 11:case 15:is(e,t,n,a),l&2048&&ho(9,t);break;case 1:is(e,t,n,a);break;case 3:is(e,t,n,a),l&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oo(e)));break;case 12:if(l&2048){is(e,t,n,a),e=t.stateNode;try{var r=t.memoizedProps,i=r.id,o=r.onPostCommit;typeof o=="function"&&o(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Ke(t,t.return,c)}}else is(e,t,n,a);break;case 13:is(e,t,n,a);break;case 23:break;case 22:r=t.stateNode,i=t.alternate,t.memoizedState!==null?r._visibility&2?is(e,t,n,a):_i(e,t):r._visibility&2?is(e,t,n,a):(r._visibility|=2,$l(e,t,n,a,(t.subtreeFlags&10256)!==0)),l&2048&&Zm(i,t);break;case 24:is(e,t,n,a),l&2048&&Wm(t.alternate,t);break;default:is(e,t,n,a)}}function $l(e,t,n,a,l){for(l=l&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var r=e,i=t,o=n,c=a,d=i.flags;switch(i.tag){case 0:case 11:case 15:$l(r,i,o,c,l),ho(8,i);break;case 23:break;case 22:var f=i.stateNode;i.memoizedState!==null?f._visibility&2?$l(r,i,o,c,l):_i(r,i):(f._visibility|=2,$l(r,i,o,c,l)),l&&d&2048&&Zm(i.alternate,i);break;case 24:$l(r,i,o,c,l),l&&d&2048&&Wm(i.alternate,i);break;default:$l(r,i,o,c,l)}t=t.sibling}}function _i(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,l=a.flags;switch(a.tag){case 22:_i(n,a),l&2048&&Zm(a.alternate,a);break;case 24:_i(n,a),l&2048&&Wm(a.alternate,a);break;default:_i(n,a)}t=t.sibling}}var ai=8192;function _l(e){if(e.subtreeFlags&ai)for(e=e.child;e!==null;)pj(e),e=e.sibling}function pj(e){switch(e.tag){case 26:_l(e),e.flags&ai&&e.memoizedState!==null&&oC(Bn,e.memoizedState,e.memoizedProps);break;case 5:_l(e);break;case 3:case 4:var t=Bn;Bn=lu(e.stateNode.containerInfo),_l(e),Bn=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=ai,ai=16777216,_l(e),ai=t):_l(e));break;default:_l(e)}}function xj(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 Kr(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];Rt=a,vj(a,e)}xj(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)gj(e),e=e.sibling}function gj(e){switch(e.tag){case 0:case 11:case 15:Kr(e),e.flags&2048&&Aa(9,e,e.return);break;case 3:Kr(e);break;case 12:Kr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,jc(e)):Kr(e);break;default:Kr(e)}}function jc(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];Rt=a,vj(a,e)}xj(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Aa(8,t,t.return),jc(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,jc(t));break;default:jc(t)}e=e.sibling}}function vj(e,t){for(;Rt!==null;){var n=Rt;switch(n.tag){case 0:case 11:case 15:Aa(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:oo(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,Rt=a;else e:for(n=e;Rt!==null;){a=Rt;var l=a.sibling,r=a.return;if(cj(a),a===n){Rt=null;break e}if(l!==null){l.return=r,Rt=l;break e}Rt=r}}}var N2={getCacheForType:function(e){var t=It(wt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n}},k2=typeof WeakMap=="function"?WeakMap:Map,qe=0,We=null,Ae=null,$e=0,Pe=0,rn=null,ga=!1,Tr=!1,Jm=!1,Ks=0,ut=0,Ma=0,tl=0,ep=0,Cn=0,pr=0,wi=null,Zt=null,wh=!1,tp=0,Jc=1/0,eu=null,Na=null,Dt=0,ka=null,xr=null,nr=0,Nh=0,kh=null,yj=null,Ni=0,Sh=null;function fn(){if(qe&2&&$e!==0)return $e&-$e;if(je.T!==null){var e=dr;return e!==0?e:sp()}return Ey()}function bj(){Cn===0&&(Cn=!($e&536870912)||Le?Sy():536870912);var e=Mn.current;return e!==null&&(e.flags|=32),Cn}function hn(e,t,n){(e===We&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(gr(e,0),va(e,$e,Cn,!1)),so(e,n),(!(qe&2)||e!==We)&&(e===We&&(!(qe&2)&&(tl|=n),ut===4&&va(e,$e,Cn,!1)),_s(e))}function jj(e,t,n){if(qe&6)throw Error(Q(327));var a=!n&&(t&124)===0&&(t&e.expiredLanes)===0||no(e,t),l=a?T2(e,t):of(e,t,!0),r=a;do{if(l===0){Tr&&!a&&va(e,t,0,!1);break}else{if(n=e.current.alternate,r&&!S2(n)){l=of(e,t,!1),r=!1;continue}if(l===2){if(r=t,e.errorRecoveryDisabledLanes&r)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;l=wi;var c=o.current.memoizedState.isDehydrated;if(c&&(gr(o,i).flags|=256),i=of(o,i,!1),i!==2){if(Jm&&!c){o.errorRecoveryDisabledLanes|=r,tl|=r,l=4;break e}r=Zt,Zt=l,r!==null&&(Zt===null?Zt=r:Zt.push.apply(Zt,r))}l=i}if(r=!1,l!==2)continue}}if(l===1){gr(e,0),va(e,t,0,!0);break}e:{switch(a=e,r=l,r){case 0:case 1:throw Error(Q(345));case 4:if((t&4194048)!==t)break;case 6:va(a,t,Cn,!ga);break e;case 2:Zt=null;break;case 3:case 5:break;default:throw Error(Q(329))}if((t&62914560)===t&&(l=tp+300-ps(),10<l)){if(va(a,t,Cn,!ga),Ou(a,0,!0)!==0)break e;a.timeoutHandle=Hj(jg.bind(null,a,n,Zt,eu,wh,t,Cn,tl,pr,ga,r,2,-0,0),l);break e}jg(a,n,Zt,eu,wh,t,Cn,tl,pr,ga,r,0,-0,0)}}break}while(!0);_s(e)}function jg(e,t,n,a,l,r,i,o,c,d,f,h,m,x){if(e.timeoutHandle=-1,h=t.subtreeFlags,(h&8192||(h&16785408)===16785408)&&(Ui={stylesheets:null,count:0,unsuspend:iC},pj(t),h=cC(),h!==null)){e.cancelPendingCommit=h(wg.bind(null,e,t,r,n,a,l,i,o,c,f,1,m,x)),va(e,r,i,!d);return}wg(e,t,r,n,a,l,i,o,c)}function S2(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 l=n[a],r=l.getSnapshot;l=l.value;try{if(!pn(r(),l))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 va(e,t,n,a){t&=~ep,t&=~tl,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var l=t;0<l;){var r=31-dn(l),i=1<<r;a[r]=-1,l&=~i}n!==0&&Ty(e,n,t)}function qu(){return qe&6?!0:(mo(0),!1)}function np(){if(Ae!==null){if(Pe===0)var e=Ae.return;else e=Ae,Ps=gl=null,Pm(e),tr=null,Di=0,e=Ae;for(;e!==null;)nj(e.alternate,e),e=e.return;Ae=null}}function gr(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,G2(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),np(),We=e,Ae=n=Gs(e.current,null),$e=t,Pe=0,rn=null,ga=!1,Tr=no(e,t),Jm=!1,pr=Cn=ep=tl=Ma=ut=0,Zt=wi=null,wh=!1,t&8&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var l=31-dn(a),r=1<<l;t|=e[l],a&=~r}return Ks=t,Lu(),n}function _j(e,t){Re=null,je.H=Fc,t===co||t===Bu?(t=Jx(),Pe=3):t===rb?(t=Jx(),Pe=4):Pe=t===Qb?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,rn=t,Ae===null&&(ut=1,Qc(e,Sn(t,e.current)))}function wj(){var e=je.H;return je.H=Fc,e===null?Fc:e}function Nj(){var e=je.A;return je.A=N2,e}function Ch(){ut=4,ga||($e&4194048)!==$e&&Mn.current!==null||(Tr=!0),!(Ma&134217727)&&!(tl&134217727)||We===null||va(We,$e,Cn,!1)}function of(e,t,n){var a=qe;qe|=2;var l=wj(),r=Nj();(We!==e||$e!==t)&&(eu=null,gr(e,t)),t=!1;var i=ut;e:do try{if(Pe!==0&&Ae!==null){var o=Ae,c=rn;switch(Pe){case 8:np(),i=6;break e;case 3:case 2:case 9:case 6:Mn.current===null&&(t=!0);var d=Pe;if(Pe=0,rn=null,Fl(e,o,c,d),n&&Tr){i=0;break e}break;default:d=Pe,Pe=0,rn=null,Fl(e,o,c,d)}}C2(),i=ut;break}catch(f){_j(e,f)}while(!0);return t&&e.shellSuspendCounter++,Ps=gl=null,qe=a,je.H=l,je.A=r,Ae===null&&(We=null,$e=0,Lu()),i}function C2(){for(;Ae!==null;)kj(Ae)}function T2(e,t){var n=qe;qe|=2;var a=wj(),l=Nj();We!==e||$e!==t?(eu=null,Jc=ps()+500,gr(e,t)):Tr=no(e,t);e:do try{if(Pe!==0&&Ae!==null){t=Ae;var r=rn;t:switch(Pe){case 1:Pe=0,rn=null,Fl(e,t,r,1);break;case 2:case 9:if(Wx(r)){Pe=0,rn=null,_g(t);break}t=function(){Pe!==2&&Pe!==9||We!==e||(Pe=7),_s(e)},r.then(t,t);break e;case 3:Pe=7;break e;case 4:Pe=5;break e;case 7:Wx(r)?(Pe=0,rn=null,_g(t)):(Pe=0,rn=null,Fl(e,t,r,7));break;case 5:var i=null;switch(Ae.tag){case 26:i=Ae.memoizedState;case 5:case 27:var o=Ae;if(!i||Gj(i)){Pe=0,rn=null;var c=o.sibling;if(c!==null)Ae=c;else{var d=o.return;d!==null?(Ae=d,Gu(d)):Ae=null}break t}}Pe=0,rn=null,Fl(e,t,r,5);break;case 6:Pe=0,rn=null,Fl(e,t,r,6);break;case 8:np(),ut=6;break e;default:throw Error(Q(462))}}R2();break}catch(f){_j(e,f)}while(!0);return Ps=gl=null,je.H=a,je.A=l,qe=n,Ae!==null?0:(We=null,$e=0,Lu(),ut)}function R2(){for(;Ae!==null&&!Z1();)kj(Ae)}function kj(e){var t=tj(e.alternate,e,Ks);e.memoizedProps=e.pendingProps,t===null?Gu(e):Ae=t}function _g(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pg(n,t,t.pendingProps,t.type,void 0,$e);break;case 11:t=pg(n,t,t.pendingProps,t.type.render,t.ref,$e);break;case 5:Pm(t);default:nj(n,t),t=Ae=nb(t,Ks),t=tj(n,t,Ks)}e.memoizedProps=e.pendingProps,t===null?Gu(e):Ae=t}function Fl(e,t,n,a){Ps=gl=null,Pm(t),tr=null,Di=0;var l=t.return;try{if(v2(e,l,t,n,$e)){ut=1,Qc(e,Sn(n,e.current)),Ae=null;return}}catch(r){if(l!==null)throw Ae=l,r;ut=1,Qc(e,Sn(n,e.current)),Ae=null;return}t.flags&32768?(Le||a===1?e=!0:Tr||$e&536870912?e=!1:(ga=e=!0,(a===2||a===9||a===3||a===6)&&(a=Mn.current,a!==null&&a.tag===13&&(a.flags|=16384))),Sj(t,e)):Gu(t)}function Gu(e){var t=e;do{if(t.flags&32768){Sj(t,ga);return}e=t.return;var n=b2(t.alternate,t,Ks);if(n!==null){Ae=n;return}if(t=t.sibling,t!==null){Ae=t;return}Ae=t=e}while(t!==null);ut===0&&(ut=5)}function Sj(e,t){do{var n=j2(e.alternate,e);if(n!==null){n.flags&=32767,Ae=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ae=e;return}Ae=e=n}while(e!==null);ut=6,Ae=null}function wg(e,t,n,a,l,r,i,o,c){e.cancelPendingCommit=null;do Vu();while(Dt!==0);if(qe&6)throw Error(Q(327));if(t!==null){if(t===e.current)throw Error(Q(177));if(r=t.lanes|t.childLanes,r|=Rm,iS(e,n,r,i,o,c),e===We&&(Ae=We=null,$e=0),xr=t,ka=e,nr=n,Nh=r,kh=l,yj=a,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,O2(Lc,function(){return Aj(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,t.subtreeFlags&13878||a){a=je.T,je.T=null,l=Ue.p,Ue.p=2,i=qe,qe|=4;try{_2(e,t,n)}finally{qe=i,Ue.p=l,je.T=a}}Dt=1,Cj(),Tj(),Rj()}}function Cj(){if(Dt===1){Dt=0;var e=ka,t=xr,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=je.T,je.T=null;var a=Ue.p;Ue.p=2;var l=qe;qe|=4;try{fj(t,e);var r=Ah,i=Xy(e.containerInfo),o=r.focusedElem,c=r.selectionRange;if(i!==o&&o&&o.ownerDocument&&Fy(o.ownerDocument.documentElement,o)){if(c!==null&&Tm(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(),j=o.textContent.length,v=Math.min(c.start,j),y=c.end===void 0?v:Math.min(c.end,j);!x.extend&&v>y&&(i=y,y=v,v=i);var g=Gx(o,v),p=Gx(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 b=h.createRange();b.setStart(g.node,g.offset),x.removeAllRanges(),v>y?(x.addRange(b),x.extend(p.node,p.offset)):(b.setEnd(p.node,p.offset),x.addRange(b))}}}}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 _=h[o];_.element.scrollLeft=_.left,_.element.scrollTop=_.top}}ou=!!Eh,Ah=Eh=null}finally{qe=l,Ue.p=a,je.T=n}}e.current=t,Dt=2}}function Tj(){if(Dt===2){Dt=0;var e=ka,t=xr,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=je.T,je.T=null;var a=Ue.p;Ue.p=2;var l=qe;qe|=4;try{oj(e,t.alternate,t)}finally{qe=l,Ue.p=a,je.T=n}}Dt=3}}function Rj(){if(Dt===4||Dt===3){Dt=0,W1();var e=ka,t=xr,n=nr,a=yj;t.subtreeFlags&10256||t.flags&10256?Dt=5:(Dt=0,xr=ka=null,Ej(e,e.pendingLanes));var l=e.pendingLanes;if(l===0&&(Na=null),jm(n),t=t.stateNode,un&&typeof un.onCommitFiberRoot=="function")try{un.onCommitFiberRoot(to,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=je.T,l=Ue.p,Ue.p=2,je.T=null;try{for(var r=e.onRecoverableError,i=0;i<a.length;i++){var o=a[i];r(o.value,{componentStack:o.stack})}}finally{je.T=t,Ue.p=l}}nr&3&&Vu(),_s(e),l=e.pendingLanes,n&4194090&&l&42?e===Sh?Ni++:(Ni=0,Sh=e):Ni=0,mo(0)}}function Ej(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,oo(t)))}function Vu(e){return Cj(),Tj(),Rj(),Aj()}function Aj(){if(Dt!==5)return!1;var e=ka,t=Nh;Nh=0;var n=jm(nr),a=je.T,l=Ue.p;try{Ue.p=32>n?32:n,je.T=null,n=kh,kh=null;var r=ka,i=nr;if(Dt=0,xr=ka=null,nr=0,qe&6)throw Error(Q(331));var o=qe;if(qe|=4,gj(r.current),mj(r,r.current,i,n),qe=o,mo(0,!1),un&&typeof un.onPostCommitFiberRoot=="function")try{un.onPostCommitFiberRoot(to,r)}catch{}return!0}finally{Ue.p=l,je.T=a,Ej(e,t)}}function Ng(e,t,n){t=Sn(n,t),t=yh(e.stateNode,t,2),e=wa(e,t,2),e!==null&&(so(e,2),_s(e))}function Ke(e,t,n){if(e.tag===3)Ng(e,e,n);else for(;t!==null;){if(t.tag===3){Ng(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Na===null||!Na.has(a))){e=Sn(n,e),n=Xb(2),a=wa(t,n,2),a!==null&&(Kb(n,a,t,e),so(a,2),_s(a));break}}t=t.return}}function cf(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new k2;var l=new Set;a.set(t,l)}else l=a.get(t),l===void 0&&(l=new Set,a.set(t,l));l.has(n)||(Jm=!0,l.add(n),e=E2.bind(null,e,t,n),t.then(e,e))}function E2(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,We===e&&($e&n)===n&&(ut===4||ut===3&&($e&62914560)===$e&&300>ps()-tp?!(qe&2)&&gr(e,0):ep|=n,pr===$e&&(pr=0)),_s(e)}function Mj(e,t){t===0&&(t=Cy()),e=Cr(e,t),e!==null&&(so(e,t),_s(e))}function A2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Mj(e,n)}function M2(e,t){var n=0;switch(e.tag){case 13:var a=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(Q(314))}a!==null&&a.delete(t),Mj(e,n)}function O2(e,t){return ym(e,t)}var tu=null,Dl=null,Th=!1,nu=!1,uf=!1,nl=0;function _s(e){e!==Dl&&e.next===null&&(Dl===null?tu=Dl=e:Dl=Dl.next=e),nu=!0,Th||(Th=!0,D2())}function mo(e,t){if(!uf&&nu){uf=!0;do for(var n=!1,a=tu;a!==null;){if(e!==0){var l=a.pendingLanes;if(l===0)var r=0;else{var i=a.suspendedLanes,o=a.pingedLanes;r=(1<<31-dn(42|e)+1)-1,r&=l&~(i&~o),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,kg(a,r))}else r=$e,r=Ou(a,a===We?r:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),!(r&3)||no(a,r)||(n=!0,kg(a,r));a=a.next}while(n);uf=!1}}function $2(){Oj()}function Oj(){nu=Th=!1;var e=0;nl!==0&&(q2()&&(e=nl),nl=0);for(var t=ps(),n=null,a=tu;a!==null;){var l=a.next,r=$j(a,t);r===0?(a.next=null,n===null?tu=l:n.next=l,l===null&&(Dl=n)):(n=a,(e!==0||r&3)&&(nu=!0)),a=l}mo(e)}function $j(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,l=e.expirationTimes,r=e.pendingLanes&-62914561;0<r;){var i=31-dn(r),o=1<<i,c=l[i];c===-1?(!(o&n)||o&a)&&(l[i]=rS(o,t)):c<=t&&(e.expiredLanes|=o),r&=~o}if(t=We,n=$e,n=Ou(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Dd(a),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||no(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&Dd(a),jm(n)){case 2:case 8:n=Ny;break;case 32:n=Lc;break;case 268435456:n=ky;break;default:n=Lc}return a=Dj.bind(null,e),n=ym(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&Dd(a),e.callbackPriority=2,e.callbackNode=null,2}function Dj(e,t){if(Dt!==0&&Dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Vu()&&e.callbackNode!==n)return null;var a=$e;return a=Ou(e,e===We?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(jj(e,a,t),$j(e,ps()),e.callbackNode!=null&&e.callbackNode===n?Dj.bind(null,e):null)}function kg(e,t){if(Vu())return null;jj(e,t,!0)}function D2(){V2(function(){qe&6?ym(wy,$2):Oj()})}function sp(){return nl===0&&(nl=Sy()),nl}function Sg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:hc(""+e)}function Cg(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 z2(e,t,n,a,l){if(t==="submit"&&n&&n.stateNode===l){var r=Sg((l[Wt]||null).action),i=a.submitter;i&&(t=(t=i[Wt]||null)?Sg(t.formAction):i.getAttribute("formAction"),t!==null&&(r=t,i=null));var o=new $u("action","action",null,a,l);e.push({event:o,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(nl!==0){var c=i?Cg(l,i):new FormData(l);gh(n,{pending:!0,data:c,method:l.method,action:r},null,c)}}else typeof r=="function"&&(o.preventDefault(),c=i?Cg(l,i):new FormData(l),gh(n,{pending:!0,data:c,method:l.method,action:r},r,c))},currentTarget:l}]})}}for(var df=0;df<lh.length;df++){var ff=lh[df],L2=ff.toLowerCase(),U2=ff[0].toUpperCase()+ff.slice(1);Zn(L2,"on"+U2)}Zn(Qy,"onAnimationEnd");Zn(Zy,"onAnimationIteration");Zn(Wy,"onAnimationStart");Zn("dblclick","onDoubleClick");Zn("focusin","onFocus");Zn("focusout","onBlur");Zn(t2,"onTransitionRun");Zn(n2,"onTransitionStart");Zn(s2,"onTransitionCancel");Zn(Jy,"onTransitionEnd");cr("onMouseEnter",["mouseout","mouseover"]);cr("onMouseLeave",["mouseout","mouseover"]);cr("onPointerEnter",["pointerout","pointerover"]);cr("onPointerLeave",["pointerout","pointerover"]);ml("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ml("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ml("onBeforeInput",["compositionend","keypress","textInput","paste"]);ml("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ml("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ml("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(" "),B2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(zi));function zj(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],l=a.event;a=a.listeners;e:{var r=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!==r&&l.isPropagationStopped())break e;r=o,l.currentTarget=d;try{r(l)}catch(f){Kc(f)}l.currentTarget=null,r=c}else for(i=0;i<a.length;i++){if(o=a[i],c=o.instance,d=o.currentTarget,o=o.listener,c!==r&&l.isPropagationStopped())break e;r=o,l.currentTarget=d;try{r(l)}catch(f){Kc(f)}l.currentTarget=null,r=c}}}}function Ee(e,t){var n=t[Wf];n===void 0&&(n=t[Wf]=new Set);var a=e+"__bubble";n.has(a)||(Lj(t,e,2,!1),n.add(a))}function hf(e,t,n){var a=0;t&&(a|=4),Lj(n,e,a,t)}var Yo="_reactListening"+Math.random().toString(36).slice(2);function ap(e){if(!e[Yo]){e[Yo]=!0,Ay.forEach(function(n){n!=="selectionchange"&&(B2.has(n)||hf(n,!1,e),hf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Yo]||(t[Yo]=!0,hf("selectionchange",!1,t))}}function Lj(e,t,n,a){switch(Kj(t)){case 2:var l=fC;break;case 8:l=hC;break;default:l=op}n=l.bind(null,t,n,e),l=void 0,!nh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),a?l!==void 0?e.addEventListener(t,n,{capture:!0,passive:l}):e.addEventListener(t,n,!0):l!==void 0?e.addEventListener(t,n,{passive:l}):e.addEventListener(t,n,!1)}function mf(e,t,n,a,l){var r=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===l)break;if(i===4)for(i=a.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===l)return;i=i.return}for(;o!==null;){if(i=Ul(o),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){a=r=i;continue e}o=o.parentNode}}a=a.return}By(function(){var d=r,f=Nm(n),h=[];e:{var m=eb.get(e);if(m!==void 0){var x=$u,j=e;switch(e){case"keypress":if(pc(n)===0)break e;case"keydown":case"keyup":x=OS;break;case"focusin":j="focus",x=qd;break;case"focusout":j="blur",x=qd;break;case"beforeblur":case"afterblur":x=qd;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=$x;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=jS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=zS;break;case Qy:case Zy:case Wy:x=NS;break;case Jy:x=US;break;case"scroll":case"scrollend":x=yS;break;case"wheel":x=HS;break;case"copy":case"cut":case"paste":x=SS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=zx;break;case"toggle":case"beforetoggle":x=PS}var v=(t&4)!==0,y=!v&&(e==="scroll"||e==="scrollend"),g=v?m!==null?m+"Capture":null:m;v=[];for(var p=d,b;p!==null;){var _=p;if(b=_.stateNode,_=_.tag,_!==5&&_!==26&&_!==27||b===null||g===null||(_=Ei(p,g),_!=null&&v.push(Li(p,_,b))),y)break;p=p.return}0<v.length&&(m=new x(m,j,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!==th&&(j=n.relatedTarget||n.fromElement)&&(Ul(j)||j[kr]))break e;if((x||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,x?(j=n.relatedTarget||n.toElement,x=d,j=j?Ul(j):null,j!==null&&(y=eo(j),v=j.tag,j!==y||v!==5&&v!==27&&v!==6)&&(j=null)):(x=null,j=d),x!==j)){if(v=$x,_="onMouseLeave",g="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(v=zx,_="onPointerLeave",g="onPointerEnter",p="pointer"),y=x==null?m:si(x),b=j==null?m:si(j),m=new v(_,p+"leave",x,n,f),m.target=y,m.relatedTarget=b,_=null,Ul(f)===d&&(v=new v(g,p+"enter",j,n,f),v.target=b,v.relatedTarget=y,_=v),y=_,x&&j)t:{for(v=x,g=j,p=0,b=v;b;b=wl(b))p++;for(b=0,_=g;_;_=wl(_))b++;for(;0<p-b;)v=wl(v),p--;for(;0<b-p;)g=wl(g),b--;for(;p--;){if(v===g||g!==null&&v===g.alternate)break t;v=wl(v),g=wl(g)}v=null}else v=null;x!==null&&Tg(h,m,x,v,!1),j!==null&&y!==null&&Tg(h,y,j,v,!0)}}e:{if(m=d?si(d):window,x=m.nodeName&&m.nodeName.toLowerCase(),x==="select"||x==="input"&&m.type==="file")var N=Hx;else if(Bx(m))if(Vy)N=WS;else{N=QS;var C=KS}else x=m.nodeName,!x||x.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?d&&wm(d.elementType)&&(N=Hx):N=ZS;if(N&&(N=N(e,d))){Gy(h,N,n,f);break e}C&&C(e,m,d),e==="focusout"&&d&&m.type==="number"&&d.memoizedProps.value!=null&&eh(m,"number",m.value)}switch(C=d?si(d):window,e){case"focusin":(Bx(C)||C.contentEditable==="true")&&(Il=C,sh=d,mi=null);break;case"focusout":mi=sh=Il=null;break;case"mousedown":ah=!0;break;case"contextmenu":case"mouseup":case"dragend":ah=!1,Vx(h,n,f);break;case"selectionchange":if(e2)break;case"keydown":case"keyup":Vx(h,n,f)}var w;if(Cm)e:{switch(e){case"compositionstart":var k="onCompositionStart";break e;case"compositionend":k="onCompositionEnd";break e;case"compositionupdate":k="onCompositionUpdate";break e}k=void 0}else Hl?Py(e,n)&&(k="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(k="onCompositionStart");k&&(Iy&&n.locale!=="ko"&&(Hl||k!=="onCompositionStart"?k==="onCompositionEnd"&&Hl&&(w=Hy()):(xa=f,km="value"in xa?xa.value:xa.textContent,Hl=!0)),C=su(d,k),0<C.length&&(k=new Dx(k,e,null,n,f),h.push({event:k,listeners:C}),w?k.data=w:(w=qy(n),w!==null&&(k.data=w)))),(w=GS?VS(e,n):YS(e,n))&&(k=su(d,"onBeforeInput"),0<k.length&&(C=new Dx("onBeforeInput","beforeinput",null,n,f),h.push({event:C,listeners:k}),C.data=w)),z2(h,e,d,n,f)}zj(h,t)})}function Li(e,t,n){return{instance:e,listener:t,currentTarget:n}}function su(e,t){for(var n=t+"Capture",a=[];e!==null;){var l=e,r=l.stateNode;if(l=l.tag,l!==5&&l!==26&&l!==27||r===null||(l=Ei(e,n),l!=null&&a.unshift(Li(e,l,r)),l=Ei(e,t),l!=null&&a.push(Li(e,l,r))),e.tag===3)return a;e=e.return}return[]}function wl(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Tg(e,t,n,a,l){for(var r=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,l?(d=Ei(n,r),d!=null&&i.unshift(Li(n,d,c))):l||(d=Ei(n,r),d!=null&&i.push(Li(n,d,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var H2=/\r\n?/g,I2=/\u0000|\uFFFD/g;function Rg(e){return(typeof e=="string"?e:""+e).replace(H2,`
49
- `).replace(I2,"")}function Uj(e,t){return t=Rg(t),Rg(e)===t}function Yu(){}function Fe(e,t,n,a,l,r){switch(n){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||ur(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&ur(e,""+a);break;case"className":Bo(e,"class",a);break;case"tabIndex":Bo(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Bo(e,n,a);break;case"style":Uy(e,a,r);break;case"data":if(t!=="object"){Bo(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=hc(""+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 r=="function"&&(n==="formAction"?(t!=="input"&&Fe(e,t,"name",l.name,l,null),Fe(e,t,"formEncType",l.formEncType,l,null),Fe(e,t,"formMethod",l.formMethod,l,null),Fe(e,t,"formTarget",l.formTarget,l,null)):(Fe(e,t,"encType",l.encType,l,null),Fe(e,t,"method",l.method,l,null),Fe(e,t,"target",l.target,l,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=hc(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=Yu);break;case"onScroll":a!=null&&Ee("scroll",e);break;case"onScrollEnd":a!=null&&Ee("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(Q(61));if(n=a.__html,n!=null){if(l.children!=null)throw Error(Q(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=hc(""+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":Ee("beforetoggle",e),Ee("toggle",e),fc(e,"popover",a);break;case"xlinkActuate":As(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":As(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":As(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":As(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":As(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":As(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":As(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":As(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":As(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":fc(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=gS.get(n)||n,fc(e,n,a))}}function Rh(e,t,n,a,l,r){switch(n){case"style":Uy(e,a,r);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(Q(61));if(n=a.__html,n!=null){if(l.children!=null)throw Error(Q(60));e.innerHTML=n}}break;case"children":typeof a=="string"?ur(e,a):(typeof a=="number"||typeof a=="bigint")&&ur(e,""+a);break;case"onScroll":a!=null&&Ee("scroll",e);break;case"onScrollEnd":a!=null&&Ee("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Yu);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!My.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(l=n.endsWith("Capture"),t=n.slice(2,l?n.length-7:void 0),r=e[Wt]||null,r=r!=null?r[n]:null,typeof r=="function"&&e.removeEventListener(t,r,l),typeof a=="function")){typeof r!="function"&&r!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,a,l);break e}n in e?e[n]=a:a===!0?e.setAttribute(n,""):fc(e,n,a)}}}function zt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var a=!1,l=!1,r;for(r in n)if(n.hasOwnProperty(r)){var i=n[r];if(i!=null)switch(r){case"src":a=!0;break;case"srcSet":l=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Q(137,t));default:Fe(e,t,r,i,n,null)}}l&&Fe(e,t,"srcSet",n.srcSet,n,null),a&&Fe(e,t,"src",n.src,n,null);return;case"input":Ee("invalid",e);var o=r=i=l=null,c=null,d=null;for(a in n)if(n.hasOwnProperty(a)){var f=n[a];if(f!=null)switch(a){case"name":l=f;break;case"type":i=f;break;case"checked":c=f;break;case"defaultChecked":d=f;break;case"value":r=f;break;case"defaultValue":o=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(Q(137,t));break;default:Fe(e,t,a,f,n,null)}}Dy(e,r,o,c,d,i,l,!1),Uc(e);return;case"select":Ee("invalid",e),a=i=r=null;for(l in n)if(n.hasOwnProperty(l)&&(o=n[l],o!=null))switch(l){case"value":r=o;break;case"defaultValue":i=o;break;case"multiple":a=o;default:Fe(e,t,l,o,n,null)}t=r,n=i,e.multiple=!!a,t!=null?Ql(e,!!a,t,!1):n!=null&&Ql(e,!!a,n,!0);return;case"textarea":Ee("invalid",e),r=l=a=null;for(i in n)if(n.hasOwnProperty(i)&&(o=n[i],o!=null))switch(i){case"value":a=o;break;case"defaultValue":l=o;break;case"children":r=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(Q(91));break;default:Fe(e,t,i,o,n,null)}Ly(e,a,l,r),Uc(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:Fe(e,t,c,a,n,null)}return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(a=0;a<zi.length;a++)Ee(zi[a],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("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(Q(137,t));default:Fe(e,t,d,a,n,null)}return;default:if(wm(t)){for(f in n)n.hasOwnProperty(f)&&(a=n[f],a!==void 0&&Rh(e,t,f,a,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(a=n[o],a!=null&&Fe(e,t,o,a,n,null))}function P2(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 l=null,r=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)||Fe(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":r=x;break;case"name":l=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(Q(137,t));break;default:x!==h&&Fe(e,t,m,x,a,h)}}Jf(e,i,o,c,d,f,r,l);return;case"select":x=i=o=m=null;for(r in n)if(c=n[r],n.hasOwnProperty(r)&&c!=null)switch(r){case"value":break;case"multiple":x=c;default:a.hasOwnProperty(r)||Fe(e,t,r,null,a,c)}for(l in a)if(r=a[l],c=n[l],a.hasOwnProperty(l)&&(r!=null||c!=null))switch(l){case"value":m=r;break;case"defaultValue":o=r;break;case"multiple":i=r;default:r!==c&&Fe(e,t,l,r,a,c)}t=o,n=i,a=x,m!=null?Ql(e,!!n,m,!1):!!a!=!!n&&(t!=null?Ql(e,!!n,t,!0):Ql(e,!!n,n?[]:"",!1));return;case"textarea":x=m=null;for(o in n)if(l=n[o],n.hasOwnProperty(o)&&l!=null&&!a.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:Fe(e,t,o,null,a,l)}for(i in a)if(l=a[i],r=n[i],a.hasOwnProperty(i)&&(l!=null||r!=null))switch(i){case"value":m=l;break;case"defaultValue":x=l;break;case"children":break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(Q(91));break;default:l!==r&&Fe(e,t,i,l,a,r)}zy(e,m,x);return;case"option":for(var j in n)if(m=n[j],n.hasOwnProperty(j)&&m!=null&&!a.hasOwnProperty(j))switch(j){case"selected":e.selected=!1;break;default:Fe(e,t,j,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:Fe(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)&&Fe(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(Q(137,t));break;default:Fe(e,t,d,m,a,x)}return;default:if(wm(t)){for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!==void 0&&!a.hasOwnProperty(y)&&Rh(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||Rh(e,t,f,m,a,x);return}}for(var g in n)m=n[g],n.hasOwnProperty(g)&&m!=null&&!a.hasOwnProperty(g)&&Fe(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||Fe(e,t,h,m,a,x)}var Eh=null,Ah=null;function au(e){return e.nodeType===9?e:e.ownerDocument}function Eg(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 Bj(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 Mh(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 pf=null;function q2(){var e=window.event;return e&&e.type==="popstate"?e===pf?!1:(pf=e,!0):(pf=null,!1)}var Hj=typeof setTimeout=="function"?setTimeout:void 0,G2=typeof clearTimeout=="function"?clearTimeout:void 0,Ag=typeof Promise=="function"?Promise:void 0,V2=typeof queueMicrotask=="function"?queueMicrotask:typeof Ag<"u"?function(e){return Ag.resolve(null).then(e).catch(Y2)}:Hj;function Y2(e){setTimeout(function(){throw e})}function La(e){return e==="head"}function Mg(e,t){var n=t,a=0,l=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(0<a&&8>a){n=a;var i=e.ownerDocument;if(n&1&&ki(i.documentElement),n&2&&ki(i.body),n&4)for(n=i.head,ki(n),i=n.firstChild;i;){var o=i.nextSibling,c=i.nodeName;i[ao]||c==="SCRIPT"||c==="STYLE"||c==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}if(l===0){e.removeChild(r),Pi(t);return}l--}else n==="$"||n==="$?"||n==="$!"?l++:a=n.charCodeAt(0)-48;else a=0;n=r}while(n);Pi(t)}function Oh(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":Oh(n),_m(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function F2(e,t,n,a){for(;e.nodeType===1;){var l=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[ao])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==l.rel||e.getAttribute("href")!==(l.href==null||l.href===""?null:l.href)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin)||e.getAttribute("title")!==(l.title==null?null:l.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(l.src==null?null:l.src)||e.getAttribute("type")!==(l.type==null?null:l.type)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=l.name==null?null:""+l.name;if(l.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=Gn(e.nextSibling),e===null)break}return null}function X2(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Gn(e.nextSibling),e===null))return null;return e}function $h(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function K2(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 Gn(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 Dh=null;function Og(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 Ij(e,t,n){switch(t=au(n),e){case"html":if(e=t.documentElement,!e)throw Error(Q(452));return e;case"head":if(e=t.head,!e)throw Error(Q(453));return e;case"body":if(e=t.body,!e)throw Error(Q(454));return e;default:throw Error(Q(451))}}function ki(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_m(e)}var On=new Map,$g=new Set;function lu(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ws=Ue.d;Ue.d={f:Q2,r:Z2,D:W2,C:J2,L:eC,m:tC,X:sC,S:nC,M:aC};function Q2(){var e=Ws.f(),t=qu();return e||t}function Z2(e){var t=Sr(e);t!==null&&t.tag===5&&t.type==="form"?$b(t):Ws.r(e)}var Rr=typeof document>"u"?null:document;function Pj(e,t,n){var a=Rr;if(a&&typeof t=="string"&&t){var l=kn(t);l='link[rel="'+e+'"][href="'+l+'"]',typeof n=="string"&&(l+='[crossorigin="'+n+'"]'),$g.has(l)||($g.add(l),e={rel:e,crossOrigin:n,href:t},a.querySelector(l)===null&&(t=a.createElement("link"),zt(t,"link",e),Et(t),a.head.appendChild(t)))}}function W2(e){Ws.D(e),Pj("dns-prefetch",e,null)}function J2(e,t){Ws.C(e,t),Pj("preconnect",e,t)}function eC(e,t,n){Ws.L(e,t,n);var a=Rr;if(a&&e&&t){var l='link[rel="preload"][as="'+kn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(l+='[imagesrcset="'+kn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(l+='[imagesizes="'+kn(n.imageSizes)+'"]')):l+='[href="'+kn(e)+'"]';var r=l;switch(t){case"style":r=vr(e);break;case"script":r=Er(e)}On.has(r)||(e=Je({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),On.set(r,e),a.querySelector(l)!==null||t==="style"&&a.querySelector(po(r))||t==="script"&&a.querySelector(xo(r))||(t=a.createElement("link"),zt(t,"link",e),Et(t),a.head.appendChild(t)))}}function tC(e,t){Ws.m(e,t);var n=Rr;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",l='link[rel="modulepreload"][as="'+kn(a)+'"][href="'+kn(e)+'"]',r=l;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=Er(e)}if(!On.has(r)&&(e=Je({rel:"modulepreload",href:e},t),On.set(r,e),n.querySelector(l)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(xo(r)))return}a=n.createElement("link"),zt(a,"link",e),Et(a),n.head.appendChild(a)}}}function nC(e,t,n){Ws.S(e,t,n);var a=Rr;if(a&&e){var l=Kl(a).hoistableStyles,r=vr(e);t=t||"default";var i=l.get(r);if(!i){var o={loading:0,preload:null};if(i=a.querySelector(po(r)))o.loading=5;else{e=Je({rel:"stylesheet",href:e,"data-precedence":t},n),(n=On.get(r))&&lp(e,n);var c=i=a.createElement("link");Et(c),zt(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,_c(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:o},l.set(r,i)}}}function sC(e,t){Ws.X(e,t);var n=Rr;if(n&&e){var a=Kl(n).hoistableScripts,l=Er(e),r=a.get(l);r||(r=n.querySelector(xo(l)),r||(e=Je({src:e,async:!0},t),(t=On.get(l))&&rp(e,t),r=n.createElement("script"),Et(r),zt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(l,r))}}function aC(e,t){Ws.M(e,t);var n=Rr;if(n&&e){var a=Kl(n).hoistableScripts,l=Er(e),r=a.get(l);r||(r=n.querySelector(xo(l)),r||(e=Je({src:e,async:!0,type:"module"},t),(t=On.get(l))&&rp(e,t),r=n.createElement("script"),Et(r),zt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(l,r))}}function Dg(e,t,n,a){var l=(l=ja.current)?lu(l):null;if(!l)throw Error(Q(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=vr(n.href),n=Kl(l).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=vr(n.href);var r=Kl(l).hoistableStyles,i=r.get(e);if(i||(l=l.ownerDocument||l,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,i),(r=l.querySelector(po(e)))&&!r._p&&(i.instance=r,i.state.loading=5),On.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},On.set(e,n),r||lC(l,e,n,i.state))),t&&a===null)throw Error(Q(528,""));return i}if(t&&a!==null)throw Error(Q(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Er(n),n=Kl(l).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(Q(444,e))}}function vr(e){return'href="'+kn(e)+'"'}function po(e){return'link[rel="stylesheet"]['+e+"]"}function qj(e){return Je({},e,{"data-precedence":e.precedence,precedence:null})}function lC(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}),zt(t,"link",n),Et(t),e.head.appendChild(t))}function Er(e){return'[src="'+kn(e)+'"]'}function xo(e){return"script[async]"+e}function zg(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+kn(n.href)+'"]');if(a)return t.instance=a,Et(a),a;var l=Je({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Et(a),zt(a,"style",l),_c(a,n.precedence,e),t.instance=a;case"stylesheet":l=vr(n.href);var r=e.querySelector(po(l));if(r)return t.state.loading|=4,t.instance=r,Et(r),r;a=qj(n),(l=On.get(l))&&lp(a,l),r=(e.ownerDocument||e).createElement("link"),Et(r);var i=r;return i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),zt(r,"link",a),t.state.loading|=4,_c(r,n.precedence,e),t.instance=r;case"script":return r=Er(n.src),(l=e.querySelector(xo(r)))?(t.instance=l,Et(l),l):(a=n,(l=On.get(r))&&(a=Je({},n),rp(a,l)),e=e.ownerDocument||e,l=e.createElement("script"),Et(l),zt(l,"link",a),e.head.appendChild(l),t.instance=l);case"void":return null;default:throw Error(Q(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(a=t.instance,t.state.loading|=4,_c(a,n.precedence,e));return t.instance}function _c(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),l=a.length?a[a.length-1]:null,r=l,i=0;i<a.length;i++){var o=a[i];if(o.dataset.precedence===t)r=o;else if(r!==l)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function lp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function rp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var wc=null;function Lg(e,t,n){if(wc===null){var a=new Map,l=wc=new Map;l.set(n,a)}else l=wc,a=l.get(n),a||(a=new Map,l.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),l=0;l<n.length;l++){var r=n[l];if(!(r[ao]||r[Ht]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var i=r.getAttribute(t)||"";i=e+i;var o=a.get(i);o?o.push(r):a.set(i,[r])}}return a}function Ug(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function rC(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 Gj(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var Ui=null;function iC(){}function oC(e,t,n){if(Ui===null)throw Error(Q(475));var a=Ui;if(t.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var l=vr(n.href),r=e.querySelector(po(l));if(r){e=r._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(a.count++,a=ru.bind(a),e.then(a,a)),t.state.loading|=4,t.instance=r,Et(r);return}r=e.ownerDocument||e,n=qj(n),(l=On.get(l))&&lp(n,l),r=r.createElement("link"),Et(r);var i=r;i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),zt(r,"link",n),t.instance=r}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(t,e),(e=t.state.preload)&&!(t.state.loading&3)&&(a.count++,t=ru.bind(a),e.addEventListener("load",t),e.addEventListener("error",t))}}function cC(){if(Ui===null)throw Error(Q(475));var e=Ui;return e.stylesheets&&e.count===0&&zh(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&zh(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 ru(){if(this.count--,this.count===0){if(this.stylesheets)zh(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var iu=null;function zh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,iu=new Map,t.forEach(uC,e),iu=null,ru.call(e))}function uC(e,t){if(!(t.state.loading&4)){var n=iu.get(e);if(n)var a=n.get(null);else{n=new Map,iu.set(e,n);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<l.length;r++){var i=l[r];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(n.set(i.dataset.precedence,i),a=i)}a&&n.set(null,a)}l=t.instance,i=l.getAttribute("data-precedence"),r=n.get(i)||a,r===a&&n.set(null,l),n.set(i,l),this.count++,a=ru.bind(this),l.addEventListener("load",a),l.addEventListener("error",a),r?r.parentNode.insertBefore(l,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(l,e.firstChild)),t.state.loading|=4}}var Bi={$$typeof:Bs,Provider:null,Consumer:null,_currentValue:Qa,_currentValue2:Qa,_threadCount:0};function dC(e,t,n,a,l,r,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=zd(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zd(0),this.hiddenUpdates=zd(null),this.identifierPrefix=a,this.onUncaughtError=l,this.onCaughtError=r,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function Vj(e,t,n,a,l,r,i,o,c,d,f,h){return e=new dC(e,t,n,i,o,c,d,h),t=1,r===!0&&(t|=24),r=cn(3,null,null,t),e.current=r,r.stateNode=e,t=$m(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:a,isDehydrated:n,cache:t},zm(r),e}function Yj(e){return e?(e=Gl,e):Gl}function Fj(e,t,n,a,l,r){l=Yj(l),a.context===null?a.context=l:a.pendingContext=l,a=_a(t),a.payload={element:n},r=r===void 0?null:r,r!==null&&(a.callback=r),n=wa(e,a,t),n!==null&&(hn(n,e,t),gi(n,e,t))}function Bg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){Bg(e,t),(e=e.alternate)&&Bg(e,t)}function Xj(e){if(e.tag===13){var t=Cr(e,67108864);t!==null&&hn(t,e,67108864),ip(e,67108864)}}var ou=!0;function fC(e,t,n,a){var l=je.T;je.T=null;var r=Ue.p;try{Ue.p=2,op(e,t,n,a)}finally{Ue.p=r,je.T=l}}function hC(e,t,n,a){var l=je.T;je.T=null;var r=Ue.p;try{Ue.p=8,op(e,t,n,a)}finally{Ue.p=r,je.T=l}}function op(e,t,n,a){if(ou){var l=Lh(a);if(l===null)mf(e,t,a,cu,n),Hg(e,a);else if(pC(l,e,t,n,a))a.stopPropagation();else if(Hg(e,a),t&4&&-1<mC.indexOf(e)){for(;l!==null;){var r=Sr(l);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var i=Ya(r.pendingLanes);if(i!==0){var o=r;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var c=1<<31-dn(i);o.entanglements[1]|=c,i&=~c}_s(r),!(qe&6)&&(Jc=ps()+500,mo(0))}}break;case 13:o=Cr(r,2),o!==null&&hn(o,r,2),qu(),ip(r,2)}if(r=Lh(a),r===null&&mf(e,t,a,cu,n),r===l)break;l=r}l!==null&&a.stopPropagation()}else mf(e,t,a,null,n)}}function Lh(e){return e=Nm(e),cp(e)}var cu=null;function cp(e){if(cu=null,e=Ul(e),e!==null){var t=eo(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=yy(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 cu=e,null}function Kj(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(J1()){case wy:return 2;case Ny:return 8;case Lc:case eS:return 32;case ky:return 268435456;default:return 32}default:return 32}}var Uh=!1,Sa=null,Ca=null,Ta=null,Hi=new Map,Ii=new Map,ma=[],mC="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 Hg(e,t){switch(e){case"focusin":case"focusout":Sa=null;break;case"dragenter":case"dragleave":Ca=null;break;case"mouseover":case"mouseout":Ta=null;break;case"pointerover":case"pointerout":Hi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ii.delete(t.pointerId)}}function Qr(e,t,n,a,l,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:r,targetContainers:[l]},t!==null&&(t=Sr(t),t!==null&&Xj(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function pC(e,t,n,a,l){switch(t){case"focusin":return Sa=Qr(Sa,e,t,n,a,l),!0;case"dragenter":return Ca=Qr(Ca,e,t,n,a,l),!0;case"mouseover":return Ta=Qr(Ta,e,t,n,a,l),!0;case"pointerover":var r=l.pointerId;return Hi.set(r,Qr(Hi.get(r)||null,e,t,n,a,l)),!0;case"gotpointercapture":return r=l.pointerId,Ii.set(r,Qr(Ii.get(r)||null,e,t,n,a,l)),!0}return!1}function Qj(e){var t=Ul(e.target);if(t!==null){var n=eo(t);if(n!==null){if(t=n.tag,t===13){if(t=yy(n),t!==null){e.blockedOn=t,oS(e.priority,function(){if(n.tag===13){var a=fn();a=bm(a);var l=Cr(n,a);l!==null&&hn(l,n,a),ip(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 Nc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Lh(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);th=a,n.target.dispatchEvent(a),th=null}else return t=Sr(n),t!==null&&Xj(t),e.blockedOn=n,!1;t.shift()}return!0}function Ig(e,t,n){Nc(e)&&n.delete(t)}function xC(){Uh=!1,Sa!==null&&Nc(Sa)&&(Sa=null),Ca!==null&&Nc(Ca)&&(Ca=null),Ta!==null&&Nc(Ta)&&(Ta=null),Hi.forEach(Ig),Ii.forEach(Ig)}function Fo(e,t){e.blockedOn===t&&(e.blockedOn=null,Uh||(Uh=!0,kt.unstable_scheduleCallback(kt.unstable_NormalPriority,xC)))}var Xo=null;function Pg(e){Xo!==e&&(Xo=e,kt.unstable_scheduleCallback(kt.unstable_NormalPriority,function(){Xo===e&&(Xo=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],l=e[t+2];if(typeof a!="function"){if(cp(a||n)===null)continue;break}var r=Sr(n);r!==null&&(e.splice(t,3),t-=3,gh(r,{pending:!0,data:l,method:n.method,action:a},a,l))}}))}function Pi(e){function t(c){return Fo(c,e)}Sa!==null&&Fo(Sa,e),Ca!==null&&Fo(Ca,e),Ta!==null&&Fo(Ta,e),Hi.forEach(t),Ii.forEach(t);for(var n=0;n<ma.length;n++){var a=ma[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<ma.length&&(n=ma[0],n.blockedOn===null);)Qj(n),n.blockedOn===null&&ma.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var l=n[a],r=n[a+1],i=l[Wt]||null;if(typeof r=="function")i||Pg(n);else if(i){var o=null;if(r&&r.hasAttribute("formAction")){if(l=r,i=r[Wt]||null)o=i.formAction;else if(cp(l)!==null)continue}else o=i.action;typeof o=="function"?n[a+1]=o:(n.splice(a,3),a-=3),Pg(n)}}}function up(e){this._internalRoot=e}Fu.prototype.render=up.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));var n=t.current,a=fn();Fj(n,a,e,t,null,null)};Fu.prototype.unmount=up.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fj(e.current,2,null,e,null,null),qu(),t[kr]=null}};function Fu(e){this._internalRoot=e}Fu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ey();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ma.length&&t!==0&&t<ma[n].priority;n++);ma.splice(n,0,e),n===0&&Qj(e)}};var qg=gy.version;if(qg!=="19.1.0")throw Error(Q(527,qg,"19.1.0"));Ue.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=Y1(t),e=e!==null?by(e):null,e=e===null?null:e.stateNode,e};var gC={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:je,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ko=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ko.isDisabled&&Ko.supportsFiber)try{to=Ko.inject(gC),un=Ko}catch{}}Au.createRoot=function(e,t){if(!vy(e))throw Error(Q(299));var n=!1,a="",l=Vb,r=Yb,i=Fb,o=null;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(l=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(o=t.unstable_transitionCallbacks)),t=Vj(e,1,!1,null,null,n,a,l,r,i,o,null),e[kr]=t.current,ap(e),new up(t)};Au.hydrateRoot=function(e,t,n){if(!vy(e))throw Error(Q(299));var a=!1,l="",r=Vb,i=Yb,o=Fb,c=null,d=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=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=Vj(e,1,!0,t,n??null,a,l,r,i,o,c,d),t.context=Yj(null),n=t.current,a=fn(),a=bm(a),l=_a(a),l.callback=null,wa(n,l,a),n=a,t.current.lanes=n,so(t,n),_s(t),e[kr]=t.current,ap(e),new Fu(t)};Au.version="19.1.0";function Zj(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Zj)}catch(e){console.error(e)}}Zj(),dy.exports=Au;var vC=dy.exports;const Wj=u.createContext(null);function Jj({data:e,router:t,identity:n,notify:a,children:l}){return s.jsx(Wj.Provider,{value:{data:e,router:t,identity:n,notify:a},children:l})}function Xu(){const e=u.useContext(Wj);if(!e)throw new Error("A shared app page rendered outside AppUiProvider.");return e}const yC={success:()=>{},error:()=>{}},en=()=>Xu().data,Ve=()=>Xu().router,Ku=()=>Xu().identity,Ar=()=>Xu().notify??yC;function bC(){const{probe:e}=en(),{href:t,Link:n}=Ve(),a=Ku(),[l,r]=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&&r(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":l??"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 _n(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Dy(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xS(e){var t=Dy(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 l=n.get,r=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){a=""+i,r.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 Uc(e){e._valueTracker||(e._valueTracker=xS(e))}function zy(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=Dy(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function Bc(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 gS=/[\n"\\]/g;function kn(e){return e.replace(gS,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Jf(e,t,n,a,l,r,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=""+_n(t)):e.value!==""+_n(t)&&(e.value=""+_n(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?eh(e,i,_n(t)):n!=null?eh(e,i,_n(n)):a!=null&&e.removeAttribute("value"),l==null&&r!=null&&(e.defaultChecked=!!r),l!=null&&(e.checked=l&&typeof l!="function"&&typeof l!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+_n(o):e.removeAttribute("name")}function Ly(e,t,n,a,l,r,i,o){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null))return;n=n!=null?""+_n(n):"",t=t!=null?""+_n(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}a=a??l,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 eh(e,t,n){t==="number"&&Bc(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ql(e,t,n,a){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&a&&(e[n].defaultSelected=!0)}else{for(n=""+_n(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,a&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function Uy(e,t,n){if(t!=null&&(t=""+_n(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+_n(n):""}function By(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(Q(92));if(ni(a)){if(1<a.length)throw Error(Q(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=_n(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a)}function ur(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var vS=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 Ax(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||vS.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Hy(e,t,n){if(t!=null&&typeof t!="object")throw Error(Q(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 l in t)a=t[l],t.hasOwnProperty(l)&&n[l]!==a&&Ax(e,l,a)}else for(var r in t)t.hasOwnProperty(r)&&Ax(e,r,t[r])}function wm(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 yS=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"]]),bS=/^[\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 hc(e){return bS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var th=null;function Nm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bl=null,Zl=null;function Mx(e){var t=Sr(e);if(t&&(e=t.stateNode)){var n=e[Wt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Jf(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="'+kn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var l=a[Wt]||null;if(!l)throw Error(Q(90));Jf(a,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&zy(a)}break e;case"textarea":Uy(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ql(e,!!n.multiple,t,!1)}}}var Hd=!1;function Iy(e,t,n){if(Hd)return e(t,n);Hd=!0;try{var a=e(t);return a}finally{if(Hd=!1,(Bl!==null||Zl!==null)&&(qu(),Bl&&(t=Bl,e=Zl,Zl=Bl=null,Mx(t),e)))for(t=0;t<e.length;t++)Mx(e[t])}}function Ei(e,t){var n=e.stateNode;if(n===null)return null;var a=n[Wt]||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(Q(231,t,typeof n));return n}var Ys=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),nh=!1;if(Ys)try{var Gr={};Object.defineProperty(Gr,"passive",{get:function(){nh=!0}}),window.addEventListener("test",Gr,Gr),window.removeEventListener("test",Gr,Gr)}catch{nh=!1}var xa=null,km=null,mc=null;function Py(){if(mc)return mc;var e,t=km,n=t.length,a,l="value"in xa?xa.value:xa.textContent,r=l.length;for(e=0;e<n&&t[e]===l[e];e++);var i=n-e;for(a=1;a<=i&&t[n-a]===l[r-a];a++);return mc=l.slice(e,1<a?1-a:void 0)}function pc(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 Ho(){return!0}function Ox(){return!1}function Jt(e){function t(n,a,l,r,i){this._reactName=n,this._targetInst=l,this.type=a,this.nativeEvent=r,this.target=i,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(r):r[o]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?Ho:Ox,this.isPropagationStopped=Ox,this}return Je(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=Ho)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ho)},persist:function(){},isPersistent:Ho}),t}var pl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$u=Jt(pl),lo=Je({},pl,{view:0,detail:0}),jS=Jt(lo),Id,Pd,Vr,Du=Je({},lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sm,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!==Vr&&(Vr&&e.type==="mousemove"?(Id=e.screenX-Vr.screenX,Pd=e.screenY-Vr.screenY):Pd=Id=0,Vr=e),Id)},movementY:function(e){return"movementY"in e?e.movementY:Pd}}),$x=Jt(Du),_S=Je({},Du,{dataTransfer:0}),wS=Jt(_S),NS=Je({},lo,{relatedTarget:0}),qd=Jt(NS),kS=Je({},pl,{animationName:0,elapsedTime:0,pseudoElement:0}),SS=Jt(kS),CS=Je({},pl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),RS=Jt(CS),TS=Je({},pl,{data:0}),Dx=Jt(TS),ES={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AS={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"},MS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function OS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=MS[e])?!!t[e]:!1}function Sm(){return OS}var $S=Je({},lo,{key:function(e){if(e.key){var t=ES[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=pc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?AS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sm,charCode:function(e){return e.type==="keypress"?pc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?pc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),DS=Jt($S),zS=Je({},Du,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zx=Jt(zS),LS=Je({},lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sm}),US=Jt(LS),BS=Je({},pl,{propertyName:0,elapsedTime:0,pseudoElement:0}),HS=Jt(BS),IS=Je({},Du,{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}),PS=Jt(IS),qS=Je({},pl,{newState:0,oldState:0}),GS=Jt(qS),VS=[9,13,27,32],Cm=Ys&&"CompositionEvent"in window,fi=null;Ys&&"documentMode"in document&&(fi=document.documentMode);var YS=Ys&&"TextEvent"in window&&!fi,qy=Ys&&(!Cm||fi&&8<fi&&11>=fi),Lx=" ",Ux=!1;function Gy(e,t){switch(e){case"keyup":return VS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vy(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hl=!1;function FS(e,t){switch(e){case"compositionend":return Vy(t);case"keypress":return t.which!==32?null:(Ux=!0,Lx);case"textInput":return e=t.data,e===Lx&&Ux?null:e;default:return null}}function XS(e,t){if(Hl)return e==="compositionend"||!Cm&&Gy(e,t)?(e=Py(),mc=km=xa=null,Hl=!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 qy&&t.locale!=="ko"?null:t.data;default:return null}}var KS={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 Bx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!KS[e.type]:t==="textarea"}function Yy(e,t,n,a){Bl?Zl?Zl.push(a):Zl=[a]:Bl=a,t=su(t,"onChange"),0<t.length&&(n=new $u("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var hi=null,Ai=null;function QS(e){Uj(e,0)}function zu(e){var t=si(e);if(zy(t))return e}function Hx(e,t){if(e==="change")return t}var Fy=!1;if(Ys){var Gd;if(Ys){var Vd="oninput"in document;if(!Vd){var Ix=document.createElement("div");Ix.setAttribute("oninput","return;"),Vd=typeof Ix.oninput=="function"}Gd=Vd}else Gd=!1;Fy=Gd&&(!document.documentMode||9<document.documentMode)}function Px(){hi&&(hi.detachEvent("onpropertychange",Xy),Ai=hi=null)}function Xy(e){if(e.propertyName==="value"&&zu(Ai)){var t=[];Yy(t,Ai,e,Nm(e)),Iy(QS,t)}}function ZS(e,t,n){e==="focusin"?(Px(),hi=t,Ai=n,hi.attachEvent("onpropertychange",Xy)):e==="focusout"&&Px()}function WS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return zu(Ai)}function JS(e,t){if(e==="click")return zu(t)}function e2(e,t){if(e==="input"||e==="change")return zu(t)}function t2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pn=typeof Object.is=="function"?Object.is:t2;function Mi(e,t){if(pn(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 l=n[a];if(!Zf.call(t,l)||!pn(e[l],t[l]))return!1}return!0}function qx(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gx(e,t){var n=qx(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=qx(n)}}function Ky(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ky(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qy(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bc(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=Bc(e.document)}return t}function Rm(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 n2=Ys&&"documentMode"in document&&11>=document.documentMode,Il=null,sh=null,mi=null,ah=!1;function Vx(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ah||Il==null||Il!==Bc(a)||(a=Il,"selectionStart"in a&&Rm(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}),mi&&Mi(mi,a)||(mi=a,a=su(sh,"onSelect"),0<a.length&&(t=new $u("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Il)))}function Ga(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Pl={animationend:Ga("Animation","AnimationEnd"),animationiteration:Ga("Animation","AnimationIteration"),animationstart:Ga("Animation","AnimationStart"),transitionrun:Ga("Transition","TransitionRun"),transitionstart:Ga("Transition","TransitionStart"),transitioncancel:Ga("Transition","TransitionCancel"),transitionend:Ga("Transition","TransitionEnd")},Yd={},Zy={};Ys&&(Zy=document.createElement("div").style,"AnimationEvent"in window||(delete Pl.animationend.animation,delete Pl.animationiteration.animation,delete Pl.animationstart.animation),"TransitionEvent"in window||delete Pl.transitionend.transition);function xl(e){if(Yd[e])return Yd[e];if(!Pl[e])return e;var t=Pl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Zy)return Yd[e]=t[n];return e}var Wy=xl("animationend"),Jy=xl("animationiteration"),eb=xl("animationstart"),s2=xl("transitionrun"),a2=xl("transitionstart"),l2=xl("transitioncancel"),tb=xl("transitionend"),nb=new Map,lh="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(" ");lh.push("scrollEnd");function Zn(e,t){nb.set(e,t),ml(t,[e])}var Yx=new WeakMap;function Sn(e,t){if(typeof e=="object"&&e!==null){var n=Yx.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Ex(t)},Yx.set(e,t),t)}return{value:e,source:t,stack:Ex(t)}}var jn=[],ql=0,Tm=0;function Lu(){for(var e=ql,t=Tm=ql=0;t<e;){var n=jn[t];jn[t++]=null;var a=jn[t];jn[t++]=null;var l=jn[t];jn[t++]=null;var r=jn[t];if(jn[t++]=null,a!==null&&l!==null){var i=a.pending;i===null?l.next=l:(l.next=i.next,i.next=l),a.pending=l}r!==0&&sb(n,l,r)}}function Uu(e,t,n,a){jn[ql++]=e,jn[ql++]=t,jn[ql++]=n,jn[ql++]=a,Tm|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Em(e,t,n,a){return Uu(e,t,n,a),Hc(e)}function Cr(e,t){return Uu(e,null,null,t),Hc(e)}function sb(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var l=!1,r=e.return;r!==null;)r.childLanes|=n,a=r.alternate,a!==null&&(a.childLanes|=n),r.tag===22&&(e=r.stateNode,e===null||e._visibility&1||(l=!0)),e=r,r=r.return;return e.tag===3?(r=e.stateNode,l&&t!==null&&(l=31-dn(n),e=r.hiddenUpdates,a=e[l],a===null?e[l]=[t]:a.push(t),t.lane=n|536870912),r):null}function Hc(e){if(50<Ni)throw Ni=0,Sh=null,Error(Q(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Gl={};function r2(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 r2(e,t,n,a)}function Am(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Gs(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 ab(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 xc(e,t,n,a,l,r){var i=0;if(a=e,typeof e=="function")Am(e)&&(i=1);else if(typeof e=="string")i=oC(e,n,ms.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Ff:return e=cn(31,n,t,l),e.elementType=Ff,e.lanes=r,e;case zl:return Za(n.children,l,r,t);case wy:i=8,l|=24;break;case Gf:return e=cn(12,n,t,l|2),e.elementType=Gf,e.lanes=r,e;case Vf:return e=cn(13,n,t,l),e.elementType=Vf,e.lanes=r,e;case Yf:return e=cn(19,n,t,l),e.elementType=Yf,e.lanes=r,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Q1:case Bs:i=10;break e;case Ny:i=9;break e;case gm:i=11;break e;case vm:i=14;break e;case ca:i=16,a=null;break e}i=29,n=Error(Q(130,e===null?"null":typeof e,"")),a=null}return t=cn(i,n,t,l),t.elementType=e,t.type=a,t.lanes=r,t}function Za(e,t,n,a){return e=cn(7,e,a,t),e.lanes=n,e}function Fd(e,t,n){return e=cn(6,e,null,t),e.lanes=n,e}function Xd(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 Vl=[],Yl=0,Ic=null,Pc=0,wn=[],Nn=0,Wa=null,Hs=1,Is="";function Fa(e,t){Vl[Yl++]=Pc,Vl[Yl++]=Ic,Ic=e,Pc=t}function lb(e,t,n){wn[Nn++]=Hs,wn[Nn++]=Is,wn[Nn++]=Wa,Wa=e;var a=Hs;e=Is;var l=32-dn(a)-1;a&=~(1<<l),n+=1;var r=32-dn(t)+l;if(30<r){var i=l-l%5;r=(a&(1<<i)-1).toString(32),a>>=i,l-=i,Hs=1<<32-dn(t)+l|n<<l|a,Is=r+e}else Hs=1<<r|n<<l|a,Is=e}function Mm(e){e.return!==null&&(Fa(e,1),lb(e,1,0))}function Om(e){for(;e===Ic;)Ic=Vl[--Yl],Vl[Yl]=null,Pc=Vl[--Yl],Vl[Yl]=null;for(;e===Wa;)Wa=wn[--Nn],wn[Nn]=null,Is=wn[--Nn],wn[Nn]=null,Hs=wn[--Nn],wn[Nn]=null}var qt=null,ct=null,Le=!1,Ja=null,os=!1,rh=Error(Q(519));function al(e){var t=Error(Q(418,""));throw Oi(Sn(t,e)),rh}function Fx(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[Ht]=e,t[Wt]=a,n){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(n=0;n<zi.length;n++)Ee(zi[n],t);break;case"source":Ee("error",t);break;case"img":case"image":case"link":Ee("error",t),Ee("load",t);break;case"details":Ee("toggle",t);break;case"input":Ee("invalid",t),Ly(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0),Uc(t);break;case"select":Ee("invalid",t);break;case"textarea":Ee("invalid",t),By(t,a.value,a.defaultValue,a.children),Uc(t)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||Hj(t.textContent,n)?(a.popover!=null&&(Ee("beforetoggle",t),Ee("toggle",t)),a.onScroll!=null&&Ee("scroll",t),a.onScrollEnd!=null&&Ee("scrollend",t),a.onClick!=null&&(t.onclick=Yu),t=!0):t=!1,t||al(e)}function Xx(e){for(qt=e.return;qt;)switch(qt.tag){case 5:case 13:os=!1;return;case 27:case 3:os=!0;return;default:qt=qt.return}}function Yr(e){if(e!==qt)return!1;if(!Le)return Xx(e),Le=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Mh(e.type,e.memoizedProps)),n=!n),n&&ct&&al(e),Xx(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(n=e.data,n==="/$"){if(t===0){ct=Gn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++;e=e.nextSibling}ct=null}}else t===27?(t=ct,La(e.type)?(e=Dh,Dh=null,ct=e):ct=t):ct=qt?Gn(e.stateNode.nextSibling):null;return!0}function ro(){ct=qt=null,Le=!1}function Kx(){var e=Ja;return e!==null&&(Zt===null?Zt=e:Zt.push.apply(Zt,e),Ja=null),e}function Oi(e){Ja===null?Ja=[e]:Ja.push(e)}var ih=js(null),gl=null,Ps=null;function da(e,t,n){nt(ih,t._currentValue),t._currentValue=n}function Vs(e){e._currentValue=ih.current,Mt(ih)}function oh(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 ch(e,t,n,a){var l=e.child;for(l!==null&&(l.return=e);l!==null;){var r=l.dependencies;if(r!==null){var i=l.child;r=r.firstContext;e:for(;r!==null;){var o=r;r=l;for(var c=0;c<t.length;c++)if(o.context===t[c]){r.lanes|=n,o=r.alternate,o!==null&&(o.lanes|=n),oh(r.return,n,e),a||(i=null);break e}r=o.next}}else if(l.tag===18){if(i=l.return,i===null)throw Error(Q(341));i.lanes|=n,r=i.alternate,r!==null&&(r.lanes|=n),oh(i,n,e),i=null}else i=l.child;if(i!==null)i.return=l;else for(i=l;i!==null;){if(i===e){i=null;break}if(l=i.sibling,l!==null){l.return=i.return,i=l;break}i=i.return}l=i}}function io(e,t,n,a){e=null;for(var l=t,r=!1;l!==null;){if(!r){if(l.flags&524288)r=!0;else if(l.flags&262144)break}if(l.tag===10){var i=l.alternate;if(i===null)throw Error(Q(387));if(i=i.memoizedProps,i!==null){var o=l.type;pn(l.pendingProps.value,i.value)||(e!==null?e.push(o):e=[o])}}else if(l===$c.current){if(i=l.alternate,i===null)throw Error(Q(387));i.memoizedState.memoizedState!==l.memoizedState.memoizedState&&(e!==null?e.push(Bi):e=[Bi])}l=l.return}e!==null&&ch(t,e,n,a),t.flags|=262144}function qc(e){for(e=e.firstContext;e!==null;){if(!pn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ll(e){gl=e,Ps=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function It(e){return rb(gl,e)}function Io(e,t){return gl===null&&ll(e),rb(e,t)}function rb(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ps===null){if(e===null)throw Error(Q(308));Ps=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ps=Ps.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()})}},o2=kt.unstable_scheduleCallback,c2=kt.unstable_NormalPriority,wt={$$typeof:Bs,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $m(){return{controller:new i2,data:new Map,refCount:0}}function oo(e){e.refCount--,e.refCount===0&&o2(c2,function(){e.controller.abort()})}var pi=null,uh=0,dr=0,Wl=null;function u2(e,t){if(pi===null){var n=pi=[];uh=0,dr=sp(),Wl={status:"pending",value:void 0,then:function(a){n.push(a)}}}return uh++,t.then(Qx,Qx),t}function Qx(){if(--uh===0&&pi!==null){Wl!==null&&(Wl.status="fulfilled");var e=pi;pi=null,dr=0,Wl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function d2(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(l){n.push(l)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var l=0;l<n.length;l++)(0,n[l])(t)},function(l){for(a.status="rejected",a.reason=l,l=0;l<n.length;l++)(0,n[l])(void 0)}),a}var Zx=je.S;je.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&u2(e,t),Zx!==null&&Zx(e,t)};var el=js(null);function Dm(){var e=el.current;return e!==null?e:We.pooledCache}function gc(e,t){t===null?nt(el,el.current):nt(el,t.pool)}function ib(){var e=Dm();return e===null?null:{parent:wt._currentValue,pool:e}}var co=Error(Q(460)),ob=Error(Q(474)),Bu=Error(Q(542)),dh={then:function(){}};function Wx(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Po(){}function cb(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Po,Po),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(Po,Po);else{if(e=We,e!==null&&100<e.shellSuspendCounter)throw Error(Q(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var l=t;l.status="fulfilled",l.value=a}},function(a){if(t.status==="pending"){var l=t;l.status="rejected",l.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,eg(e),e}throw xi=t,co}}var xi=null;function Jx(){if(xi===null)throw Error(Q(459));var e=xi;return xi=null,e}function eg(e){if(e===co||e===Bu)throw Error(Q(483))}var ua=!1;function zm(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function fh(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 _a(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wa(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,qe&2){var l=a.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),a.pending=t,t=Hc(e),sb(e,null,n),t}return Uu(e,a,t,n),Hc(e)}function gi(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,Ay(e,n)}}function Kd(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var l=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?l=r=i:r=r.next=i,n=n.next}while(n!==null);r===null?l=r=t:r=r.next=t}else l=r=t;n={baseState:a.baseState,firstBaseUpdate:l,lastBaseUpdate:r,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 hh=!1;function vi(){if(hh){var e=Wl;if(e!==null)throw e}}function yi(e,t,n,a){hh=!1;var l=e.updateQueue;ua=!1;var r=l.firstBaseUpdate,i=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var c=o,d=c.next;c.next=null,i===null?r=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(r!==null){var h=l.baseState;i=0,f=d=c=null,o=r;do{var m=o.lane&-536870913,g=m!==o.lane;if(g?($e&m)===m:(a&m)===m){m!==0&&m===dr&&(hh=!0),f!==null&&(f=f.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var j=e,v=o;m=t;var y=n;switch(v.tag){case 1:if(j=v.payload,typeof j=="function"){h=j.call(y,h,m);break e}h=j;break e;case 3:j.flags=j.flags&-65537|128;case 0:if(j=v.payload,m=typeof j=="function"?j.call(y,h,m):j,m==null)break e;h=Je({},h,m);break e;case 2:ua=!0}}m=o.callback,m!==null&&(e.flags|=64,g&&(e.flags|=8192),g=l.callbacks,g===null?l.callbacks=[m]:g.push(m))}else g={lane:m,tag:o.tag,payload:o.payload,callback:o.callback,next:null},f===null?(d=f=g,c=h):f=f.next=g,i|=m;if(o=o.next,o===null){if(o=l.shared.pending,o===null)break;g=o,o=g.next,g.next=null,l.lastBaseUpdate=g,l.shared.pending=null}}while(!0);f===null&&(c=h),l.baseState=c,l.firstBaseUpdate=d,l.lastBaseUpdate=f,r===null&&(l.shared.lanes=0),Ma|=i,e.lanes=i,e.memoizedState=h}}function ub(e,t){if(typeof e!="function")throw Error(Q(191,e));e.call(t)}function db(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)ub(n[e],t)}var fr=js(null),Gc=js(0);function tg(e,t){e=Ks,nt(Gc,e),nt(fr,t),Ks=e|t.baseLanes}function mh(){nt(Gc,Ks),nt(fr,fr.current)}function Lm(){Ks=Gc.current,Mt(fr),Mt(Gc)}var Ea=0,Te=null,Xe=null,gt=null,Vc=!1,Jl=!1,rl=!1,Yc=0,$i=0,er=null,f2=0;function ht(){throw Error(Q(321))}function Um(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!pn(e[n],t[n]))return!1;return!0}function Bm(e,t,n,a,l,r){return Ea=r,Te=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,je.H=e===null||e.memoizedState===null?Pb:qb,rl=!1,r=n(a,l),rl=!1,Jl&&(r=hb(t,n,a,l)),fb(e),r}function fb(e){je.H=Fc;var t=Xe!==null&&Xe.next!==null;if(Ea=0,gt=Xe=Te=null,Vc=!1,$i=0,er=null,t)throw Error(Q(300));e===null||At||(e=e.dependencies,e!==null&&qc(e)&&(At=!0))}function hb(e,t,n,a){Te=e;var l=0;do{if(Jl&&(er=null),$i=0,Jl=!1,25<=l)throw Error(Q(301));if(l+=1,gt=Xe=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}je.H=y2,r=t(n,a)}while(Jl);return r}function h2(){var e=je.H,t=e.useState()[0];return t=typeof t.then=="function"?uo(t):t,e=e.useState()[0],(Xe!==null?Xe.memoizedState:null)!==e&&(Te.flags|=1024),t}function Hm(){var e=Yc!==0;return Yc=0,e}function Im(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Pm(e){if(Vc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Vc=!1}Ea=0,gt=Xe=Te=null,Jl=!1,$i=Yc=0,er=null}function Kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?Te.memoizedState=gt=e:gt=gt.next=e,gt}function bt(){if(Xe===null){var e=Te.alternate;e=e!==null?e.memoizedState:null}else e=Xe.next;var t=gt===null?Te.memoizedState:gt.next;if(t!==null)gt=t,Xe=e;else{if(e===null)throw Te.alternate===null?Error(Q(467)):Error(Q(310));Xe=e,e={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},gt===null?Te.memoizedState=gt=e:gt=gt.next=e}return gt}function qm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function uo(e){var t=$i;return $i+=1,er===null&&(er=[]),e=cb(er,e,t),t=Te,(gt===null?t.memoizedState:gt.next)===null&&(t=t.alternate,je.H=t===null||t.memoizedState===null?Pb:qb),e}function Hu(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return uo(e);if(e.$$typeof===Bs)return It(e)}throw Error(Q(438,String(e)))}function Gm(e){var t=null,n=Te.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Te.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(l){return l.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=qm(),Te.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]=Z1;return t.index++,n}function Fs(e,t){return typeof t=="function"?t(e):t}function vc(e){var t=bt();return Vm(t,Xe,e)}function Vm(e,t,n){var a=e.queue;if(a===null)throw Error(Q(311));a.lastRenderedReducer=n;var l=e.baseQueue,r=a.pending;if(r!==null){if(l!==null){var i=l.next;l.next=r.next,r.next=i}t.baseQueue=l=r,a.pending=null}if(r=e.baseState,l===null)e.memoizedState=r;else{t=l.next;var o=i=null,c=null,d=t,f=!1;do{var h=d.lane&-536870913;if(h!==d.lane?($e&h)===h:(Ea&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===dr&&(f=!0);else if((Ea&m)===m){d=d.next,m===dr&&(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=r):c=c.next=h,Te.lanes|=m,Ma|=m;h=d.action,rl&&n(r,h),r=d.hasEagerState?d.eagerState:n(r,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=r):c=c.next=m,Te.lanes|=h,Ma|=h;d=d.next}while(d!==null&&d!==t);if(c===null?i=r:c.next=o,!pn(r,e.memoizedState)&&(At=!0,f&&(n=Wl,n!==null)))throw n;e.memoizedState=r,e.baseState=i,e.baseQueue=c,a.lastRenderedState=r}return l===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function Qd(e){var t=bt(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var a=n.dispatch,l=n.pending,r=t.memoizedState;if(l!==null){n.pending=null;var i=l=l.next;do r=e(r,i.action),i=i.next;while(i!==l);pn(r,t.memoizedState)||(At=!0),t.memoizedState=r,t.baseQueue===null&&(t.baseState=r),n.lastRenderedState=r}return[r,a]}function mb(e,t,n){var a=Te,l=bt(),r=Le;if(r){if(n===void 0)throw Error(Q(407));n=n()}else n=t();var i=!pn((Xe||l).memoizedState,n);i&&(l.memoizedState=n,At=!0),l=l.queue;var o=gb.bind(null,a,l,e);if(fo(2048,8,o,[e]),l.getSnapshot!==t||i||gt!==null&&gt.memoizedState.tag&1){if(a.flags|=2048,hr(9,Iu(),xb.bind(null,a,l,n,t),null),We===null)throw Error(Q(349));r||Ea&124||pb(a,t,n)}return n}function pb(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Te.updateQueue,t===null?(t=qm(),Te.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function xb(e,t,n,a){t.value=n,t.getSnapshot=a,vb(t)&&yb(e)}function gb(e,t,n){return n(function(){vb(t)&&yb(e)})}function vb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!pn(e,n)}catch{return!0}}function yb(e){var t=Cr(e,2);t!==null&&hn(t,e,2)}function ph(e){var t=Kt();if(typeof e=="function"){var n=e;if(e=n(),rl){pa(!0);try{n()}finally{pa(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:e},t}function bb(e,t,n,a){return e.baseState=n,Vm(e,Xe,typeof a=="function"?a:Fs)}function m2(e,t,n,a,l){if(Pu(e))throw Error(Q(485));if(e=t.action,e!==null){var r={payload:l,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){r.listeners.push(i)}};je.T!==null?n(!0):r.isTransition=!1,a(r),n=t.pending,n===null?(r.next=t.pending=r,jb(t,r)):(r.next=n.next,t.pending=n.next=r)}}function jb(e,t){var n=t.action,a=t.payload,l=e.state;if(t.isTransition){var r=je.T,i={};je.T=i;try{var o=n(l,a),c=je.S;c!==null&&c(i,o),ng(e,t,o)}catch(d){xh(e,t,d)}finally{je.T=r}}else try{r=n(l,a),ng(e,t,r)}catch(d){xh(e,t,d)}}function ng(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){sg(e,t,a)},function(a){return xh(e,t,a)}):sg(e,t,n)}function sg(e,t,n){t.status="fulfilled",t.value=n,_b(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,jb(e,n)))}function xh(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,_b(t),t=t.next;while(t!==a)}e.action=null}function _b(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function wb(e,t){return t}function ag(e,t){if(Le){var n=We.formState;if(n!==null){e:{var a=Te;if(Le){if(ct){t:{for(var l=ct,r=os;l.nodeType!==8;){if(!r){l=null;break t}if(l=Gn(l.nextSibling),l===null){l=null;break t}}r=l.data,l=r==="F!"||r==="F"?l:null}if(l){ct=Gn(l.nextSibling),a=l.data==="F!";break e}}al(a)}a=!1}a&&(t=n[0])}}return n=Kt(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wb,lastRenderedState:t},n.queue=a,n=Bb.bind(null,Te,a),a.dispatch=n,a=ph(!1),r=Km.bind(null,Te,!1,a.queue),a=Kt(),l={state:t,dispatch:null,action:e,pending:null},a.queue=l,n=m2.bind(null,Te,l,r,n),l.dispatch=n,a.memoizedState=e,[t,n,!1]}function lg(e){var t=bt();return Nb(t,Xe,e)}function Nb(e,t,n){if(t=Vm(e,t,wb)[0],e=vc(Fs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=uo(t)}catch(i){throw i===co?Bu:i}else a=t;t=bt();var l=t.queue,r=l.dispatch;return n!==t.memoizedState&&(Te.flags|=2048,hr(9,Iu(),p2.bind(null,l,n),null)),[a,r,e]}function p2(e,t){e.action=t}function rg(e){var t=bt(),n=Xe;if(n!==null)return Nb(t,n,e);bt(),t=t.memoizedState,n=bt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function hr(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Te.updateQueue,t===null&&(t=qm(),Te.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 Iu(){return{destroy:void 0,resource:void 0}}function kb(){return bt().memoizedState}function yc(e,t,n,a){var l=Kt();a=a===void 0?null:a,Te.flags|=e,l.memoizedState=hr(1|t,Iu(),n,a)}function fo(e,t,n,a){var l=bt();a=a===void 0?null:a;var r=l.memoizedState.inst;Xe!==null&&a!==null&&Um(a,Xe.memoizedState.deps)?l.memoizedState=hr(t,r,n,a):(Te.flags|=e,l.memoizedState=hr(1|t,r,n,a))}function ig(e,t){yc(8390656,8,e,t)}function Sb(e,t){fo(2048,8,e,t)}function Cb(e,t){return fo(4,2,e,t)}function Rb(e,t){return fo(4,4,e,t)}function Tb(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 Eb(e,t,n){n=n!=null?n.concat([e]):null,fo(4,4,Tb.bind(null,t,e),n)}function Ym(){}function Ab(e,t){var n=bt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&Um(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function Mb(e,t){var n=bt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&Um(t,a[1]))return a[0];if(a=e(),rl){pa(!0);try{e()}finally{pa(!1)}}return n.memoizedState=[a,t],a}function Fm(e,t,n){return n===void 0||Ea&1073741824?e.memoizedState=t:(e.memoizedState=n,e=_j(),Te.lanes|=e,Ma|=e,n)}function Ob(e,t,n,a){return pn(n,t)?n:fr.current!==null?(e=Fm(e,n,a),pn(e,t)||(At=!0),e):Ea&42?(e=_j(),Te.lanes|=e,Ma|=e,t):(At=!0,e.memoizedState=n)}function $b(e,t,n,a,l){var r=Ue.p;Ue.p=r!==0&&8>r?r:8;var i=je.T,o={};je.T=o,Km(e,!1,t,n);try{var c=l(),d=je.S;if(d!==null&&d(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=d2(c,a);bi(e,t,f,fn(e))}else bi(e,t,a,fn(e))}catch(h){bi(e,t,{then:function(){},status:"rejected",reason:h},fn())}finally{Ue.p=r,je.T=i}}function x2(){}function gh(e,t,n,a){if(e.tag!==5)throw Error(Q(476));var l=Db(e).queue;$b(e,l,t,Qa,n===null?x2:function(){return zb(e),n(a)})}function Db(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Qa,baseState:Qa,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:Qa},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function zb(e){var t=Db(e).next.queue;bi(e,t,{},fn())}function Xm(){return It(Bi)}function Lb(){return bt().memoizedState}function Ub(){return bt().memoizedState}function g2(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=fn();e=_a(n);var a=wa(t,e,n);a!==null&&(hn(a,t,n),gi(a,t,n)),t={cache:$m()},e.payload=t;return}t=t.return}}function v2(e,t,n){var a=fn();n={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},Pu(e)?Hb(t,n):(n=Em(e,t,n,a),n!==null&&(hn(n,e,a),Ib(n,t,a)))}function Bb(e,t,n){var a=fn();bi(e,t,n,a)}function bi(e,t,n,a){var l={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(Pu(e))Hb(t,l);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var i=t.lastRenderedState,o=r(i,n);if(l.hasEagerState=!0,l.eagerState=o,pn(o,i))return Uu(e,t,l,0),We===null&&Lu(),!1}catch{}finally{}if(n=Em(e,t,l,a),n!==null)return hn(n,e,a),Ib(n,t,a),!0}return!1}function Km(e,t,n,a){if(a={lane:2,revertLane:sp(),action:a,hasEagerState:!1,eagerState:null,next:null},Pu(e)){if(t)throw Error(Q(479))}else t=Em(e,n,a,2),t!==null&&hn(t,e,2)}function Pu(e){var t=e.alternate;return e===Te||t!==null&&t===Te}function Hb(e,t){Jl=Vc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ib(e,t,n){if(n&4194048){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Ay(e,n)}}var Fc={readContext:It,use:Hu,useCallback:ht,useContext:ht,useEffect:ht,useImperativeHandle:ht,useLayoutEffect:ht,useInsertionEffect:ht,useMemo:ht,useReducer:ht,useRef:ht,useState:ht,useDebugValue:ht,useDeferredValue:ht,useTransition:ht,useSyncExternalStore:ht,useId:ht,useHostTransitionStatus:ht,useFormState:ht,useActionState:ht,useOptimistic:ht,useMemoCache:ht,useCacheRefresh:ht},Pb={readContext:It,use:Hu,useCallback:function(e,t){return Kt().memoizedState=[e,t===void 0?null:t],e},useContext:It,useEffect:ig,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,yc(4194308,4,Tb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return yc(4194308,4,e,t)},useInsertionEffect:function(e,t){yc(4,2,e,t)},useMemo:function(e,t){var n=Kt();t=t===void 0?null:t;var a=e();if(rl){pa(!0);try{e()}finally{pa(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=Kt();if(n!==void 0){var l=n(t);if(rl){pa(!0);try{n(t)}finally{pa(!1)}}}else l=t;return a.memoizedState=a.baseState=l,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:l},a.queue=e,e=e.dispatch=v2.bind(null,Te,e),[a.memoizedState,e]},useRef:function(e){var t=Kt();return e={current:e},t.memoizedState=e},useState:function(e){e=ph(e);var t=e.queue,n=Bb.bind(null,Te,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ym,useDeferredValue:function(e,t){var n=Kt();return Fm(n,e,t)},useTransition:function(){var e=ph(!1);return e=$b.bind(null,Te,e.queue,!0,!1),Kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Te,l=Kt();if(Le){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),We===null)throw Error(Q(349));$e&124||pb(a,t,n)}l.memoizedState=n;var r={value:n,getSnapshot:t};return l.queue=r,ig(gb.bind(null,a,r,e),[e]),a.flags|=2048,hr(9,Iu(),xb.bind(null,a,r,n,t),null),n},useId:function(){var e=Kt(),t=We.identifierPrefix;if(Le){var n=Is,a=Hs;n=(a&~(1<<32-dn(a)-1)).toString(32)+n,t="«"+t+"R"+n,n=Yc++,0<n&&(t+="H"+n.toString(32)),t+="»"}else n=f2++,t="«"+t+"r"+n.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:Xm,useFormState:ag,useActionState:ag,useOptimistic:function(e){var t=Kt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Km.bind(null,Te,!0,n),n.dispatch=t,[e,t]},useMemoCache:Gm,useCacheRefresh:function(){return Kt().memoizedState=g2.bind(null,Te)}},qb={readContext:It,use:Hu,useCallback:Ab,useContext:It,useEffect:Sb,useImperativeHandle:Eb,useInsertionEffect:Cb,useLayoutEffect:Rb,useMemo:Mb,useReducer:vc,useRef:kb,useState:function(){return vc(Fs)},useDebugValue:Ym,useDeferredValue:function(e,t){var n=bt();return Ob(n,Xe.memoizedState,e,t)},useTransition:function(){var e=vc(Fs)[0],t=bt().memoizedState;return[typeof e=="boolean"?e:uo(e),t]},useSyncExternalStore:mb,useId:Lb,useHostTransitionStatus:Xm,useFormState:lg,useActionState:lg,useOptimistic:function(e,t){var n=bt();return bb(n,Xe,e,t)},useMemoCache:Gm,useCacheRefresh:Ub},y2={readContext:It,use:Hu,useCallback:Ab,useContext:It,useEffect:Sb,useImperativeHandle:Eb,useInsertionEffect:Cb,useLayoutEffect:Rb,useMemo:Mb,useReducer:Qd,useRef:kb,useState:function(){return Qd(Fs)},useDebugValue:Ym,useDeferredValue:function(e,t){var n=bt();return Xe===null?Fm(n,e,t):Ob(n,Xe.memoizedState,e,t)},useTransition:function(){var e=Qd(Fs)[0],t=bt().memoizedState;return[typeof e=="boolean"?e:uo(e),t]},useSyncExternalStore:mb,useId:Lb,useHostTransitionStatus:Xm,useFormState:rg,useActionState:rg,useOptimistic:function(e,t){var n=bt();return Xe!==null?bb(n,Xe,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Gm,useCacheRefresh:Ub},tr=null,Di=0;function qo(e){var t=Di;return Di+=1,tr===null&&(tr=[]),cb(tr,e,t)}function Fr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Go(e,t){throw t.$$typeof===K1?Error(Q(525)):(e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function og(e){var t=e._init;return t(e._payload)}function Gb(e){function t(x,p){if(e){var b=x.deletions;b===null?(x.deletions=[p],x.flags|=16):b.push(p)}}function n(x,p){if(!e)return null;for(;p!==null;)t(x,p),p=p.sibling;return null}function a(x){for(var p=new Map;x!==null;)x.key!==null?p.set(x.key,x):p.set(x.index,x),x=x.sibling;return p}function l(x,p){return x=Gs(x,p),x.index=0,x.sibling=null,x}function r(x,p,b){return x.index=b,e?(b=x.alternate,b!==null?(b=b.index,b<p?(x.flags|=67108866,p):b):(x.flags|=67108866,p)):(x.flags|=1048576,p)}function i(x){return e&&x.alternate===null&&(x.flags|=67108866),x}function o(x,p,b,_){return p===null||p.tag!==6?(p=Fd(b,x.mode,_),p.return=x,p):(p=l(p,b),p.return=x,p)}function c(x,p,b,_){var N=b.type;return N===zl?f(x,p,b.props.children,_,b.key):p!==null&&(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ca&&og(N)===p.type)?(p=l(p,b.props),Fr(p,b),p.return=x,p):(p=xc(b.type,b.key,b.props,null,x.mode,_),Fr(p,b),p.return=x,p)}function d(x,p,b,_){return p===null||p.tag!==4||p.stateNode.containerInfo!==b.containerInfo||p.stateNode.implementation!==b.implementation?(p=Xd(b,x.mode,_),p.return=x,p):(p=l(p,b.children||[]),p.return=x,p)}function f(x,p,b,_,N){return p===null||p.tag!==7?(p=Za(b,x.mode,_,N),p.return=x,p):(p=l(p,b),p.return=x,p)}function h(x,p,b){if(typeof p=="string"&&p!==""||typeof p=="number"||typeof p=="bigint")return p=Fd(""+p,x.mode,b),p.return=x,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case zo:return b=xc(p.type,p.key,p.props,null,x.mode,b),Fr(b,p),b.return=x,b;case ti:return p=Xd(p,x.mode,b),p.return=x,p;case ca:var _=p._init;return p=_(p._payload),h(x,p,b)}if(ni(p)||qr(p))return p=Za(p,x.mode,b,null),p.return=x,p;if(typeof p.then=="function")return h(x,qo(p),b);if(p.$$typeof===Bs)return h(x,Io(x,p),b);Go(x,p)}return null}function m(x,p,b,_){var N=p!==null?p.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return N!==null?null:o(x,p,""+b,_);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case zo:return b.key===N?c(x,p,b,_):null;case ti:return b.key===N?d(x,p,b,_):null;case ca:return N=b._init,b=N(b._payload),m(x,p,b,_)}if(ni(b)||qr(b))return N!==null?null:f(x,p,b,_,null);if(typeof b.then=="function")return m(x,p,qo(b),_);if(b.$$typeof===Bs)return m(x,p,Io(x,b),_);Go(x,b)}return null}function g(x,p,b,_,N){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return x=x.get(b)||null,o(p,x,""+_,N);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case zo:return x=x.get(_.key===null?b:_.key)||null,c(p,x,_,N);case ti:return x=x.get(_.key===null?b:_.key)||null,d(p,x,_,N);case ca:var C=_._init;return _=C(_._payload),g(x,p,b,_,N)}if(ni(_)||qr(_))return x=x.get(b)||null,f(p,x,_,N,null);if(typeof _.then=="function")return g(x,p,b,qo(_),N);if(_.$$typeof===Bs)return g(x,p,b,Io(p,_),N);Go(p,_)}return null}function j(x,p,b,_){for(var N=null,C=null,w=p,k=p=0,A=null;w!==null&&k<b.length;k++){w.index>k?(A=w,w=null):A=w.sibling;var $=m(x,w,b[k],_);if($===null){w===null&&(w=A);break}e&&w&&$.alternate===null&&t(x,w),p=r($,p,k),C===null?N=$:C.sibling=$,C=$,w=A}if(k===b.length)return n(x,w),Le&&Fa(x,k),N;if(w===null){for(;k<b.length;k++)w=h(x,b[k],_),w!==null&&(p=r(w,p,k),C===null?N=w:C.sibling=w,C=w);return Le&&Fa(x,k),N}for(w=a(w);k<b.length;k++)A=g(w,x,k,b[k],_),A!==null&&(e&&A.alternate!==null&&w.delete(A.key===null?k:A.key),p=r(A,p,k),C===null?N=A:C.sibling=A,C=A);return e&&w.forEach(function(X){return t(x,X)}),Le&&Fa(x,k),N}function v(x,p,b,_){if(b==null)throw Error(Q(151));for(var N=null,C=null,w=p,k=p=0,A=null,$=b.next();w!==null&&!$.done;k++,$=b.next()){w.index>k?(A=w,w=null):A=w.sibling;var X=m(x,w,$.value,_);if(X===null){w===null&&(w=A);break}e&&w&&X.alternate===null&&t(x,w),p=r(X,p,k),C===null?N=X:C.sibling=X,C=X,w=A}if($.done)return n(x,w),Le&&Fa(x,k),N;if(w===null){for(;!$.done;k++,$=b.next())$=h(x,$.value,_),$!==null&&(p=r($,p,k),C===null?N=$:C.sibling=$,C=$);return Le&&Fa(x,k),N}for(w=a(w);!$.done;k++,$=b.next())$=g(w,x,k,$.value,_),$!==null&&(e&&$.alternate!==null&&w.delete($.key===null?k:$.key),p=r($,p,k),C===null?N=$:C.sibling=$,C=$);return e&&w.forEach(function(Y){return t(x,Y)}),Le&&Fa(x,k),N}function y(x,p,b,_){if(typeof b=="object"&&b!==null&&b.type===zl&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case zo:e:{for(var N=b.key;p!==null;){if(p.key===N){if(N=b.type,N===zl){if(p.tag===7){n(x,p.sibling),_=l(p,b.props.children),_.return=x,x=_;break e}}else if(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ca&&og(N)===p.type){n(x,p.sibling),_=l(p,b.props),Fr(_,b),_.return=x,x=_;break e}n(x,p);break}else t(x,p);p=p.sibling}b.type===zl?(_=Za(b.props.children,x.mode,_,b.key),_.return=x,x=_):(_=xc(b.type,b.key,b.props,null,x.mode,_),Fr(_,b),_.return=x,x=_)}return i(x);case ti:e:{for(N=b.key;p!==null;){if(p.key===N)if(p.tag===4&&p.stateNode.containerInfo===b.containerInfo&&p.stateNode.implementation===b.implementation){n(x,p.sibling),_=l(p,b.children||[]),_.return=x,x=_;break e}else{n(x,p);break}else t(x,p);p=p.sibling}_=Xd(b,x.mode,_),_.return=x,x=_}return i(x);case ca:return N=b._init,b=N(b._payload),y(x,p,b,_)}if(ni(b))return j(x,p,b,_);if(qr(b)){if(N=qr(b),typeof N!="function")throw Error(Q(150));return b=N.call(b),v(x,p,b,_)}if(typeof b.then=="function")return y(x,p,qo(b),_);if(b.$$typeof===Bs)return y(x,p,Io(x,b),_);Go(x,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,p!==null&&p.tag===6?(n(x,p.sibling),_=l(p,b),_.return=x,x=_):(n(x,p),_=Fd(b,x.mode,_),_.return=x,x=_),i(x)):n(x,p)}return function(x,p,b,_){try{Di=0;var N=y(x,p,b,_);return tr=null,N}catch(w){if(w===co||w===Bu)throw w;var C=cn(29,w,null,x.mode);return C.lanes=_,C.return=x,C}finally{}}}var mr=Gb(!0),Vb=Gb(!1),Mn=js(null),xs=null;function fa(e){var t=e.alternate;nt(Nt,Nt.current&1),nt(Mn,e),xs===null&&(t===null||fr.current!==null||t.memoizedState!==null)&&(xs=e)}function Yb(e){if(e.tag===22){if(nt(Nt,Nt.current),nt(Mn,e),xs===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(xs=e)}}else ha()}function ha(){nt(Nt,Nt.current),nt(Mn,Mn.current)}function qs(e){Mt(Mn),xs===e&&(xs=null),Mt(Nt)}var Nt=js(0);function Xc(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==="$?"||$h(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 Zd(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:Je({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vh={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=fn(),l=_a(a);l.payload=t,n!=null&&(l.callback=n),t=wa(e,l,a),t!==null&&(hn(t,e,a),gi(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=fn(),l=_a(a);l.tag=1,l.payload=t,n!=null&&(l.callback=n),t=wa(e,l,a),t!==null&&(hn(t,e,a),gi(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fn(),a=_a(n);a.tag=2,t!=null&&(a.callback=t),t=wa(e,a,n),t!==null&&(hn(t,e,n),gi(t,e,n))}};function cg(e,t,n,a,l,r,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,r,i):t.prototype&&t.prototype.isPureReactComponent?!Mi(n,a)||!Mi(l,r):!0}function ug(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&&vh.enqueueReplaceState(t,t.state,null)}function il(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=Je({},n));for(var l in e)n[l]===void 0&&(n[l]=e[l])}return n}var Kc=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 Fb(e){Kc(e)}function Xb(e){console.error(e)}function Kb(e){Kc(e)}function Qc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function dg(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(l){setTimeout(function(){throw l})}}function yh(e,t,n){return n=_a(n),n.tag=3,n.payload={element:null},n.callback=function(){Qc(e,t)},n}function Qb(e){return e=_a(e),e.tag=3,e}function Zb(e,t,n,a){var l=n.type.getDerivedStateFromError;if(typeof l=="function"){var r=a.value;e.payload=function(){return l(r)},e.callback=function(){dg(t,n,a)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){dg(t,n,a),typeof l!="function"&&(Na===null?Na=new Set([this]):Na.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function b2(e,t,n,a,l){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&io(t,n,l,!0),n=Mn.current,n!==null){switch(n.tag){case 13:return xs===null?Ch():n.alternate===null&&ut===0&&(ut=3),n.flags&=-257,n.flags|=65536,n.lanes=l,a===dh?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),cf(e,a,l)),!1;case 22:return n.flags|=65536,a===dh?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,l)),!1}throw Error(Q(435,n.tag))}return cf(e,a,l),Ch(),!1}if(Le)return t=Mn.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=l,a!==rh&&(e=Error(Q(422),{cause:a}),Oi(Sn(e,n)))):(a!==rh&&(t=Error(Q(423),{cause:a}),Oi(Sn(t,n))),e=e.current.alternate,e.flags|=65536,l&=-l,e.lanes|=l,a=Sn(a,n),l=yh(e.stateNode,a,l),Kd(e,l),ut!==4&&(ut=2)),!1;var r=Error(Q(520),{cause:a});if(r=Sn(r,n),wi===null?wi=[r]:wi.push(r),ut!==4&&(ut=2),t===null)return!0;a=Sn(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=l&-l,n.lanes|=e,e=yh(n.stateNode,a,e),Kd(n,e),!1;case 1:if(t=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(Na===null||!Na.has(r))))return n.flags|=65536,l&=-l,n.lanes|=l,l=Qb(l),Zb(l,e,n,a),Kd(n,l),!1}n=n.return}while(n!==null);return!1}var Wb=Error(Q(461)),At=!1;function $t(e,t,n,a){t.child=e===null?Vb(t,null,n,a):mr(t,e.child,n,a)}function fg(e,t,n,a,l){n=n.render;var r=t.ref;if("ref"in a){var i={};for(var o in a)o!=="ref"&&(i[o]=a[o])}else i=a;return ll(t),a=Bm(e,t,n,i,r,l),o=Hm(),e!==null&&!At?(Im(e,t,l),Xs(e,t,l)):(Le&&o&&Mm(t),t.flags|=1,$t(e,t,a,l),t.child)}function hg(e,t,n,a,l){if(e===null){var r=n.type;return typeof r=="function"&&!Am(r)&&r.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=r,Jb(e,t,r,a,l)):(e=xc(n.type,null,a,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(r=e.child,!Qm(e,l)){var i=r.memoizedProps;if(n=n.compare,n=n!==null?n:Mi,n(i,a)&&e.ref===t.ref)return Xs(e,t,l)}return t.flags|=1,e=Gs(r,a),e.ref=t.ref,e.return=t,t.child=e}function Jb(e,t,n,a,l){if(e!==null){var r=e.memoizedProps;if(Mi(r,a)&&e.ref===t.ref)if(At=!1,t.pendingProps=a=r,Qm(e,l))e.flags&131072&&(At=!0);else return t.lanes=e.lanes,Xs(e,t,l)}return bh(e,t,n,a,l)}function ej(e,t,n){var a=t.pendingProps,l=a.children,r=e!==null?e.memoizedState:null;if(a.mode==="hidden"){if(t.flags&128){if(a=r!==null?r.baseLanes|n:n,e!==null){for(l=t.child=e.child,r=0;l!==null;)r=r|l.lanes|l.childLanes,l=l.sibling;t.childLanes=r&~a}else t.childLanes=0,t.child=null;return mg(e,t,a,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&gc(t,r!==null?r.cachePool:null),r!==null?tg(t,r):mh(),Yb(t);else return t.lanes=t.childLanes=536870912,mg(e,t,r!==null?r.baseLanes|n:n,n)}else r!==null?(gc(t,r.cachePool),tg(t,r),ha(),t.memoizedState=null):(e!==null&&gc(t,null),mh(),ha());return $t(e,t,l,n),t.child}function mg(e,t,n,a){var l=Dm();return l=l===null?null:{parent:wt._currentValue,pool:l},t.memoizedState={baseLanes:n,cachePool:l},e!==null&&gc(t,null),mh(),Yb(t),e!==null&&io(e,t,a,!0),null}function bc(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(Q(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function bh(e,t,n,a,l){return ll(t),n=Bm(e,t,n,a,void 0,l),a=Hm(),e!==null&&!At?(Im(e,t,l),Xs(e,t,l)):(Le&&a&&Mm(t),t.flags|=1,$t(e,t,n,l),t.child)}function pg(e,t,n,a,l,r){return ll(t),t.updateQueue=null,n=hb(t,a,n,l),fb(e),a=Hm(),e!==null&&!At?(Im(e,t,r),Xs(e,t,r)):(Le&&a&&Mm(t),t.flags|=1,$t(e,t,n,r),t.child)}function xg(e,t,n,a,l){if(ll(t),t.stateNode===null){var r=Gl,i=n.contextType;typeof i=="object"&&i!==null&&(r=It(i)),r=new n(a,r),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=vh,t.stateNode=r,r._reactInternals=t,r=t.stateNode,r.props=a,r.state=t.memoizedState,r.refs={},zm(t),i=n.contextType,r.context=typeof i=="object"&&i!==null?It(i):Gl,r.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(Zd(t,n,i,a),r.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(i=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),i!==r.state&&vh.enqueueReplaceState(r,r.state,null),yi(t,a,r,l),vi(),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){r=t.stateNode;var o=t.memoizedProps,c=il(n,o);r.props=c;var d=r.context,f=n.contextType;i=Gl,typeof f=="object"&&f!==null&&(i=It(f));var h=n.getDerivedStateFromProps;f=typeof h=="function"||typeof r.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,f||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(o||d!==i)&&ug(t,r,a,i),ua=!1;var m=t.memoizedState;r.state=m,yi(t,a,r,l),vi(),d=t.memoizedState,o||m!==d||ua?(typeof h=="function"&&(Zd(t,n,h,a),d=t.memoizedState),(c=ua||cg(t,n,c,a,m,d,i))?(f||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(t.flags|=4194308)):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=d),r.props=a,r.state=d,r.context=i,a=c):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{r=t.stateNode,fh(e,t),i=t.memoizedProps,f=il(n,i),r.props=f,h=t.pendingProps,m=r.context,d=n.contextType,c=Gl,typeof d=="object"&&d!==null&&(c=It(d)),o=n.getDerivedStateFromProps,(d=typeof o=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(i!==h||m!==c)&&ug(t,r,a,c),ua=!1,m=t.memoizedState,r.state=m,yi(t,a,r,l),vi();var g=t.memoizedState;i!==h||m!==g||ua||e!==null&&e.dependencies!==null&&qc(e.dependencies)?(typeof o=="function"&&(Zd(t,n,o,a),g=t.memoizedState),(f=ua||cg(t,n,f,a,m,g,c)||e!==null&&e.dependencies!==null&&qc(e.dependencies))?(d||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(a,g,c),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(a,g,c)),typeof r.componentDidUpdate=="function"&&(t.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof r.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=g),r.props=a,r.state=g,r.context=c,a=f):(typeof r.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),a=!1)}return r=a,bc(e,t),a=(t.flags&128)!==0,r||a?(r=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:r.render(),t.flags|=1,e!==null&&a?(t.child=mr(t,e.child,null,l),t.child=mr(t,null,n,l)):$t(e,t,n,l),t.memoizedState=r.state,e=t.child):e=Xs(e,t,l),e}function gg(e,t,n,a){return ro(),t.flags|=256,$t(e,t,n,a),t.child}var Wd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jd(e){return{baseLanes:e,cachePool:ib()}}function ef(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Cn),e}function tj(e,t,n){var a=t.pendingProps,l=!1,r=(t.flags&128)!==0,i;if((i=r)||(i=e!==null&&e.memoizedState===null?!1:(Nt.current&2)!==0),i&&(l=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(Le){if(l?fa(t):ha(),Le){var o=ct,c;if(c=o){e:{for(c=o,o=os;c.nodeType!==8;){if(!o){o=null;break e}if(c=Gn(c.nextSibling),c===null){o=null;break e}}o=c}o!==null?(t.memoizedState={dehydrated:o,treeContext:Wa!==null?{id:Hs,overflow:Is}:null,retryLane:536870912,hydrationErrors:null},c=cn(18,null,null,0),c.stateNode=o,c.return=t,t.child=c,qt=t,ct=null,c=!0):c=!1}c||al(t)}if(o=t.memoizedState,o!==null&&(o=o.dehydrated,o!==null))return $h(o)?t.lanes=32:t.lanes=536870912,null;qs(t)}return o=a.children,a=a.fallback,l?(ha(),l=t.mode,o=Zc({mode:"hidden",children:o},l),a=Za(a,l,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,l=t.child,l.memoizedState=Jd(n),l.childLanes=ef(e,i,n),t.memoizedState=Wd,a):(fa(t),jh(t,o))}if(c=e.memoizedState,c!==null&&(o=c.dehydrated,o!==null)){if(r)t.flags&256?(fa(t),t.flags&=-257,t=tf(e,t,n)):t.memoizedState!==null?(ha(),t.child=e.child,t.flags|=128,t=null):(ha(),l=a.fallback,o=t.mode,a=Zc({mode:"visible",children:a.children},o),l=Za(l,o,n,null),l.flags|=2,a.return=t,l.return=t,a.sibling=l,t.child=a,mr(t,e.child,null,n),a=t.child,a.memoizedState=Jd(n),a.childLanes=ef(e,i,n),t.memoizedState=Wd,t=l);else if(fa(t),$h(o)){if(i=o.nextSibling&&o.nextSibling.dataset,i)var d=i.dgst;i=d,a=Error(Q(419)),a.stack="",a.digest=i,Oi({value:a,source:null,stack:null}),t=tf(e,t,n)}else if(At||io(e,t,n,!1),i=(n&e.childLanes)!==0,At||i){if(i=We,i!==null&&(a=n&-n,a=a&42?1:bm(a),a=a&(i.suspendedLanes|n)?0:a,a!==0&&a!==c.retryLane))throw c.retryLane=a,Cr(e,a),hn(i,e,a),Wb;o.data==="$?"||Ch(),t=tf(e,t,n)}else o.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,ct=Gn(o.nextSibling),qt=t,Le=!0,Ja=null,os=!1,e!==null&&(wn[Nn++]=Hs,wn[Nn++]=Is,wn[Nn++]=Wa,Hs=e.id,Is=e.overflow,Wa=t),t=jh(t,a.children),t.flags|=4096);return t}return l?(ha(),l=a.fallback,o=t.mode,c=e.child,d=c.sibling,a=Gs(c,{mode:"hidden",children:a.children}),a.subtreeFlags=c.subtreeFlags&65011712,d!==null?l=Gs(d,l):(l=Za(l,o,n,null),l.flags|=2),l.return=t,a.return=t,a.sibling=l,t.child=a,a=l,l=t.child,o=e.child.memoizedState,o===null?o=Jd(n):(c=o.cachePool,c!==null?(d=wt._currentValue,c=c.parent!==d?{parent:d,pool:d}:c):c=ib(),o={baseLanes:o.baseLanes|n,cachePool:c}),l.memoizedState=o,l.childLanes=ef(e,i,n),t.memoizedState=Wd,a):(fa(t),n=e.child,e=n.sibling,n=Gs(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 jh(e,t){return t=Zc({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Zc(e,t){return e=cn(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function tf(e,t,n){return mr(t,e.child,null,n),e=jh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function vg(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),oh(e.return,t,n)}function nf(e,t,n,a,l){var r=e.memoizedState;r===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:l}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=a,r.tail=n,r.tailMode=l)}function nj(e,t,n){var a=t.pendingProps,l=a.revealOrder,r=a.tail;if($t(e,t,a.children,n),a=Nt.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&&vg(e,n,t);else if(e.tag===19)vg(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(nt(Nt,a),l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Xc(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),nf(t,!1,l,n,r);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Xc(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}nf(t,!0,n,null,r);break;case"together":nf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Xs(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ma|=t.lanes,!(n&t.childLanes))if(e!==null){if(io(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,n=Gs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Gs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Qm(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&qc(e)))}function j2(e,t,n){switch(t.tag){case 3:Dc(t,t.stateNode.containerInfo),da(t,wt,e.memoizedState.cache),ro();break;case 27:case 5:Qf(t);break;case 4:Dc(t,t.stateNode.containerInfo);break;case 10:da(t,t.type,t.memoizedProps.value);break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(fa(t),t.flags|=128,null):n&t.child.childLanes?tj(e,t,n):(fa(t),e=Xs(e,t,n),e!==null?e.sibling:null);fa(t);break;case 19:var l=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(io(e,t,n,!1),a=(n&t.childLanes)!==0),l){if(a)return nj(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),nt(Nt,Nt.current),a)break;return null;case 22:case 23:return t.lanes=0,ej(e,t,n);case 24:da(t,wt,e.memoizedState.cache)}return Xs(e,t,n)}function sj(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)At=!0;else{if(!Qm(e,n)&&!(t.flags&128))return At=!1,j2(e,t,n);At=!!(e.flags&131072)}else At=!1,Le&&t.flags&1048576&&lb(t,Pc,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var a=t.elementType,l=a._init;if(a=l(a._payload),t.type=a,typeof a=="function")Am(a)?(e=il(a,e),t.tag=1,t=xg(null,t,a,e,n)):(t.tag=0,t=bh(null,t,a,e,n));else{if(a!=null){if(l=a.$$typeof,l===gm){t.tag=11,t=fg(null,t,a,e,n);break e}else if(l===vm){t.tag=14,t=hg(null,t,a,e,n);break e}}throw t=Xf(a)||a,Error(Q(306,t,""))}}return t;case 0:return bh(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,l=il(a,t.pendingProps),xg(e,t,a,l,n);case 3:e:{if(Dc(t,t.stateNode.containerInfo),e===null)throw Error(Q(387));a=t.pendingProps;var r=t.memoizedState;l=r.element,fh(e,t),yi(t,a,null,n);var i=t.memoizedState;if(a=i.cache,da(t,wt,a),a!==r.cache&&ch(t,[wt],n,!0),vi(),a=i.element,r.isDehydrated)if(r={element:a,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=gg(e,t,a,n);break e}else if(a!==l){l=Sn(Error(Q(424)),t),Oi(l),t=gg(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(ct=Gn(e.firstChild),qt=t,Le=!0,Ja=null,os=!0,n=Vb(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ro(),a===l){t=Xs(e,t,n);break e}$t(e,t,a,n)}t=t.child}return t;case 26:return bc(e,t),e===null?(n=Dg(t.type,null,t.pendingProps,null))?t.memoizedState=n:Le||(n=t.type,e=t.pendingProps,a=au(ja.current).createElement(n),a[Ht]=t,a[Wt]=e,zt(a,n,e),Et(a),t.stateNode=a):t.memoizedState=Dg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Qf(t),e===null&&Le&&(a=t.stateNode=qj(t.type,t.pendingProps,ja.current),qt=t,os=!0,l=ct,La(t.type)?(Dh=l,ct=Gn(a.firstChild)):ct=l),$t(e,t,t.pendingProps.children,n),bc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Le&&((l=a=ct)&&(a=K2(a,t.type,t.pendingProps,os),a!==null?(t.stateNode=a,qt=t,ct=Gn(a.firstChild),os=!1,l=!0):l=!1),l||al(t)),Qf(t),l=t.type,r=t.pendingProps,i=e!==null?e.memoizedProps:null,a=r.children,Mh(l,r)?a=null:i!==null&&Mh(l,i)&&(t.flags|=32),t.memoizedState!==null&&(l=Bm(e,t,h2,null,null,n),Bi._currentValue=l),bc(e,t),$t(e,t,a,n),t.child;case 6:return e===null&&Le&&((e=n=ct)&&(n=Q2(n,t.pendingProps,os),n!==null?(t.stateNode=n,qt=t,ct=null,e=!0):e=!1),e||al(t)),null;case 13:return tj(e,t,n);case 4:return Dc(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=mr(t,null,a,n):$t(e,t,a,n),t.child;case 11:return fg(e,t,t.type,t.pendingProps,n);case 7:return $t(e,t,t.pendingProps,n),t.child;case 8:return $t(e,t,t.pendingProps.children,n),t.child;case 12:return $t(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,da(t,t.type,a.value),$t(e,t,a.children,n),t.child;case 9:return l=t.type._context,a=t.pendingProps.children,ll(t),l=It(l),a=a(l),t.flags|=1,$t(e,t,a,n),t.child;case 14:return hg(e,t,t.type,t.pendingProps,n);case 15:return Jb(e,t,t.type,t.pendingProps,n);case 19:return nj(e,t,n);case 31:return a=t.pendingProps,n=t.mode,a={mode:a.mode,children:a.children},e===null?(n=Zc(a,n),n.ref=t.ref,t.child=n,n.return=t,t=n):(n=Gs(e.child,a),n.ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return ej(e,t,n);case 24:return ll(t),a=It(wt),e===null?(l=Dm(),l===null&&(l=We,r=$m(),l.pooledCache=r,r.refCount++,r!==null&&(l.pooledCacheLanes|=n),l=r),t.memoizedState={parent:a,cache:l},zm(t),da(t,wt,l)):(e.lanes&n&&(fh(e,t),yi(t,null,null,n),vi()),l=e.memoizedState,r=t.memoizedState,l.parent!==a?(l={parent:a,cache:a},t.memoizedState=l,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=l),da(t,wt,a)):(a=r.cache,da(t,wt,a),a!==l.cache&&ch(t,[wt],n,!0))),$t(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(Q(156,t.tag))}function Ms(e){e.flags|=4}function yg(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Yj(t)){if(t=Mn.current,t!==null&&(($e&4194048)===$e?xs!==null:($e&62914560)!==$e&&!($e&536870912)||t!==xs))throw xi=dh,ob;e.flags|=8192}}function Vo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ty():536870912,e.lanes|=t,pr|=t)}function Xr(e,t){if(!Le)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 lt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,a|=l.subtreeFlags&65011712,a|=l.flags&65011712,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,a|=l.subtreeFlags,a|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function _2(e,t,n){var a=t.pendingProps;switch(Om(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lt(t),null;case 1:return lt(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Vs(wt),or(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Yr(t)?Ms(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Kx())),lt(t),null;case 26:return n=t.memoizedState,e===null?(Ms(t),n!==null?(lt(t),yg(t,n)):(lt(t),t.flags&=-16777217)):n?n!==e.memoizedState?(Ms(t),lt(t),yg(t,n)):(lt(t),t.flags&=-16777217):(e.memoizedProps!==a&&Ms(t),lt(t),t.flags&=-16777217),null;case 27:zc(t),n=ja.current;var l=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Ms(t);else{if(!a){if(t.stateNode===null)throw Error(Q(166));return lt(t),null}e=ms.current,Yr(t)?Fx(t):(e=qj(l,a,n),t.stateNode=e,Ms(t))}return lt(t),null;case 5:if(zc(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Ms(t);else{if(!a){if(t.stateNode===null)throw Error(Q(166));return lt(t),null}if(e=ms.current,Yr(t))Fx(t);else{switch(l=au(ja.current),e){case 1:e=l.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=l.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=l.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=l.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":e=l.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof a.is=="string"?l.createElement("select",{is:a.is}):l.createElement("select"),a.multiple?e.multiple=!0:a.size&&(e.size=a.size);break;default:e=typeof a.is=="string"?l.createElement(n,{is:a.is}):l.createElement(n)}}e[Ht]=t,e[Wt]=a;e:for(l=t.child;l!==null;){if(l.tag===5||l.tag===6)e.appendChild(l.stateNode);else if(l.tag!==4&&l.tag!==27&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===t)break e;for(;l.sibling===null;){if(l.return===null||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}t.stateNode=e;e:switch(zt(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&&Ms(t)}}return lt(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Ms(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(Q(166));if(e=ja.current,Yr(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,l=qt,l!==null)switch(l.tag){case 27:case 5:a=l.memoizedProps}e[Ht]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||Hj(e.nodeValue,n)),e||al(t)}else e=au(e).createTextNode(a),e[Ht]=t,t.stateNode=e}return lt(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(l=Yr(t),a!==null&&a.dehydrated!==null){if(e===null){if(!l)throw Error(Q(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(Q(317));l[Ht]=t}else ro(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;lt(t),l=!1}else l=Kx(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),l=!0;if(!l)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,l=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(l=a.alternate.memoizedState.cachePool.pool);var r=null;a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==l&&(a.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),Vo(t,t.updateQueue),lt(t),null;case 4:return or(),e===null&&ap(t.stateNode.containerInfo),lt(t),null;case 10:return Vs(t.type),lt(t),null;case 19:if(Mt(Nt),l=t.memoizedState,l===null)return lt(t),null;if(a=(t.flags&128)!==0,r=l.rendering,r===null)if(a)Xr(l,!1);else{if(ut!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(r=Xc(e),r!==null){for(t.flags|=128,Xr(l,!1),e=r.updateQueue,t.updateQueue=e,Vo(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ab(n,e),n=n.sibling;return nt(Nt,Nt.current&1|2),t.child}e=e.sibling}l.tail!==null&&ps()>Jc&&(t.flags|=128,a=!0,Xr(l,!1),t.lanes=4194304)}else{if(!a)if(e=Xc(r),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Vo(t,e),Xr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!r.alternate&&!Le)return lt(t),null}else 2*ps()-l.renderingStartTime>Jc&&n!==536870912&&(t.flags|=128,a=!0,Xr(l,!1),t.lanes=4194304);l.isBackwards?(r.sibling=t.child,t.child=r):(e=l.last,e!==null?e.sibling=r:t.child=r,l.last=r)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=ps(),t.sibling=null,e=Nt.current,nt(Nt,a?e&1|2:e&1),t):(lt(t),null);case 22:case 23:return qs(t),Lm(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?n&536870912&&!(t.flags&128)&&(lt(t),t.subtreeFlags&6&&(t.flags|=8192)):lt(t),n=t.updateQueue,n!==null&&Vo(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&&Mt(el),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Vs(wt),lt(t),null;case 25:return null;case 30:return null}throw Error(Q(156,t.tag))}function w2(e,t){switch(Om(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vs(wt),or(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return zc(t),null;case 13:if(qs(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));ro()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Mt(Nt),null;case 4:return or(),null;case 10:return Vs(t.type),null;case 22:case 23:return qs(t),Lm(),e!==null&&Mt(el),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vs(wt),null;case 25:return null;default:return null}}function aj(e,t){switch(Om(t),t.tag){case 3:Vs(wt),or();break;case 26:case 27:case 5:zc(t);break;case 4:or();break;case 13:qs(t);break;case 19:Mt(Nt);break;case 10:Vs(t.type);break;case 22:case 23:qs(t),Lm(),e!==null&&Mt(el);break;case 24:Vs(wt)}}function ho(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var l=a.next;n=l;do{if((n.tag&e)===e){a=void 0;var r=n.create,i=n.inst;a=r(),i.destroy=a}n=n.next}while(n!==l)}}catch(o){Ke(t,t.return,o)}}function Aa(e,t,n){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var r=l.next;a=r;do{if((a.tag&e)===e){var i=a.inst,o=i.destroy;if(o!==void 0){i.destroy=void 0,l=t;var c=n,d=o;try{d()}catch(f){Ke(l,c,f)}}}a=a.next}while(a!==r)}}catch(f){Ke(t,t.return,f)}}function lj(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{db(t,n)}catch(a){Ke(e,e.return,a)}}}function rj(e,t,n){n.props=il(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){Ke(e,t,a)}}function ji(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(l){Ke(e,t,l)}}function ds(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(l){Ke(e,t,l)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(l){Ke(e,t,l)}else n.current=null}function ij(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(l){Ke(e,e.return,l)}}function sf(e,t,n){try{var a=e.stateNode;G2(a,e.type,n,t),a[Wt]=t}catch(l){Ke(e,e.return,l)}}function oj(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&La(e.type)||e.tag===4}function af(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||oj(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&&La(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 _h(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=Yu));else if(a!==4&&(a===27&&La(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(_h(e,t,n),e=e.sibling;e!==null;)_h(e,t,n),e=e.sibling}function Wc(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&&La(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function cj(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,l=t.attributes;l.length;)t.removeAttributeNode(l[0]);zt(t,a,n),t[Ht]=e,t[Wt]=n}catch(r){Ke(e,e.return,r)}}var Us=!1,mt=!1,lf=!1,bg=typeof WeakSet=="function"?WeakSet:Set,Tt=null;function N2(e,t){if(e=e.containerInfo,Eh=ou,e=Qy(e),Rm(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 l=a.anchorOffset,r=a.focusNode;a=a.focusOffset;try{n.nodeType,r.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 g;h!==n||l!==0&&h.nodeType!==3||(o=i+l),h!==r||a!==0&&h.nodeType!==3||(c=i+a),h.nodeType===3&&(i+=h.nodeValue.length),(g=h.firstChild)!==null;)m=h,h=g;for(;;){if(h===e)break t;if(m===n&&++d===l&&(o=i),m===r&&++f===a&&(c=i),(g=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=g}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ah={focusedElem:e,selectionRange:n},ou=!1,Tt=t;Tt!==null;)if(t=Tt,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,Tt=e;else for(;Tt!==null;){switch(t=Tt,r=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if(e&1024&&r!==null){e=void 0,n=t,l=r.memoizedProps,r=r.memoizedState,a=n.stateNode;try{var j=il(n.type,l,n.elementType===n.type);e=a.getSnapshotBeforeUpdate(j,r),a.__reactInternalSnapshotBeforeUpdate=e}catch(v){Ke(n,n.return,v)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Oh(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Oh(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(Q(163))}if(e=t.sibling,e!==null){e.return=t.return,Tt=e;break}Tt=t.return}}function uj(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:sa(e,n),a&4&&ho(5,n);break;case 1:if(sa(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){Ke(n,n.return,i)}else{var l=il(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(l,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){Ke(n,n.return,i)}}a&64&&lj(n),a&512&&ji(n,n.return);break;case 3:if(sa(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{db(e,t)}catch(i){Ke(n,n.return,i)}}break;case 27:t===null&&a&4&&cj(n);case 26:case 5:sa(e,n),t===null&&a&4&&ij(n),a&512&&ji(n,n.return);break;case 12:sa(e,n);break;case 13:sa(e,n),a&4&&hj(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=O2.bind(null,n),Z2(e,n))));break;case 22:if(a=n.memoizedState!==null||Us,!a){t=t!==null&&t.memoizedState!==null||mt,l=Us;var r=mt;Us=a,(mt=t)&&!r?ia(e,n,(n.subtreeFlags&8772)!==0):sa(e,n),Us=l,mt=r}break;case 30:break;default:sa(e,n)}}function dj(e){var t=e.alternate;t!==null&&(e.alternate=null,dj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_m(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 et=null,Qt=!1;function Os(e,t,n){for(n=n.child;n!==null;)fj(e,t,n),n=n.sibling}function fj(e,t,n){if(un&&typeof un.onCommitFiberUnmount=="function")try{un.onCommitFiberUnmount(to,n)}catch{}switch(n.tag){case 26:mt||ds(n,t),Os(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:mt||ds(n,t);var a=et,l=Qt;La(n.type)&&(et=n.stateNode,Qt=!1),Os(e,t,n),ki(n.stateNode),et=a,Qt=l;break;case 5:mt||ds(n,t);case 6:if(a=et,l=Qt,et=null,Os(e,t,n),et=a,Qt=l,et!==null)if(Qt)try{(et.nodeType===9?et.body:et.nodeName==="HTML"?et.ownerDocument.body:et).removeChild(n.stateNode)}catch(r){Ke(n,t,r)}else try{et.removeChild(n.stateNode)}catch(r){Ke(n,t,r)}break;case 18:et!==null&&(Qt?(e=et,Mg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Pi(e)):Mg(et,n.stateNode));break;case 4:a=et,l=Qt,et=n.stateNode.containerInfo,Qt=!0,Os(e,t,n),et=a,Qt=l;break;case 0:case 11:case 14:case 15:mt||Aa(2,n,t),mt||Aa(4,n,t),Os(e,t,n);break;case 1:mt||(ds(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&rj(n,t,a)),Os(e,t,n);break;case 21:Os(e,t,n);break;case 22:mt=(a=mt)||n.memoizedState!==null,Os(e,t,n),mt=a;break;default:Os(e,t,n)}}function hj(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Pi(e)}catch(n){Ke(t,t.return,n)}}function k2(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new bg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new bg),t;default:throw Error(Q(435,e.tag))}}function rf(e,t){var n=k2(e);t.forEach(function(a){var l=$2.bind(null,e,a);n.has(a)||(n.add(a),a.then(l,l))})}function sn(e,t){var n=t.deletions;if(n!==null)for(var a=0;a<n.length;a++){var l=n[a],r=e,i=t,o=i;e:for(;o!==null;){switch(o.tag){case 27:if(La(o.type)){et=o.stateNode,Qt=!1;break e}break;case 5:et=o.stateNode,Qt=!1;break e;case 3:case 4:et=o.stateNode.containerInfo,Qt=!0;break e}o=o.return}if(et===null)throw Error(Q(160));fj(r,i,l),et=null,Qt=!1,r=l.alternate,r!==null&&(r.return=null),l.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)mj(t,e),t=t.sibling}var Bn=null;function mj(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:sn(t,e),an(e),a&4&&(Aa(3,e,e.return),ho(3,e),Aa(5,e,e.return));break;case 1:sn(t,e),an(e),a&512&&(mt||n===null||ds(n,n.return)),a&64&&Us&&(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 l=Bn;if(sn(t,e),an(e),a&512&&(mt||n===null||ds(n,n.return)),a&4){var r=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,l=l.ownerDocument||l;t:switch(a){case"title":r=l.getElementsByTagName("title")[0],(!r||r[ao]||r[Ht]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=l.createElement(a),l.head.insertBefore(r,l.querySelector("head > title"))),zt(r,a,n),r[Ht]=e,Et(r),a=r;break e;case"link":var i=Lg("link","href",l).get(a+(n.href||""));if(i){for(var o=0;o<i.length;o++)if(r=i[o],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){i.splice(o,1);break t}}r=l.createElement(a),zt(r,a,n),l.head.appendChild(r);break;case"meta":if(i=Lg("meta","content",l).get(a+(n.content||""))){for(o=0;o<i.length;o++)if(r=i[o],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){i.splice(o,1);break t}}r=l.createElement(a),zt(r,a,n),l.head.appendChild(r);break;default:throw Error(Q(468,a))}r[Ht]=e,Et(r),a=r}e.stateNode=a}else Ug(l,e.type,e.stateNode);else e.stateNode=zg(l,a,e.memoizedProps);else r!==a?(r===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):r.count--,a===null?Ug(l,e.type,e.stateNode):zg(l,a,e.memoizedProps)):a===null&&e.stateNode!==null&&sf(e,e.memoizedProps,n.memoizedProps)}break;case 27:sn(t,e),an(e),a&512&&(mt||n===null||ds(n,n.return)),n!==null&&a&4&&sf(e,e.memoizedProps,n.memoizedProps);break;case 5:if(sn(t,e),an(e),a&512&&(mt||n===null||ds(n,n.return)),e.flags&32){l=e.stateNode;try{ur(l,"")}catch(g){Ke(e,e.return,g)}}a&4&&e.stateNode!=null&&(l=e.memoizedProps,sf(e,l,n!==null?n.memoizedProps:l)),a&1024&&(lf=!0);break;case 6:if(sn(t,e),an(e),a&4){if(e.stateNode===null)throw Error(Q(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(g){Ke(e,e.return,g)}}break;case 3:if(wc=null,l=Bn,Bn=lu(t.containerInfo),sn(t,e),Bn=l,an(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{Pi(t.containerInfo)}catch(g){Ke(e,e.return,g)}lf&&(lf=!1,pj(e));break;case 4:a=Bn,Bn=lu(e.stateNode.containerInfo),sn(t,e),an(e),Bn=a;break;case 12:sn(t,e),an(e);break;case 13:sn(t,e),an(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(tp=ps()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,rf(e,a)));break;case 22:l=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,d=Us,f=mt;if(Us=d||l,mt=f||c,sn(t,e),mt=f,Us=d,an(e),a&8192)e:for(t=e.stateNode,t._visibility=l?t._visibility&-2:t._visibility|1,l&&(n===null||c||Us||mt||Xa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(r=c.stateNode,l)i=r.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(g){Ke(c,c.return,g)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=l?"":c.memoizedProps}catch(g){Ke(c,c.return,g)}}}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,rf(e,n))));break;case 19:sn(t,e),an(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,rf(e,a)));break;case 30:break;case 21:break;default:sn(t,e),an(e)}}function an(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(oj(a)){n=a;break}a=a.return}if(n==null)throw Error(Q(160));switch(n.tag){case 27:var l=n.stateNode,r=af(e);Wc(e,r,l);break;case 5:var i=n.stateNode;n.flags&32&&(ur(i,""),n.flags&=-33);var o=af(e);Wc(e,o,i);break;case 3:case 4:var c=n.stateNode.containerInfo,d=af(e);_h(e,d,c);break;default:throw Error(Q(161))}}catch(f){Ke(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pj(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;pj(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function sa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)uj(e,t.alternate,t),t=t.sibling}function Xa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Aa(4,t,t.return),Xa(t);break;case 1:ds(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&rj(t,t.return,n),Xa(t);break;case 27:ki(t.stateNode);case 26:case 5:ds(t,t.return),Xa(t);break;case 22:t.memoizedState===null&&Xa(t);break;case 30:Xa(t);break;default:Xa(t)}e=e.sibling}}function ia(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,l=e,r=t,i=r.flags;switch(r.tag){case 0:case 11:case 15:ia(l,r,n),ho(4,r);break;case 1:if(ia(l,r,n),a=r,l=a.stateNode,typeof l.componentDidMount=="function")try{l.componentDidMount()}catch(d){Ke(a,a.return,d)}if(a=r,l=a.updateQueue,l!==null){var o=a.stateNode;try{var c=l.shared.hiddenCallbacks;if(c!==null)for(l.shared.hiddenCallbacks=null,l=0;l<c.length;l++)ub(c[l],o)}catch(d){Ke(a,a.return,d)}}n&&i&64&&lj(r),ji(r,r.return);break;case 27:cj(r);case 26:case 5:ia(l,r,n),n&&a===null&&i&4&&ij(r),ji(r,r.return);break;case 12:ia(l,r,n);break;case 13:ia(l,r,n),n&&i&4&&hj(l,r);break;case 22:r.memoizedState===null&&ia(l,r,n),ji(r,r.return);break;case 30:break;default:ia(l,r,n)}t=t.sibling}}function Zm(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&&oo(n))}function Wm(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oo(e))}function is(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xj(e,t,n,a),t=t.sibling}function xj(e,t,n,a){var l=t.flags;switch(t.tag){case 0:case 11:case 15:is(e,t,n,a),l&2048&&ho(9,t);break;case 1:is(e,t,n,a);break;case 3:is(e,t,n,a),l&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oo(e)));break;case 12:if(l&2048){is(e,t,n,a),e=t.stateNode;try{var r=t.memoizedProps,i=r.id,o=r.onPostCommit;typeof o=="function"&&o(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Ke(t,t.return,c)}}else is(e,t,n,a);break;case 13:is(e,t,n,a);break;case 23:break;case 22:r=t.stateNode,i=t.alternate,t.memoizedState!==null?r._visibility&2?is(e,t,n,a):_i(e,t):r._visibility&2?is(e,t,n,a):(r._visibility|=2,$l(e,t,n,a,(t.subtreeFlags&10256)!==0)),l&2048&&Zm(i,t);break;case 24:is(e,t,n,a),l&2048&&Wm(t.alternate,t);break;default:is(e,t,n,a)}}function $l(e,t,n,a,l){for(l=l&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var r=e,i=t,o=n,c=a,d=i.flags;switch(i.tag){case 0:case 11:case 15:$l(r,i,o,c,l),ho(8,i);break;case 23:break;case 22:var f=i.stateNode;i.memoizedState!==null?f._visibility&2?$l(r,i,o,c,l):_i(r,i):(f._visibility|=2,$l(r,i,o,c,l)),l&&d&2048&&Zm(i.alternate,i);break;case 24:$l(r,i,o,c,l),l&&d&2048&&Wm(i.alternate,i);break;default:$l(r,i,o,c,l)}t=t.sibling}}function _i(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,l=a.flags;switch(a.tag){case 22:_i(n,a),l&2048&&Zm(a.alternate,a);break;case 24:_i(n,a),l&2048&&Wm(a.alternate,a);break;default:_i(n,a)}t=t.sibling}}var ai=8192;function _l(e){if(e.subtreeFlags&ai)for(e=e.child;e!==null;)gj(e),e=e.sibling}function gj(e){switch(e.tag){case 26:_l(e),e.flags&ai&&e.memoizedState!==null&&uC(Bn,e.memoizedState,e.memoizedProps);break;case 5:_l(e);break;case 3:case 4:var t=Bn;Bn=lu(e.stateNode.containerInfo),_l(e),Bn=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=ai,ai=16777216,_l(e),ai=t):_l(e));break;default:_l(e)}}function vj(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 Kr(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];Tt=a,bj(a,e)}vj(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)yj(e),e=e.sibling}function yj(e){switch(e.tag){case 0:case 11:case 15:Kr(e),e.flags&2048&&Aa(9,e,e.return);break;case 3:Kr(e);break;case 12:Kr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,jc(e)):Kr(e);break;default:Kr(e)}}function jc(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];Tt=a,bj(a,e)}vj(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Aa(8,t,t.return),jc(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,jc(t));break;default:jc(t)}e=e.sibling}}function bj(e,t){for(;Tt!==null;){var n=Tt;switch(n.tag){case 0:case 11:case 15:Aa(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:oo(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,Tt=a;else e:for(n=e;Tt!==null;){a=Tt;var l=a.sibling,r=a.return;if(dj(a),a===n){Tt=null;break e}if(l!==null){l.return=r,Tt=l;break e}Tt=r}}}var S2={getCacheForType:function(e){var t=It(wt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n}},C2=typeof WeakMap=="function"?WeakMap:Map,qe=0,We=null,Ae=null,$e=0,Pe=0,rn=null,ga=!1,Rr=!1,Jm=!1,Ks=0,ut=0,Ma=0,tl=0,ep=0,Cn=0,pr=0,wi=null,Zt=null,wh=!1,tp=0,Jc=1/0,eu=null,Na=null,Dt=0,ka=null,xr=null,nr=0,Nh=0,kh=null,jj=null,Ni=0,Sh=null;function fn(){if(qe&2&&$e!==0)return $e&-$e;if(je.T!==null){var e=dr;return e!==0?e:sp()}return My()}function _j(){Cn===0&&(Cn=!($e&536870912)||Le?Ry():536870912);var e=Mn.current;return e!==null&&(e.flags|=32),Cn}function hn(e,t,n){(e===We&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(gr(e,0),va(e,$e,Cn,!1)),so(e,n),(!(qe&2)||e!==We)&&(e===We&&(!(qe&2)&&(tl|=n),ut===4&&va(e,$e,Cn,!1)),_s(e))}function wj(e,t,n){if(qe&6)throw Error(Q(327));var a=!n&&(t&124)===0&&(t&e.expiredLanes)===0||no(e,t),l=a?E2(e,t):of(e,t,!0),r=a;do{if(l===0){Rr&&!a&&va(e,t,0,!1);break}else{if(n=e.current.alternate,r&&!R2(n)){l=of(e,t,!1),r=!1;continue}if(l===2){if(r=t,e.errorRecoveryDisabledLanes&r)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;l=wi;var c=o.current.memoizedState.isDehydrated;if(c&&(gr(o,i).flags|=256),i=of(o,i,!1),i!==2){if(Jm&&!c){o.errorRecoveryDisabledLanes|=r,tl|=r,l=4;break e}r=Zt,Zt=l,r!==null&&(Zt===null?Zt=r:Zt.push.apply(Zt,r))}l=i}if(r=!1,l!==2)continue}}if(l===1){gr(e,0),va(e,t,0,!0);break}e:{switch(a=e,r=l,r){case 0:case 1:throw Error(Q(345));case 4:if((t&4194048)!==t)break;case 6:va(a,t,Cn,!ga);break e;case 2:Zt=null;break;case 3:case 5:break;default:throw Error(Q(329))}if((t&62914560)===t&&(l=tp+300-ps(),10<l)){if(va(a,t,Cn,!ga),Ou(a,0,!0)!==0)break e;a.timeoutHandle=Pj(jg.bind(null,a,n,Zt,eu,wh,t,Cn,tl,pr,ga,r,2,-0,0),l);break e}jg(a,n,Zt,eu,wh,t,Cn,tl,pr,ga,r,0,-0,0)}}break}while(!0);_s(e)}function jg(e,t,n,a,l,r,i,o,c,d,f,h,m,g){if(e.timeoutHandle=-1,h=t.subtreeFlags,(h&8192||(h&16785408)===16785408)&&(Ui={stylesheets:null,count:0,unsuspend:cC},gj(t),h=dC(),h!==null)){e.cancelPendingCommit=h(wg.bind(null,e,t,r,n,a,l,i,o,c,f,1,m,g)),va(e,r,i,!d);return}wg(e,t,r,n,a,l,i,o,c)}function R2(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 l=n[a],r=l.getSnapshot;l=l.value;try{if(!pn(r(),l))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 va(e,t,n,a){t&=~ep,t&=~tl,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var l=t;0<l;){var r=31-dn(l),i=1<<r;a[r]=-1,l&=~i}n!==0&&Ey(e,n,t)}function qu(){return qe&6?!0:(mo(0),!1)}function np(){if(Ae!==null){if(Pe===0)var e=Ae.return;else e=Ae,Ps=gl=null,Pm(e),tr=null,Di=0,e=Ae;for(;e!==null;)aj(e.alternate,e),e=e.return;Ae=null}}function gr(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Y2(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),np(),We=e,Ae=n=Gs(e.current,null),$e=t,Pe=0,rn=null,ga=!1,Rr=no(e,t),Jm=!1,pr=Cn=ep=tl=Ma=ut=0,Zt=wi=null,wh=!1,t&8&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var l=31-dn(a),r=1<<l;t|=e[l],a&=~r}return Ks=t,Lu(),n}function Nj(e,t){Te=null,je.H=Fc,t===co||t===Bu?(t=Jx(),Pe=3):t===ob?(t=Jx(),Pe=4):Pe=t===Wb?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,rn=t,Ae===null&&(ut=1,Qc(e,Sn(t,e.current)))}function kj(){var e=je.H;return je.H=Fc,e===null?Fc:e}function Sj(){var e=je.A;return je.A=S2,e}function Ch(){ut=4,ga||($e&4194048)!==$e&&Mn.current!==null||(Rr=!0),!(Ma&134217727)&&!(tl&134217727)||We===null||va(We,$e,Cn,!1)}function of(e,t,n){var a=qe;qe|=2;var l=kj(),r=Sj();(We!==e||$e!==t)&&(eu=null,gr(e,t)),t=!1;var i=ut;e:do try{if(Pe!==0&&Ae!==null){var o=Ae,c=rn;switch(Pe){case 8:np(),i=6;break e;case 3:case 2:case 9:case 6:Mn.current===null&&(t=!0);var d=Pe;if(Pe=0,rn=null,Fl(e,o,c,d),n&&Rr){i=0;break e}break;default:d=Pe,Pe=0,rn=null,Fl(e,o,c,d)}}T2(),i=ut;break}catch(f){Nj(e,f)}while(!0);return t&&e.shellSuspendCounter++,Ps=gl=null,qe=a,je.H=l,je.A=r,Ae===null&&(We=null,$e=0,Lu()),i}function T2(){for(;Ae!==null;)Cj(Ae)}function E2(e,t){var n=qe;qe|=2;var a=kj(),l=Sj();We!==e||$e!==t?(eu=null,Jc=ps()+500,gr(e,t)):Rr=no(e,t);e:do try{if(Pe!==0&&Ae!==null){t=Ae;var r=rn;t:switch(Pe){case 1:Pe=0,rn=null,Fl(e,t,r,1);break;case 2:case 9:if(Wx(r)){Pe=0,rn=null,_g(t);break}t=function(){Pe!==2&&Pe!==9||We!==e||(Pe=7),_s(e)},r.then(t,t);break e;case 3:Pe=7;break e;case 4:Pe=5;break e;case 7:Wx(r)?(Pe=0,rn=null,_g(t)):(Pe=0,rn=null,Fl(e,t,r,7));break;case 5:var i=null;switch(Ae.tag){case 26:i=Ae.memoizedState;case 5:case 27:var o=Ae;if(!i||Yj(i)){Pe=0,rn=null;var c=o.sibling;if(c!==null)Ae=c;else{var d=o.return;d!==null?(Ae=d,Gu(d)):Ae=null}break t}}Pe=0,rn=null,Fl(e,t,r,5);break;case 6:Pe=0,rn=null,Fl(e,t,r,6);break;case 8:np(),ut=6;break e;default:throw Error(Q(462))}}A2();break}catch(f){Nj(e,f)}while(!0);return Ps=gl=null,je.H=a,je.A=l,qe=n,Ae!==null?0:(We=null,$e=0,Lu(),ut)}function A2(){for(;Ae!==null&&!J1();)Cj(Ae)}function Cj(e){var t=sj(e.alternate,e,Ks);e.memoizedProps=e.pendingProps,t===null?Gu(e):Ae=t}function _g(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pg(n,t,t.pendingProps,t.type,void 0,$e);break;case 11:t=pg(n,t,t.pendingProps,t.type.render,t.ref,$e);break;case 5:Pm(t);default:aj(n,t),t=Ae=ab(t,Ks),t=sj(n,t,Ks)}e.memoizedProps=e.pendingProps,t===null?Gu(e):Ae=t}function Fl(e,t,n,a){Ps=gl=null,Pm(t),tr=null,Di=0;var l=t.return;try{if(b2(e,l,t,n,$e)){ut=1,Qc(e,Sn(n,e.current)),Ae=null;return}}catch(r){if(l!==null)throw Ae=l,r;ut=1,Qc(e,Sn(n,e.current)),Ae=null;return}t.flags&32768?(Le||a===1?e=!0:Rr||$e&536870912?e=!1:(ga=e=!0,(a===2||a===9||a===3||a===6)&&(a=Mn.current,a!==null&&a.tag===13&&(a.flags|=16384))),Rj(t,e)):Gu(t)}function Gu(e){var t=e;do{if(t.flags&32768){Rj(t,ga);return}e=t.return;var n=_2(t.alternate,t,Ks);if(n!==null){Ae=n;return}if(t=t.sibling,t!==null){Ae=t;return}Ae=t=e}while(t!==null);ut===0&&(ut=5)}function Rj(e,t){do{var n=w2(e.alternate,e);if(n!==null){n.flags&=32767,Ae=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ae=e;return}Ae=e=n}while(e!==null);ut=6,Ae=null}function wg(e,t,n,a,l,r,i,o,c){e.cancelPendingCommit=null;do Vu();while(Dt!==0);if(qe&6)throw Error(Q(327));if(t!==null){if(t===e.current)throw Error(Q(177));if(r=t.lanes|t.childLanes,r|=Tm,cS(e,n,r,i,o,c),e===We&&(Ae=We=null,$e=0),xr=t,ka=e,nr=n,Nh=r,kh=l,jj=a,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,D2(Lc,function(){return Oj(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,t.subtreeFlags&13878||a){a=je.T,je.T=null,l=Ue.p,Ue.p=2,i=qe,qe|=4;try{N2(e,t,n)}finally{qe=i,Ue.p=l,je.T=a}}Dt=1,Tj(),Ej(),Aj()}}function Tj(){if(Dt===1){Dt=0;var e=ka,t=xr,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=je.T,je.T=null;var a=Ue.p;Ue.p=2;var l=qe;qe|=4;try{mj(t,e);var r=Ah,i=Qy(e.containerInfo),o=r.focusedElem,c=r.selectionRange;if(i!==o&&o&&o.ownerDocument&&Ky(o.ownerDocument.documentElement,o)){if(c!==null&&Rm(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 g=m.getSelection(),j=o.textContent.length,v=Math.min(c.start,j),y=c.end===void 0?v:Math.min(c.end,j);!g.extend&&v>y&&(i=y,y=v,v=i);var x=Gx(o,v),p=Gx(o,y);if(x&&p&&(g.rangeCount!==1||g.anchorNode!==x.node||g.anchorOffset!==x.offset||g.focusNode!==p.node||g.focusOffset!==p.offset)){var b=h.createRange();b.setStart(x.node,x.offset),g.removeAllRanges(),v>y?(g.addRange(b),g.extend(p.node,p.offset)):(b.setEnd(p.node,p.offset),g.addRange(b))}}}}for(h=[],g=o;g=g.parentNode;)g.nodeType===1&&h.push({element:g,left:g.scrollLeft,top:g.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<h.length;o++){var _=h[o];_.element.scrollLeft=_.left,_.element.scrollTop=_.top}}ou=!!Eh,Ah=Eh=null}finally{qe=l,Ue.p=a,je.T=n}}e.current=t,Dt=2}}function Ej(){if(Dt===2){Dt=0;var e=ka,t=xr,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=je.T,je.T=null;var a=Ue.p;Ue.p=2;var l=qe;qe|=4;try{uj(e,t.alternate,t)}finally{qe=l,Ue.p=a,je.T=n}}Dt=3}}function Aj(){if(Dt===4||Dt===3){Dt=0,eS();var e=ka,t=xr,n=nr,a=jj;t.subtreeFlags&10256||t.flags&10256?Dt=5:(Dt=0,xr=ka=null,Mj(e,e.pendingLanes));var l=e.pendingLanes;if(l===0&&(Na=null),jm(n),t=t.stateNode,un&&typeof un.onCommitFiberRoot=="function")try{un.onCommitFiberRoot(to,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=je.T,l=Ue.p,Ue.p=2,je.T=null;try{for(var r=e.onRecoverableError,i=0;i<a.length;i++){var o=a[i];r(o.value,{componentStack:o.stack})}}finally{je.T=t,Ue.p=l}}nr&3&&Vu(),_s(e),l=e.pendingLanes,n&4194090&&l&42?e===Sh?Ni++:(Ni=0,Sh=e):Ni=0,mo(0)}}function Mj(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,oo(t)))}function Vu(e){return Tj(),Ej(),Aj(),Oj()}function Oj(){if(Dt!==5)return!1;var e=ka,t=Nh;Nh=0;var n=jm(nr),a=je.T,l=Ue.p;try{Ue.p=32>n?32:n,je.T=null,n=kh,kh=null;var r=ka,i=nr;if(Dt=0,xr=ka=null,nr=0,qe&6)throw Error(Q(331));var o=qe;if(qe|=4,yj(r.current),xj(r,r.current,i,n),qe=o,mo(0,!1),un&&typeof un.onPostCommitFiberRoot=="function")try{un.onPostCommitFiberRoot(to,r)}catch{}return!0}finally{Ue.p=l,je.T=a,Mj(e,t)}}function Ng(e,t,n){t=Sn(n,t),t=yh(e.stateNode,t,2),e=wa(e,t,2),e!==null&&(so(e,2),_s(e))}function Ke(e,t,n){if(e.tag===3)Ng(e,e,n);else for(;t!==null;){if(t.tag===3){Ng(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Na===null||!Na.has(a))){e=Sn(n,e),n=Qb(2),a=wa(t,n,2),a!==null&&(Zb(n,a,t,e),so(a,2),_s(a));break}}t=t.return}}function cf(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new C2;var l=new Set;a.set(t,l)}else l=a.get(t),l===void 0&&(l=new Set,a.set(t,l));l.has(n)||(Jm=!0,l.add(n),e=M2.bind(null,e,t,n),t.then(e,e))}function M2(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,We===e&&($e&n)===n&&(ut===4||ut===3&&($e&62914560)===$e&&300>ps()-tp?!(qe&2)&&gr(e,0):ep|=n,pr===$e&&(pr=0)),_s(e)}function $j(e,t){t===0&&(t=Ty()),e=Cr(e,t),e!==null&&(so(e,t),_s(e))}function O2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),$j(e,n)}function $2(e,t){var n=0;switch(e.tag){case 13:var a=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(Q(314))}a!==null&&a.delete(t),$j(e,n)}function D2(e,t){return ym(e,t)}var tu=null,Dl=null,Rh=!1,nu=!1,uf=!1,nl=0;function _s(e){e!==Dl&&e.next===null&&(Dl===null?tu=Dl=e:Dl=Dl.next=e),nu=!0,Rh||(Rh=!0,L2())}function mo(e,t){if(!uf&&nu){uf=!0;do for(var n=!1,a=tu;a!==null;){if(e!==0){var l=a.pendingLanes;if(l===0)var r=0;else{var i=a.suspendedLanes,o=a.pingedLanes;r=(1<<31-dn(42|e)+1)-1,r&=l&~(i&~o),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,kg(a,r))}else r=$e,r=Ou(a,a===We?r:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),!(r&3)||no(a,r)||(n=!0,kg(a,r));a=a.next}while(n);uf=!1}}function z2(){Dj()}function Dj(){nu=Rh=!1;var e=0;nl!==0&&(V2()&&(e=nl),nl=0);for(var t=ps(),n=null,a=tu;a!==null;){var l=a.next,r=zj(a,t);r===0?(a.next=null,n===null?tu=l:n.next=l,l===null&&(Dl=n)):(n=a,(e!==0||r&3)&&(nu=!0)),a=l}mo(e)}function zj(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,l=e.expirationTimes,r=e.pendingLanes&-62914561;0<r;){var i=31-dn(r),o=1<<i,c=l[i];c===-1?(!(o&n)||o&a)&&(l[i]=oS(o,t)):c<=t&&(e.expiredLanes|=o),r&=~o}if(t=We,n=$e,n=Ou(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Dd(a),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||no(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&Dd(a),jm(n)){case 2:case 8:n=Sy;break;case 32:n=Lc;break;case 268435456:n=Cy;break;default:n=Lc}return a=Lj.bind(null,e),n=ym(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&Dd(a),e.callbackPriority=2,e.callbackNode=null,2}function Lj(e,t){if(Dt!==0&&Dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Vu()&&e.callbackNode!==n)return null;var a=$e;return a=Ou(e,e===We?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(wj(e,a,t),zj(e,ps()),e.callbackNode!=null&&e.callbackNode===n?Lj.bind(null,e):null)}function kg(e,t){if(Vu())return null;wj(e,t,!0)}function L2(){F2(function(){qe&6?ym(ky,z2):Dj()})}function sp(){return nl===0&&(nl=Ry()),nl}function Sg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:hc(""+e)}function Cg(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 U2(e,t,n,a,l){if(t==="submit"&&n&&n.stateNode===l){var r=Sg((l[Wt]||null).action),i=a.submitter;i&&(t=(t=i[Wt]||null)?Sg(t.formAction):i.getAttribute("formAction"),t!==null&&(r=t,i=null));var o=new $u("action","action",null,a,l);e.push({event:o,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(nl!==0){var c=i?Cg(l,i):new FormData(l);gh(n,{pending:!0,data:c,method:l.method,action:r},null,c)}}else typeof r=="function"&&(o.preventDefault(),c=i?Cg(l,i):new FormData(l),gh(n,{pending:!0,data:c,method:l.method,action:r},r,c))},currentTarget:l}]})}}for(var df=0;df<lh.length;df++){var ff=lh[df],B2=ff.toLowerCase(),H2=ff[0].toUpperCase()+ff.slice(1);Zn(B2,"on"+H2)}Zn(Wy,"onAnimationEnd");Zn(Jy,"onAnimationIteration");Zn(eb,"onAnimationStart");Zn("dblclick","onDoubleClick");Zn("focusin","onFocus");Zn("focusout","onBlur");Zn(s2,"onTransitionRun");Zn(a2,"onTransitionStart");Zn(l2,"onTransitionCancel");Zn(tb,"onTransitionEnd");cr("onMouseEnter",["mouseout","mouseover"]);cr("onMouseLeave",["mouseout","mouseover"]);cr("onPointerEnter",["pointerout","pointerover"]);cr("onPointerLeave",["pointerout","pointerover"]);ml("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ml("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ml("onBeforeInput",["compositionend","keypress","textInput","paste"]);ml("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ml("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ml("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(" "),I2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(zi));function Uj(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],l=a.event;a=a.listeners;e:{var r=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!==r&&l.isPropagationStopped())break e;r=o,l.currentTarget=d;try{r(l)}catch(f){Kc(f)}l.currentTarget=null,r=c}else for(i=0;i<a.length;i++){if(o=a[i],c=o.instance,d=o.currentTarget,o=o.listener,c!==r&&l.isPropagationStopped())break e;r=o,l.currentTarget=d;try{r(l)}catch(f){Kc(f)}l.currentTarget=null,r=c}}}}function Ee(e,t){var n=t[Wf];n===void 0&&(n=t[Wf]=new Set);var a=e+"__bubble";n.has(a)||(Bj(t,e,2,!1),n.add(a))}function hf(e,t,n){var a=0;t&&(a|=4),Bj(n,e,a,t)}var Yo="_reactListening"+Math.random().toString(36).slice(2);function ap(e){if(!e[Yo]){e[Yo]=!0,Oy.forEach(function(n){n!=="selectionchange"&&(I2.has(n)||hf(n,!1,e),hf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Yo]||(t[Yo]=!0,hf("selectionchange",!1,t))}}function Bj(e,t,n,a){switch(Zj(t)){case 2:var l=mC;break;case 8:l=pC;break;default:l=op}n=l.bind(null,t,n,e),l=void 0,!nh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),a?l!==void 0?e.addEventListener(t,n,{capture:!0,passive:l}):e.addEventListener(t,n,!0):l!==void 0?e.addEventListener(t,n,{passive:l}):e.addEventListener(t,n,!1)}function mf(e,t,n,a,l){var r=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===l)break;if(i===4)for(i=a.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===l)return;i=i.return}for(;o!==null;){if(i=Ul(o),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){a=r=i;continue e}o=o.parentNode}}a=a.return}Iy(function(){var d=r,f=Nm(n),h=[];e:{var m=nb.get(e);if(m!==void 0){var g=$u,j=e;switch(e){case"keypress":if(pc(n)===0)break e;case"keydown":case"keyup":g=DS;break;case"focusin":j="focus",g=qd;break;case"focusout":j="blur",g=qd;break;case"beforeblur":case"afterblur":g=qd;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":g=$x;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=wS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=US;break;case Wy:case Jy:case eb:g=SS;break;case tb:g=HS;break;case"scroll":case"scrollend":g=jS;break;case"wheel":g=PS;break;case"copy":case"cut":case"paste":g=RS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=zx;break;case"toggle":case"beforetoggle":g=GS}var v=(t&4)!==0,y=!v&&(e==="scroll"||e==="scrollend"),x=v?m!==null?m+"Capture":null:m;v=[];for(var p=d,b;p!==null;){var _=p;if(b=_.stateNode,_=_.tag,_!==5&&_!==26&&_!==27||b===null||x===null||(_=Ei(p,x),_!=null&&v.push(Li(p,_,b))),y)break;p=p.return}0<v.length&&(m=new g(m,j,null,n,f),h.push({event:m,listeners:v}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",m&&n!==th&&(j=n.relatedTarget||n.fromElement)&&(Ul(j)||j[kr]))break e;if((g||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,g?(j=n.relatedTarget||n.toElement,g=d,j=j?Ul(j):null,j!==null&&(y=eo(j),v=j.tag,j!==y||v!==5&&v!==27&&v!==6)&&(j=null)):(g=null,j=d),g!==j)){if(v=$x,_="onMouseLeave",x="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(v=zx,_="onPointerLeave",x="onPointerEnter",p="pointer"),y=g==null?m:si(g),b=j==null?m:si(j),m=new v(_,p+"leave",g,n,f),m.target=y,m.relatedTarget=b,_=null,Ul(f)===d&&(v=new v(x,p+"enter",j,n,f),v.target=b,v.relatedTarget=y,_=v),y=_,g&&j)t:{for(v=g,x=j,p=0,b=v;b;b=wl(b))p++;for(b=0,_=x;_;_=wl(_))b++;for(;0<p-b;)v=wl(v),p--;for(;0<b-p;)x=wl(x),b--;for(;p--;){if(v===x||x!==null&&v===x.alternate)break t;v=wl(v),x=wl(x)}v=null}else v=null;g!==null&&Rg(h,m,g,v,!1),j!==null&&y!==null&&Rg(h,y,j,v,!0)}}e:{if(m=d?si(d):window,g=m.nodeName&&m.nodeName.toLowerCase(),g==="select"||g==="input"&&m.type==="file")var N=Hx;else if(Bx(m))if(Fy)N=e2;else{N=WS;var C=ZS}else g=m.nodeName,!g||g.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?d&&wm(d.elementType)&&(N=Hx):N=JS;if(N&&(N=N(e,d))){Yy(h,N,n,f);break e}C&&C(e,m,d),e==="focusout"&&d&&m.type==="number"&&d.memoizedProps.value!=null&&eh(m,"number",m.value)}switch(C=d?si(d):window,e){case"focusin":(Bx(C)||C.contentEditable==="true")&&(Il=C,sh=d,mi=null);break;case"focusout":mi=sh=Il=null;break;case"mousedown":ah=!0;break;case"contextmenu":case"mouseup":case"dragend":ah=!1,Vx(h,n,f);break;case"selectionchange":if(n2)break;case"keydown":case"keyup":Vx(h,n,f)}var w;if(Cm)e:{switch(e){case"compositionstart":var k="onCompositionStart";break e;case"compositionend":k="onCompositionEnd";break e;case"compositionupdate":k="onCompositionUpdate";break e}k=void 0}else Hl?Gy(e,n)&&(k="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(k="onCompositionStart");k&&(qy&&n.locale!=="ko"&&(Hl||k!=="onCompositionStart"?k==="onCompositionEnd"&&Hl&&(w=Py()):(xa=f,km="value"in xa?xa.value:xa.textContent,Hl=!0)),C=su(d,k),0<C.length&&(k=new Dx(k,e,null,n,f),h.push({event:k,listeners:C}),w?k.data=w:(w=Vy(n),w!==null&&(k.data=w)))),(w=YS?FS(e,n):XS(e,n))&&(k=su(d,"onBeforeInput"),0<k.length&&(C=new Dx("onBeforeInput","beforeinput",null,n,f),h.push({event:C,listeners:k}),C.data=w)),U2(h,e,d,n,f)}Uj(h,t)})}function Li(e,t,n){return{instance:e,listener:t,currentTarget:n}}function su(e,t){for(var n=t+"Capture",a=[];e!==null;){var l=e,r=l.stateNode;if(l=l.tag,l!==5&&l!==26&&l!==27||r===null||(l=Ei(e,n),l!=null&&a.unshift(Li(e,l,r)),l=Ei(e,t),l!=null&&a.push(Li(e,l,r))),e.tag===3)return a;e=e.return}return[]}function wl(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Rg(e,t,n,a,l){for(var r=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,l?(d=Ei(n,r),d!=null&&i.unshift(Li(n,d,c))):l||(d=Ei(n,r),d!=null&&i.push(Li(n,d,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var P2=/\r\n?/g,q2=/\u0000|\uFFFD/g;function Tg(e){return(typeof e=="string"?e:""+e).replace(P2,`
49
+ `).replace(q2,"")}function Hj(e,t){return t=Tg(t),Tg(e)===t}function Yu(){}function Fe(e,t,n,a,l,r){switch(n){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||ur(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&ur(e,""+a);break;case"className":Bo(e,"class",a);break;case"tabIndex":Bo(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Bo(e,n,a);break;case"style":Hy(e,a,r);break;case"data":if(t!=="object"){Bo(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=hc(""+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 r=="function"&&(n==="formAction"?(t!=="input"&&Fe(e,t,"name",l.name,l,null),Fe(e,t,"formEncType",l.formEncType,l,null),Fe(e,t,"formMethod",l.formMethod,l,null),Fe(e,t,"formTarget",l.formTarget,l,null)):(Fe(e,t,"encType",l.encType,l,null),Fe(e,t,"method",l.method,l,null),Fe(e,t,"target",l.target,l,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=hc(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=Yu);break;case"onScroll":a!=null&&Ee("scroll",e);break;case"onScrollEnd":a!=null&&Ee("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(Q(61));if(n=a.__html,n!=null){if(l.children!=null)throw Error(Q(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=hc(""+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":Ee("beforetoggle",e),Ee("toggle",e),fc(e,"popover",a);break;case"xlinkActuate":As(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":As(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":As(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":As(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":As(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":As(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":As(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":As(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":As(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":fc(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=yS.get(n)||n,fc(e,n,a))}}function Th(e,t,n,a,l,r){switch(n){case"style":Hy(e,a,r);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(Q(61));if(n=a.__html,n!=null){if(l.children!=null)throw Error(Q(60));e.innerHTML=n}}break;case"children":typeof a=="string"?ur(e,a):(typeof a=="number"||typeof a=="bigint")&&ur(e,""+a);break;case"onScroll":a!=null&&Ee("scroll",e);break;case"onScrollEnd":a!=null&&Ee("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Yu);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$y.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(l=n.endsWith("Capture"),t=n.slice(2,l?n.length-7:void 0),r=e[Wt]||null,r=r!=null?r[n]:null,typeof r=="function"&&e.removeEventListener(t,r,l),typeof a=="function")){typeof r!="function"&&r!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,a,l);break e}n in e?e[n]=a:a===!0?e.setAttribute(n,""):fc(e,n,a)}}}function zt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var a=!1,l=!1,r;for(r in n)if(n.hasOwnProperty(r)){var i=n[r];if(i!=null)switch(r){case"src":a=!0;break;case"srcSet":l=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Q(137,t));default:Fe(e,t,r,i,n,null)}}l&&Fe(e,t,"srcSet",n.srcSet,n,null),a&&Fe(e,t,"src",n.src,n,null);return;case"input":Ee("invalid",e);var o=r=i=l=null,c=null,d=null;for(a in n)if(n.hasOwnProperty(a)){var f=n[a];if(f!=null)switch(a){case"name":l=f;break;case"type":i=f;break;case"checked":c=f;break;case"defaultChecked":d=f;break;case"value":r=f;break;case"defaultValue":o=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(Q(137,t));break;default:Fe(e,t,a,f,n,null)}}Ly(e,r,o,c,d,i,l,!1),Uc(e);return;case"select":Ee("invalid",e),a=i=r=null;for(l in n)if(n.hasOwnProperty(l)&&(o=n[l],o!=null))switch(l){case"value":r=o;break;case"defaultValue":i=o;break;case"multiple":a=o;default:Fe(e,t,l,o,n,null)}t=r,n=i,e.multiple=!!a,t!=null?Ql(e,!!a,t,!1):n!=null&&Ql(e,!!a,n,!0);return;case"textarea":Ee("invalid",e),r=l=a=null;for(i in n)if(n.hasOwnProperty(i)&&(o=n[i],o!=null))switch(i){case"value":a=o;break;case"defaultValue":l=o;break;case"children":r=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(Q(91));break;default:Fe(e,t,i,o,n,null)}By(e,a,l,r),Uc(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:Fe(e,t,c,a,n,null)}return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(a=0;a<zi.length;a++)Ee(zi[a],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("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(Q(137,t));default:Fe(e,t,d,a,n,null)}return;default:if(wm(t)){for(f in n)n.hasOwnProperty(f)&&(a=n[f],a!==void 0&&Th(e,t,f,a,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(a=n[o],a!=null&&Fe(e,t,o,a,n,null))}function G2(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 l=null,r=null,i=null,o=null,c=null,d=null,f=null;for(g in n){var h=n[g];if(n.hasOwnProperty(g)&&h!=null)switch(g){case"checked":break;case"value":break;case"defaultValue":c=h;default:a.hasOwnProperty(g)||Fe(e,t,g,null,a,h)}}for(var m in a){var g=a[m];if(h=n[m],a.hasOwnProperty(m)&&(g!=null||h!=null))switch(m){case"type":r=g;break;case"name":l=g;break;case"checked":d=g;break;case"defaultChecked":f=g;break;case"value":i=g;break;case"defaultValue":o=g;break;case"children":case"dangerouslySetInnerHTML":if(g!=null)throw Error(Q(137,t));break;default:g!==h&&Fe(e,t,m,g,a,h)}}Jf(e,i,o,c,d,f,r,l);return;case"select":g=i=o=m=null;for(r in n)if(c=n[r],n.hasOwnProperty(r)&&c!=null)switch(r){case"value":break;case"multiple":g=c;default:a.hasOwnProperty(r)||Fe(e,t,r,null,a,c)}for(l in a)if(r=a[l],c=n[l],a.hasOwnProperty(l)&&(r!=null||c!=null))switch(l){case"value":m=r;break;case"defaultValue":o=r;break;case"multiple":i=r;default:r!==c&&Fe(e,t,l,r,a,c)}t=o,n=i,a=g,m!=null?Ql(e,!!n,m,!1):!!a!=!!n&&(t!=null?Ql(e,!!n,t,!0):Ql(e,!!n,n?[]:"",!1));return;case"textarea":g=m=null;for(o in n)if(l=n[o],n.hasOwnProperty(o)&&l!=null&&!a.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:Fe(e,t,o,null,a,l)}for(i in a)if(l=a[i],r=n[i],a.hasOwnProperty(i)&&(l!=null||r!=null))switch(i){case"value":m=l;break;case"defaultValue":g=l;break;case"children":break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(Q(91));break;default:l!==r&&Fe(e,t,i,l,a,r)}Uy(e,m,g);return;case"option":for(var j in n)if(m=n[j],n.hasOwnProperty(j)&&m!=null&&!a.hasOwnProperty(j))switch(j){case"selected":e.selected=!1;break;default:Fe(e,t,j,null,a,m)}for(c in a)if(m=a[c],g=n[c],a.hasOwnProperty(c)&&m!==g&&(m!=null||g!=null))switch(c){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Fe(e,t,c,m,a,g)}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)&&Fe(e,t,v,null,a,m);for(d in a)if(m=a[d],g=n[d],a.hasOwnProperty(d)&&m!==g&&(m!=null||g!=null))switch(d){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(Q(137,t));break;default:Fe(e,t,d,m,a,g)}return;default:if(wm(t)){for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!==void 0&&!a.hasOwnProperty(y)&&Th(e,t,y,void 0,a,m);for(f in a)m=a[f],g=n[f],!a.hasOwnProperty(f)||m===g||m===void 0&&g===void 0||Th(e,t,f,m,a,g);return}}for(var x in n)m=n[x],n.hasOwnProperty(x)&&m!=null&&!a.hasOwnProperty(x)&&Fe(e,t,x,null,a,m);for(h in a)m=a[h],g=n[h],!a.hasOwnProperty(h)||m===g||m==null&&g==null||Fe(e,t,h,m,a,g)}var Eh=null,Ah=null;function au(e){return e.nodeType===9?e:e.ownerDocument}function Eg(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 Ij(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 Mh(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 pf=null;function V2(){var e=window.event;return e&&e.type==="popstate"?e===pf?!1:(pf=e,!0):(pf=null,!1)}var Pj=typeof setTimeout=="function"?setTimeout:void 0,Y2=typeof clearTimeout=="function"?clearTimeout:void 0,Ag=typeof Promise=="function"?Promise:void 0,F2=typeof queueMicrotask=="function"?queueMicrotask:typeof Ag<"u"?function(e){return Ag.resolve(null).then(e).catch(X2)}:Pj;function X2(e){setTimeout(function(){throw e})}function La(e){return e==="head"}function Mg(e,t){var n=t,a=0,l=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(0<a&&8>a){n=a;var i=e.ownerDocument;if(n&1&&ki(i.documentElement),n&2&&ki(i.body),n&4)for(n=i.head,ki(n),i=n.firstChild;i;){var o=i.nextSibling,c=i.nodeName;i[ao]||c==="SCRIPT"||c==="STYLE"||c==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}if(l===0){e.removeChild(r),Pi(t);return}l--}else n==="$"||n==="$?"||n==="$!"?l++:a=n.charCodeAt(0)-48;else a=0;n=r}while(n);Pi(t)}function Oh(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":Oh(n),_m(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function K2(e,t,n,a){for(;e.nodeType===1;){var l=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[ao])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==l.rel||e.getAttribute("href")!==(l.href==null||l.href===""?null:l.href)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin)||e.getAttribute("title")!==(l.title==null?null:l.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(l.src==null?null:l.src)||e.getAttribute("type")!==(l.type==null?null:l.type)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=l.name==null?null:""+l.name;if(l.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=Gn(e.nextSibling),e===null)break}return null}function Q2(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Gn(e.nextSibling),e===null))return null;return e}function $h(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function Z2(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 Gn(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 Dh=null;function Og(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 qj(e,t,n){switch(t=au(n),e){case"html":if(e=t.documentElement,!e)throw Error(Q(452));return e;case"head":if(e=t.head,!e)throw Error(Q(453));return e;case"body":if(e=t.body,!e)throw Error(Q(454));return e;default:throw Error(Q(451))}}function ki(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_m(e)}var On=new Map,$g=new Set;function lu(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ws=Ue.d;Ue.d={f:W2,r:J2,D:eC,C:tC,L:nC,m:sC,X:lC,S:aC,M:rC};function W2(){var e=Ws.f(),t=qu();return e||t}function J2(e){var t=Sr(e);t!==null&&t.tag===5&&t.type==="form"?zb(t):Ws.r(e)}var Tr=typeof document>"u"?null:document;function Gj(e,t,n){var a=Tr;if(a&&typeof t=="string"&&t){var l=kn(t);l='link[rel="'+e+'"][href="'+l+'"]',typeof n=="string"&&(l+='[crossorigin="'+n+'"]'),$g.has(l)||($g.add(l),e={rel:e,crossOrigin:n,href:t},a.querySelector(l)===null&&(t=a.createElement("link"),zt(t,"link",e),Et(t),a.head.appendChild(t)))}}function eC(e){Ws.D(e),Gj("dns-prefetch",e,null)}function tC(e,t){Ws.C(e,t),Gj("preconnect",e,t)}function nC(e,t,n){Ws.L(e,t,n);var a=Tr;if(a&&e&&t){var l='link[rel="preload"][as="'+kn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(l+='[imagesrcset="'+kn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(l+='[imagesizes="'+kn(n.imageSizes)+'"]')):l+='[href="'+kn(e)+'"]';var r=l;switch(t){case"style":r=vr(e);break;case"script":r=Er(e)}On.has(r)||(e=Je({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),On.set(r,e),a.querySelector(l)!==null||t==="style"&&a.querySelector(po(r))||t==="script"&&a.querySelector(xo(r))||(t=a.createElement("link"),zt(t,"link",e),Et(t),a.head.appendChild(t)))}}function sC(e,t){Ws.m(e,t);var n=Tr;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",l='link[rel="modulepreload"][as="'+kn(a)+'"][href="'+kn(e)+'"]',r=l;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=Er(e)}if(!On.has(r)&&(e=Je({rel:"modulepreload",href:e},t),On.set(r,e),n.querySelector(l)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(xo(r)))return}a=n.createElement("link"),zt(a,"link",e),Et(a),n.head.appendChild(a)}}}function aC(e,t,n){Ws.S(e,t,n);var a=Tr;if(a&&e){var l=Kl(a).hoistableStyles,r=vr(e);t=t||"default";var i=l.get(r);if(!i){var o={loading:0,preload:null};if(i=a.querySelector(po(r)))o.loading=5;else{e=Je({rel:"stylesheet",href:e,"data-precedence":t},n),(n=On.get(r))&&lp(e,n);var c=i=a.createElement("link");Et(c),zt(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,_c(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:o},l.set(r,i)}}}function lC(e,t){Ws.X(e,t);var n=Tr;if(n&&e){var a=Kl(n).hoistableScripts,l=Er(e),r=a.get(l);r||(r=n.querySelector(xo(l)),r||(e=Je({src:e,async:!0},t),(t=On.get(l))&&rp(e,t),r=n.createElement("script"),Et(r),zt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(l,r))}}function rC(e,t){Ws.M(e,t);var n=Tr;if(n&&e){var a=Kl(n).hoistableScripts,l=Er(e),r=a.get(l);r||(r=n.querySelector(xo(l)),r||(e=Je({src:e,async:!0,type:"module"},t),(t=On.get(l))&&rp(e,t),r=n.createElement("script"),Et(r),zt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(l,r))}}function Dg(e,t,n,a){var l=(l=ja.current)?lu(l):null;if(!l)throw Error(Q(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=vr(n.href),n=Kl(l).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=vr(n.href);var r=Kl(l).hoistableStyles,i=r.get(e);if(i||(l=l.ownerDocument||l,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,i),(r=l.querySelector(po(e)))&&!r._p&&(i.instance=r,i.state.loading=5),On.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},On.set(e,n),r||iC(l,e,n,i.state))),t&&a===null)throw Error(Q(528,""));return i}if(t&&a!==null)throw Error(Q(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Er(n),n=Kl(l).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(Q(444,e))}}function vr(e){return'href="'+kn(e)+'"'}function po(e){return'link[rel="stylesheet"]['+e+"]"}function Vj(e){return Je({},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}),zt(t,"link",n),Et(t),e.head.appendChild(t))}function Er(e){return'[src="'+kn(e)+'"]'}function xo(e){return"script[async]"+e}function zg(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+kn(n.href)+'"]');if(a)return t.instance=a,Et(a),a;var l=Je({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Et(a),zt(a,"style",l),_c(a,n.precedence,e),t.instance=a;case"stylesheet":l=vr(n.href);var r=e.querySelector(po(l));if(r)return t.state.loading|=4,t.instance=r,Et(r),r;a=Vj(n),(l=On.get(l))&&lp(a,l),r=(e.ownerDocument||e).createElement("link"),Et(r);var i=r;return i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),zt(r,"link",a),t.state.loading|=4,_c(r,n.precedence,e),t.instance=r;case"script":return r=Er(n.src),(l=e.querySelector(xo(r)))?(t.instance=l,Et(l),l):(a=n,(l=On.get(r))&&(a=Je({},n),rp(a,l)),e=e.ownerDocument||e,l=e.createElement("script"),Et(l),zt(l,"link",a),e.head.appendChild(l),t.instance=l);case"void":return null;default:throw Error(Q(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(a=t.instance,t.state.loading|=4,_c(a,n.precedence,e));return t.instance}function _c(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),l=a.length?a[a.length-1]:null,r=l,i=0;i<a.length;i++){var o=a[i];if(o.dataset.precedence===t)r=o;else if(r!==l)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function lp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function rp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var wc=null;function Lg(e,t,n){if(wc===null){var a=new Map,l=wc=new Map;l.set(n,a)}else l=wc,a=l.get(n),a||(a=new Map,l.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),l=0;l<n.length;l++){var r=n[l];if(!(r[ao]||r[Ht]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var i=r.getAttribute(t)||"";i=e+i;var o=a.get(i);o?o.push(r):a.set(i,[r])}}return a}function Ug(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function oC(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 Yj(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var Ui=null;function cC(){}function uC(e,t,n){if(Ui===null)throw Error(Q(475));var a=Ui;if(t.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var l=vr(n.href),r=e.querySelector(po(l));if(r){e=r._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(a.count++,a=ru.bind(a),e.then(a,a)),t.state.loading|=4,t.instance=r,Et(r);return}r=e.ownerDocument||e,n=Vj(n),(l=On.get(l))&&lp(n,l),r=r.createElement("link"),Et(r);var i=r;i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),zt(r,"link",n),t.instance=r}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(t,e),(e=t.state.preload)&&!(t.state.loading&3)&&(a.count++,t=ru.bind(a),e.addEventListener("load",t),e.addEventListener("error",t))}}function dC(){if(Ui===null)throw Error(Q(475));var e=Ui;return e.stylesheets&&e.count===0&&zh(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&zh(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 ru(){if(this.count--,this.count===0){if(this.stylesheets)zh(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var iu=null;function zh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,iu=new Map,t.forEach(fC,e),iu=null,ru.call(e))}function fC(e,t){if(!(t.state.loading&4)){var n=iu.get(e);if(n)var a=n.get(null);else{n=new Map,iu.set(e,n);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<l.length;r++){var i=l[r];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(n.set(i.dataset.precedence,i),a=i)}a&&n.set(null,a)}l=t.instance,i=l.getAttribute("data-precedence"),r=n.get(i)||a,r===a&&n.set(null,l),n.set(i,l),this.count++,a=ru.bind(this),l.addEventListener("load",a),l.addEventListener("error",a),r?r.parentNode.insertBefore(l,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(l,e.firstChild)),t.state.loading|=4}}var Bi={$$typeof:Bs,Provider:null,Consumer:null,_currentValue:Qa,_currentValue2:Qa,_threadCount:0};function hC(e,t,n,a,l,r,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=zd(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zd(0),this.hiddenUpdates=zd(null),this.identifierPrefix=a,this.onUncaughtError=l,this.onCaughtError=r,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function Fj(e,t,n,a,l,r,i,o,c,d,f,h){return e=new hC(e,t,n,i,o,c,d,h),t=1,r===!0&&(t|=24),r=cn(3,null,null,t),e.current=r,r.stateNode=e,t=$m(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:a,isDehydrated:n,cache:t},zm(r),e}function Xj(e){return e?(e=Gl,e):Gl}function Kj(e,t,n,a,l,r){l=Xj(l),a.context===null?a.context=l:a.pendingContext=l,a=_a(t),a.payload={element:n},r=r===void 0?null:r,r!==null&&(a.callback=r),n=wa(e,a,t),n!==null&&(hn(n,e,t),gi(n,e,t))}function Bg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){Bg(e,t),(e=e.alternate)&&Bg(e,t)}function Qj(e){if(e.tag===13){var t=Cr(e,67108864);t!==null&&hn(t,e,67108864),ip(e,67108864)}}var ou=!0;function mC(e,t,n,a){var l=je.T;je.T=null;var r=Ue.p;try{Ue.p=2,op(e,t,n,a)}finally{Ue.p=r,je.T=l}}function pC(e,t,n,a){var l=je.T;je.T=null;var r=Ue.p;try{Ue.p=8,op(e,t,n,a)}finally{Ue.p=r,je.T=l}}function op(e,t,n,a){if(ou){var l=Lh(a);if(l===null)mf(e,t,a,cu,n),Hg(e,a);else if(gC(l,e,t,n,a))a.stopPropagation();else if(Hg(e,a),t&4&&-1<xC.indexOf(e)){for(;l!==null;){var r=Sr(l);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var i=Ya(r.pendingLanes);if(i!==0){var o=r;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var c=1<<31-dn(i);o.entanglements[1]|=c,i&=~c}_s(r),!(qe&6)&&(Jc=ps()+500,mo(0))}}break;case 13:o=Cr(r,2),o!==null&&hn(o,r,2),qu(),ip(r,2)}if(r=Lh(a),r===null&&mf(e,t,a,cu,n),r===l)break;l=r}l!==null&&a.stopPropagation()}else mf(e,t,a,null,n)}}function Lh(e){return e=Nm(e),cp(e)}var cu=null;function cp(e){if(cu=null,e=Ul(e),e!==null){var t=eo(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=jy(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 cu=e,null}function Zj(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(tS()){case ky:return 2;case Sy:return 8;case Lc:case nS:return 32;case Cy:return 268435456;default:return 32}default:return 32}}var Uh=!1,Sa=null,Ca=null,Ra=null,Hi=new Map,Ii=new Map,ma=[],xC="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 Hg(e,t){switch(e){case"focusin":case"focusout":Sa=null;break;case"dragenter":case"dragleave":Ca=null;break;case"mouseover":case"mouseout":Ra=null;break;case"pointerover":case"pointerout":Hi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ii.delete(t.pointerId)}}function Qr(e,t,n,a,l,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:r,targetContainers:[l]},t!==null&&(t=Sr(t),t!==null&&Qj(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function gC(e,t,n,a,l){switch(t){case"focusin":return Sa=Qr(Sa,e,t,n,a,l),!0;case"dragenter":return Ca=Qr(Ca,e,t,n,a,l),!0;case"mouseover":return Ra=Qr(Ra,e,t,n,a,l),!0;case"pointerover":var r=l.pointerId;return Hi.set(r,Qr(Hi.get(r)||null,e,t,n,a,l)),!0;case"gotpointercapture":return r=l.pointerId,Ii.set(r,Qr(Ii.get(r)||null,e,t,n,a,l)),!0}return!1}function Wj(e){var t=Ul(e.target);if(t!==null){var n=eo(t);if(n!==null){if(t=n.tag,t===13){if(t=jy(n),t!==null){e.blockedOn=t,uS(e.priority,function(){if(n.tag===13){var a=fn();a=bm(a);var l=Cr(n,a);l!==null&&hn(l,n,a),ip(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 Nc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Lh(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);th=a,n.target.dispatchEvent(a),th=null}else return t=Sr(n),t!==null&&Qj(t),e.blockedOn=n,!1;t.shift()}return!0}function Ig(e,t,n){Nc(e)&&n.delete(t)}function vC(){Uh=!1,Sa!==null&&Nc(Sa)&&(Sa=null),Ca!==null&&Nc(Ca)&&(Ca=null),Ra!==null&&Nc(Ra)&&(Ra=null),Hi.forEach(Ig),Ii.forEach(Ig)}function Fo(e,t){e.blockedOn===t&&(e.blockedOn=null,Uh||(Uh=!0,kt.unstable_scheduleCallback(kt.unstable_NormalPriority,vC)))}var Xo=null;function Pg(e){Xo!==e&&(Xo=e,kt.unstable_scheduleCallback(kt.unstable_NormalPriority,function(){Xo===e&&(Xo=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],l=e[t+2];if(typeof a!="function"){if(cp(a||n)===null)continue;break}var r=Sr(n);r!==null&&(e.splice(t,3),t-=3,gh(r,{pending:!0,data:l,method:n.method,action:a},a,l))}}))}function Pi(e){function t(c){return Fo(c,e)}Sa!==null&&Fo(Sa,e),Ca!==null&&Fo(Ca,e),Ra!==null&&Fo(Ra,e),Hi.forEach(t),Ii.forEach(t);for(var n=0;n<ma.length;n++){var a=ma[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<ma.length&&(n=ma[0],n.blockedOn===null);)Wj(n),n.blockedOn===null&&ma.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var l=n[a],r=n[a+1],i=l[Wt]||null;if(typeof r=="function")i||Pg(n);else if(i){var o=null;if(r&&r.hasAttribute("formAction")){if(l=r,i=r[Wt]||null)o=i.formAction;else if(cp(l)!==null)continue}else o=i.action;typeof o=="function"?n[a+1]=o:(n.splice(a,3),a-=3),Pg(n)}}}function up(e){this._internalRoot=e}Fu.prototype.render=up.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));var n=t.current,a=fn();Kj(n,a,e,t,null,null)};Fu.prototype.unmount=up.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Kj(e.current,2,null,e,null,null),qu(),t[kr]=null}};function Fu(e){this._internalRoot=e}Fu.prototype.unstable_scheduleHydration=function(e){if(e){var t=My();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ma.length&&t!==0&&t<ma[n].priority;n++);ma.splice(n,0,e),n===0&&Wj(e)}};var qg=yy.version;if(qg!=="19.1.0")throw Error(Q(527,qg,"19.1.0"));Ue.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=X1(t),e=e!==null?_y(e):null,e=e===null?null:e.stateNode,e};var yC={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:je,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ko=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ko.isDisabled&&Ko.supportsFiber)try{to=Ko.inject(yC),un=Ko}catch{}}Au.createRoot=function(e,t){if(!by(e))throw Error(Q(299));var n=!1,a="",l=Fb,r=Xb,i=Kb,o=null;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(l=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(o=t.unstable_transitionCallbacks)),t=Fj(e,1,!1,null,null,n,a,l,r,i,o,null),e[kr]=t.current,ap(e),new up(t)};Au.hydrateRoot=function(e,t,n){if(!by(e))throw Error(Q(299));var a=!1,l="",r=Fb,i=Xb,o=Kb,c=null,d=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=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=Fj(e,1,!0,t,n??null,a,l,r,i,o,c,d),t.context=Xj(null),n=t.current,a=fn(),a=bm(a),l=_a(a),l.callback=null,wa(n,l,a),n=a,t.current.lanes=n,so(t,n),_s(t),e[kr]=t.current,ap(e),new Fu(t)};Au.version="19.1.0";function Jj(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Jj)}catch(e){console.error(e)}}Jj(),hy.exports=Au;var bC=hy.exports;const e0=u.createContext(null);function t0({data:e,router:t,identity:n,notify:a,children:l}){return s.jsx(e0.Provider,{value:{data:e,router:t,identity:n,notify:a},children:l})}function Xu(){const e=u.useContext(e0);if(!e)throw new Error("A shared app page rendered outside AppUiProvider.");return e}const jC={success:()=>{},error:()=>{}},en=()=>Xu().data,Ve=()=>Xu().router,Ku=()=>Xu().identity,Ar=()=>Xu().notify??jC;function _C(){const{probe:e}=en(),{href:t,Link:n}=Ve(),a=Ku(),[l,r]=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&&r(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":l??"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 jC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_C=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),Gg=e=>{const t=_C(e);return t.charAt(0).toUpperCase()+t.slice(1)},e0=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),wC=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
54
+ */const wC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),NC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),Gg=e=>{const t=NC(e);return t.charAt(0).toUpperCase()+t.slice(1)},n0=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),kC=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 NC={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"};/**
59
+ */var SC={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 kC=u.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:l="",children:r,iconNode:i,...o},c)=>u.createElement("svg",{ref:c,...NC,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:e0("lucide",l),...!r&&!wC(o)&&{"aria-hidden":"true"},...o},[...i.map(([d,f])=>u.createElement(d,f)),...Array.isArray(r)?r:[r]]));/**
64
+ */const CC=u.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:l="",children:r,iconNode:i,...o},c)=>u.createElement("svg",{ref:c,...SC,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:n0("lucide",l),...!r&&!kC(o)&&{"aria-hidden":"true"},...o},[...i.map(([d,f])=>u.createElement(d,f)),...Array.isArray(r)?r:[r]]));/**
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 xe=(e,t)=>{const n=u.forwardRef(({className:a,...l},r)=>u.createElement(kC,{ref:r,iconNode:t,className:e0(`lucide-${jC(Gg(e))}`,`lucide-${e}`,a),...l}));return n.displayName=Gg(e),n};/**
69
+ */const xe=(e,t)=>{const n=u.forwardRef(({className:a,...l},r)=>u.createElement(CC,{ref:r,iconNode:t,className:n0(`lucide-${wC(Gg(e))}`,`lucide-${e}`,a),...l}));return n.displayName=Gg(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 SC=[["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"}]],CC=xe("archive-restore",SC);/**
74
+ */const RC=[["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"}]],TC=xe("archive-restore",RC);/**
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 TC=[["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"}]],Vg=xe("archive",TC);/**
79
+ */const EC=[["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"}]],Vg=xe("archive",EC);/**
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 RC=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],EC=xe("arrow-down",RC);/**
84
+ */const AC=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],MC=xe("arrow-down",AC);/**
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 AC=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],t0=xe("arrow-left",AC);/**
89
+ */const OC=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],s0=xe("arrow-left",OC);/**
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 MC=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],OC=xe("arrow-up",MC);/**
94
+ */const $C=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],DC=xe("arrow-up",$C);/**
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 $C=[["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"}]],dp=xe("bot",$C);/**
99
+ */const zC=[["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"}]],dp=xe("bot",zC);/**
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 DC=[["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"}]],zC=xe("briefcase",DC);/**
104
+ */const LC=[["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"}]],UC=xe("briefcase",LC);/**
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 LC=[["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"}]],UC=xe("building-2",LC);/**
109
+ */const BC=[["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"}]],HC=xe("building-2",BC);/**
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 BC=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Mr=xe("check",BC);/**
114
+ */const IC=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Mr=xe("check",IC);/**
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 HC=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],IC=xe("chevron-down",HC);/**
119
+ */const PC=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qC=xe("chevron-down",PC);/**
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 PC=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],n0=xe("chevron-right",PC);/**
124
+ */const GC=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],a0=xe("chevron-right",GC);/**
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 qC=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],GC=xe("chevron-up",qC);/**
129
+ */const VC=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],YC=xe("chevron-up",VC);/**
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 VC=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],s0=xe("chevrons-up-down",VC);/**
134
+ */const FC=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],l0=xe("chevrons-up-down",FC);/**
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 YC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],rt=xe("circle-alert",YC);/**
139
+ */const XC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],rt=xe("circle-alert",XC);/**
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 FC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Qu=xe("circle-check",FC);/**
144
+ */const KC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Qu=xe("circle-check",KC);/**
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 XC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],KC=xe("circle",XC);/**
149
+ */const QC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ZC=xe("circle",QC);/**
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 QC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],ZC=xe("clock",QC);/**
154
+ */const WC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],JC=xe("clock",WC);/**
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 WC=[["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"}]],JC=xe("copy",WC);/**
159
+ */const eR=[["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"}]],tR=xe("copy",eR);/**
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 eT=[["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"}]],fp=xe("ellipsis",eT);/**
164
+ */const nR=[["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"}]],fp=xe("ellipsis",nR);/**
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 tT=[["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"}]],nT=xe("eraser",tT);/**
169
+ */const sR=[["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"}]],aR=xe("eraser",sR);/**
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 sT=[["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"}]],go=xe("eye",sT);/**
174
+ */const lR=[["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"}]],go=xe("eye",lR);/**
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 aT=[["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"}]],a0=xe("folder-git-2",aT);/**
179
+ */const rR=[["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"}]],r0=xe("folder-git-2",rR);/**
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 lT=[["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"}]],rT=xe("folder-git",lT);/**
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"}]],oR=xe("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 iT=[["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"}]],oT=xe("git-fork",iT);/**
189
+ */const cR=[["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"}]],uR=xe("git-fork",cR);/**
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 cT=[["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"}]],uT=xe("hard-drive",cT);/**
194
+ */const dR=[["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=xe("hard-drive",dR);/**
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 dT=[["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"}]],fT=xe("history",dT);/**
199
+ */const hR=[["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"}]],mR=xe("history",hR);/**
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 hT=[["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"}]],mT=xe("house",hT);/**
204
+ */const pR=[["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"}]],xR=xe("house",pR);/**
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 pT=[["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"}]],xT=xe("inbox",pT);/**
209
+ */const gR=[["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"}]],vR=xe("inbox",gR);/**
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 gT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Ua=xe("info",gT);/**
214
+ */const yR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Ua=xe("info",yR);/**
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 vT=[["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"}]],yT=xe("laptop",vT);/**
219
+ */const bR=[["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"}]],jR=xe("laptop",bR);/**
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 bT=[["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"}]],jT=xe("life-buoy",bT);/**
224
+ */const _R=[["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"}]],wR=xe("life-buoy",_R);/**
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 _T=[["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"}]],l0=xe("list-checks",_T);/**
229
+ */const NR=[["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"}]],i0=xe("list-checks",NR);/**
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 wT=[["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"}]],r0=xe("list-ordered",wT);/**
234
+ */const kR=[["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"}]],o0=xe("list-ordered",kR);/**
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 NT=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],kT=xe("loader-circle",NT);/**
239
+ */const SR=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],CR=xe("loader-circle",SR);/**
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 ST=[["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"}]],CT=xe("lock",ST);/**
244
+ */const RR=[["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"}]],TR=xe("lock",RR);/**
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 TT=[["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"}]],RT=xe("messages-square",TT);/**
249
+ */const ER=[["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"}]],AR=xe("messages-square",ER);/**
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 ET=[["path",{d:"M5 12h14",key:"1ays0h"}]],AT=xe("minus",ET);/**
254
+ */const MR=[["path",{d:"M5 12h14",key:"1ays0h"}]],OR=xe("minus",MR);/**
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 MT=[["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"}]],OT=xe("network",MT);/**
259
+ */const $R=[["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"}]],DR=xe("network",$R);/**
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 $T=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],DT=xe("panel-left",$T);/**
264
+ */const zR=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],LR=xe("panel-left",zR);/**
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 zT=[["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"}]],i0=xe("pause",zT);/**
269
+ */const UR=[["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"}]],c0=xe("pause",UR);/**
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 LT=[["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"}]],Zu=xe("pencil",LT);/**
274
+ */const BR=[["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"}]],Zu=xe("pencil",BR);/**
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 UT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],yr=xe("plus",UT);/**
279
+ */const HR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],yr=xe("plus",HR);/**
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 BT=[["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"}]],vl=xe("refresh-cw",BT);/**
284
+ */const IR=[["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"}]],vl=xe("refresh-cw",IR);/**
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 HT=[["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"}]],IT=xe("rotate-ccw",HT);/**
289
+ */const PR=[["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"}]],qR=xe("rotate-ccw",PR);/**
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 PT=[["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"}]],Wu=xe("search-x",PT);/**
294
+ */const GR=[["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"}]],Wu=xe("search-x",GR);/**
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 qT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],GT=xe("search",qT);/**
299
+ */const VR=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],YR=xe("search",VR);/**
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 VT=[["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"}]],YT=xe("shield-alert",VT);/**
304
+ */const FR=[["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"}]],XR=xe("shield-alert",FR);/**
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 FT=[["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"}]],XT=xe("snowflake",FT);/**
309
+ */const KR=[["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"}]],QR=xe("snowflake",KR);/**
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 KT=[["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"}]],uu=xe("tag",KT);/**
314
+ */const ZR=[["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"}]],uu=xe("tag",ZR);/**
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 QT=[["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"}]],xn=xe("triangle-alert",QT);/**
319
+ */const WR=[["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"}]],xn=xe("triangle-alert",WR);/**
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 ZT=[["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"}]],WT=xe("user-check",ZT);/**
324
+ */const JR=[["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"}]],eT=xe("user-check",JR);/**
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 JT=[["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"}]],eR=xe("user-cog",JT);/**
329
+ */const tT=[["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"}]],nT=xe("user-cog",tT);/**
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 tR=[["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"}]],hp=xe("user",tR);/**
334
+ */const sT=[["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"}]],hp=xe("user",sT);/**
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 nR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ju=xe("x",nR),sR="Local only · this machine · not connected to SoftwareDLC",aR="Checking sync state…",lR="Sync state unknown",rR="Projects are the repositories this viewer reads on this machine. Nothing is shared unless you connect to SoftwareDLC.",ol="Details are in the terminal running sdlc viewer.",iR="How to fix it is in the terminal running sdlc viewer.",ed="Loading…",du="Not available";function oR(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 li(e){return(typeof e=="string"?new Date(e):e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const cR={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 o0(e,t){const n=t?` this list was read at ${li(t)}.`:"";if(e.reason==="store_locked"){const a=e.store?cR[e.store]:"a local store",l=e.since?` since ${li(e.since)}`:"";return`Another sdlc command has held ${a}${l};${n||" nothing was read yet."} ${ol}`}return e.status===0?`The viewer did not answer. Is sdlc viewer still running?${t?` This list was read at ${li(t)}.`:""}`:`The read failed.${t?` This list was read at ${li(t)}.`:""} ${ol}`}const uR=e=>e.status===409,dR={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 fR(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 l=e.folder?`the folder ${e.folder}`:"its folder";return{kind:"moved_member",cause:`This repository, ${t}, is not where ${l} 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?dR[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 Yg=["tasks","issues","releases"],mp=u.createContext(null);function vn(){const e=u.useContext(mp);if(!e)throw new Error("A shell page rendered outside the app shell.");return e}function hR(){var e;return(e=u.useContext(mp))==null?void 0:e.engine}const mR=10,pR=()=>new Date;function xR({shell:e,now:t=pR,children:n}){var L;const[a,l]=u.useState(null),[r,i]=u.useState(null),[o,c]=u.useState(null),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,j]=u.useState(!0),[v,y]=u.useState(!1),[g,p]=u.useState(void 0),[b,_]=u.useState(!1),[N,C]=u.useState(Yg),w=u.useRef(!1),k=u.useRef(!1),A=u.useRef(null),$=u.useRef(!0),X=u.useCallback(async(H=!1)=>{A.current&&clearTimeout(A.current),A.current=null,y(!0);const[R,T]=await Promise.all([e.organizations.list(),e.projects.list()]);if(!$.current)return;if(y(!1),j(!1),R.ok&&T.ok){if(w.current=!0,k.current=!1,m(null),f(t()),R.data.organizations.length===0){c("not_in_git"),l(null),i(null);return}c(null),l(R.data.organizations[0]),i(T.data.projects);return}const z=R.ok?T.ok?null:T.refusal:R.refusal;if(!z)return;if(uR(z)){k.current=!1,m(null),c(z),l(null),i(null);return}const S=w.current&&!k.current&&!H;k.current=!0;const O=z.retry_after??mR;m({refusal:z,shown:!S,retryInSeconds:S?O:null}),S&&(A.current=setTimeout(()=>void X(!0),O*1e3))},[e,t]);u.useEffect(()=>($.current=!0,X(),e.about.about().then(H=>{$.current&&(H.ok?p(H.data):H.refusal.status===404?p(null):_(!0))}),Promise.all(Yg.map(async H=>{var R;return[H,await((R=e[H])==null?void 0:R.access())]})).then(H=>{$.current&&C(H.filter(([,R])=>!(R!=null&&R.ok&&!R.data.can_view)).map(([R])=>R))}),()=>{$.current=!1,A.current&&clearTimeout(A.current)}),[e,X]);const Y={loading:x,org:a,projects:r,none:o,readAt:d,failure:h,about:g,aboutFailed:b,engine:(g==null?void 0:g.engine)===null?null:(L=g==null?void 0:g.engine)==null?void 0:L.source,domains:N,reading:v,refresh:()=>void X()};return s.jsx(mp.Provider,{value:Y,children:n})}const c0=e=>`The ${e} page is not part of this sdlc install`,Or="The sdlc engine here is too old for this page";function gR(e){return e==="checkout"?"Update the main checkout, then restart sdlc viewer.":"Update sdlc to its latest version, then restart sdlc viewer."}function Wn(){return gR(hR())}function u0(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(n=u0(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function d0(){for(var e,t,n=0,a="",l=arguments.length;n<l;n++)(e=arguments[n])&&(t=u0(e))&&(a&&(a+=" "),a+=t);return a}const Fg=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Xg=d0,vo=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return Xg(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:r}=t,i=Object.keys(l).map(d=>{const f=n==null?void 0:n[d],h=r==null?void 0:r[d];if(f===null)return null;const m=Fg(f)||Fg(h);return l[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(j=>{let[v,y]=j;return Array.isArray(y)?y.includes({...r,...o}[v]):{...r,...o}[v]===y})?[...d,h,m]:d},[]);return Xg(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},pp="-",vR=e=>{const t=bR(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i=>{const o=i.split(pp);return o[0]===""&&o.length!==1&&o.shift(),f0(o,t)||yR(i)},getConflictingClassGroupIds:(i,o)=>{const c=n[i]||[];return o&&a[i]?[...c,...a[i]]:c}}},f0=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],a=t.nextPart.get(n),l=a?f0(e.slice(1),a):void 0;if(l)return l;if(t.validators.length===0)return;const r=e.join(pp);return(i=t.validators.find(({validator:o})=>o(r)))==null?void 0:i.classGroupId},Kg=/^\[(.+)\]$/,yR=e=>{if(Kg.test(e)){const t=Kg.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},bR=e=>{const{theme:t,classGroups:n}=e,a={nextPart:new Map,validators:[]};for(const l in n)Bh(n[l],a,l,t);return a},Bh=(e,t,n,a)=>{e.forEach(l=>{if(typeof l=="string"){const r=l===""?t:Qg(t,l);r.classGroupId=n;return}if(typeof l=="function"){if(jR(l)){Bh(l(a),t,n,a);return}t.validators.push({validator:l,classGroupId:n});return}Object.entries(l).forEach(([r,i])=>{Bh(i,Qg(t,r),n,a)})})},Qg=(e,t)=>{let n=e;return t.split(pp).forEach(a=>{n.nextPart.has(a)||n.nextPart.set(a,{nextPart:new Map,validators:[]}),n=n.nextPart.get(a)}),n},jR=e=>e.isThemeGetter,_R=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,a=new Map;const l=(r,i)=>{n.set(r,i),t++,t>e&&(t=0,a=n,n=new Map)};return{get(r){let i=n.get(r);if(i!==void 0)return i;if((i=a.get(r))!==void 0)return l(r,i),i},set(r,i){n.has(r)?n.set(r,i):l(r,i)}}},Hh="!",Ih=":",wR=Ih.length,NR=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=l=>{const r=[];let i=0,o=0,c=0,d;for(let j=0;j<l.length;j++){let v=l[j];if(i===0&&o===0){if(v===Ih){r.push(l.slice(c,j)),c=j+wR;continue}if(v==="/"){d=j;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=r.length===0?l:l.substring(c),h=kR(f),m=h!==f,x=d&&d>c?d-c:void 0;return{modifiers:r,hasImportantModifier:m,baseClassName:h,maybePostfixModifierPosition:x}};if(t){const l=t+Ih,r=a;a=i=>i.startsWith(l)?r(i.substring(l.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const l=a;a=r=>n({className:r,parseClassName:l})}return a},kR=e=>e.endsWith(Hh)?e.substring(0,e.length-1):e.startsWith(Hh)?e.substring(1):e,SR=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const l=[];let r=[];return a.forEach(i=>{i[0]==="["||t[i]?(l.push(...r.sort(),i),r=[]):r.push(i)}),l.push(...r.sort()),l}},CR=e=>({cache:_R(e.cacheSize),parseClassName:NR(e),sortModifiers:SR(e),...vR(e)}),TR=/\s+/,RR=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:r}=t,i=[],o=e.trim().split(TR);let c="";for(let d=o.length-1;d>=0;d-=1){const f=o[d],{isExternal:h,modifiers:m,hasImportantModifier:x,baseClassName:j,maybePostfixModifierPosition:v}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let y=!!v,g=a(y?j.substring(0,v):j);if(!g){if(!y){c=f+(c.length>0?" "+c:c);continue}if(g=a(j),!g){c=f+(c.length>0?" "+c:c);continue}y=!1}const p=r(m).join(":"),b=x?p+Hh:p,_=b+g;if(i.includes(_))continue;i.push(_);const N=l(g,y);for(let C=0;C<N.length;++C){const w=N[C];i.push(b+w)}c=f+(c.length>0?" "+c:c)}return c};function ER(){let e=0,t,n,a="";for(;e<arguments.length;)(t=arguments[e++])&&(n=h0(t))&&(a&&(a+=" "),a+=n);return a}const h0=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=h0(e[a]))&&(n&&(n+=" "),n+=t);return n};function AR(e,...t){let n,a,l,r=i;function i(c){const d=t.reduce((f,h)=>h(f),e());return n=CR(d),a=n.cache.get,l=n.cache.set,r=o,o(c)}function o(c){const d=a(c);if(d)return d;const f=RR(c,n);return l(c,f),f}return function(){return r(ER.apply(null,arguments))}}const _t=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},m0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,p0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,MR=/^\d+\/\d+$/,OR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$R=/\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$/,DR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nl=e=>MR.test(e),Te=e=>!!e&&!Number.isNaN(Number(e)),aa=e=>!!e&&Number.isInteger(Number(e)),xf=e=>e.endsWith("%")&&Te(e.slice(0,-1)),$s=e=>OR.test(e),UR=()=>!0,BR=e=>$R.test(e)&&!DR.test(e),x0=()=>!1,HR=e=>zR.test(e),IR=e=>LR.test(e),PR=e=>!de(e)&&!fe(e),qR=e=>$r(e,y0,x0),de=e=>m0.test(e),Va=e=>$r(e,b0,BR),gf=e=>$r(e,XR,Te),Zg=e=>$r(e,g0,x0),GR=e=>$r(e,v0,IR),Qo=e=>$r(e,j0,HR),fe=e=>p0.test(e),Zr=e=>Dr(e,b0),VR=e=>Dr(e,KR),Wg=e=>Dr(e,g0),YR=e=>Dr(e,y0),FR=e=>Dr(e,v0),Zo=e=>Dr(e,j0,!0),$r=(e,t,n)=>{const a=m0.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Dr=(e,t,n=!1)=>{const a=p0.exec(e);return a?a[1]?t(a[1]):n:!1},g0=e=>e==="position"||e==="percentage",v0=e=>e==="image"||e==="url",y0=e=>e==="length"||e==="size"||e==="bg-size",b0=e=>e==="length",XR=e=>e==="number",KR=e=>e==="family-name",j0=e=>e==="shadow",QR=()=>{const e=_t("color"),t=_t("font"),n=_t("text"),a=_t("font-weight"),l=_t("tracking"),r=_t("leading"),i=_t("breakpoint"),o=_t("container"),c=_t("spacing"),d=_t("radius"),f=_t("shadow"),h=_t("inset-shadow"),m=_t("text-shadow"),x=_t("drop-shadow"),j=_t("blur"),v=_t("perspective"),y=_t("aspect"),g=_t("ease"),p=_t("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[..._(),fe,de],C=()=>["auto","hidden","clip","visible","scroll"],w=()=>["auto","contain","none"],k=()=>[fe,de,c],A=()=>[Nl,"full","auto",...k()],$=()=>[aa,"none","subgrid",fe,de],X=()=>["auto",{span:["full",aa,fe,de]},aa,fe,de],Y=()=>[aa,"auto",fe,de],L=()=>["auto","min","max","fr",fe,de],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],R=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...k()],z=()=>[Nl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],S=()=>[e,fe,de],O=()=>[..._(),Wg,Zg,{position:[fe,de]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],E=()=>["auto","cover","contain",YR,qR,{size:[fe,de]}],I=()=>[xf,Zr,Va],ne=()=>["","none","full",d,fe,de],ee=()=>["",Te,Zr,Va],ge=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>[Te,xf,Wg,Zg],V=()=>["","none",j,fe,de],ae=()=>["none",Te,fe,de],B=()=>["none",Te,fe,de],te=()=>[Te,fe,de],J=()=>[Nl,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$s],breakpoint:[$s],color:[UR],container:[$s],"drop-shadow":[$s],ease:["in","out","in-out"],font:[PR],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$s],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$s],shadow:[$s],spacing:["px",Te],text:[$s],"text-shadow":[$s],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nl,de,fe,y]}],container:["container"],columns:[{columns:[Te,de,fe,o]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:w()}],"overscroll-x":[{"overscroll-x":w()}],"overscroll-y":[{"overscroll-y":w()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[aa,"auto",fe,de]}],basis:[{basis:[Nl,"full","auto",o,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Te,Nl,"auto","initial","none",de]}],grow:[{grow:["",Te,fe,de]}],shrink:[{shrink:["",Te,fe,de]}],order:[{order:[aa,"first","last","none",fe,de]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:X()}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:X()}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...R(),"normal"]}],"justify-self":[{"justify-self":["auto",...R()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...R(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...R(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...R(),"baseline"]}],"place-self":[{"place-self":["auto",...R()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],w:[{w:[o,"screen",...z()]}],"min-w":[{"min-w":[o,"screen","none",...z()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",n,Zr,Va]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,fe,gf]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xf,de]}],"font-family":[{font:[VR,de,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:[l,fe,de]}],"line-clamp":[{"line-clamp":[Te,"none",fe,gf]}],leading:[{leading:[r,...k()]}],"list-image":[{"list-image":["none",fe,de]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",fe,de]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[Te,"from-font","auto",fe,Va]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[Te,"auto",fe,de]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe,de]}],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",fe,de]}],"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:Z()}],"bg-size":[{bg:E()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},aa,fe,de],radial:["",fe,de],conic:[aa,fe,de]},FR,GR]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Te,fe,de]}],"outline-w":[{outline:["",Te,Zr,Va]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",f,Zo,Qo]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",h,Zo,Qo]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[Te,Va]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",m,Zo,Qo]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[Te,fe,de]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"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":[Te]}],"mask-image-linear-from-pos":[{"mask-linear-from":M()}],"mask-image-linear-to-pos":[{"mask-linear-to":M()}],"mask-image-linear-from-color":[{"mask-linear-from":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"mask-image-t-from-pos":[{"mask-t-from":M()}],"mask-image-t-to-pos":[{"mask-t-to":M()}],"mask-image-t-from-color":[{"mask-t-from":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"mask-image-r-from-pos":[{"mask-r-from":M()}],"mask-image-r-to-pos":[{"mask-r-to":M()}],"mask-image-r-from-color":[{"mask-r-from":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"mask-image-b-from-pos":[{"mask-b-from":M()}],"mask-image-b-to-pos":[{"mask-b-to":M()}],"mask-image-b-from-color":[{"mask-b-from":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"mask-image-l-from-pos":[{"mask-l-from":M()}],"mask-image-l-to-pos":[{"mask-l-to":M()}],"mask-image-l-from-color":[{"mask-l-from":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"mask-image-x-from-pos":[{"mask-x-from":M()}],"mask-image-x-to-pos":[{"mask-x-to":M()}],"mask-image-x-from-color":[{"mask-x-from":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"mask-image-y-from-pos":[{"mask-y-from":M()}],"mask-image-y-to-pos":[{"mask-y-to":M()}],"mask-image-y-from-color":[{"mask-y-from":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[fe,de]}],"mask-image-radial-from-pos":[{"mask-radial-from":M()}],"mask-image-radial-to-pos":[{"mask-radial-to":M()}],"mask-image-radial-from-color":[{"mask-radial-from":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Te]}],"mask-image-conic-from-pos":[{"mask-conic-from":M()}],"mask-image-conic-to-pos":[{"mask-conic-to":M()}],"mask-image-conic-from-color":[{"mask-conic-from":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:E()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,de]}],filter:[{filter:["","none",fe,de]}],blur:[{blur:V()}],brightness:[{brightness:[Te,fe,de]}],contrast:[{contrast:[Te,fe,de]}],"drop-shadow":[{"drop-shadow":["","none",x,Zo,Qo]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",Te,fe,de]}],"hue-rotate":[{"hue-rotate":[Te,fe,de]}],invert:[{invert:["",Te,fe,de]}],saturate:[{saturate:[Te,fe,de]}],sepia:[{sepia:["",Te,fe,de]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,de]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[Te,fe,de]}],"backdrop-contrast":[{"backdrop-contrast":[Te,fe,de]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Te,fe,de]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Te,fe,de]}],"backdrop-invert":[{"backdrop-invert":["",Te,fe,de]}],"backdrop-opacity":[{"backdrop-opacity":[Te,fe,de]}],"backdrop-saturate":[{"backdrop-saturate":[Te,fe,de]}],"backdrop-sepia":[{"backdrop-sepia":["",Te,fe,de]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",fe,de]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Te,"initial",fe,de]}],ease:[{ease:["linear","initial",g,fe,de]}],delay:[{delay:[Te,fe,de]}],animate:[{animate:["none",p,fe,de]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,fe,de]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[fe,de,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:J()}],"translate-x":[{"translate-x":J()}],"translate-y":[{"translate-y":J()}],"translate-z":[{"translate-z":J()}],"translate-none":["translate-none"],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}],"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",fe,de]}],"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":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",fe,de]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[Te,Zr,Va,gf]}],stroke:[{stroke:["none",...S()]}],"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"]}},ZR=AR(QR);function ie(...e){return ZR(d0(e))}const WR=vo("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground *:data-[slot=alert-description]:text-muted-foreground",info:"border-info/40 bg-info/10 text-info",success:"border-success/40 bg-success/10 text-success",warning:"border-warning/40 bg-warning/10 text-warning",destructive:"border-destructive/40 bg-destructive/10 text-destructive"}},defaultVariants:{variant:"default"}});function me({className:e,variant:t,...n}){return s.jsx("div",{"data-slot":"alert",role:"alert",className:ie(WR({variant:t}),e),...n})}function ve({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 pe({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 ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(l){if(e==null||e(l),n===!1||!l.defaultPrevented)return t==null?void 0:t(l)}}function Jg(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function td(...e){return t=>{let n=!1;const a=e.map(l=>{const r=Jg(l,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let l=0;l<a.length;l++){const r=a[l];typeof r=="function"?r():Jg(e[l],null)}}}}function Ie(...e){return u.useCallback(td(...e),e)}function JR(e,t){const n=u.createContext(t),a=r=>{const{children:i,...o}=r,c=u.useMemo(()=>o,Object.values(o));return s.jsx(n.Provider,{value:c,children:i})};a.displayName=e+"Provider";function l(r){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}return[a,l]}function ws(e,t=[]){let n=[];function a(r,i){const o=u.createContext(i),c=n.length;n=[...n,i];const d=h=>{var g;const{scope:m,children:x,...j}=h,v=((g=m==null?void 0:m[e])==null?void 0:g[c])||o,y=u.useMemo(()=>j,Object.values(j));return s.jsx(v.Provider,{value:y,children:x})};d.displayName=r+"Provider";function f(h,m){var v;const x=((v=m==null?void 0:m[e])==null?void 0:v[c])||o,j=u.useContext(x);if(j)return j;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${r}\``)}return[d,f]}const l=()=>{const r=n.map(i=>u.createContext(i));return function(o){const c=(o==null?void 0:o[e])||r;return u.useMemo(()=>({[`__scope${e}`]:{...o,[e]:c}}),[o,c])}};return l.scopeName=e,[a,eE(l,...t)]}function eE(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(r){const i=a.reduce((o,{useScope:c,scopeName:d})=>{const h=c(r)[`__scope${d}`];return{...o,...h}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Pt=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},tE=uy[" useId ".trim().toString()]||(()=>{}),nE=0;function Vn(e){const[t,n]=u.useState(tE());return Pt(()=>{n(a=>a??String(nE++))},[e]),t?`radix-${t}`:""}var sE=uy[" useInsertionEffect ".trim().toString()]||Pt;function Oa({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[l,r,i]=aE({defaultProp:t,onChange:n}),o=e!==void 0,c=o?e:l;{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=lE(f)?f(e):f;m!==e&&((h=i.current)==null||h.call(i,m))}else r(f)},[o,e,r,i]);return[c,d]}function aE({defaultProp:e,onChange:t}){const[n,a]=u.useState(e),l=u.useRef(n),r=u.useRef(t);return sE(()=>{r.current=t},[t]),u.useEffect(()=>{var i;l.current!==n&&((i=r.current)==null||i.call(r,n),l.current=n)},[n,l]),[n,a,r]}function lE(e){return typeof e=="function"}function cl(e){const t=iE(e),n=u.forwardRef((a,l)=>{const{children:r,...i}=a,o=u.Children.toArray(r),c=o.find(cE);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:l,children:u.isValidElement(d)?u.cloneElement(d,void 0,f):null})}return s.jsx(t,{...i,ref:l,children:r})});return n.displayName=`${e}.Slot`,n}var rE=cl("Slot");function iE(e){const t=u.forwardRef((n,a)=>{const{children:l,...r}=n;if(u.isValidElement(l)){const i=dE(l),o=uE(r,l.props);return l.type!==u.Fragment&&(o.ref=a?td(a,i):i),u.cloneElement(l,o)}return u.Children.count(l)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _0=Symbol("radix.slottable");function oE(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=_0,t}function cE(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_0}function uE(e,t){const n={...t};for(const a in t){const l=e[a],r=t[a];/^on[A-Z]/.test(a)?l&&r?n[a]=(...o)=>{const c=r(...o);return l(...o),c}:l&&(n[a]=l):a==="style"?n[a]={...l,...r}:a==="className"&&(n[a]=[l,r].filter(Boolean).join(" "))}return{...e,...n}}function dE(e){var a,l;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=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=fE.reduce((e,t)=>{const n=cl(`Primitive.${t}`),a=u.forwardRef((l,r)=>{const{asChild:i,...o}=l,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...o,ref:r})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function w0(e,t){e&&Nr.flushSync(()=>e.dispatchEvent(t))}function ys(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 hE(e,t=globalThis==null?void 0:globalThis.document){const n=ys(e);u.useEffect(()=>{const a=l=>{l.key==="Escape"&&n(l)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var mE="DismissableLayer",Ph="dismissableLayer.update",pE="dismissableLayer.pointerDownOutside",xE="dismissableLayer.focusOutside",ev,N0=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yo=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:r,onInteractOutside:i,onDismiss:o,...c}=e,d=u.useContext(N0),[f,h]=u.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=u.useState({}),j=Ie(t,w=>h(w)),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(y),p=f?v.indexOf(f):-1,b=d.layersWithOutsidePointerEventsDisabled.size>0,_=p>=g,N=yE(w=>{const k=w.target,A=[...d.branches].some($=>$.contains(k));!_||A||(l==null||l(w),i==null||i(w),w.defaultPrevented||o==null||o())},m),C=bE(w=>{const k=w.target;[...d.branches].some($=>$.contains(k))||(r==null||r(w),i==null||i(w),w.defaultPrevented||o==null||o())},m);return hE(w=>{p===d.layers.size-1&&(a==null||a(w),!w.defaultPrevented&&o&&(w.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),tv(),()=>{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),tv())},[f,d]),u.useEffect(()=>{const w=()=>x({});return document.addEventListener(Ph,w),()=>document.removeEventListener(Ph,w)},[]),s.jsx(we.div,{...c,ref:j,style:{pointerEvents:b?_?"auto":"none":void 0,...e.style},onFocusCapture:ce(e.onFocusCapture,C.onFocusCapture),onBlurCapture:ce(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:ce(e.onPointerDownCapture,N.onPointerDownCapture)})});yo.displayName=mE;var gE="DismissableLayerBranch",vE=u.forwardRef((e,t)=>{const n=u.useContext(N0),a=u.useRef(null),l=Ie(t,a);return u.useEffect(()=>{const r=a.current;if(r)return n.branches.add(r),()=>{n.branches.delete(r)}},[n.branches]),s.jsx(we.div,{...e,ref:l})});vE.displayName=gE;function yE(e,t=globalThis==null?void 0:globalThis.document){const n=ys(e),a=u.useRef(!1),l=u.useRef(()=>{});return u.useEffect(()=>{const r=o=>{if(o.target&&!a.current){let c=function(){k0(pE,n,d,{discrete:!0})};const d={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",l.current),l.current=c,t.addEventListener("click",l.current,{once:!0})):c()}else t.removeEventListener("click",l.current);a.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",r)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",r),t.removeEventListener("click",l.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function bE(e,t=globalThis==null?void 0:globalThis.document){const n=ys(e),a=u.useRef(!1);return u.useEffect(()=>{const l=r=>{r.target&&!a.current&&k0(xE,n,{originalEvent:r},{discrete:!1})};return t.addEventListener("focusin",l),()=>t.removeEventListener("focusin",l)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function tv(){const e=new CustomEvent(Ph);document.dispatchEvent(e)}function k0(e,t,n,{discrete:a}){const l=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&l.addEventListener(e,t,{once:!0}),a?w0(l,r):l.dispatchEvent(r)}var vf="focusScope.autoFocusOnMount",yf="focusScope.autoFocusOnUnmount",nv={bubbles:!1,cancelable:!0},jE="FocusScope",nd=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:l,onUnmountAutoFocus:r,...i}=e,[o,c]=u.useState(null),d=ys(l),f=ys(r),h=u.useRef(null),m=Ie(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(b){if(x.paused||!o)return;const _=b.target;o.contains(_)?h.current=_:oa(h.current,{select:!0})},y=function(b){if(x.paused||!o)return;const _=b.relatedTarget;_!==null&&(o.contains(_)||oa(h.current,{select:!0}))},g=function(b){if(document.activeElement===document.body)for(const N of b)N.removedNodes.length>0&&oa(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){av.add(x);const v=document.activeElement;if(!o.contains(v)){const g=new CustomEvent(vf,nv);o.addEventListener(vf,d),o.dispatchEvent(g),g.defaultPrevented||(_E(CE(S0(o)),{select:!0}),document.activeElement===v&&oa(o))}return()=>{o.removeEventListener(vf,d),setTimeout(()=>{const g=new CustomEvent(yf,nv);o.addEventListener(yf,f),o.dispatchEvent(g),g.defaultPrevented||oa(v??document.body,{select:!0}),o.removeEventListener(yf,f),av.remove(x)},0)}}},[o,d,f,x]);const j=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,[b,_]=wE(p);b&&_?!v.shiftKey&&g===_?(v.preventDefault(),n&&oa(b,{select:!0})):v.shiftKey&&g===b&&(v.preventDefault(),n&&oa(_,{select:!0})):g===p&&v.preventDefault()}},[n,a,x.paused]);return s.jsx(we.div,{tabIndex:-1,...i,ref:m,onKeyDown:j})});nd.displayName=jE;function _E(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(oa(a,{select:t}),document.activeElement!==n)return}function wE(e){const t=S0(e),n=sv(t,e),a=sv(t.reverse(),e);return[n,a]}function S0(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const l=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||l?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function sv(e,t){for(const n of e)if(!NE(n,{upTo:t}))return n}function NE(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 kE(e){return e instanceof HTMLInputElement&&"select"in e}function oa(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&kE(e)&&t&&e.select()}}var av=SE();function SE(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=lv(e,t),e.unshift(t)},remove(t){var n;e=lv(e,t),(n=e[0])==null||n.resume()}}}function lv(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function CE(e){return e.filter(t=>t.tagName!=="A")}var TE="Portal",bo=u.forwardRef((e,t)=>{var o;const{container:n,...a}=e,[l,r]=u.useState(!1);Pt(()=>r(!0),[]);const i=n||l&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return i?G1.createPortal(s.jsx(we.div,{...a,ref:t}),i):null});bo.displayName=TE;function RE(e,t){return u.useReducer((n,a)=>t[n][a]??n,e)}var $n=e=>{const{present:t,children:n}=e,a=EE(t),l=typeof n=="function"?n({present:a.isPresent}):u.Children.only(n),r=Ie(a.ref,AE(l));return typeof n=="function"||a.isPresent?u.cloneElement(l,{ref:r}):null};$n.displayName="Presence";function EE(e){const[t,n]=u.useState(),a=u.useRef(null),l=u.useRef(e),r=u.useRef("none"),i=e?"mounted":"unmounted",[o,c]=RE(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=Wo(a.current);r.current=o==="mounted"?d:"none"},[o]),Pt(()=>{const d=a.current,f=l.current;if(f!==e){const m=r.current,x=Wo(d);e?c("MOUNT"):x==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==x?"ANIMATION_OUT":"UNMOUNT"),l.current=e}},[e,c]),Pt(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=x=>{const v=Wo(a.current).includes(x.animationName);if(x.target===t&&v&&(c("ANIMATION_END"),!l.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&&(r.current=Wo(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 Wo(e){return(e==null?void 0:e.animationName)||"none"}function AE(e){var a,l;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=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bf=0;function xp(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rv()),document.body.insertAdjacentElement("beforeend",e[1]??rv()),bf++,()=>{bf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),bf--}},[])}function rv(){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 cs=function(){return cs=Object.assign||function(t){for(var n,a=1,l=arguments.length;a<l;a++){n=arguments[a];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cs.apply(this,arguments)};function C0(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 l=0,a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(n[a[l]]=e[a[l]]);return n}function ME(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,r;a<l;a++)(r||!(a in t))&&(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}var kc="right-scroll-bar-position",Sc="width-before-scroll-bar",OE="with-scroll-bars-hidden",$E="--removed-body-scroll-bar-size";function jf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function DE(e,t){var n=u.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var l=n.value;l!==a&&(n.value=a,n.callback(a,l))}}}})[0];return n.callback=t,n.facade}var zE=typeof window<"u"?u.useLayoutEffect:u.useEffect,iv=new WeakMap;function LE(e,t){var n=DE(null,function(a){return e.forEach(function(l){return jf(l,a)})});return zE(function(){var a=iv.get(n);if(a){var l=new Set(a),r=new Set(e),i=n.current;l.forEach(function(o){r.has(o)||jf(o,null)}),r.forEach(function(o){l.has(o)||jf(o,i)})}iv.set(n,e)},[e]),n}function UE(e){return e}function BE(e,t){t===void 0&&(t=UE);var n=[],a=!1,l={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(r){var i=t(r,a);return n.push(i),function(){n=n.filter(function(o){return o!==i})}},assignSyncMedium:function(r){for(a=!0;n.length;){var i=n;n=[],i.forEach(r)}n={push:function(o){return r(o)},filter:function(){return n}}},assignMedium:function(r){a=!0;var i=[];if(n.length){var o=n;n=[],o.forEach(r),i=n}var c=function(){var f=i;i=[],f.forEach(r)},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 l}function HE(e){e===void 0&&(e={});var t=BE(null);return t.options=cs({async:!0,ssr:!1},e),t}var T0=function(e){var t=e.sideCar,n=C0(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,cs({},n))};T0.isSideCarExport=!0;function IE(e,t){return e.useMedium(t),T0}var R0=HE(),_f=function(){},sd=u.forwardRef(function(e,t){var n=u.useRef(null),a=u.useState({onScrollCapture:_f,onWheelCapture:_f,onTouchMoveCapture:_f}),l=a[0],r=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,j=e.noIsolation,v=e.inert,y=e.allowPinchZoom,g=e.as,p=g===void 0?"div":g,b=e.gapMode,_=C0(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,C=LE([n,t]),w=cs(cs({},_),l);return u.createElement(u.Fragment,null,f&&u.createElement(N,{sideCar:R0,removeScrollBar:d,shards:h,noRelative:x,noIsolation:j,inert:v,setCallbacks:r,allowPinchZoom:!!y,lockRef:n,gapMode:b}),i?u.cloneElement(u.Children.only(o),cs(cs({},w),{ref:C})):u.createElement(p,cs({},w,{className:c,ref:C}),o))});sd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};sd.classNames={fullWidth:Sc,zeroRight:kc};var PE=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qE(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=PE();return t&&e.setAttribute("nonce",t),e}function GE(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function VE(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var YE=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qE())&&(GE(t,n),VE(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},FE=function(){var e=YE();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},E0=function(){var e=FE(),t=function(n){var a=n.styles,l=n.dynamic;return e(a,l),null};return t},XE={left:0,top:0,right:0,gap:0},wf=function(e){return parseInt(e||"",10)||0},KE=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],l=t[e==="padding"?"paddingRight":"marginRight"];return[wf(n),wf(a),wf(l)]},QE=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return XE;var t=KE(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])}},ZE=E0(),sr="data-scroll-locked",WE=function(e,t,n,a){var l=e.left,r=e.top,i=e.right,o=e.gap;return n===void 0&&(n="margin"),`
340
- .`.concat(OE,` {
339
+ */const aT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ju=xe("x",aT),lT="Local only · this machine · not connected to SoftwareDLC",rT="Checking sync state…",iT="Sync state unknown",oT="Projects are the repositories this viewer reads on this machine. Nothing is shared unless you connect to SoftwareDLC.",ol="Details are in the terminal running sdlc viewer.",cT="How to fix it is in the terminal running sdlc viewer.",ed="Loading…",du="Not available";function uT(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 li(e){return(typeof e=="string"?new Date(e):e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const dT={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 u0(e,t){const n=t?` this list was read at ${li(t)}.`:"";if(e.reason==="store_locked"){const a=e.store?dT[e.store]:"a local store",l=e.since?` since ${li(e.since)}`:"";return`Another sdlc command has held ${a}${l};${n||" nothing was read yet."} ${ol}`}return e.status===0?`The viewer did not answer. Is sdlc viewer still running?${t?` This list was read at ${li(t)}.`:""}`:`The read failed.${t?` This list was read at ${li(t)}.`:""} ${ol}`}const fT=e=>e.status===409,hT={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 mT(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 l=e.folder?`the folder ${e.folder}`:"its folder";return{kind:"moved_member",cause:`This repository, ${t}, is not where ${l} 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?hT[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 Yg=["tasks","issues","releases"],mp=u.createContext(null);function vn(){const e=u.useContext(mp);if(!e)throw new Error("A shell page rendered outside the app shell.");return e}function pT(){var e;return(e=u.useContext(mp))==null?void 0:e.engine}const xT=10,gT=()=>new Date;function vT({shell:e,now:t=gT,children:n}){var L;const[a,l]=u.useState(null),[r,i]=u.useState(null),[o,c]=u.useState(null),[d,f]=u.useState(null),[h,m]=u.useState(null),[g,j]=u.useState(!0),[v,y]=u.useState(!1),[x,p]=u.useState(void 0),[b,_]=u.useState(!1),[N,C]=u.useState(Yg),w=u.useRef(!1),k=u.useRef(!1),A=u.useRef(null),$=u.useRef(!0),X=u.useCallback(async(H=!1)=>{A.current&&clearTimeout(A.current),A.current=null,y(!0);const[T,R]=await Promise.all([e.organizations.list(),e.projects.list()]);if(!$.current)return;if(y(!1),j(!1),T.ok&&R.ok){if(w.current=!0,k.current=!1,m(null),f(t()),T.data.organizations.length===0){c("not_in_git"),l(null),i(null);return}c(null),l(T.data.organizations[0]),i(R.data.projects);return}const z=T.ok?R.ok?null:R.refusal:T.refusal;if(!z)return;if(fT(z)){k.current=!1,m(null),c(z),l(null),i(null);return}const S=w.current&&!k.current&&!H;k.current=!0;const O=z.retry_after??xT;m({refusal:z,shown:!S,retryInSeconds:S?O:null}),S&&(A.current=setTimeout(()=>void X(!0),O*1e3))},[e,t]);u.useEffect(()=>($.current=!0,X(),e.about.about().then(H=>{$.current&&(H.ok?p(H.data):H.refusal.status===404?p(null):_(!0))}),Promise.all(Yg.map(async H=>{var T;return[H,await((T=e[H])==null?void 0:T.access())]})).then(H=>{$.current&&C(H.filter(([,T])=>!(T!=null&&T.ok&&!T.data.can_view)).map(([T])=>T))}),()=>{$.current=!1,A.current&&clearTimeout(A.current)}),[e,X]);const Y={loading:g,org:a,projects:r,none:o,readAt:d,failure:h,about:x,aboutFailed:b,engine:(x==null?void 0:x.engine)===null?null:(L=x==null?void 0:x.engine)==null?void 0:L.source,domains:N,reading:v,refresh:()=>void X()};return s.jsx(mp.Provider,{value:Y,children:n})}const d0=e=>`The ${e} page is not part of this sdlc install`,Or="The sdlc engine here is too old for this page";function yT(e){return e==="checkout"?"Update the main checkout, then restart sdlc viewer.":"Update sdlc to its latest version, then restart sdlc viewer."}function Wn(){return yT(pT())}function f0(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(n=f0(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function h0(){for(var e,t,n=0,a="",l=arguments.length;n<l;n++)(e=arguments[n])&&(t=f0(e))&&(a&&(a+=" "),a+=t);return a}const Fg=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Xg=h0,vo=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return Xg(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:r}=t,i=Object.keys(l).map(d=>{const f=n==null?void 0:n[d],h=r==null?void 0:r[d];if(f===null)return null;const m=Fg(f)||Fg(h);return l[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,...g}=f;return Object.entries(g).every(j=>{let[v,y]=j;return Array.isArray(y)?y.includes({...r,...o}[v]):{...r,...o}[v]===y})?[...d,h,m]:d},[]);return Xg(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},pp="-",bT=e=>{const t=_T(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i=>{const o=i.split(pp);return o[0]===""&&o.length!==1&&o.shift(),m0(o,t)||jT(i)},getConflictingClassGroupIds:(i,o)=>{const c=n[i]||[];return o&&a[i]?[...c,...a[i]]:c}}},m0=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],a=t.nextPart.get(n),l=a?m0(e.slice(1),a):void 0;if(l)return l;if(t.validators.length===0)return;const r=e.join(pp);return(i=t.validators.find(({validator:o})=>o(r)))==null?void 0:i.classGroupId},Kg=/^\[(.+)\]$/,jT=e=>{if(Kg.test(e)){const t=Kg.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},_T=e=>{const{theme:t,classGroups:n}=e,a={nextPart:new Map,validators:[]};for(const l in n)Bh(n[l],a,l,t);return a},Bh=(e,t,n,a)=>{e.forEach(l=>{if(typeof l=="string"){const r=l===""?t:Qg(t,l);r.classGroupId=n;return}if(typeof l=="function"){if(wT(l)){Bh(l(a),t,n,a);return}t.validators.push({validator:l,classGroupId:n});return}Object.entries(l).forEach(([r,i])=>{Bh(i,Qg(t,r),n,a)})})},Qg=(e,t)=>{let n=e;return t.split(pp).forEach(a=>{n.nextPart.has(a)||n.nextPart.set(a,{nextPart:new Map,validators:[]}),n=n.nextPart.get(a)}),n},wT=e=>e.isThemeGetter,NT=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,a=new Map;const l=(r,i)=>{n.set(r,i),t++,t>e&&(t=0,a=n,n=new Map)};return{get(r){let i=n.get(r);if(i!==void 0)return i;if((i=a.get(r))!==void 0)return l(r,i),i},set(r,i){n.has(r)?n.set(r,i):l(r,i)}}},Hh="!",Ih=":",kT=Ih.length,ST=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=l=>{const r=[];let i=0,o=0,c=0,d;for(let j=0;j<l.length;j++){let v=l[j];if(i===0&&o===0){if(v===Ih){r.push(l.slice(c,j)),c=j+kT;continue}if(v==="/"){d=j;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=r.length===0?l:l.substring(c),h=CT(f),m=h!==f,g=d&&d>c?d-c:void 0;return{modifiers:r,hasImportantModifier:m,baseClassName:h,maybePostfixModifierPosition:g}};if(t){const l=t+Ih,r=a;a=i=>i.startsWith(l)?r(i.substring(l.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const l=a;a=r=>n({className:r,parseClassName:l})}return a},CT=e=>e.endsWith(Hh)?e.substring(0,e.length-1):e.startsWith(Hh)?e.substring(1):e,RT=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const l=[];let r=[];return a.forEach(i=>{i[0]==="["||t[i]?(l.push(...r.sort(),i),r=[]):r.push(i)}),l.push(...r.sort()),l}},TT=e=>({cache:NT(e.cacheSize),parseClassName:ST(e),sortModifiers:RT(e),...bT(e)}),ET=/\s+/,AT=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:r}=t,i=[],o=e.trim().split(ET);let c="";for(let d=o.length-1;d>=0;d-=1){const f=o[d],{isExternal:h,modifiers:m,hasImportantModifier:g,baseClassName:j,maybePostfixModifierPosition:v}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let y=!!v,x=a(y?j.substring(0,v):j);if(!x){if(!y){c=f+(c.length>0?" "+c:c);continue}if(x=a(j),!x){c=f+(c.length>0?" "+c:c);continue}y=!1}const p=r(m).join(":"),b=g?p+Hh:p,_=b+x;if(i.includes(_))continue;i.push(_);const N=l(x,y);for(let C=0;C<N.length;++C){const w=N[C];i.push(b+w)}c=f+(c.length>0?" "+c:c)}return c};function MT(){let e=0,t,n,a="";for(;e<arguments.length;)(t=arguments[e++])&&(n=p0(t))&&(a&&(a+=" "),a+=n);return a}const p0=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=p0(e[a]))&&(n&&(n+=" "),n+=t);return n};function OT(e,...t){let n,a,l,r=i;function i(c){const d=t.reduce((f,h)=>h(f),e());return n=TT(d),a=n.cache.get,l=n.cache.set,r=o,o(c)}function o(c){const d=a(c);if(d)return d;const f=AT(c,n);return l(c,f),f}return function(){return r(MT.apply(null,arguments))}}const _t=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},x0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,g0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,$T=/^\d+\/\d+$/,DT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zT=/\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$/,LT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,UT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,BT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nl=e=>$T.test(e),Re=e=>!!e&&!Number.isNaN(Number(e)),aa=e=>!!e&&Number.isInteger(Number(e)),xf=e=>e.endsWith("%")&&Re(e.slice(0,-1)),$s=e=>DT.test(e),HT=()=>!0,IT=e=>zT.test(e)&&!LT.test(e),v0=()=>!1,PT=e=>UT.test(e),qT=e=>BT.test(e),GT=e=>!de(e)&&!fe(e),VT=e=>$r(e,j0,v0),de=e=>x0.test(e),Va=e=>$r(e,_0,IT),gf=e=>$r(e,QT,Re),Zg=e=>$r(e,y0,v0),YT=e=>$r(e,b0,qT),Qo=e=>$r(e,w0,PT),fe=e=>g0.test(e),Zr=e=>Dr(e,_0),FT=e=>Dr(e,ZT),Wg=e=>Dr(e,y0),XT=e=>Dr(e,j0),KT=e=>Dr(e,b0),Zo=e=>Dr(e,w0,!0),$r=(e,t,n)=>{const a=x0.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Dr=(e,t,n=!1)=>{const a=g0.exec(e);return a?a[1]?t(a[1]):n:!1},y0=e=>e==="position"||e==="percentage",b0=e=>e==="image"||e==="url",j0=e=>e==="length"||e==="size"||e==="bg-size",_0=e=>e==="length",QT=e=>e==="number",ZT=e=>e==="family-name",w0=e=>e==="shadow",WT=()=>{const e=_t("color"),t=_t("font"),n=_t("text"),a=_t("font-weight"),l=_t("tracking"),r=_t("leading"),i=_t("breakpoint"),o=_t("container"),c=_t("spacing"),d=_t("radius"),f=_t("shadow"),h=_t("inset-shadow"),m=_t("text-shadow"),g=_t("drop-shadow"),j=_t("blur"),v=_t("perspective"),y=_t("aspect"),x=_t("ease"),p=_t("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[..._(),fe,de],C=()=>["auto","hidden","clip","visible","scroll"],w=()=>["auto","contain","none"],k=()=>[fe,de,c],A=()=>[Nl,"full","auto",...k()],$=()=>[aa,"none","subgrid",fe,de],X=()=>["auto",{span:["full",aa,fe,de]},aa,fe,de],Y=()=>[aa,"auto",fe,de],L=()=>["auto","min","max","fr",fe,de],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],T=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...k()],z=()=>[Nl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],S=()=>[e,fe,de],O=()=>[..._(),Wg,Zg,{position:[fe,de]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],E=()=>["auto","cover","contain",XT,VT,{size:[fe,de]}],I=()=>[xf,Zr,Va],ne=()=>["","none","full",d,fe,de],ee=()=>["",Re,Zr,Va],ge=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>[Re,xf,Wg,Zg],V=()=>["","none",j,fe,de],ae=()=>["none",Re,fe,de],B=()=>["none",Re,fe,de],te=()=>[Re,fe,de],J=()=>[Nl,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$s],breakpoint:[$s],color:[HT],container:[$s],"drop-shadow":[$s],ease:["in","out","in-out"],font:[GT],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$s],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$s],shadow:[$s],spacing:["px",Re],text:[$s],"text-shadow":[$s],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nl,de,fe,y]}],container:["container"],columns:[{columns:[Re,de,fe,o]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:w()}],"overscroll-x":[{"overscroll-x":w()}],"overscroll-y":[{"overscroll-y":w()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[aa,"auto",fe,de]}],basis:[{basis:[Nl,"full","auto",o,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Re,Nl,"auto","initial","none",de]}],grow:[{grow:["",Re,fe,de]}],shrink:[{shrink:["",Re,fe,de]}],order:[{order:[aa,"first","last","none",fe,de]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:X()}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:X()}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...T(),"normal"]}],"justify-self":[{"justify-self":["auto",...T()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...T(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...T(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...T(),"baseline"]}],"place-self":[{"place-self":["auto",...T()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],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":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],w:[{w:[o,"screen",...z()]}],"min-w":[{"min-w":[o,"screen","none",...z()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",n,Zr,Va]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,fe,gf]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xf,de]}],"font-family":[{font:[FT,de,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:[l,fe,de]}],"line-clamp":[{"line-clamp":[Re,"none",fe,gf]}],leading:[{leading:[r,...k()]}],"list-image":[{"list-image":["none",fe,de]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",fe,de]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[Re,"from-font","auto",fe,Va]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[Re,"auto",fe,de]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe,de]}],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",fe,de]}],"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:Z()}],"bg-size":[{bg:E()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},aa,fe,de],radial:["",fe,de],conic:[aa,fe,de]},KT,YT]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Re,fe,de]}],"outline-w":[{outline:["",Re,Zr,Va]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",f,Zo,Qo]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",h,Zo,Qo]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[Re,Va]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",m,Zo,Qo]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[Re,fe,de]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"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":[Re]}],"mask-image-linear-from-pos":[{"mask-linear-from":M()}],"mask-image-linear-to-pos":[{"mask-linear-to":M()}],"mask-image-linear-from-color":[{"mask-linear-from":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"mask-image-t-from-pos":[{"mask-t-from":M()}],"mask-image-t-to-pos":[{"mask-t-to":M()}],"mask-image-t-from-color":[{"mask-t-from":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"mask-image-r-from-pos":[{"mask-r-from":M()}],"mask-image-r-to-pos":[{"mask-r-to":M()}],"mask-image-r-from-color":[{"mask-r-from":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"mask-image-b-from-pos":[{"mask-b-from":M()}],"mask-image-b-to-pos":[{"mask-b-to":M()}],"mask-image-b-from-color":[{"mask-b-from":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"mask-image-l-from-pos":[{"mask-l-from":M()}],"mask-image-l-to-pos":[{"mask-l-to":M()}],"mask-image-l-from-color":[{"mask-l-from":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"mask-image-x-from-pos":[{"mask-x-from":M()}],"mask-image-x-to-pos":[{"mask-x-to":M()}],"mask-image-x-from-color":[{"mask-x-from":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"mask-image-y-from-pos":[{"mask-y-from":M()}],"mask-image-y-to-pos":[{"mask-y-to":M()}],"mask-image-y-from-color":[{"mask-y-from":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[fe,de]}],"mask-image-radial-from-pos":[{"mask-radial-from":M()}],"mask-image-radial-to-pos":[{"mask-radial-to":M()}],"mask-image-radial-from-color":[{"mask-radial-from":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Re]}],"mask-image-conic-from-pos":[{"mask-conic-from":M()}],"mask-image-conic-to-pos":[{"mask-conic-to":M()}],"mask-image-conic-from-color":[{"mask-conic-from":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:E()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,de]}],filter:[{filter:["","none",fe,de]}],blur:[{blur:V()}],brightness:[{brightness:[Re,fe,de]}],contrast:[{contrast:[Re,fe,de]}],"drop-shadow":[{"drop-shadow":["","none",g,Zo,Qo]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",Re,fe,de]}],"hue-rotate":[{"hue-rotate":[Re,fe,de]}],invert:[{invert:["",Re,fe,de]}],saturate:[{saturate:[Re,fe,de]}],sepia:[{sepia:["",Re,fe,de]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,de]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[Re,fe,de]}],"backdrop-contrast":[{"backdrop-contrast":[Re,fe,de]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Re,fe,de]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Re,fe,de]}],"backdrop-invert":[{"backdrop-invert":["",Re,fe,de]}],"backdrop-opacity":[{"backdrop-opacity":[Re,fe,de]}],"backdrop-saturate":[{"backdrop-saturate":[Re,fe,de]}],"backdrop-sepia":[{"backdrop-sepia":["",Re,fe,de]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",fe,de]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Re,"initial",fe,de]}],ease:[{ease:["linear","initial",x,fe,de]}],delay:[{delay:[Re,fe,de]}],animate:[{animate:["none",p,fe,de]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,fe,de]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[fe,de,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:J()}],"translate-x":[{"translate-x":J()}],"translate-y":[{"translate-y":J()}],"translate-z":[{"translate-z":J()}],"translate-none":["translate-none"],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}],"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",fe,de]}],"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":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",fe,de]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[Re,Zr,Va,gf]}],stroke:[{stroke:["none",...S()]}],"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"]}},JT=OT(WT);function ie(...e){return JT(h0(e))}const eE=vo("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground *:data-[slot=alert-description]:text-muted-foreground",info:"border-info/40 bg-info/10 text-info",success:"border-success/40 bg-success/10 text-success",warning:"border-warning/40 bg-warning/10 text-warning",destructive:"border-destructive/40 bg-destructive/10 text-destructive"}},defaultVariants:{variant:"default"}});function me({className:e,variant:t,...n}){return s.jsx("div",{"data-slot":"alert",role:"alert",className:ie(eE({variant:t}),e),...n})}function ve({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 pe({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 ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(l){if(e==null||e(l),n===!1||!l.defaultPrevented)return t==null?void 0:t(l)}}function Jg(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function td(...e){return t=>{let n=!1;const a=e.map(l=>{const r=Jg(l,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let l=0;l<a.length;l++){const r=a[l];typeof r=="function"?r():Jg(e[l],null)}}}}function Ie(...e){return u.useCallback(td(...e),e)}function tE(e,t){const n=u.createContext(t),a=r=>{const{children:i,...o}=r,c=u.useMemo(()=>o,Object.values(o));return s.jsx(n.Provider,{value:c,children:i})};a.displayName=e+"Provider";function l(r){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}return[a,l]}function ws(e,t=[]){let n=[];function a(r,i){const o=u.createContext(i),c=n.length;n=[...n,i];const d=h=>{var x;const{scope:m,children:g,...j}=h,v=((x=m==null?void 0:m[e])==null?void 0:x[c])||o,y=u.useMemo(()=>j,Object.values(j));return s.jsx(v.Provider,{value:y,children:g})};d.displayName=r+"Provider";function f(h,m){var v;const g=((v=m==null?void 0:m[e])==null?void 0:v[c])||o,j=u.useContext(g);if(j)return j;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${r}\``)}return[d,f]}const l=()=>{const r=n.map(i=>u.createContext(i));return function(o){const c=(o==null?void 0:o[e])||r;return u.useMemo(()=>({[`__scope${e}`]:{...o,[e]:c}}),[o,c])}};return l.scopeName=e,[a,nE(l,...t)]}function nE(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(r){const i=a.reduce((o,{useScope:c,scopeName:d})=>{const h=c(r)[`__scope${d}`];return{...o,...h}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Pt=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},sE=fy[" useId ".trim().toString()]||(()=>{}),aE=0;function Vn(e){const[t,n]=u.useState(sE());return Pt(()=>{n(a=>a??String(aE++))},[e]),t?`radix-${t}`:""}var lE=fy[" useInsertionEffect ".trim().toString()]||Pt;function Oa({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[l,r,i]=rE({defaultProp:t,onChange:n}),o=e!==void 0,c=o?e:l;{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 r(f)},[o,e,r,i]);return[c,d]}function rE({defaultProp:e,onChange:t}){const[n,a]=u.useState(e),l=u.useRef(n),r=u.useRef(t);return lE(()=>{r.current=t},[t]),u.useEffect(()=>{var i;l.current!==n&&((i=r.current)==null||i.call(r,n),l.current=n)},[n,l]),[n,a,r]}function iE(e){return typeof e=="function"}function cl(e){const t=cE(e),n=u.forwardRef((a,l)=>{const{children:r,...i}=a,o=u.Children.toArray(r),c=o.find(dE);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:l,children:u.isValidElement(d)?u.cloneElement(d,void 0,f):null})}return s.jsx(t,{...i,ref:l,children:r})});return n.displayName=`${e}.Slot`,n}var oE=cl("Slot");function cE(e){const t=u.forwardRef((n,a)=>{const{children:l,...r}=n;if(u.isValidElement(l)){const i=hE(l),o=fE(r,l.props);return l.type!==u.Fragment&&(o.ref=a?td(a,i):i),u.cloneElement(l,o)}return u.Children.count(l)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var N0=Symbol("radix.slottable");function uE(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=N0,t}function dE(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===N0}function fE(e,t){const n={...t};for(const a in t){const l=e[a],r=t[a];/^on[A-Z]/.test(a)?l&&r?n[a]=(...o)=>{const c=r(...o);return l(...o),c}:l&&(n[a]=l):a==="style"?n[a]={...l,...r}:a==="className"&&(n[a]=[l,r].filter(Boolean).join(" "))}return{...e,...n}}function hE(e){var a,l;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=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=mE.reduce((e,t)=>{const n=cl(`Primitive.${t}`),a=u.forwardRef((l,r)=>{const{asChild:i,...o}=l,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...o,ref:r})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function k0(e,t){e&&Nr.flushSync(()=>e.dispatchEvent(t))}function ys(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 pE(e,t=globalThis==null?void 0:globalThis.document){const n=ys(e);u.useEffect(()=>{const a=l=>{l.key==="Escape"&&n(l)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var xE="DismissableLayer",Ph="dismissableLayer.update",gE="dismissableLayer.pointerDownOutside",vE="dismissableLayer.focusOutside",ev,S0=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yo=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:r,onInteractOutside:i,onDismiss:o,...c}=e,d=u.useContext(S0),[f,h]=u.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=u.useState({}),j=Ie(t,w=>h(w)),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(y),p=f?v.indexOf(f):-1,b=d.layersWithOutsidePointerEventsDisabled.size>0,_=p>=x,N=jE(w=>{const k=w.target,A=[...d.branches].some($=>$.contains(k));!_||A||(l==null||l(w),i==null||i(w),w.defaultPrevented||o==null||o())},m),C=_E(w=>{const k=w.target;[...d.branches].some($=>$.contains(k))||(r==null||r(w),i==null||i(w),w.defaultPrevented||o==null||o())},m);return pE(w=>{p===d.layers.size-1&&(a==null||a(w),!w.defaultPrevented&&o&&(w.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),tv(),()=>{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),tv())},[f,d]),u.useEffect(()=>{const w=()=>g({});return document.addEventListener(Ph,w),()=>document.removeEventListener(Ph,w)},[]),s.jsx(we.div,{...c,ref:j,style:{pointerEvents:b?_?"auto":"none":void 0,...e.style},onFocusCapture:ce(e.onFocusCapture,C.onFocusCapture),onBlurCapture:ce(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:ce(e.onPointerDownCapture,N.onPointerDownCapture)})});yo.displayName=xE;var yE="DismissableLayerBranch",bE=u.forwardRef((e,t)=>{const n=u.useContext(S0),a=u.useRef(null),l=Ie(t,a);return u.useEffect(()=>{const r=a.current;if(r)return n.branches.add(r),()=>{n.branches.delete(r)}},[n.branches]),s.jsx(we.div,{...e,ref:l})});bE.displayName=yE;function jE(e,t=globalThis==null?void 0:globalThis.document){const n=ys(e),a=u.useRef(!1),l=u.useRef(()=>{});return u.useEffect(()=>{const r=o=>{if(o.target&&!a.current){let c=function(){C0(gE,n,d,{discrete:!0})};const d={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",l.current),l.current=c,t.addEventListener("click",l.current,{once:!0})):c()}else t.removeEventListener("click",l.current);a.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",r)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",r),t.removeEventListener("click",l.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function _E(e,t=globalThis==null?void 0:globalThis.document){const n=ys(e),a=u.useRef(!1);return u.useEffect(()=>{const l=r=>{r.target&&!a.current&&C0(vE,n,{originalEvent:r},{discrete:!1})};return t.addEventListener("focusin",l),()=>t.removeEventListener("focusin",l)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function tv(){const e=new CustomEvent(Ph);document.dispatchEvent(e)}function C0(e,t,n,{discrete:a}){const l=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&l.addEventListener(e,t,{once:!0}),a?k0(l,r):l.dispatchEvent(r)}var vf="focusScope.autoFocusOnMount",yf="focusScope.autoFocusOnUnmount",nv={bubbles:!1,cancelable:!0},wE="FocusScope",nd=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:l,onUnmountAutoFocus:r,...i}=e,[o,c]=u.useState(null),d=ys(l),f=ys(r),h=u.useRef(null),m=Ie(t,v=>c(v)),g=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(a){let v=function(b){if(g.paused||!o)return;const _=b.target;o.contains(_)?h.current=_:oa(h.current,{select:!0})},y=function(b){if(g.paused||!o)return;const _=b.relatedTarget;_!==null&&(o.contains(_)||oa(h.current,{select:!0}))},x=function(b){if(document.activeElement===document.body)for(const N of b)N.removedNodes.length>0&&oa(o)};document.addEventListener("focusin",v),document.addEventListener("focusout",y);const p=new MutationObserver(x);return o&&p.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),p.disconnect()}}},[a,o,g.paused]),u.useEffect(()=>{if(o){av.add(g);const v=document.activeElement;if(!o.contains(v)){const x=new CustomEvent(vf,nv);o.addEventListener(vf,d),o.dispatchEvent(x),x.defaultPrevented||(NE(TE(R0(o)),{select:!0}),document.activeElement===v&&oa(o))}return()=>{o.removeEventListener(vf,d),setTimeout(()=>{const x=new CustomEvent(yf,nv);o.addEventListener(yf,f),o.dispatchEvent(x),x.defaultPrevented||oa(v??document.body,{select:!0}),o.removeEventListener(yf,f),av.remove(g)},0)}}},[o,d,f,g]);const j=u.useCallback(v=>{if(!n&&!a||g.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(y&&x){const p=v.currentTarget,[b,_]=kE(p);b&&_?!v.shiftKey&&x===_?(v.preventDefault(),n&&oa(b,{select:!0})):v.shiftKey&&x===b&&(v.preventDefault(),n&&oa(_,{select:!0})):x===p&&v.preventDefault()}},[n,a,g.paused]);return s.jsx(we.div,{tabIndex:-1,...i,ref:m,onKeyDown:j})});nd.displayName=wE;function NE(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(oa(a,{select:t}),document.activeElement!==n)return}function kE(e){const t=R0(e),n=sv(t,e),a=sv(t.reverse(),e);return[n,a]}function R0(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const l=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||l?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function sv(e,t){for(const n of e)if(!SE(n,{upTo:t}))return n}function SE(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 CE(e){return e instanceof HTMLInputElement&&"select"in e}function oa(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&CE(e)&&t&&e.select()}}var av=RE();function RE(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=lv(e,t),e.unshift(t)},remove(t){var n;e=lv(e,t),(n=e[0])==null||n.resume()}}}function lv(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function TE(e){return e.filter(t=>t.tagName!=="A")}var EE="Portal",bo=u.forwardRef((e,t)=>{var o;const{container:n,...a}=e,[l,r]=u.useState(!1);Pt(()=>r(!0),[]);const i=n||l&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return i?Y1.createPortal(s.jsx(we.div,{...a,ref:t}),i):null});bo.displayName=EE;function AE(e,t){return u.useReducer((n,a)=>t[n][a]??n,e)}var $n=e=>{const{present:t,children:n}=e,a=ME(t),l=typeof n=="function"?n({present:a.isPresent}):u.Children.only(n),r=Ie(a.ref,OE(l));return typeof n=="function"||a.isPresent?u.cloneElement(l,{ref:r}):null};$n.displayName="Presence";function ME(e){const[t,n]=u.useState(),a=u.useRef(null),l=u.useRef(e),r=u.useRef("none"),i=e?"mounted":"unmounted",[o,c]=AE(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=Wo(a.current);r.current=o==="mounted"?d:"none"},[o]),Pt(()=>{const d=a.current,f=l.current;if(f!==e){const m=r.current,g=Wo(d);e?c("MOUNT"):g==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),l.current=e}},[e,c]),Pt(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=g=>{const v=Wo(a.current).includes(g.animationName);if(g.target===t&&v&&(c("ANIMATION_END"),!l.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=g=>{g.target===t&&(r.current=Wo(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 Wo(e){return(e==null?void 0:e.animationName)||"none"}function OE(e){var a,l;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=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bf=0;function xp(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rv()),document.body.insertAdjacentElement("beforeend",e[1]??rv()),bf++,()=>{bf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),bf--}},[])}function rv(){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 cs=function(){return cs=Object.assign||function(t){for(var n,a=1,l=arguments.length;a<l;a++){n=arguments[a];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cs.apply(this,arguments)};function T0(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 l=0,a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(n[a[l]]=e[a[l]]);return n}function $E(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,r;a<l;a++)(r||!(a in t))&&(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}var kc="right-scroll-bar-position",Sc="width-before-scroll-bar",DE="with-scroll-bars-hidden",zE="--removed-body-scroll-bar-size";function jf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function LE(e,t){var n=u.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var l=n.value;l!==a&&(n.value=a,n.callback(a,l))}}}})[0];return n.callback=t,n.facade}var UE=typeof window<"u"?u.useLayoutEffect:u.useEffect,iv=new WeakMap;function BE(e,t){var n=LE(null,function(a){return e.forEach(function(l){return jf(l,a)})});return UE(function(){var a=iv.get(n);if(a){var l=new Set(a),r=new Set(e),i=n.current;l.forEach(function(o){r.has(o)||jf(o,null)}),r.forEach(function(o){l.has(o)||jf(o,i)})}iv.set(n,e)},[e]),n}function HE(e){return e}function IE(e,t){t===void 0&&(t=HE);var n=[],a=!1,l={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(r){var i=t(r,a);return n.push(i),function(){n=n.filter(function(o){return o!==i})}},assignSyncMedium:function(r){for(a=!0;n.length;){var i=n;n=[],i.forEach(r)}n={push:function(o){return r(o)},filter:function(){return n}}},assignMedium:function(r){a=!0;var i=[];if(n.length){var o=n;n=[],o.forEach(r),i=n}var c=function(){var f=i;i=[],f.forEach(r)},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 l}function PE(e){e===void 0&&(e={});var t=IE(null);return t.options=cs({async:!0,ssr:!1},e),t}var E0=function(e){var t=e.sideCar,n=T0(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,cs({},n))};E0.isSideCarExport=!0;function qE(e,t){return e.useMedium(t),E0}var A0=PE(),_f=function(){},sd=u.forwardRef(function(e,t){var n=u.useRef(null),a=u.useState({onScrollCapture:_f,onWheelCapture:_f,onTouchMoveCapture:_f}),l=a[0],r=a[1],i=e.forwardProps,o=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,h=e.shards,m=e.sideCar,g=e.noRelative,j=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,p=x===void 0?"div":x,b=e.gapMode,_=T0(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,C=BE([n,t]),w=cs(cs({},_),l);return u.createElement(u.Fragment,null,f&&u.createElement(N,{sideCar:A0,removeScrollBar:d,shards:h,noRelative:g,noIsolation:j,inert:v,setCallbacks:r,allowPinchZoom:!!y,lockRef:n,gapMode:b}),i?u.cloneElement(u.Children.only(o),cs(cs({},w),{ref:C})):u.createElement(p,cs({},w,{className:c,ref:C}),o))});sd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};sd.classNames={fullWidth:Sc,zeroRight:kc};var GE=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function VE(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=GE();return t&&e.setAttribute("nonce",t),e}function YE(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function FE(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var XE=function(){var e=0,t=null;return{add:function(n){e==0&&(t=VE())&&(YE(t,n),FE(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},KE=function(){var e=XE();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},M0=function(){var e=KE(),t=function(n){var a=n.styles,l=n.dynamic;return e(a,l),null};return t},QE={left:0,top:0,right:0,gap:0},wf=function(e){return parseInt(e||"",10)||0},ZE=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],l=t[e==="padding"?"paddingRight":"marginRight"];return[wf(n),wf(a),wf(l)]},WE=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return QE;var t=ZE(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])}},JE=M0(),sr="data-scroll-locked",eA=function(e,t,n,a){var l=e.left,r=e.top,i=e.right,o=e.gap;return n===void 0&&(n="margin"),`
340
+ .`.concat(DE,` {
341
341
  overflow: hidden `).concat(a,`;
342
342
  padding-right: `).concat(o,"px ").concat(a,`;
343
343
  }
@@ -371,19 +371,19 @@ Error generating stack: `+n.message+`
371
371
  }
372
372
 
373
373
  body[`).concat(sr,`] {
374
- `).concat($E,": ").concat(o,`px;
374
+ `).concat(zE,": ").concat(o,`px;
375
375
  }
376
- `)},ov=function(){var e=parseInt(document.body.getAttribute(sr)||"0",10);return isFinite(e)?e:0},JE=function(){u.useEffect(function(){return document.body.setAttribute(sr,(ov()+1).toString()),function(){var e=ov()-1;e<=0?document.body.removeAttribute(sr):document.body.setAttribute(sr,e.toString())}},[])},eA=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,l=a===void 0?"margin":a;JE();var r=u.useMemo(function(){return QE(l)},[l]);return u.createElement(ZE,{styles:WE(r,!t,l,n?"":"!important")})},qh=!1;if(typeof window<"u")try{var Jo=Object.defineProperty({},"passive",{get:function(){return qh=!0,!0}});window.addEventListener("test",Jo,Jo),window.removeEventListener("test",Jo,Jo)}catch{qh=!1}var kl=qh?{passive:!1}:!1,tA=function(e){return e.tagName==="TEXTAREA"},A0=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!tA(e)&&n[t]==="visible")},nA=function(e){return A0(e,"overflowY")},sA=function(e){return A0(e,"overflowX")},cv=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var l=M0(e,a);if(l){var r=O0(e,a),i=r[1],o=r[2];if(i>o)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},aA=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},lA=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},M0=function(e,t){return e==="v"?nA(t):sA(t)},O0=function(e,t){return e==="v"?aA(t):lA(t)},rA=function(e,t){return e==="h"&&t==="rtl"?-1:1},iA=function(e,t,n,a,l){var r=rA(e,window.getComputedStyle(t).direction),i=r*a,o=n.target,c=t.contains(o),d=!1,f=i>0,h=0,m=0;do{if(!o)break;var x=O0(e,o),j=x[0],v=x[1],y=x[2],g=v-y-r*j;(j||g)&&M0(e,o)&&(h+=g,m+=j);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},ec=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},uv=function(e){return[e.deltaX,e.deltaY]},dv=function(e){return e&&"current"in e?e.current:e},oA=function(e,t){return e[0]===t[0]&&e[1]===t[1]},cA=function(e){return`
376
+ `)},ov=function(){var e=parseInt(document.body.getAttribute(sr)||"0",10);return isFinite(e)?e:0},tA=function(){u.useEffect(function(){return document.body.setAttribute(sr,(ov()+1).toString()),function(){var e=ov()-1;e<=0?document.body.removeAttribute(sr):document.body.setAttribute(sr,e.toString())}},[])},nA=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,l=a===void 0?"margin":a;tA();var r=u.useMemo(function(){return WE(l)},[l]);return u.createElement(JE,{styles:eA(r,!t,l,n?"":"!important")})},qh=!1;if(typeof window<"u")try{var Jo=Object.defineProperty({},"passive",{get:function(){return qh=!0,!0}});window.addEventListener("test",Jo,Jo),window.removeEventListener("test",Jo,Jo)}catch{qh=!1}var kl=qh?{passive:!1}:!1,sA=function(e){return e.tagName==="TEXTAREA"},O0=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!sA(e)&&n[t]==="visible")},aA=function(e){return O0(e,"overflowY")},lA=function(e){return O0(e,"overflowX")},cv=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var l=$0(e,a);if(l){var r=D0(e,a),i=r[1],o=r[2];if(i>o)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},rA=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},iA=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},$0=function(e,t){return e==="v"?aA(t):lA(t)},D0=function(e,t){return e==="v"?rA(t):iA(t)},oA=function(e,t){return e==="h"&&t==="rtl"?-1:1},cA=function(e,t,n,a,l){var r=oA(e,window.getComputedStyle(t).direction),i=r*a,o=n.target,c=t.contains(o),d=!1,f=i>0,h=0,m=0;do{if(!o)break;var g=D0(e,o),j=g[0],v=g[1],y=g[2],x=v-y-r*j;(j||x)&&$0(e,o)&&(h+=x,m+=j);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},ec=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},uv=function(e){return[e.deltaX,e.deltaY]},dv=function(e){return e&&"current"in e?e.current:e},uA=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dA=function(e){return`
377
377
  .block-interactivity-`.concat(e,` {pointer-events: none;}
378
378
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
379
- `)},uA=0,Sl=[];function dA(e){var t=u.useRef([]),n=u.useRef([0,0]),a=u.useRef(),l=u.useState(uA++)[0],r=u.useState(E0)[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(l));var v=ME([e.lockRef.current],(e.shards||[]).map(dv),!0).filter(Boolean);return v.forEach(function(y){return y.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),v.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(l))})}}},[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=ec(v),p=n.current,b="deltaX"in v?v.deltaX:p[0]-g[0],_="deltaY"in v?v.deltaY:p[1]-g[1],N,C=v.target,w=Math.abs(b)>Math.abs(_)?"h":"v";if("touches"in v&&w==="h"&&C.type==="range")return!1;var k=cv(w,C);if(!k)return!0;if(k?N=w:(N=w==="v"?"h":"v",k=cv(w,C)),!k)return!1;if(!a.current&&"changedTouches"in v&&(b||_)&&(a.current=N),!N)return!0;var A=a.current||N;return iA(A,y,v,A==="h"?b:_)},[]),c=u.useCallback(function(v){var y=v;if(!(!Sl.length||Sl[Sl.length-1]!==r)){var g="deltaY"in y?uv(y):ec(y),p=t.current.filter(function(N){return N.name===y.type&&(N.target===y.target||y.target===N.shadowParent)&&oA(N.delta,g)})[0];if(p&&p.should){y.cancelable&&y.preventDefault();return}if(!p){var b=(i.current.shards||[]).map(dv).filter(Boolean).filter(function(N){return N.contains(y.target)}),_=b.length>0?o(y,b[0]):!i.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),d=u.useCallback(function(v,y,g,p){var b={name:v,delta:y,target:g,should:p,shadowParent:fA(g)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(_){return _!==b})},1)},[]),f=u.useCallback(function(v){n.current=ec(v),a.current=void 0},[]),h=u.useCallback(function(v){d(v.type,uv(v),v.target,o(v,e.lockRef.current))},[]),m=u.useCallback(function(v){d(v.type,ec(v),v.target,o(v,e.lockRef.current))},[]);u.useEffect(function(){return Sl.push(r),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,kl),document.addEventListener("touchmove",c,kl),document.addEventListener("touchstart",f,kl),function(){Sl=Sl.filter(function(v){return v!==r}),document.removeEventListener("wheel",c,kl),document.removeEventListener("touchmove",c,kl),document.removeEventListener("touchstart",f,kl)}},[]);var x=e.removeScrollBar,j=e.inert;return u.createElement(u.Fragment,null,j?u.createElement(r,{styles:cA(l)}):null,x?u.createElement(eA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function fA(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hA=IE(R0,dA);var ad=u.forwardRef(function(e,t){return u.createElement(sd,cs({},e,{ref:t,sideCar:hA}))});ad.classNames=sd.classNames;var mA=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Cl=new WeakMap,tc=new WeakMap,nc={},Nf=0,$0=function(e){return e&&(e.host||$0(e.parentNode))},pA=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=$0(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})},xA=function(e,t,n,a){var l=pA(t,Array.isArray(e)?e:[e]);nc[n]||(nc[n]=new WeakMap);var r=nc[n],i=[],o=new Set,c=new Set(l),d=function(h){!h||o.has(h)||(o.add(h),d(h.parentNode))};l.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),j=x!==null&&x!=="false",v=(Cl.get(m)||0)+1,y=(r.get(m)||0)+1;Cl.set(m,v),r.set(m,y),i.push(m),v===1&&j&&tc.set(m,!0),y===1&&m.setAttribute(n,"true"),j||m.setAttribute(a,"true")}catch(g){console.error("aria-hidden: cannot operate on ",m,g)}})};return f(t),o.clear(),Nf++,function(){i.forEach(function(h){var m=Cl.get(h)-1,x=r.get(h)-1;Cl.set(h,m),r.set(h,x),m||(tc.has(h)||h.removeAttribute(a),tc.delete(h)),x||h.removeAttribute(n)}),Nf--,Nf||(Cl=new WeakMap,Cl=new WeakMap,tc=new WeakMap,nc={})}},gp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),l=mA(e);return l?(a.push.apply(a,Array.from(l.querySelectorAll("[aria-live], script"))),xA(a,l,n,"aria-hidden")):function(){return null}},ld="Dialog",[D0]=ws(ld),[gA,Jn]=D0(ld),z0=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:l,onOpenChange:r,modal:i=!0}=e,o=u.useRef(null),c=u.useRef(null),[d,f]=Oa({prop:a,defaultProp:l??!1,onChange:r,caller:ld});return s.jsx(gA,{scope:t,triggerRef:o,contentRef:c,contentId:Vn(),titleId:Vn(),descriptionId:Vn(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(h=>!h),[f]),modal:i,children:n})};z0.displayName=ld;var L0="DialogTrigger",vA=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Jn(L0,n),r=Ie(t,l.triggerRef);return s.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":bp(l.open),...a,ref:r,onClick:ce(e.onClick,l.onOpenToggle)})});vA.displayName=L0;var vp="DialogPortal",[yA,U0]=D0(vp,{forceMount:void 0}),B0=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:l}=e,r=Jn(vp,t);return s.jsx(yA,{scope:t,forceMount:n,children:u.Children.map(a,i=>s.jsx($n,{present:n||r.open,children:s.jsx(bo,{asChild:!0,container:l,children:i})}))})};B0.displayName=vp;var fu="DialogOverlay",H0=u.forwardRef((e,t)=>{const n=U0(fu,e.__scopeDialog),{forceMount:a=n.forceMount,...l}=e,r=Jn(fu,e.__scopeDialog);return r.modal?s.jsx($n,{present:a||r.open,children:s.jsx(jA,{...l,ref:t})}):null});H0.displayName=fu;var bA=cl("DialogOverlay.RemoveScroll"),jA=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Jn(fu,n);return s.jsx(ad,{as:bA,allowPinchZoom:!0,shards:[l.contentRef],children:s.jsx(we.div,{"data-state":bp(l.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),ul="DialogContent",I0=u.forwardRef((e,t)=>{const n=U0(ul,e.__scopeDialog),{forceMount:a=n.forceMount,...l}=e,r=Jn(ul,e.__scopeDialog);return s.jsx($n,{present:a||r.open,children:r.modal?s.jsx(_A,{...l,ref:t}):s.jsx(wA,{...l,ref:t})})});I0.displayName=ul;var _A=u.forwardRef((e,t)=>{const n=Jn(ul,e.__scopeDialog),a=u.useRef(null),l=Ie(t,n.contentRef,a);return u.useEffect(()=>{const r=a.current;if(r)return gp(r)},[]),s.jsx(P0,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(e.onCloseAutoFocus,r=>{var i;r.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ce(e.onPointerDownOutside,r=>{const i=r.detail.originalEvent,o=i.button===0&&i.ctrlKey===!0;(i.button===2||o)&&r.preventDefault()}),onFocusOutside:ce(e.onFocusOutside,r=>r.preventDefault())})}),wA=u.forwardRef((e,t)=>{const n=Jn(ul,e.__scopeDialog),a=u.useRef(!1),l=u.useRef(!1);return s.jsx(P0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var i,o;(i=e.onCloseAutoFocus)==null||i.call(e,r),r.defaultPrevented||(a.current||(o=n.triggerRef.current)==null||o.focus(),r.preventDefault()),a.current=!1,l.current=!1},onInteractOutside:r=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,r),r.defaultPrevented||(a.current=!0,r.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const i=r.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&l.current&&r.preventDefault()}})}),P0=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:r,...i}=e,o=Jn(ul,n),c=u.useRef(null),d=Ie(t,c);return xp(),s.jsxs(s.Fragment,{children:[s.jsx(nd,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:l,onUnmountAutoFocus:r,children:s.jsx(yo,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":bp(o.open),...i,ref:d,onDismiss:()=>o.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(NA,{titleId:o.titleId}),s.jsx(SA,{contentRef:c,descriptionId:o.descriptionId})]})]})}),yp="DialogTitle",q0=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Jn(yp,n);return s.jsx(we.h2,{id:l.titleId,...a,ref:t})});q0.displayName=yp;var G0="DialogDescription",V0=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Jn(G0,n);return s.jsx(we.p,{id:l.descriptionId,...a,ref:t})});V0.displayName=G0;var Y0="DialogClose",F0=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Jn(Y0,n);return s.jsx(we.button,{type:"button",...a,ref:t,onClick:ce(e.onClick,()=>l.onOpenChange(!1))})});F0.displayName=Y0;function bp(e){return e?"open":"closed"}var X0="DialogTitleWarning",[Y6,K0]=JR(X0,{contentName:ul,titleName:yp,docsSlug:"dialog"}),NA=({titleId:e})=>{const t=K0(X0),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
379
+ `)},fA=0,Sl=[];function hA(e){var t=u.useRef([]),n=u.useRef([0,0]),a=u.useRef(),l=u.useState(fA++)[0],r=u.useState(M0)[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(l));var v=$E([e.lockRef.current],(e.shards||[]).map(dv),!0).filter(Boolean);return v.forEach(function(y){return y.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),v.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(l))})}}},[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 x=ec(v),p=n.current,b="deltaX"in v?v.deltaX:p[0]-x[0],_="deltaY"in v?v.deltaY:p[1]-x[1],N,C=v.target,w=Math.abs(b)>Math.abs(_)?"h":"v";if("touches"in v&&w==="h"&&C.type==="range")return!1;var k=cv(w,C);if(!k)return!0;if(k?N=w:(N=w==="v"?"h":"v",k=cv(w,C)),!k)return!1;if(!a.current&&"changedTouches"in v&&(b||_)&&(a.current=N),!N)return!0;var A=a.current||N;return cA(A,y,v,A==="h"?b:_)},[]),c=u.useCallback(function(v){var y=v;if(!(!Sl.length||Sl[Sl.length-1]!==r)){var x="deltaY"in y?uv(y):ec(y),p=t.current.filter(function(N){return N.name===y.type&&(N.target===y.target||y.target===N.shadowParent)&&uA(N.delta,x)})[0];if(p&&p.should){y.cancelable&&y.preventDefault();return}if(!p){var b=(i.current.shards||[]).map(dv).filter(Boolean).filter(function(N){return N.contains(y.target)}),_=b.length>0?o(y,b[0]):!i.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),d=u.useCallback(function(v,y,x,p){var b={name:v,delta:y,target:x,should:p,shadowParent:mA(x)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(_){return _!==b})},1)},[]),f=u.useCallback(function(v){n.current=ec(v),a.current=void 0},[]),h=u.useCallback(function(v){d(v.type,uv(v),v.target,o(v,e.lockRef.current))},[]),m=u.useCallback(function(v){d(v.type,ec(v),v.target,o(v,e.lockRef.current))},[]);u.useEffect(function(){return Sl.push(r),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,kl),document.addEventListener("touchmove",c,kl),document.addEventListener("touchstart",f,kl),function(){Sl=Sl.filter(function(v){return v!==r}),document.removeEventListener("wheel",c,kl),document.removeEventListener("touchmove",c,kl),document.removeEventListener("touchstart",f,kl)}},[]);var g=e.removeScrollBar,j=e.inert;return u.createElement(u.Fragment,null,j?u.createElement(r,{styles:dA(l)}):null,g?u.createElement(nA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function mA(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const pA=qE(A0,hA);var ad=u.forwardRef(function(e,t){return u.createElement(sd,cs({},e,{ref:t,sideCar:pA}))});ad.classNames=sd.classNames;var xA=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Cl=new WeakMap,tc=new WeakMap,nc={},Nf=0,z0=function(e){return e&&(e.host||z0(e.parentNode))},gA=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=z0(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})},vA=function(e,t,n,a){var l=gA(t,Array.isArray(e)?e:[e]);nc[n]||(nc[n]=new WeakMap);var r=nc[n],i=[],o=new Set,c=new Set(l),d=function(h){!h||o.has(h)||(o.add(h),d(h.parentNode))};l.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 g=m.getAttribute(a),j=g!==null&&g!=="false",v=(Cl.get(m)||0)+1,y=(r.get(m)||0)+1;Cl.set(m,v),r.set(m,y),i.push(m),v===1&&j&&tc.set(m,!0),y===1&&m.setAttribute(n,"true"),j||m.setAttribute(a,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return f(t),o.clear(),Nf++,function(){i.forEach(function(h){var m=Cl.get(h)-1,g=r.get(h)-1;Cl.set(h,m),r.set(h,g),m||(tc.has(h)||h.removeAttribute(a),tc.delete(h)),g||h.removeAttribute(n)}),Nf--,Nf||(Cl=new WeakMap,Cl=new WeakMap,tc=new WeakMap,nc={})}},gp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),l=xA(e);return l?(a.push.apply(a,Array.from(l.querySelectorAll("[aria-live], script"))),vA(a,l,n,"aria-hidden")):function(){return null}},ld="Dialog",[L0]=ws(ld),[yA,Jn]=L0(ld),U0=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:l,onOpenChange:r,modal:i=!0}=e,o=u.useRef(null),c=u.useRef(null),[d,f]=Oa({prop:a,defaultProp:l??!1,onChange:r,caller:ld});return s.jsx(yA,{scope:t,triggerRef:o,contentRef:c,contentId:Vn(),titleId:Vn(),descriptionId:Vn(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(h=>!h),[f]),modal:i,children:n})};U0.displayName=ld;var B0="DialogTrigger",bA=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Jn(B0,n),r=Ie(t,l.triggerRef);return s.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":bp(l.open),...a,ref:r,onClick:ce(e.onClick,l.onOpenToggle)})});bA.displayName=B0;var vp="DialogPortal",[jA,H0]=L0(vp,{forceMount:void 0}),I0=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:l}=e,r=Jn(vp,t);return s.jsx(jA,{scope:t,forceMount:n,children:u.Children.map(a,i=>s.jsx($n,{present:n||r.open,children:s.jsx(bo,{asChild:!0,container:l,children:i})}))})};I0.displayName=vp;var fu="DialogOverlay",P0=u.forwardRef((e,t)=>{const n=H0(fu,e.__scopeDialog),{forceMount:a=n.forceMount,...l}=e,r=Jn(fu,e.__scopeDialog);return r.modal?s.jsx($n,{present:a||r.open,children:s.jsx(wA,{...l,ref:t})}):null});P0.displayName=fu;var _A=cl("DialogOverlay.RemoveScroll"),wA=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Jn(fu,n);return s.jsx(ad,{as:_A,allowPinchZoom:!0,shards:[l.contentRef],children:s.jsx(we.div,{"data-state":bp(l.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),ul="DialogContent",q0=u.forwardRef((e,t)=>{const n=H0(ul,e.__scopeDialog),{forceMount:a=n.forceMount,...l}=e,r=Jn(ul,e.__scopeDialog);return s.jsx($n,{present:a||r.open,children:r.modal?s.jsx(NA,{...l,ref:t}):s.jsx(kA,{...l,ref:t})})});q0.displayName=ul;var NA=u.forwardRef((e,t)=>{const n=Jn(ul,e.__scopeDialog),a=u.useRef(null),l=Ie(t,n.contentRef,a);return u.useEffect(()=>{const r=a.current;if(r)return gp(r)},[]),s.jsx(G0,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(e.onCloseAutoFocus,r=>{var i;r.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ce(e.onPointerDownOutside,r=>{const i=r.detail.originalEvent,o=i.button===0&&i.ctrlKey===!0;(i.button===2||o)&&r.preventDefault()}),onFocusOutside:ce(e.onFocusOutside,r=>r.preventDefault())})}),kA=u.forwardRef((e,t)=>{const n=Jn(ul,e.__scopeDialog),a=u.useRef(!1),l=u.useRef(!1);return s.jsx(G0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var i,o;(i=e.onCloseAutoFocus)==null||i.call(e,r),r.defaultPrevented||(a.current||(o=n.triggerRef.current)==null||o.focus(),r.preventDefault()),a.current=!1,l.current=!1},onInteractOutside:r=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,r),r.defaultPrevented||(a.current=!0,r.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const i=r.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&l.current&&r.preventDefault()}})}),G0=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:r,...i}=e,o=Jn(ul,n),c=u.useRef(null),d=Ie(t,c);return xp(),s.jsxs(s.Fragment,{children:[s.jsx(nd,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:l,onUnmountAutoFocus:r,children:s.jsx(yo,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":bp(o.open),...i,ref:d,onDismiss:()=>o.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(SA,{titleId:o.titleId}),s.jsx(RA,{contentRef:c,descriptionId:o.descriptionId})]})]})}),yp="DialogTitle",V0=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Jn(yp,n);return s.jsx(we.h2,{id:l.titleId,...a,ref:t})});V0.displayName=yp;var Y0="DialogDescription",F0=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Jn(Y0,n);return s.jsx(we.p,{id:l.descriptionId,...a,ref:t})});F0.displayName=Y0;var X0="DialogClose",K0=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Jn(X0,n);return s.jsx(we.button,{type:"button",...a,ref:t,onClick:ce(e.onClick,()=>l.onOpenChange(!1))})});K0.displayName=X0;function bp(e){return e?"open":"closed"}var Q0="DialogTitleWarning",[Q6,Z0]=tE(Q0,{contentName:ul,titleName:yp,docsSlug:"dialog"}),SA=({titleId:e})=>{const t=Z0(Q0),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
380
380
 
381
381
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
382
382
 
383
- 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},kA="DialogDescriptionWarning",SA=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${K0(kA).contentName}}.`;return u.useEffect(()=>{var r;const l=(r=e.current)==null?void 0:r.getAttribute("aria-describedby");t&&l&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},Q0=z0,Z0=B0,W0=H0,J0=I0,e_=q0,t_=V0,jp=F0;function gn({className:e,...t}){return s.jsx(kT,{role:"status","aria-label":"Loading",className:ie("size-4 animate-spin",e),...t})}const ar="aria-pressed:border aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:text-accent-foreground",CA="border border-primary bg-accent text-accent-foreground hover:bg-accent",rd=vo("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"}}),P=u.forwardRef(({className:e,disabled:t,variant:n,size:a,asChild:l=!1,loading:r,children:i,...o},c)=>{const d=l?rE:"button",f=a==="icon"||a==="sm-icon"||a==="control-icon"||a==="xs-icon",h=s.jsx(gn,{"aria-hidden":"true","aria-label":void 0,role:void 0,className:ie(!f&&"mr-2")}),m=l?i:r&&f?h:s.jsxs(s.Fragment,{children:[r?h:null,i]});return s.jsx(d,{className:ie(rd({variant:n,size:a,className:e})),ref:c,disabled:t||r,...o,children:m})});P.displayName="Button";const n_=u.createContext(null);function TA({container:e,children:t}){return s.jsx(n_.Provider,{value:e,children:t})}function jo(){return u.useContext(n_)??void 0}function s_(e){return s.jsx(Q0,{"data-slot":"alert-dialog",...e})}function RA({className:e,...t}){return s.jsx(W0,{"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 a_({className:e,onOpenAutoFocus:t,onPointerDownOutside:n,onInteractOutside:a,...l}){return s.jsxs(Z0,{container:jo(),children:[s.jsx(RA,{}),s.jsx(J0,{"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:r=>{if(t==null||t(r),r.defaultPrevented)return;const i=r.currentTarget,o=i instanceof HTMLElement?i.querySelector('[data-slot="alert-dialog-cancel"]'):null;o&&(r.preventDefault(),o.focus())},onPointerDownOutside:r=>{n==null||n(r),r.preventDefault()},onInteractOutside:r=>{a==null||a(r),r.preventDefault()},...l})]})}function l_({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 r_({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 i_({className:e,...t}){return s.jsx(e_,{"data-slot":"alert-dialog-title",className:ie("text-lg font-semibold",e),...t})}function o_({className:e,...t}){return s.jsx(t_,{"data-slot":"alert-dialog-description",className:ie("text-muted-foreground text-sm",e),...t})}function c_({className:e,variant:t,...n}){return s.jsx(jp,{"data-slot":"alert-dialog-action",className:ie(rd({variant:t}),e),...n})}function u_({className:e,...t}){return s.jsx(jp,{"data-slot":"alert-dialog-cancel",className:ie(rd({variant:"outline"}),e),...t})}function EA(){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 AA(e,t){t!=null&&t.isConnected&&(e.preventDefault(),t.focus())}function _o(){const[e,t]=u.useState(null),n=u.useRef(null),a=u.useRef(null),l=u.useCallback(o=>{var c;(c=n.current)==null||c.resolve(o),n.current=null,t(null)},[]),r=u.useCallback(o=>new Promise(c=>{var f;(f=n.current)==null||f.resolve(!1),a.current=EA();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(s_,{open:e!==null,onOpenChange:o=>{o||l(!1)},children:s.jsxs(a_,{onCloseAutoFocus:o=>AA(o,a.current),children:[s.jsxs(l_,{children:[s.jsx(i_,{children:e==null?void 0:e.title}),s.jsx(o_,{className:"whitespace-pre-line",children:e==null?void 0:e.description})]}),s.jsxs(r_,{children:[s.jsx(u_,{children:"Cancel"}),s.jsx(c_,{variant:e!=null&&e.destructive?"destructive":"default",onClick:()=>l(!0),children:e==null?void 0:e.action_label})]})]})});return{confirm:r,confirm_dialog:i}}const Ds="px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",MA=vo("inline-flex items-center rounded-md border transition-colors",{variants:{variant:{default:`${Ds} border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80`,secondary:`${Ds} border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`${Ds} border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80`,outline:`${Ds} text-foreground`,success:`${Ds} border-success/40 bg-success/10 text-success`,warning:`${Ds} border-warning/40 bg-warning/10 text-warning`,info:`${Ds} border-info/40 bg-info/10 text-info`,error:`${Ds} border-destructive/40 bg-destructive/10 text-destructive`,neutral:`${Ds} 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 he({className:e,variant:t,size:n,...a}){return s.jsx("div",{className:ie(MA({variant:t,size:n}),e),...a})}function d_(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 f_(e){const[t,n]=u.useState(void 0);return Pt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const r=l[0];let i,o;if("borderBoxSize"in r){const c=r.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 id="Checkbox",[OA]=ws(id),[$A,_p]=OA(id);function DA(e){const{__scopeCheckbox:t,checked:n,children:a,defaultChecked:l,disabled:r,form:i,name:o,onCheckedChange:c,required:d,value:f="on",internal_do_not_use_render:h}=e,[m,x]=Oa({prop:n,defaultProp:l??!1,onChange:c,caller:id}),[j,v]=u.useState(null),[y,g]=u.useState(null),p=u.useRef(!1),b=j?!!i||!!j.closest("form"):!0,_={checked:m,disabled:r,setChecked:x,control:j,setControl:v,name:o,form:i,value:f,hasConsumerStoppedPropagationRef:p,required:d,defaultChecked:Ra(l)?!1:l,isFormControl:b,bubbleInput:y,setBubbleInput:g};return s.jsx($A,{scope:t,..._,children:zA(h)?h(_):a})}var h_="CheckboxTrigger",m_=u.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},l)=>{const{control:r,value:i,disabled:o,checked:c,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:x,bubbleInput:j}=_p(h_,e),v=Ie(l,f),y=u.useRef(c);return u.useEffect(()=>{const g=r==null?void 0:r.form;if(g){const p=()=>h(y.current);return g.addEventListener("reset",p),()=>g.removeEventListener("reset",p)}},[r,h]),s.jsx(we.button,{type:"button",role:"checkbox","aria-checked":Ra(c)?"mixed":c,"aria-required":d,"data-state":y_(c),"data-disabled":o?"":void 0,disabled:o,value:i,...a,ref:v,onKeyDown:ce(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:ce(n,g=>{h(p=>Ra(p)?!0:!p),j&&x&&(m.current=g.isPropagationStopped(),m.current||g.stopPropagation())})})});m_.displayName=h_;var wp=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:a,checked:l,defaultChecked:r,required:i,disabled:o,value:c,onCheckedChange:d,form:f,...h}=e;return s.jsx(DA,{__scopeCheckbox:n,checked:l,defaultChecked:r,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(m_,{...h,ref:t,__scopeCheckbox:n}),m&&s.jsx(v_,{__scopeCheckbox:n})]})})});wp.displayName=id;var p_="CheckboxIndicator",x_=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...l}=e,r=_p(p_,n);return s.jsx($n,{present:a||Ra(r.checked)||r.checked===!0,children:s.jsx(we.span,{"data-state":y_(r.checked),"data-disabled":r.disabled?"":void 0,...l,ref:t,style:{pointerEvents:"none",...e.style}})})});x_.displayName=p_;var g_="CheckboxBubbleInput",v_=u.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:a,hasConsumerStoppedPropagationRef:l,checked:r,defaultChecked:i,required:o,disabled:c,name:d,value:f,form:h,bubbleInput:m,setBubbleInput:x}=_p(g_,e),j=Ie(n,x),v=d_(r),y=f_(a);u.useEffect(()=>{const p=m;if(!p)return;const b=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(b,"checked").set,C=!l.current;if(v!==r&&N){const w=new Event("click",{bubbles:C});p.indeterminate=Ra(r),N.call(p,Ra(r)?!1:r),p.dispatchEvent(w)}},[m,v,r,l]);const g=u.useRef(Ra(r)?!1:r);return s.jsx(we.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??g.current,required:o,disabled:c,name:d,value:f,form:h,...t,tabIndex:-1,ref:j,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});v_.displayName=g_;function zA(e){return typeof e=="function"}function Ra(e){return e==="indeterminate"}function y_(e){return Ra(e)?"indeterminate":e?"checked":"unchecked"}const zr=u.forwardRef(({className:e,...t},n)=>s.jsx(wp,{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(x_,{className:ie("flex items-center justify-center text-current"),children:t.checked==="indeterminate"?s.jsx(AT,{className:"size-4","aria-hidden":"true"}):s.jsx(Mr,{className:"size-4","aria-hidden":"true"})})}));zr.displayName=wp.displayName;const LA=vo("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 es({...e}){return s.jsx(Q0,{"data-slot":"dialog",...e})}function UA({...e}){const t=jo();return s.jsx(Z0,{"data-slot":"dialog-portal",container:t,...e})}function BA({className:e,...t}){return s.jsx(W0,{"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 ts({className:e,children:t,showCloseButton:n=!0,size:a,...l}){return s.jsxs(UA,{"data-slot":"dialog-portal",children:[s.jsx(BA,{}),s.jsxs(J0,{"data-slot":"dialog-content",className:ie(LA({size:a}),e),...l,children:[t,n&&s.jsxs(jp,{"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(Ju,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ns({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 ss({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 as({className:e,...t}){return s.jsx(e_,{"data-slot":"dialog-title",className:ie("text-lg leading-none font-semibold",e),...t})}function ls({className:e,...t}){return s.jsx(t_,{"data-slot":"dialog-description",className:ie("text-muted-foreground text-sm",e),...t})}function Np(e){const t=e+"CollectionProvider",[n,a]=ws(t),[l,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=v=>{const{scope:y,children:g}=v,p=ra.useRef(null),b=ra.useRef(new Map).current;return s.jsx(l,{scope:y,itemMap:b,collectionRef:p,children:g})};i.displayName=t;const o=e+"CollectionSlot",c=cl(o),d=ra.forwardRef((v,y)=>{const{scope:g,children:p}=v,b=r(o,g),_=Ie(y,b.collectionRef);return s.jsx(c,{ref:_,children:p})});d.displayName=o;const f=e+"CollectionItemSlot",h="data-radix-collection-item",m=cl(f),x=ra.forwardRef((v,y)=>{const{scope:g,children:p,...b}=v,_=ra.useRef(null),N=Ie(y,_),C=r(f,g);return ra.useEffect(()=>(C.itemMap.set(_,{ref:_,...b}),()=>void C.itemMap.delete(_))),s.jsx(m,{[h]:"",ref:N,children:p})});x.displayName=f;function j(v){const y=r(e+"CollectionConsumer",v);return ra.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const b=Array.from(p.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((C,w)=>b.indexOf(C.ref.current)-b.indexOf(w.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},j,a]}var HA=u.createContext(void 0);function od(e){const t=u.useContext(HA);return e||t||"ltr"}const IA=["top","right","bottom","left"],$a=Math.min,on=Math.max,hu=Math.round,sc=Math.floor,gs=e=>({x:e,y:e}),PA={left:"right",right:"left",bottom:"top",top:"bottom"},qA={start:"end",end:"start"};function Gh(e,t,n){return on(e,$a(t,n))}function Qs(e,t){return typeof e=="function"?e(t):e}function Zs(e){return e.split("-")[0]}function Lr(e){return e.split("-")[1]}function kp(e){return e==="x"?"y":"x"}function Sp(e){return e==="y"?"height":"width"}function fs(e){return["top","bottom"].includes(Zs(e))?"y":"x"}function Cp(e){return kp(fs(e))}function GA(e,t,n){n===void 0&&(n=!1);const a=Lr(e),l=Cp(e),r=Sp(l);let i=l==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(i=mu(i)),[i,mu(i)]}function VA(e){const t=mu(e);return[Vh(e),t,Vh(t)]}function Vh(e){return e.replace(/start|end/g,t=>qA[t])}function YA(e,t,n){const a=["left","right"],l=["right","left"],r=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?l:a:t?a:l;case"left":case"right":return t?r:i;default:return[]}}function FA(e,t,n,a){const l=Lr(e);let r=YA(Zs(e),n==="start",a);return l&&(r=r.map(i=>i+"-"+l),t&&(r=r.concat(r.map(Vh)))),r}function mu(e){return e.replace(/left|right|bottom|top/g,t=>PA[t])}function XA(e){return{top:0,right:0,bottom:0,left:0,...e}}function b_(e){return typeof e!="number"?XA(e):{top:e,right:e,bottom:e,left:e}}function pu(e){const{x:t,y:n,width:a,height:l}=e;return{width:a,height:l,top:n,left:t,right:t+a,bottom:n+l,x:t,y:n}}function fv(e,t,n){let{reference:a,floating:l}=e;const r=fs(t),i=Cp(t),o=Sp(i),c=Zs(t),d=r==="y",f=a.x+a.width/2-l.width/2,h=a.y+a.height/2-l.height/2,m=a[o]/2-l[o]/2;let x;switch(c){case"top":x={x:f,y:a.y-l.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-l.width,y:h};break;default:x={x:a.x,y:a.y}}switch(Lr(t)){case"start":x[i]-=m*(n&&d?-1:1);break;case"end":x[i]+=m*(n&&d?-1:1);break}return x}const KA=async(e,t,n)=>{const{placement:a="bottom",strategy:l="absolute",middleware:r=[],platform:i}=n,o=r.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:l}),{x:f,y:h}=fv(d,a,c),m=a,x={},j=0;for(let v=0;v<o.length;v++){const{name:y,fn:g}=o[v],{x:p,y:b,data:_,reset:N}=await g({x:f,y:h,initialPlacement:a,placement:m,strategy:l,middlewareData:x,rects:d,platform:i,elements:{reference:e,floating:t}});f=p??f,h=b??h,x={...x,[y]:{...x[y],..._}},N&&j<=50&&(j++,typeof N=="object"&&(N.placement&&(m=N.placement),N.rects&&(d=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:l}):N.rects),{x:f,y:h}=fv(d,m,c)),v=-1)}return{x:f,y:h,placement:m,strategy:l,middlewareData:x}};async function qi(e,t){var n;t===void 0&&(t={});const{x:a,y:l,platform:r,rects:i,elements:o,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:x=0}=Qs(t,e),j=b_(x),y=o[m?h==="floating"?"reference":"floating":h],g=pu(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(y)))==null||n?y:y.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(o.floating)),boundary:d,rootBoundary:f,strategy:c})),p=h==="floating"?{x:a,y:l,width:i.floating.width,height:i.floating.height}:i.reference,b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(o.floating)),_=await(r.isElement==null?void 0:r.isElement(b))?await(r.getScale==null?void 0:r.getScale(b))||{x:1,y:1}:{x:1,y:1},N=pu(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:p,offsetParent:b,strategy:c}):p);return{top:(g.top-N.top+j.top)/_.y,bottom:(N.bottom-g.bottom+j.bottom)/_.y,left:(g.left-N.left+j.left)/_.x,right:(N.right-g.right+j.right)/_.x}}const QA=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:l,rects:r,platform:i,elements:o,middlewareData:c}=t,{element:d,padding:f=0}=Qs(e,t)||{};if(d==null)return{};const h=b_(f),m={x:n,y:a},x=Cp(l),j=Sp(x),v=await i.getDimensions(d),y=x==="y",g=y?"top":"left",p=y?"bottom":"right",b=y?"clientHeight":"clientWidth",_=r.reference[j]+r.reference[x]-m[x]-r.floating[j],N=m[x]-r.reference[x],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let w=C?C[b]:0;(!w||!await(i.isElement==null?void 0:i.isElement(C)))&&(w=o.floating[b]||r.floating[j]);const k=_/2-N/2,A=w/2-v[j]/2-1,$=$a(h[g],A),X=$a(h[p],A),Y=$,L=w-v[j]-X,H=w/2-v[j]/2+k,R=Gh(Y,H,L),T=!c.arrow&&Lr(l)!=null&&H!==R&&r.reference[j]/2-(H<Y?$:X)-v[j]/2<0,z=T?H<Y?H-Y:H-L:0;return{[x]:m[x]+z,data:{[x]:R,centerOffset:H-R-z,...T&&{alignmentOffset:z}},reset:T}}}),ZA=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:l,middlewareData:r,rects:i,initialPlacement:o,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:v=!0,...y}=Qs(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const g=Zs(l),p=fs(o),b=Zs(o)===o,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=m||(b||!v?[mu(o)]:VA(o)),C=j!=="none";!m&&C&&N.push(...FA(o,v,j,_));const w=[o,...N],k=await qi(t,y),A=[];let $=((a=r.flip)==null?void 0:a.overflows)||[];if(f&&A.push(k[g]),h){const H=GA(l,i,_);A.push(k[H[0]],k[H[1]])}if($=[...$,{placement:l,overflows:A}],!A.every(H=>H<=0)){var X,Y;const H=(((X=r.flip)==null?void 0:X.index)||0)+1,R=w[H];if(R&&(!(h==="alignment"?p!==fs(R):!1)||$.every(S=>S.overflows[0]>0&&fs(S.placement)===p)))return{data:{index:H,overflows:$},reset:{placement:R}};let T=(Y=$.filter(z=>z.overflows[0]<=0).sort((z,S)=>z.overflows[1]-S.overflows[1])[0])==null?void 0:Y.placement;if(!T)switch(x){case"bestFit":{var L;const z=(L=$.filter(S=>{if(C){const O=fs(S.placement);return O===p||O==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(O=>O>0).reduce((O,Z)=>O+Z,0)]).sort((S,O)=>S[1]-O[1])[0])==null?void 0:L[0];z&&(T=z);break}case"initialPlacement":T=o;break}if(l!==T)return{reset:{placement:T}}}return{}}}};function hv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function mv(e){return IA.some(t=>e[t]>=0)}const WA=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...l}=Qs(e,t);switch(a){case"referenceHidden":{const r=await qi(t,{...l,elementContext:"reference"}),i=hv(r,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:mv(i)}}}case"escaped":{const r=await qi(t,{...l,altBoundary:!0}),i=hv(r,n.floating);return{data:{escapedOffsets:i,escaped:mv(i)}}}default:return{}}}}};async function JA(e,t){const{placement:n,platform:a,elements:l}=e,r=await(a.isRTL==null?void 0:a.isRTL(l.floating)),i=Zs(n),o=Lr(n),c=fs(n)==="y",d=["left","top"].includes(i)?-1:1,f=r&&c?-1:1,h=Qs(t,e);let{mainAxis:m,crossAxis:x,alignmentAxis:j}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof j=="number"&&(x=o==="end"?j*-1:j),c?{x:x*f,y:m*d}:{x:m*d,y:x*f}}const eM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:l,y:r,placement:i,middlewareData:o}=t,c=await JA(t,e);return i===((n=o.offset)==null?void 0:n.placement)&&(a=o.arrow)!=null&&a.alignmentOffset?{}:{x:l+c.x,y:r+c.y,data:{...c,placement:i}}}}},tM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:l}=t,{mainAxis:r=!0,crossAxis:i=!1,limiter:o={fn:y=>{let{x:g,y:p}=y;return{x:g,y:p}}},...c}=Qs(e,t),d={x:n,y:a},f=await qi(t,c),h=fs(Zs(l)),m=kp(h);let x=d[m],j=d[h];if(r){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",p=x+f[y],b=x-f[g];x=Gh(p,x,b)}if(i){const y=h==="y"?"top":"left",g=h==="y"?"bottom":"right",p=j+f[y],b=j-f[g];j=Gh(p,j,b)}const v=o.fn({...t,[m]:x,[h]:j});return{...v,data:{x:v.x-n,y:v.y-a,enabled:{[m]:r,[h]:i}}}}}},nM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:l,rects:r,middlewareData:i}=t,{offset:o=0,mainAxis:c=!0,crossAxis:d=!0}=Qs(e,t),f={x:n,y:a},h=fs(l),m=kp(h);let x=f[m],j=f[h];const v=Qs(o,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const b=m==="y"?"height":"width",_=r.reference[m]-r.floating[b]+y.mainAxis,N=r.reference[m]+r.reference[b]-y.mainAxis;x<_?x=_:x>N&&(x=N)}if(d){var g,p;const b=m==="y"?"width":"height",_=["top","left"].includes(Zs(l)),N=r.reference[h]-r.floating[b]+(_&&((g=i.offset)==null?void 0:g[h])||0)+(_?0:y.crossAxis),C=r.reference[h]+r.reference[b]+(_?0:((p=i.offset)==null?void 0:p[h])||0)-(_?y.crossAxis:0);j<N?j=N:j>C&&(j=C)}return{[m]:x,[h]:j}}}},sM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:l,rects:r,platform:i,elements:o}=t,{apply:c=()=>{},...d}=Qs(e,t),f=await qi(t,d),h=Zs(l),m=Lr(l),x=fs(l)==="y",{width:j,height:v}=r.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,b=j-f.left-f.right,_=$a(v-f[y],p),N=$a(j-f[g],b),C=!t.middlewareData.shift;let w=_,k=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=b),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(w=p),C&&!m){const $=on(f.left,0),X=on(f.right,0),Y=on(f.top,0),L=on(f.bottom,0);x?k=j-2*($!==0||X!==0?$+X:on(f.left,f.right)):w=v-2*(Y!==0||L!==0?Y+L:on(f.top,f.bottom))}await c({...t,availableWidth:k,availableHeight:w});const A=await i.getDimensions(o.floating);return j!==A.width||v!==A.height?{reset:{rects:!0}}:{}}}};function cd(){return typeof window<"u"}function Ur(e){return j_(e)?(e.nodeName||"").toLowerCase():"#document"}function mn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ns(e){var t;return(t=(j_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function j_(e){return cd()?e instanceof Node||e instanceof mn(e).Node:!1}function Xn(e){return cd()?e instanceof Element||e instanceof mn(e).Element:!1}function bs(e){return cd()?e instanceof HTMLElement||e instanceof mn(e).HTMLElement:!1}function pv(e){return!cd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof mn(e).ShadowRoot}function wo(e){const{overflow:t,overflowX:n,overflowY:a,display:l}=Kn(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!["inline","contents"].includes(l)}function aM(e){return["table","td","th"].includes(Ur(e))}function ud(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Tp(e){const t=Rp(),n=Xn(e)?Kn(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 lM(e){let t=Da(e);for(;bs(t)&&!br(t);){if(Tp(t))return t;if(ud(t))return null;t=Da(t)}return null}function Rp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function br(e){return["html","body","#document"].includes(Ur(e))}function Kn(e){return mn(e).getComputedStyle(e)}function dd(e){return Xn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Da(e){if(Ur(e)==="html")return e;const t=e.assignedSlot||e.parentNode||pv(e)&&e.host||Ns(e);return pv(t)?t.host:t}function __(e){const t=Da(e);return br(t)?e.ownerDocument?e.ownerDocument.body:e.body:bs(t)&&wo(t)?t:__(t)}function Gi(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const l=__(e),r=l===((a=e.ownerDocument)==null?void 0:a.body),i=mn(l);if(r){const o=Yh(i);return t.concat(i,i.visualViewport||[],wo(l)?l:[],o&&n?Gi(o):[])}return t.concat(l,Gi(l,[],n))}function Yh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function w_(e){const t=Kn(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const l=bs(e),r=l?e.offsetWidth:n,i=l?e.offsetHeight:a,o=hu(n)!==r||hu(a)!==i;return o&&(n=r,a=i),{width:n,height:a,$:o}}function Ep(e){return Xn(e)?e:e.contextElement}function lr(e){const t=Ep(e);if(!bs(t))return gs(1);const n=t.getBoundingClientRect(),{width:a,height:l,$:r}=w_(t);let i=(r?hu(n.width):n.width)/a,o=(r?hu(n.height):n.height)/l;return(!i||!Number.isFinite(i))&&(i=1),(!o||!Number.isFinite(o))&&(o=1),{x:i,y:o}}const rM=gs(0);function N_(e){const t=mn(e);return!Rp()||!t.visualViewport?rM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iM(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==mn(e)?!1:t}function dl(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const l=e.getBoundingClientRect(),r=Ep(e);let i=gs(1);t&&(a?Xn(a)&&(i=lr(a)):i=lr(e));const o=iM(r,n,a)?N_(r):gs(0);let c=(l.left+o.x)/i.x,d=(l.top+o.y)/i.y,f=l.width/i.x,h=l.height/i.y;if(r){const m=mn(r),x=a&&Xn(a)?mn(a):a;let j=m,v=Yh(j);for(;v&&a&&x!==j;){const y=lr(v),g=v.getBoundingClientRect(),p=Kn(v),b=g.left+(v.clientLeft+parseFloat(p.paddingLeft))*y.x,_=g.top+(v.clientTop+parseFloat(p.paddingTop))*y.y;c*=y.x,d*=y.y,f*=y.x,h*=y.y,c+=b,d+=_,j=mn(v),v=Yh(j)}}return pu({width:f,height:h,x:c,y:d})}function Ap(e,t){const n=dd(e).scrollLeft;return t?t.left+n:dl(Ns(e)).left+n}function k_(e,t,n){n===void 0&&(n=!1);const a=e.getBoundingClientRect(),l=a.left+t.scrollLeft-(n?0:Ap(e,a)),r=a.top+t.scrollTop;return{x:l,y:r}}function oM(e){let{elements:t,rect:n,offsetParent:a,strategy:l}=e;const r=l==="fixed",i=Ns(a),o=t?ud(t.floating):!1;if(a===i||o&&r)return n;let c={scrollLeft:0,scrollTop:0},d=gs(1);const f=gs(0),h=bs(a);if((h||!h&&!r)&&((Ur(a)!=="body"||wo(i))&&(c=dd(a)),bs(a))){const x=dl(a);d=lr(a),f.x=x.x+a.clientLeft,f.y=x.y+a.clientTop}const m=i&&!h&&!r?k_(i,c,!0):gs(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 cM(e){return Array.from(e.getClientRects())}function uM(e){const t=Ns(e),n=dd(e),a=e.ownerDocument.body,l=on(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),r=on(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-n.scrollLeft+Ap(e);const o=-n.scrollTop;return Kn(a).direction==="rtl"&&(i+=on(t.clientWidth,a.clientWidth)-l),{width:l,height:r,x:i,y:o}}function dM(e,t){const n=mn(e),a=Ns(e),l=n.visualViewport;let r=a.clientWidth,i=a.clientHeight,o=0,c=0;if(l){r=l.width,i=l.height;const d=Rp();(!d||d&&t==="fixed")&&(o=l.offsetLeft,c=l.offsetTop)}return{width:r,height:i,x:o,y:c}}function fM(e,t){const n=dl(e,!0,t==="fixed"),a=n.top+e.clientTop,l=n.left+e.clientLeft,r=bs(e)?lr(e):gs(1),i=e.clientWidth*r.x,o=e.clientHeight*r.y,c=l*r.x,d=a*r.y;return{width:i,height:o,x:c,y:d}}function xv(e,t,n){let a;if(t==="viewport")a=dM(e,n);else if(t==="document")a=uM(Ns(e));else if(Xn(t))a=fM(t,n);else{const l=N_(e);a={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return pu(a)}function S_(e,t){const n=Da(e);return n===t||!Xn(n)||br(n)?!1:Kn(n).position==="fixed"||S_(n,t)}function hM(e,t){const n=t.get(e);if(n)return n;let a=Gi(e,[],!1).filter(o=>Xn(o)&&Ur(o)!=="body"),l=null;const r=Kn(e).position==="fixed";let i=r?Da(e):e;for(;Xn(i)&&!br(i);){const o=Kn(i),c=Tp(i);!c&&o.position==="fixed"&&(l=null),(r?!c&&!l:!c&&o.position==="static"&&!!l&&["absolute","fixed"].includes(l.position)||wo(i)&&!c&&S_(e,i))?a=a.filter(f=>f!==i):l=o,i=Da(i)}return t.set(e,a),a}function mM(e){let{element:t,boundary:n,rootBoundary:a,strategy:l}=e;const i=[...n==="clippingAncestors"?ud(t)?[]:hM(t,this._c):[].concat(n),a],o=i[0],c=i.reduce((d,f)=>{const h=xv(t,f,l);return d.top=on(h.top,d.top),d.right=$a(h.right,d.right),d.bottom=$a(h.bottom,d.bottom),d.left=on(h.left,d.left),d},xv(t,o,l));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function pM(e){const{width:t,height:n}=w_(e);return{width:t,height:n}}function xM(e,t,n){const a=bs(t),l=Ns(t),r=n==="fixed",i=dl(e,!0,r,t);let o={scrollLeft:0,scrollTop:0};const c=gs(0);function d(){c.x=Ap(l)}if(a||!a&&!r)if((Ur(t)!=="body"||wo(l))&&(o=dd(t)),a){const x=dl(t,!0,r,t);c.x=x.x+t.clientLeft,c.y=x.y+t.clientTop}else l&&d();r&&!a&&l&&d();const f=l&&!a&&!r?k_(l,o):gs(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 kf(e){return Kn(e).position==="static"}function gv(e,t){if(!bs(e)||Kn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ns(e)===n&&(n=n.ownerDocument.body),n}function C_(e,t){const n=mn(e);if(ud(e))return n;if(!bs(e)){let l=Da(e);for(;l&&!br(l);){if(Xn(l)&&!kf(l))return l;l=Da(l)}return n}let a=gv(e,t);for(;a&&aM(a)&&kf(a);)a=gv(a,t);return a&&br(a)&&kf(a)&&!Tp(a)?n:a||lM(e)||n}const gM=async function(e){const t=this.getOffsetParent||C_,n=this.getDimensions,a=await n(e.floating);return{reference:xM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function vM(e){return Kn(e).direction==="rtl"}const yM={convertOffsetParentRelativeRectToViewportRelativeRect:oM,getDocumentElement:Ns,getClippingRect:mM,getOffsetParent:C_,getElementRects:gM,getClientRects:cM,getDimensions:pM,getScale:lr,isElement:Xn,isRTL:vM};function T_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bM(e,t){let n=null,a;const l=Ns(e);function r(){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),r();const d=e.getBoundingClientRect(),{left:f,top:h,width:m,height:x}=d;if(o||t(),!m||!x)return;const j=sc(h),v=sc(l.clientWidth-(f+m)),y=sc(l.clientHeight-(h+x)),g=sc(f),b={rootMargin:-j+"px "+-v+"px "+-y+"px "+-g+"px",threshold:on(0,$a(1,c))||1};let _=!0;function N(C){const w=C[0].intersectionRatio;if(w!==c){if(!_)return i();w?i(!1,w):a=setTimeout(()=>{i(!1,1e-7)},1e3)}w===1&&!T_(d,e.getBoundingClientRect())&&i(),_=!1}try{n=new IntersectionObserver(N,{...b,root:l.ownerDocument})}catch{n=new IntersectionObserver(N,b)}n.observe(e)}return i(!0),r}function jM(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:l=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,d=Ep(e),f=l||r?[...d?Gi(d):[],...Gi(t)]:[];f.forEach(g=>{l&&g.addEventListener("scroll",n,{passive:!0}),r&&g.addEventListener("resize",n)});const h=d&&o?bM(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 b;(b=x)==null||b.observe(t)})),n()}),d&&!c&&x.observe(d),x.observe(t));let j,v=c?dl(e):null;c&&y();function y(){const g=dl(e);v&&!T_(v,g)&&n(),v=g,j=requestAnimationFrame(y)}return n(),()=>{var g;f.forEach(p=>{l&&p.removeEventListener("scroll",n),r&&p.removeEventListener("resize",n)}),h==null||h(),(g=x)==null||g.disconnect(),x=null,c&&cancelAnimationFrame(j)}}const _M=eM,wM=tM,NM=ZA,kM=sM,SM=WA,vv=QA,CM=nM,TM=(e,t,n)=>{const a=new Map,l={platform:yM,...n},r={...l.platform,_c:a};return KA(e,t,{...l,platform:r})};var RM=typeof document<"u",EM=function(){},Cc=RM?u.useLayoutEffect:EM;function xu(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,l;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(!xu(e[a],t[a]))return!1;return!0}if(l=Object.keys(e),n=l.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,l[a]))return!1;for(a=n;a--!==0;){const r=l[a];if(!(r==="_owner"&&e.$$typeof)&&!xu(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function R_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yv(e,t){const n=R_(e);return Math.round(t*n)/n}function Sf(e){const t=u.useRef(e);return Cc(()=>{t.current=e}),t}function AM(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:l,elements:{reference:r,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);xu(m,a)||x(a);const[j,v]=u.useState(null),[y,g]=u.useState(null),p=u.useCallback(S=>{S!==C.current&&(C.current=S,v(S))},[]),b=u.useCallback(S=>{S!==w.current&&(w.current=S,g(S))},[]),_=r||j,N=i||y,C=u.useRef(null),w=u.useRef(null),k=u.useRef(f),A=c!=null,$=Sf(c),X=Sf(l),Y=Sf(d),L=u.useCallback(()=>{if(!C.current||!w.current)return;const S={placement:t,strategy:n,middleware:m};X.current&&(S.platform=X.current),TM(C.current,w.current,S).then(O=>{const Z={...O,isPositioned:Y.current!==!1};H.current&&!xu(k.current,Z)&&(k.current=Z,Nr.flushSync(()=>{h(Z)}))})},[m,t,n,X,Y]);Cc(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,h(S=>({...S,isPositioned:!1})))},[d]);const H=u.useRef(!1);Cc(()=>(H.current=!0,()=>{H.current=!1}),[]),Cc(()=>{if(_&&(C.current=_),N&&(w.current=N),_&&N){if($.current)return $.current(_,N,L);L()}},[_,N,L,$,A]);const R=u.useMemo(()=>({reference:C,floating:w,setReference:p,setFloating:b}),[p,b]),T=u.useMemo(()=>({reference:_,floating:N}),[_,N]),z=u.useMemo(()=>{const S={position:n,left:0,top:0};if(!T.floating)return S;const O=yv(T.floating,f.x),Z=yv(T.floating,f.y);return o?{...S,transform:"translate("+O+"px, "+Z+"px)",...R_(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:Z}},[n,o,T.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:L,refs:R,elements:T,floatingStyles:z}),[f,L,R,T,z])}const MM=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:a,padding:l}=typeof e=="function"?e(n):e;return a&&t(a)?a.current!=null?vv({element:a.current,padding:l}).fn(n):{}:a?vv({element:a,padding:l}).fn(n):{}}}},OM=(e,t)=>({..._M(e),options:[e,t]}),$M=(e,t)=>({...wM(e),options:[e,t]}),DM=(e,t)=>({...CM(e),options:[e,t]}),zM=(e,t)=>({...NM(e),options:[e,t]}),LM=(e,t)=>({...kM(e),options:[e,t]}),UM=(e,t)=>({...SM(e),options:[e,t]}),BM=(e,t)=>({...MM(e),options:[e,t]});var HM="Arrow",E_=u.forwardRef((e,t)=>{const{children:n,width:a=10,height:l=5,...r}=e;return s.jsx(we.svg,{...r,ref:t,width:a,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});E_.displayName=HM;var IM=E_,Mp="Popper",[A_,Br]=ws(Mp),[PM,M_]=A_(Mp),O_=e=>{const{__scopePopper:t,children:n}=e,[a,l]=u.useState(null);return s.jsx(PM,{scope:t,anchor:a,onAnchorChange:l,children:n})};O_.displayName=Mp;var $_="PopperAnchor",D_=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...l}=e,r=M_($_,n),i=u.useRef(null),o=Ie(t,i);return u.useEffect(()=>{r.onAnchorChange((a==null?void 0:a.current)||i.current)}),a?null:s.jsx(we.div,{...l,ref:o})});D_.displayName=$_;var Op="PopperContent",[qM,GM]=A_(Op),z_=u.forwardRef((e,t)=>{var M,V,ae,B,te,J;const{__scopePopper:n,side:a="bottom",sideOffset:l=0,align:r="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:j,...v}=e,y=M_(Op,n),[g,p]=u.useState(null),b=Ie(t,le=>p(le)),[_,N]=u.useState(null),C=f_(_),w=(C==null?void 0:C.width)??0,k=(C==null?void 0:C.height)??0,A=a+(r!=="center"?"-"+r:""),$=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},X=Array.isArray(d)?d:[d],Y=X.length>0,L={padding:$,boundary:X.filter(YM),altBoundary:Y},{refs:H,floatingStyles:R,placement:T,isPositioned:z,middlewareData:S}=AM({strategy:"fixed",placement:A,whileElementsMounted:(...le)=>jM(...le,{animationFrame:x==="always"}),elements:{reference:y.anchor},middleware:[OM({mainAxis:l+k,alignmentAxis:i}),c&&$M({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?DM():void 0,...L}),c&&zM({...L}),LM({...L,apply:({elements:le,rects:W,availableWidth:Qe,availableHeight:oe})=>{const{width:Oe,height:K}=W.reference,Ne=le.floating.style;Ne.setProperty("--radix-popper-available-width",`${Qe}px`),Ne.setProperty("--radix-popper-available-height",`${oe}px`),Ne.setProperty("--radix-popper-anchor-width",`${Oe}px`),Ne.setProperty("--radix-popper-anchor-height",`${K}px`)}}),_&&BM({element:_,padding:o}),FM({arrowWidth:w,arrowHeight:k}),m&&UM({strategy:"referenceHidden",...L})]}),[O,Z]=B_(T),E=ys(j);Pt(()=>{z&&(E==null||E())},[z,E]);const I=(M=S.arrow)==null?void 0:M.x,ne=(V=S.arrow)==null?void 0:V.y,ee=((ae=S.arrow)==null?void 0:ae.centerOffset)!==0,[ge,G]=u.useState();return Pt(()=>{g&&G(window.getComputedStyle(g).zIndex)},[g]),s.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:z?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(B=S.transformOrigin)==null?void 0:B.x,(te=S.transformOrigin)==null?void 0:te.y].join(" "),...((J=S.hide)==null?void 0:J.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(qM,{scope:n,placedSide:O,onArrowChange:N,arrowX:I,arrowY:ne,shouldHideArrow:ee,children:s.jsx(we.div,{"data-side":O,"data-align":Z,...v,ref:b,style:{...v.style,animation:z?void 0:"none"}})})})});z_.displayName=Op;var L_="PopperArrow",VM={top:"bottom",right:"left",bottom:"top",left:"right"},U_=u.forwardRef(function(t,n){const{__scopePopper:a,...l}=t,r=GM(L_,a),i=VM[r.placedSide];return s.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:s.jsx(IM,{...l,ref:n,style:{...l.style,display:"block"}})})});U_.displayName=L_;function YM(e){return e!==null}var FM=e=>({name:"transformOrigin",options:e,fn(t){var y,g,p;const{placement:n,rects:a,middlewareData:l}=t,i=((y=l.arrow)==null?void 0:y.centerOffset)!==0,o=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=B_(n),h={start:"0%",center:"50%",end:"100%"}[f],m=(((g=l.arrow)==null?void 0:g.x)??0)+o/2,x=(((p=l.arrow)==null?void 0:p.y)??0)+c/2;let j="",v="";return d==="bottom"?(j=i?h:`${m}px`,v=`${-c}px`):d==="top"?(j=i?h:`${m}px`,v=`${a.floating.height+c}px`):d==="right"?(j=`${-c}px`,v=i?h:`${x}px`):d==="left"&&(j=`${a.floating.width+c}px`,v=i?h:`${x}px`),{data:{x:j,y:v}}}});function B_(e){const[t,n="center"]=e.split("-");return[t,n]}var $p=O_,Dp=D_,zp=z_,Lp=U_,Cf="rovingFocusGroup.onEntryFocus",XM={bubbles:!1,cancelable:!0},No="RovingFocusGroup",[Fh,H_,KM]=Np(No),[QM,fd]=ws(No,[KM]),[ZM,WM]=QM(No),I_=u.forwardRef((e,t)=>s.jsx(Fh.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Fh.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(JM,{...e,ref:t})})}));I_.displayName=No;var JM=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:l=!1,dir:r,currentTabStopId:i,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,m=u.useRef(null),x=Ie(t,m),j=od(r),[v,y]=Oa({prop:i,defaultProp:o??null,onChange:c,caller:No}),[g,p]=u.useState(!1),b=ys(d),_=H_(n),N=u.useRef(!1),[C,w]=u.useState(0);return u.useEffect(()=>{const k=m.current;if(k)return k.addEventListener(Cf,b),()=>k.removeEventListener(Cf,b)},[b]),s.jsx(ZM,{scope:n,orientation:a,dir:j,loop:l,currentTabStopId:v,onItemFocus:u.useCallback(k=>y(k),[y]),onItemShiftTab:u.useCallback(()=>p(!0),[]),onFocusableItemAdd:u.useCallback(()=>w(k=>k+1),[]),onFocusableItemRemove:u.useCallback(()=>w(k=>k-1),[]),children:s.jsx(we.div,{tabIndex:g||C===0?-1:0,"data-orientation":a,...h,ref:x,style:{outline:"none",...e.style},onMouseDown:ce(e.onMouseDown,()=>{N.current=!0}),onFocus:ce(e.onFocus,k=>{const A=!N.current;if(k.target===k.currentTarget&&A&&!g){const $=new CustomEvent(Cf,XM);if(k.currentTarget.dispatchEvent($),!$.defaultPrevented){const X=_().filter(T=>T.focusable),Y=X.find(T=>T.active),L=X.find(T=>T.id===v),R=[Y,L,...X].filter(Boolean).map(T=>T.ref.current);G_(R,f)}}N.current=!1}),onBlur:ce(e.onBlur,()=>p(!1))})})}),P_="RovingFocusGroupItem",q_=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:l=!1,tabStopId:r,children:i,...o}=e,c=Vn(),d=r||c,f=WM(P_,n),h=f.currentTabStopId===d,m=H_(n),{onFocusableItemAdd:x,onFocusableItemRemove:j,currentTabStopId:v}=f;return u.useEffect(()=>{if(a)return x(),()=>j()},[a,x,j]),s.jsx(Fh.ItemSlot,{scope:n,id:d,focusable:a,active:l,children:s.jsx(we.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...o,ref:t,onMouseDown:ce(e.onMouseDown,y=>{a?f.onItemFocus(d):y.preventDefault()}),onFocus:ce(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:ce(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=nO(y,f.orientation,f.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let b=m().filter(_=>_.focusable).map(_=>_.ref.current);if(g==="last")b.reverse();else if(g==="prev"||g==="next"){g==="prev"&&b.reverse();const _=b.indexOf(y.currentTarget);b=f.loop?sO(b,_+1):b.slice(_+1)}setTimeout(()=>G_(b))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:v!=null}):i})})});q_.displayName=P_;var eO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function nO(e,t,n){const a=tO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return eO[a]}function G_(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function sO(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var V_=I_,Y_=q_,Xh=["Enter"," "],aO=["ArrowDown","PageUp","Home"],F_=["ArrowUp","PageDown","End"],lO=[...aO,...F_],rO={ltr:[...Xh,"ArrowRight"],rtl:[...Xh,"ArrowLeft"]},iO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ko="Menu",[Vi,oO,cO]=Np(ko),[yl,X_]=ws(ko,[cO,Br,fd]),hd=Br(),K_=fd(),[uO,bl]=yl(ko),[dO,So]=yl(ko),Q_=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:l,onOpenChange:r,modal:i=!0}=e,o=hd(t),[c,d]=u.useState(null),f=u.useRef(!1),h=ys(r),m=od(l);return u.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),s.jsx($p,{...o,children:s.jsx(uO,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:s.jsx(dO,{scope:t,onClose:u.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:m,modal:i,children:a})})})};Q_.displayName=ko;var fO="MenuAnchor",Up=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=hd(n);return s.jsx(Dp,{...l,...a,ref:t})});Up.displayName=fO;var Bp="MenuPortal",[hO,Z_]=yl(Bp,{forceMount:void 0}),W_=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:l}=e,r=bl(Bp,t);return s.jsx(hO,{scope:t,forceMount:n,children:s.jsx($n,{present:n||r.open,children:s.jsx(bo,{asChild:!0,container:l,children:a})})})};W_.displayName=Bp;var Rn="MenuContent",[mO,Hp]=yl(Rn),J_=u.forwardRef((e,t)=>{const n=Z_(Rn,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,r=bl(Rn,e.__scopeMenu),i=So(Rn,e.__scopeMenu);return s.jsx(Vi.Provider,{scope:e.__scopeMenu,children:s.jsx($n,{present:a||r.open,children:s.jsx(Vi.Slot,{scope:e.__scopeMenu,children:i.modal?s.jsx(pO,{...l,ref:t}):s.jsx(xO,{...l,ref:t})})})})}),pO=u.forwardRef((e,t)=>{const n=bl(Rn,e.__scopeMenu),a=u.useRef(null),l=Ie(t,a);return u.useEffect(()=>{const r=a.current;if(r)return gp(r)},[]),s.jsx(Ip,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ce(e.onFocusOutside,r=>r.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),xO=u.forwardRef((e,t)=>{const n=bl(Rn,e.__scopeMenu);return s.jsx(Ip,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),gO=cl("MenuContent.ScrollLock"),Ip=u.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:l,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,disableOutsideScroll:j,...v}=e,y=bl(Rn,n),g=So(Rn,n),p=hd(n),b=K_(n),_=oO(n),[N,C]=u.useState(null),w=u.useRef(null),k=Ie(t,w,y.onContentChange),A=u.useRef(0),$=u.useRef(""),X=u.useRef(0),Y=u.useRef(null),L=u.useRef("right"),H=u.useRef(0),R=j?ad:u.Fragment,T=j?{as:gO,allowPinchZoom:!0}:void 0,z=O=>{var M,V;const Z=$.current+O,E=_().filter(ae=>!ae.disabled),I=document.activeElement,ne=(M=E.find(ae=>ae.ref.current===I))==null?void 0:M.textValue,ee=E.map(ae=>ae.textValue),ge=RO(ee,Z,ne),G=(V=E.find(ae=>ae.textValue===ge))==null?void 0:V.ref.current;(function ae(B){$.current=B,window.clearTimeout(A.current),B!==""&&(A.current=window.setTimeout(()=>ae(""),1e3))})(Z),G&&setTimeout(()=>G.focus())};u.useEffect(()=>()=>window.clearTimeout(A.current),[]),xp();const S=u.useCallback(O=>{var E,I;return L.current===((E=Y.current)==null?void 0:E.side)&&AO(O,(I=Y.current)==null?void 0:I.area)},[]);return s.jsx(mO,{scope:n,searchRef:$,onItemEnter:u.useCallback(O=>{S(O)&&O.preventDefault()},[S]),onItemLeave:u.useCallback(O=>{var Z;S(O)||((Z=w.current)==null||Z.focus(),C(null))},[S]),onTriggerLeave:u.useCallback(O=>{S(O)&&O.preventDefault()},[S]),pointerGraceTimerRef:X,onPointerGraceIntentChange:u.useCallback(O=>{Y.current=O},[]),children:s.jsx(R,{...T,children:s.jsx(nd,{asChild:!0,trapped:l,onMountAutoFocus:ce(r,O=>{var Z;O.preventDefault(),(Z=w.current)==null||Z.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:s.jsx(yo,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,children:s.jsx(V_,{asChild:!0,...b,dir:g.dir,orientation:"vertical",loop:a,currentTabStopId:N,onCurrentTabStopIdChange:C,onEntryFocus:ce(c,O=>{g.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(zp,{role:"menu","aria-orientation":"vertical","data-state":pw(y.open),"data-radix-menu-content":"",dir:g.dir,...p,...v,ref:k,style:{outline:"none",...v.style},onKeyDown:ce(v.onKeyDown,O=>{const E=O.target.closest("[data-radix-menu-content]")===O.currentTarget,I=O.ctrlKey||O.altKey||O.metaKey,ne=O.key.length===1;E&&(O.key==="Tab"&&O.preventDefault(),!I&&ne&&z(O.key));const ee=w.current;if(O.target!==ee||!lO.includes(O.key))return;O.preventDefault();const G=_().filter(M=>!M.disabled).map(M=>M.ref.current);F_.includes(O.key)&&G.reverse(),CO(G)}),onBlur:ce(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(A.current),$.current="")}),onPointerMove:ce(e.onPointerMove,Yi(O=>{const Z=O.target,E=H.current!==O.clientX;if(O.currentTarget.contains(Z)&&E){const I=O.clientX>H.current?"right":"left";L.current=I,H.current=O.clientX}}))})})})})})})});J_.displayName=Rn;var vO="MenuGroup",Pp=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(we.div,{role:"group",...a,ref:t})});Pp.displayName=vO;var yO="MenuLabel",ew=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(we.div,{...a,ref:t})});ew.displayName=yO;var gu="MenuItem",bv="menu.itemSelect",md=u.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...l}=e,r=u.useRef(null),i=So(gu,e.__scopeMenu),o=Hp(gu,e.__scopeMenu),c=Ie(t,r),d=u.useRef(!1),f=()=>{const h=r.current;if(!n&&h){const m=new CustomEvent(bv,{bubbles:!0,cancelable:!0});h.addEventListener(bv,x=>a==null?void 0:a(x),{once:!0}),w0(h,m),m.defaultPrevented?d.current=!1:i.onClose()}};return s.jsx(tw,{...l,ref:c,disabled:n,onClick:ce(e.onClick,f),onPointerDown:h=>{var m;(m=e.onPointerDown)==null||m.call(e,h),d.current=!0},onPointerUp:ce(e.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:ce(e.onKeyDown,h=>{const m=o.searchRef.current!=="";n||m&&h.key===" "||Xh.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});md.displayName=gu;var tw=u.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:l,...r}=e,i=Hp(gu,n),o=K_(n),c=u.useRef(null),d=Ie(t,c),[f,h]=u.useState(!1),[m,x]=u.useState("");return u.useEffect(()=>{const j=c.current;j&&x((j.textContent??"").trim())},[r.children]),s.jsx(Vi.ItemSlot,{scope:n,disabled:a,textValue:l??m,children:s.jsx(Y_,{asChild:!0,...o,focusable:!a,children:s.jsx(we.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...r,ref:d,onPointerMove:ce(e.onPointerMove,Yi(j=>{a?i.onItemLeave(j):(i.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(e.onPointerLeave,Yi(j=>i.onItemLeave(j))),onFocus:ce(e.onFocus,()=>h(!0)),onBlur:ce(e.onBlur,()=>h(!1))})})})}),bO="MenuCheckboxItem",nw=u.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...l}=e;return s.jsx(iw,{scope:e.__scopeMenu,checked:n,children:s.jsx(md,{role:"menuitemcheckbox","aria-checked":vu(n)?"mixed":n,...l,ref:t,"data-state":Gp(n),onSelect:ce(l.onSelect,()=>a==null?void 0:a(vu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});nw.displayName=bO;var sw="MenuRadioGroup",[jO,_O]=yl(sw,{value:void 0,onValueChange:()=>{}}),aw=u.forwardRef((e,t)=>{const{value:n,onValueChange:a,...l}=e,r=ys(a);return s.jsx(jO,{scope:e.__scopeMenu,value:n,onValueChange:r,children:s.jsx(Pp,{...l,ref:t})})});aw.displayName=sw;var lw="MenuRadioItem",rw=u.forwardRef((e,t)=>{const{value:n,...a}=e,l=_O(lw,e.__scopeMenu),r=n===l.value;return s.jsx(iw,{scope:e.__scopeMenu,checked:r,children:s.jsx(md,{role:"menuitemradio","aria-checked":r,...a,ref:t,"data-state":Gp(r),onSelect:ce(a.onSelect,()=>{var i;return(i=l.onValueChange)==null?void 0:i.call(l,n)},{checkForDefaultPrevented:!1})})})});rw.displayName=lw;var qp="MenuItemIndicator",[iw,wO]=yl(qp,{checked:!1}),ow=u.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...l}=e,r=wO(qp,n);return s.jsx($n,{present:a||vu(r.checked)||r.checked===!0,children:s.jsx(we.span,{...l,ref:t,"data-state":Gp(r.checked)})})});ow.displayName=qp;var NO="MenuSeparator",cw=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(we.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});cw.displayName=NO;var kO="MenuArrow",uw=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=hd(n);return s.jsx(Lp,{...l,...a,ref:t})});uw.displayName=kO;var SO="MenuSub",[F6,dw]=yl(SO),ri="MenuSubTrigger",fw=u.forwardRef((e,t)=>{const n=bl(ri,e.__scopeMenu),a=So(ri,e.__scopeMenu),l=dw(ri,e.__scopeMenu),r=Hp(ri,e.__scopeMenu),i=u.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:c}=r,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(Up,{asChild:!0,...d,children:s.jsx(tw,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":l.contentId,"data-state":pw(n.open),...e,ref:td(t,l.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:ce(e.onPointerMove,Yi(h=>{r.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(r.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:ce(e.onPointerLeave,Yi(h=>{var x,j;f();const m=(x=n.content)==null?void 0:x.getBoundingClientRect();if(m){const v=(j=n.content)==null?void 0:j.dataset.side,y=v==="right",g=y?-5:5,p=m[y?"left":"right"],b=m[y?"right":"left"];r.onPointerGraceIntentChange({area:[{x:h.clientX+g,y:h.clientY},{x:p,y:m.top},{x:b,y:m.top},{x:b,y:m.bottom},{x:p,y:m.bottom}],side:v}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>r.onPointerGraceIntentChange(null),300)}else{if(r.onTriggerLeave(h),h.defaultPrevented)return;r.onPointerGraceIntentChange(null)}})),onKeyDown:ce(e.onKeyDown,h=>{var x;const m=r.searchRef.current!=="";e.disabled||m&&h.key===" "||rO[a.dir].includes(h.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),h.preventDefault())})})})});fw.displayName=ri;var hw="MenuSubContent",mw=u.forwardRef((e,t)=>{const n=Z_(Rn,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,r=bl(Rn,e.__scopeMenu),i=So(Rn,e.__scopeMenu),o=dw(hw,e.__scopeMenu),c=u.useRef(null),d=Ie(t,c);return s.jsx(Vi.Provider,{scope:e.__scopeMenu,children:s.jsx($n,{present:a||r.open,children:s.jsx(Vi.Slot,{scope:e.__scopeMenu,children:s.jsx(Ip,{id:o.contentId,"aria-labelledby":o.triggerId,...l,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:ce(e.onFocusOutside,f=>{f.target!==o.trigger&&r.onOpenChange(!1)}),onEscapeKeyDown:ce(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:ce(e.onKeyDown,f=>{var x;const h=f.currentTarget.contains(f.target),m=iO[i.dir].includes(f.key);h&&m&&(r.onOpenChange(!1),(x=o.trigger)==null||x.focus(),f.preventDefault())})})})})})});mw.displayName=hw;function pw(e){return e?"open":"closed"}function vu(e){return e==="indeterminate"}function Gp(e){return vu(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 TO(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function RO(e,t,n){const l=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,r=n?e.indexOf(n):-1;let i=TO(e,Math.max(r,0));l.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(l.toLowerCase()));return c!==n?c:void 0}function EO(e,t){const{x:n,y:a}=e;let l=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){const o=t[r],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&&(l=!l)}return l}function AO(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return EO(n,t)}function Yi(e){return t=>t.pointerType==="mouse"?e(t):void 0}var MO=Q_,OO=Up,$O=W_,DO=J_,zO=Pp,LO=ew,UO=md,BO=nw,HO=aw,IO=rw,PO=ow,qO=cw,GO=uw,VO=fw,YO=mw,pd="DropdownMenu",[FO]=ws(pd,[X_]),Yt=X_(),[XO,xw]=FO(pd),gw=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:l,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,c=Yt(t),d=u.useRef(null),[f,h]=Oa({prop:l,defaultProp:r??!1,onChange:i,caller:pd});return s.jsx(XO,{scope:t,triggerId:Vn(),triggerRef:d,contentId:Vn(),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})})};gw.displayName=pd;var vw="DropdownMenuTrigger",yw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...l}=e,r=xw(vw,n),i=Yt(n);return s.jsx(OO,{asChild:!0,...i,children:s.jsx(we.button,{type:"button",id:r.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":r.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...l,ref:td(t,r.triggerRef),onPointerDown:ce(e.onPointerDown,o=>{!a&&o.button===0&&o.ctrlKey===!1&&(r.onOpenToggle(),r.open||o.preventDefault())}),onKeyDown:ce(e.onKeyDown,o=>{a||(["Enter"," "].includes(o.key)&&r.onOpenToggle(),o.key==="ArrowDown"&&r.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});yw.displayName=vw;var KO="DropdownMenuPortal",bw=e=>{const{__scopeDropdownMenu:t,...n}=e,a=Yt(t);return s.jsx($O,{...a,...n})};bw.displayName=KO;var jw="DropdownMenuContent",_w=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=xw(jw,n),r=Yt(n),i=u.useRef(!1);return s.jsx(DO,{id:l.contentId,"aria-labelledby":l.triggerId,...r,...a,ref:t,onCloseAutoFocus:ce(e.onCloseAutoFocus,o=>{var c;i.current||(c=l.triggerRef.current)==null||c.focus(),i.current=!1,o.preventDefault()}),onInteractOutside:ce(e.onInteractOutside,o=>{const c=o.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!l.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)"}})});_w.displayName=jw;var QO="DropdownMenuGroup",ZO=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(zO,{...l,...a,ref:t})});ZO.displayName=QO;var WO="DropdownMenuLabel",ww=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(LO,{...l,...a,ref:t})});ww.displayName=WO;var JO="DropdownMenuItem",Nw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(UO,{...l,...a,ref:t})});Nw.displayName=JO;var e4="DropdownMenuCheckboxItem",kw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(BO,{...l,...a,ref:t})});kw.displayName=e4;var t4="DropdownMenuRadioGroup",n4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(HO,{...l,...a,ref:t})});n4.displayName=t4;var s4="DropdownMenuRadioItem",Sw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(IO,{...l,...a,ref:t})});Sw.displayName=s4;var a4="DropdownMenuItemIndicator",Cw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(PO,{...l,...a,ref:t})});Cw.displayName=a4;var l4="DropdownMenuSeparator",Tw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(qO,{...l,...a,ref:t})});Tw.displayName=l4;var r4="DropdownMenuArrow",i4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(GO,{...l,...a,ref:t})});i4.displayName=r4;var o4="DropdownMenuSubTrigger",Rw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(VO,{...l,...a,ref:t})});Rw.displayName=o4;var c4="DropdownMenuSubContent",Ew=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(YO,{...l,...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)"}})});Ew.displayName=c4;var u4=gw,d4=yw,f4=bw,Aw=_w,Mw=ww,Ow=Nw,$w=kw,Dw=Sw,zw=Cw,Lw=Tw,Uw=Rw,Bw=Ew;const xd=u4,gd=d4,h4=u.forwardRef(({className:e,inset:t,children:n,...a},l)=>s.jsxs(Uw,{ref:l,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(n0,{className:"ml-auto"})]}));h4.displayName=Uw.displayName;const m4=u.forwardRef(({className:e,...t},n)=>s.jsx(Bw,{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}));m4.displayName=Bw.displayName;const Co=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>s.jsx(f4,{container:jo(),children:s.jsx(Aw,{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})}));Co.displayName=Aw.displayName;const jr=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(Ow,{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}));jr.displayName=Ow.displayName;const p4=u.forwardRef(({className:e,children:t,checked:n,...a},l)=>s.jsxs($w,{ref:l,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(zw,{children:s.jsx(Mr,{className:"h-4 w-4"})})}),t]}));p4.displayName=$w.displayName;const x4=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(Dw,{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(zw,{children:s.jsx(KC,{className:"h-2 w-2 fill-current"})})}),t]}));x4.displayName=Dw.displayName;const g4=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(Mw,{ref:a,className:ie("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));g4.displayName=Mw.displayName;const v4=u.forwardRef(({className:e,...t},n)=>s.jsx(Lw,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));v4.displayName=Lw.displayName;const y4={default:"h-9 px-3 py-1 text-sm",control:"h-7 px-2 py-1 text-xs"},Ot=u.forwardRef(({className:e,type:t,inputSize:n="default",...a},l)=>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",y4[n],e),ref:l,...a}));Ot.displayName="Input";var b4="Label",Hw=u.forwardRef((e,t)=>s.jsx(we.label,{...e,ref:t,onMouseDown:n=>{var l;n.target.closest("button, input, select, textarea")||((l=e.onMouseDown)==null||l.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Hw.displayName=b4;var Iw=Hw;const j4=vo("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Me=u.forwardRef(({className:e,...t},n)=>s.jsx(Iw,{ref:n,className:ie(j4(),e),...t}));Me.displayName=Iw.displayName;function Ba({title:e,description:t,backHref:n,backLabel:a,className:l,icon:r,link:i}){const o=s.jsx(P,{asChild:!0,variant:"outline",size:"sm",className:"mt-4 no-underline",children:s.jsx(i,{href:n,children:a})});return r?s.jsx("div",{className:ie("flex-1 px-4 py-8 sm:px-6 lg:px-8",l),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:r}),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",l),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 Ft({title:e,description:t,actions:n,className:a,children:l,...r}){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),...r,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,l]}),n?s.jsx("div",{"data-slot":"page-header-actions",className:"flex shrink-0 items-center gap-2",children:n}):null]})}function jt({as:e="div",className:t,...n}){return s.jsx(e,{className:ie("rounded-lg border",t),...n})}function jv(e,[t,n]){return Math.min(n,Math.max(t,e))}var Pw=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"}),_4="VisuallyHidden",qw=u.forwardRef((e,t)=>s.jsx(we.span,{...e,ref:t,style:{...Pw,...e.style}}));qw.displayName=_4;var w4=qw,N4=[" ","Enter","ArrowUp","ArrowDown"],k4=[" ","Enter"],fl="Select",[vd,yd,S4]=Np(fl),[Hr]=ws(fl,[S4,Br]),bd=Br(),[C4,Ha]=Hr(fl),[T4,R4]=Hr(fl),Gw=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:l,onOpenChange:r,value:i,defaultValue:o,onValueChange:c,dir:d,name:f,autoComplete:h,disabled:m,required:x,form:j}=e,v=bd(t),[y,g]=u.useState(null),[p,b]=u.useState(null),[_,N]=u.useState(!1),C=od(d),[w,k]=Oa({prop:a,defaultProp:l??!1,onChange:r,caller:fl}),[A,$]=Oa({prop:i,defaultProp:o,onChange:c,caller:fl}),X=u.useRef(null),Y=y?j||!!y.closest("form"):!0,[L,H]=u.useState(new Set),R=Array.from(L).map(T=>T.props.value).join(";");return s.jsx($p,{...v,children:s.jsxs(C4,{required:x,scope:t,trigger:y,onTriggerChange:g,valueNode:p,onValueNodeChange:b,valueNodeHasChildren:_,onValueNodeHasChildrenChange:N,contentId:Vn(),value:A,onValueChange:$,open:w,onOpenChange:k,dir:C,triggerPointerDownPosRef:X,disabled:m,children:[s.jsx(vd.Provider,{scope:t,children:s.jsx(T4,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(T=>{H(z=>new Set(z).add(T))},[]),onNativeOptionRemove:u.useCallback(T=>{H(z=>{const S=new Set(z);return S.delete(T),S})},[]),children:n})}),Y?s.jsxs(mN,{"aria-hidden":!0,required:x,tabIndex:-1,name:f,autoComplete:h,value:A,onChange:T=>$(T.target.value),disabled:m,form:j,children:[A===void 0?s.jsx("option",{value:""}):null,Array.from(L)]},R):null]})})};Gw.displayName=fl;var Vw="SelectTrigger",Yw=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...l}=e,r=bd(n),i=Ha(Vw,n),o=i.disabled||a,c=Ie(t,i.onTriggerChange),d=yd(n),f=u.useRef("touch"),[h,m,x]=xN(v=>{const y=d().filter(b=>!b.disabled),g=y.find(b=>b.value===i.value),p=gN(y,v,g);p!==void 0&&i.onValueChange(p.value)}),j=v=>{o||(i.onOpenChange(!0),x()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return s.jsx(Dp,{asChild:!0,...r,children:s.jsx(we.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":pN(i.value)?"":void 0,...l,ref:c,onClick:ce(l.onClick,v=>{v.currentTarget.focus(),f.current!=="mouse"&&j(v)}),onPointerDown:ce(l.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"&&(j(v),v.preventDefault())}),onKeyDown:ce(l.onKeyDown,v=>{const y=h.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(y&&v.key===" ")&&N4.includes(v.key)&&(j(),v.preventDefault())})})})});Yw.displayName=Vw;var Fw="SelectValue",Xw=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:l,children:r,placeholder:i="",...o}=e,c=Ha(Fw,n),{onValueNodeHasChildrenChange:d}=c,f=r!==void 0,h=Ie(t,c.onValueNodeChange);return Pt(()=>{d(f)},[d,f]),s.jsx(we.span,{...o,ref:h,style:{pointerEvents:"none"},children:pN(c.value)?s.jsx(s.Fragment,{children:i}):r})});Xw.displayName=Fw;var E4="SelectIcon",Kw=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...l}=e;return s.jsx(we.span,{"aria-hidden":!0,...l,ref:t,children:a||"▼"})});Kw.displayName=E4;var A4="SelectPortal",Qw=e=>s.jsx(bo,{asChild:!0,...e});Qw.displayName=A4;var hl="SelectContent",Zw=u.forwardRef((e,t)=>{const n=Ha(hl,e.__scopeSelect),[a,l]=u.useState();if(Pt(()=>{l(new DocumentFragment)},[]),!n.open){const r=a;return r?Nr.createPortal(s.jsx(Ww,{scope:e.__scopeSelect,children:s.jsx(vd.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),r):null}return s.jsx(Jw,{...e,ref:t})});Zw.displayName=hl;var Un=10,[Ww,Ia]=Hr(hl),M4="SelectContentImpl",O4=cl("SelectContent.RemoveScroll"),Jw=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:r,onPointerDownOutside:i,side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:j,hideWhenDetached:v,avoidCollisions:y,...g}=e,p=Ha(hl,n),[b,_]=u.useState(null),[N,C]=u.useState(null),w=Ie(t,M=>_(M)),[k,A]=u.useState(null),[$,X]=u.useState(null),Y=yd(n),[L,H]=u.useState(!1),R=u.useRef(!1);u.useEffect(()=>{if(b)return gp(b)},[b]),xp();const T=u.useCallback(M=>{const[V,...ae]=Y().map(J=>J.ref.current),[B]=ae.slice(-1),te=document.activeElement;for(const J of M)if(J===te||(J==null||J.scrollIntoView({block:"nearest"}),J===V&&N&&(N.scrollTop=0),J===B&&N&&(N.scrollTop=N.scrollHeight),J==null||J.focus(),document.activeElement!==te))return},[Y,N]),z=u.useCallback(()=>T([k,b]),[T,k,b]);u.useEffect(()=>{L&&z()},[L,z]);const{onOpenChange:S,triggerPointerDownPosRef:O}=p;u.useEffect(()=>{if(b){let M={x:0,y:0};const V=B=>{var te,J;M={x:Math.abs(Math.round(B.pageX)-(((te=O.current)==null?void 0:te.x)??0)),y:Math.abs(Math.round(B.pageY)-(((J=O.current)==null?void 0:J.y)??0))}},ae=B=>{M.x<=10&&M.y<=10?B.preventDefault():b.contains(B.target)||S(!1),document.removeEventListener("pointermove",V),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",V),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",V),document.removeEventListener("pointerup",ae,{capture:!0})}}},[b,S,O]),u.useEffect(()=>{const M=()=>S(!1);return window.addEventListener("blur",M),window.addEventListener("resize",M),()=>{window.removeEventListener("blur",M),window.removeEventListener("resize",M)}},[S]);const[Z,E]=xN(M=>{const V=Y().filter(te=>!te.disabled),ae=V.find(te=>te.ref.current===document.activeElement),B=gN(V,M,ae);B&&setTimeout(()=>B.ref.current.focus())}),I=u.useCallback((M,V,ae)=>{const B=!R.current&&!ae;(p.value!==void 0&&p.value===V||B)&&(A(M),B&&(R.current=!0))},[p.value]),ne=u.useCallback(()=>b==null?void 0:b.focus(),[b]),ee=u.useCallback((M,V,ae)=>{const B=!R.current&&!ae;(p.value!==void 0&&p.value===V||B)&&X(M)},[p.value]),ge=a==="popper"?Kh:eN,G=ge===Kh?{side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:j,hideWhenDetached:v,avoidCollisions:y}:{};return s.jsx(Ww,{scope:n,content:b,viewport:N,onViewportChange:C,itemRefCallback:I,selectedItem:k,onItemLeave:ne,itemTextRefCallback:ee,focusSelectedItem:z,selectedItemText:$,position:a,isPositioned:L,searchRef:Z,children:s.jsx(ad,{as:O4,allowPinchZoom:!0,children:s.jsx(nd,{asChild:!0,trapped:p.open,onMountAutoFocus:M=>{M.preventDefault()},onUnmountAutoFocus:ce(l,M=>{var V;(V=p.trigger)==null||V.focus({preventScroll:!0}),M.preventDefault()}),children:s.jsx(yo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:M=>M.preventDefault(),onDismiss:()=>p.onOpenChange(!1),children:s.jsx(ge,{role:"listbox",id:p.contentId,"data-state":p.open?"open":"closed",dir:p.dir,onContextMenu:M=>M.preventDefault(),...g,...G,onPlaced:()=>H(!0),ref:w,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:ce(g.onKeyDown,M=>{const V=M.ctrlKey||M.altKey||M.metaKey;if(M.key==="Tab"&&M.preventDefault(),!V&&M.key.length===1&&E(M.key),["ArrowUp","ArrowDown","Home","End"].includes(M.key)){let B=Y().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(M.key)&&(B=B.slice().reverse()),["ArrowUp","ArrowDown"].includes(M.key)){const te=M.target,J=B.indexOf(te);B=B.slice(J+1)}setTimeout(()=>T(B)),M.preventDefault()}})})})})})})});Jw.displayName=M4;var $4="SelectItemAlignedPosition",eN=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...l}=e,r=Ha(hl,n),i=Ia(hl,n),[o,c]=u.useState(null),[d,f]=u.useState(null),h=Ie(t,w=>f(w)),m=yd(n),x=u.useRef(!1),j=u.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:g,focusSelectedItem:p}=i,b=u.useCallback(()=>{if(r.trigger&&r.valueNode&&o&&d&&v&&y&&g){const w=r.trigger.getBoundingClientRect(),k=d.getBoundingClientRect(),A=r.valueNode.getBoundingClientRect(),$=g.getBoundingClientRect();if(r.dir!=="rtl"){const te=$.left-k.left,J=A.left-te,le=w.left-J,W=w.width+le,Qe=Math.max(W,k.width),oe=window.innerWidth-Un,Oe=jv(J,[Un,Math.max(Un,oe-Qe)]);o.style.minWidth=W+"px",o.style.left=Oe+"px"}else{const te=k.right-$.right,J=window.innerWidth-A.right-te,le=window.innerWidth-w.right-J,W=w.width+le,Qe=Math.max(W,k.width),oe=window.innerWidth-Un,Oe=jv(J,[Un,Math.max(Un,oe-Qe)]);o.style.minWidth=W+"px",o.style.right=Oe+"px"}const X=m(),Y=window.innerHeight-Un*2,L=v.scrollHeight,H=window.getComputedStyle(d),R=parseInt(H.borderTopWidth,10),T=parseInt(H.paddingTop,10),z=parseInt(H.borderBottomWidth,10),S=parseInt(H.paddingBottom,10),O=R+T+L+S+z,Z=Math.min(y.offsetHeight*5,O),E=window.getComputedStyle(v),I=parseInt(E.paddingTop,10),ne=parseInt(E.paddingBottom,10),ee=w.top+w.height/2-Un,ge=Y-ee,G=y.offsetHeight/2,M=y.offsetTop+G,V=R+T+M,ae=O-V;if(V<=ee){const te=X.length>0&&y===X[X.length-1].ref.current;o.style.bottom="0px";const J=d.clientHeight-v.offsetTop-v.offsetHeight,le=Math.max(ge,G+(te?ne:0)+J+z),W=V+le;o.style.height=W+"px"}else{const te=X.length>0&&y===X[0].ref.current;o.style.top="0px";const le=Math.max(ee,R+v.offsetTop+(te?I:0)+G)+ae;o.style.height=le+"px",v.scrollTop=V-ee+v.offsetTop}o.style.margin=`${Un}px 0`,o.style.minHeight=Z+"px",o.style.maxHeight=Y+"px",a==null||a(),requestAnimationFrame(()=>x.current=!0)}},[m,r.trigger,r.valueNode,o,d,v,y,g,r.dir,a]);Pt(()=>b(),[b]);const[_,N]=u.useState();Pt(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const C=u.useCallback(w=>{w&&j.current===!0&&(b(),p==null||p(),j.current=!1)},[b,p]);return s.jsx(z4,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:x,onScrollButtonChange:C,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:s.jsx(we.div,{...l,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});eN.displayName=$4;var D4="SelectPopperPosition",Kh=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:l=Un,...r}=e,i=bd(n);return s.jsx(zp,{...i,...r,ref:t,align:a,collisionPadding:l,style:{boxSizing:"border-box",...r.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Kh.displayName=D4;var[z4,Vp]=Hr(hl,{}),Qh="SelectViewport",tN=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...l}=e,r=Ia(Qh,n),i=Vp(Qh,n),o=Ie(t,r.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(vd.Slot,{scope:n,children:s.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:ce(l.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 j=window.innerHeight-Un*2,v=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),g=Math.max(v,y);if(g<j){const p=g+x,b=Math.min(j,p),_=p-b;h.style.height=b+"px",h.style.bottom==="0px"&&(f.scrollTop=_>0?_:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});tN.displayName=Qh;var nN="SelectGroup",[L4,U4]=Hr(nN),B4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,l=Vn();return s.jsx(L4,{scope:n,id:l,children:s.jsx(we.div,{role:"group","aria-labelledby":l,...a,ref:t})})});B4.displayName=nN;var sN="SelectLabel",aN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,l=U4(sN,n);return s.jsx(we.div,{id:l.id,...a,ref:t})});aN.displayName=sN;var yu="SelectItem",[H4,lN]=Hr(yu),rN=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:l=!1,textValue:r,...i}=e,o=Ha(yu,n),c=Ia(yu,n),d=o.value===a,[f,h]=u.useState(r??""),[m,x]=u.useState(!1),j=Ie(t,p=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,p,a,l)}),v=Vn(),y=u.useRef("touch"),g=()=>{l||(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(H4,{scope:n,value:a,disabled:l,textId:v,isSelected:d,onItemTextChange:u.useCallback(p=>{h(b=>b||((p==null?void 0:p.textContent)??"").trim())},[]),children:s.jsx(vd.ItemSlot,{scope:n,value:a,disabled:l,textValue:f,children:s.jsx(we.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...i,ref:j,onFocus:ce(i.onFocus,()=>x(!0)),onBlur:ce(i.onBlur,()=>x(!1)),onClick:ce(i.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:ce(i.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:ce(i.onPointerDown,p=>{y.current=p.pointerType}),onPointerMove:ce(i.onPointerMove,p=>{var b;y.current=p.pointerType,l?(b=c.onItemLeave)==null||b.call(c):y.current==="mouse"&&p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(i.onPointerLeave,p=>{var b;p.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:ce(i.onKeyDown,p=>{var _;((_=c.searchRef)==null?void 0:_.current)!==""&&p.key===" "||(k4.includes(p.key)&&g(),p.key===" "&&p.preventDefault())})})})})});rN.displayName=yu;var ii="SelectItemText",iN=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:l,...r}=e,i=Ha(ii,n),o=Ia(ii,n),c=lN(ii,n),d=R4(ii,n),[f,h]=u.useState(null),m=Ie(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,j=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 Pt(()=>(v(j),()=>y(j)),[v,y,j]),s.jsxs(s.Fragment,{children:[s.jsx(we.span,{id:c.textId,...r,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Nr.createPortal(r.children,i.valueNode):null]})});iN.displayName=ii;var oN="SelectItemIndicator",cN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return lN(oN,n).isSelected?s.jsx(we.span,{"aria-hidden":!0,...a,ref:t}):null});cN.displayName=oN;var Zh="SelectScrollUpButton",uN=u.forwardRef((e,t)=>{const n=Ia(Zh,e.__scopeSelect),a=Vp(Zh,e.__scopeSelect),[l,r]=u.useState(!1),i=Ie(t,a.onScrollButtonChange);return Pt(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollTop>0;r(d)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),l?s.jsx(fN,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop-c.offsetHeight)}}):null});uN.displayName=Zh;var Wh="SelectScrollDownButton",dN=u.forwardRef((e,t)=>{const n=Ia(Wh,e.__scopeSelect),a=Vp(Wh,e.__scopeSelect),[l,r]=u.useState(!1),i=Ie(t,a.onScrollButtonChange);return Pt(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;r(f)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),l?s.jsx(fN,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop+c.offsetHeight)}}):null});dN.displayName=Wh;var fN=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...l}=e,r=Ia("SelectScrollButton",n),i=u.useRef(null),o=yd(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),Pt(()=>{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(we.div,{"aria-hidden":!0,...l,ref:t,style:{flexShrink:0,...l.style},onPointerDown:ce(l.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:ce(l.onPointerMove,()=>{var d;(d=r.onItemLeave)==null||d.call(r),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:ce(l.onPointerLeave,()=>{c()})})}),I4="SelectSeparator",hN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return s.jsx(we.div,{"aria-hidden":!0,...a,ref:t})});hN.displayName=I4;var Jh="SelectArrow",P4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,l=bd(n),r=Ha(Jh,n),i=Ia(Jh,n);return r.open&&i.position==="popper"?s.jsx(Lp,{...l,...a,ref:t}):null});P4.displayName=Jh;var q4="SelectBubbleInput",mN=u.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const l=u.useRef(null),r=Ie(a,l),i=d_(t);return u.useEffect(()=>{const o=l.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(we.select,{...n,style:{...Pw,...n.style},ref:r,defaultValue:t})});mN.displayName=q4;function pN(e){return e===""||e===void 0}function xN(e){const t=ys(e),n=u.useRef(""),a=u.useRef(0),l=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]),r=u.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,l,r]}function gN(e,t,n){const l=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,r=n?e.indexOf(n):-1;let i=G4(e,Math.max(r,0));l.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(l.toLowerCase()));return c!==n?c:void 0}function G4(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var V4=Gw,vN=Yw,Y4=Xw,F4=Kw,X4=Qw,yN=Zw,K4=tN,bN=aN,jN=rN,Q4=iN,Z4=cN,_N=uN,wN=dN,NN=hN;const W4={default:"h-9 px-3 py-2 text-sm",control:"h-7 px-2 py-1 text-xs"},dt=V4,ft=Y4,it=u.forwardRef(({className:e,children:t,triggerSize:n="default",...a},l)=>s.jsxs(vN,{ref:l,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",W4[n],e),...a,children:[t,s.jsx(F4,{asChild:!0,children:s.jsx(s0,{className:"text-muted-foreground size-4","aria-hidden":"true"})})]}));it.displayName=vN.displayName;const kN=u.forwardRef(({className:e,...t},n)=>s.jsx(_N,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(GC,{className:"size-4","aria-hidden":"true"})}));kN.displayName=_N.displayName;const SN=u.forwardRef(({className:e,...t},n)=>s.jsx(wN,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(IC,{className:"size-4","aria-hidden":"true"})}));SN.displayName=wN.displayName;const ot=u.forwardRef(({className:e,children:t,position:n="popper",...a},l)=>s.jsx(X4,{container:jo(),children:s.jsxs(yN,{ref:l,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(kN,{}),s.jsx(K4,{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(SN,{})]})}));ot.displayName=yN.displayName;const J4=u.forwardRef(({className:e,...t},n)=>s.jsx(bN,{ref:n,className:ie("px-2 py-1.5 text-sm font-semibold",e),...t}));J4.displayName=bN.displayName;const ke=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(jN,{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(Z4,{children:s.jsx(Mr,{className:"size-4","aria-hidden":"true"})})}),s.jsx(Q4,{children:t})]}));ke.displayName=jN.displayName;const e$=u.forwardRef(({className:e,...t},n)=>s.jsx(NN,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));e$.displayName=NN.displayName;function pt({className:e,...t}){return s.jsx("div",{className:ie("animate-pulse rounded-md bg-primary/10",e),...t})}const Be=u.forwardRef(({className:e,containerClassName:t,containerRef:n,containerTabIndex:a,containerAriaLabel:l,...r},i)=>s.jsx("div",{ref:n,tabIndex:a,"aria-label":l,className:ie("relative w-full overflow-auto",t),children:s.jsx("table",{ref:i,className:ie("w-full caption-bottom text-sm",e),...r})}));Be.displayName="Table";const Ge=u.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));Ge.displayName="TableHeader";const He=u.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));He.displayName="TableBody";const t$=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}));t$.displayName="TableFooter";const ue=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}));ue.displayName="TableRow";const F=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}));F.displayName="TableHead";const q=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}));q.displayName="TableCell";const n$=u.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:ie("text-muted-foreground mt-4 text-sm",e),...t}));n$.displayName="TableCaption";var jd="Tabs",[s$]=ws(jd,[fd]),CN=fd(),[a$,Yp]=s$(jd),TN=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:l,defaultValue:r,orientation:i="horizontal",dir:o,activationMode:c="automatic",...d}=e,f=od(o),[h,m]=Oa({prop:a,onChange:l,defaultProp:r??"",caller:jd});return s.jsx(a$,{scope:n,baseId:Vn(),value:h,onValueChange:m,orientation:i,dir:f,activationMode:c,children:s.jsx(we.div,{dir:f,"data-orientation":i,...d,ref:t})})});TN.displayName=jd;var RN="TabsList",EN=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...l}=e,r=Yp(RN,n),i=CN(n);return s.jsx(V_,{asChild:!0,...i,orientation:r.orientation,dir:r.dir,loop:a,children:s.jsx(we.div,{role:"tablist","aria-orientation":r.orientation,...l,ref:t})})});EN.displayName=RN;var AN="TabsTrigger",MN=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:l=!1,...r}=e,i=Yp(AN,n),o=CN(n),c=DN(i.baseId,a),d=zN(i.baseId,a),f=a===i.value;return s.jsx(Y_,{asChild:!0,...o,focusable:!l,active:f,children:s.jsx(we.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:c,...r,ref:t,onMouseDown:ce(e.onMouseDown,h=>{!l&&h.button===0&&h.ctrlKey===!1?i.onValueChange(a):h.preventDefault()}),onKeyDown:ce(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(a)}),onFocus:ce(e.onFocus,()=>{const h=i.activationMode!=="manual";!f&&!l&&h&&i.onValueChange(a)})})})});MN.displayName=AN;var ON="TabsContent",$N=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:l,children:r,...i}=e,o=Yp(ON,n),c=DN(o.baseId,a),d=zN(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($n,{present:l||f,children:({present:m})=>s.jsx(we.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&&r})})});$N.displayName=ON;function DN(e,t){return`${e}-trigger-${t}`}function zN(e,t){return`${e}-content-${t}`}var l$=TN,LN=EN,UN=MN,BN=$N;const r$=l$,HN=u.forwardRef(({className:e,...t},n)=>s.jsx(LN,{ref:n,className:ie("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));HN.displayName=LN.displayName;const em=u.forwardRef(({className:e,...t},n)=>s.jsx(UN,{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}));em.displayName=UN.displayName;const i$=u.forwardRef(({className:e,...t},n)=>s.jsx(BN,{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}));i$.displayName=BN.displayName;const ks=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}));ks.displayName="Textarea";var[_d]=ws("Tooltip",[Br]),wd=Br(),IN="TooltipProvider",o$=700,tm="tooltip.open",[c$,Fp]=_d(IN),PN=e=>{const{__scopeTooltip:t,delayDuration:n=o$,skipDelayDuration:a=300,disableHoverableContent:l=!1,children:r}=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(c$,{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:l,children:r})};PN.displayName=IN;var Fi="Tooltip",[u$,To]=_d(Fi),qN=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:l,onOpenChange:r,disableHoverableContent:i,delayDuration:o}=e,c=Fp(Fi,e.__scopeTooltip),d=wd(t),[f,h]=u.useState(null),m=Vn(),x=u.useRef(0),j=i??c.disableHoverableContent,v=o??c.delayDuration,y=u.useRef(!1),[g,p]=Oa({prop:a,defaultProp:l??!1,onChange:w=>{w?(c.onOpen(),document.dispatchEvent(new CustomEvent(tm))):c.onClose(),r==null||r(w)},caller:Fi}),b=u.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),_=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($p,{...d,children:s.jsx(u$,{scope:t,contentId:m,open:g,stateAttribute:b,trigger:f,onTriggerChange:h,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?C():_()},[c.isOpenDelayedRef,C,_]),onTriggerLeave:u.useCallback(()=>{j?N():(window.clearTimeout(x.current),x.current=0)},[N,j]),onOpen:_,onClose:N,disableHoverableContent:j,children:n})})};qN.displayName=Fi;var nm="TooltipTrigger",GN=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=To(nm,n),r=Fp(nm,n),i=wd(n),o=u.useRef(null),c=Ie(t,o,l.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(Dp,{asChild:!0,...i,children:s.jsx(we.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...a,ref:c,onPointerMove:ce(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!r.isPointerInTransitRef.current&&(l.onTriggerEnter(),f.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{l.onTriggerLeave(),f.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{l.open&&l.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ce(e.onFocus,()=>{d.current||l.onOpen()}),onBlur:ce(e.onBlur,l.onClose),onClick:ce(e.onClick,l.onClose)})})});GN.displayName=nm;var Xp="TooltipPortal",[d$,f$]=_d(Xp,{forceMount:void 0}),VN=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:l}=e,r=To(Xp,t);return s.jsx(d$,{scope:t,forceMount:n,children:s.jsx($n,{present:n||r.open,children:s.jsx(bo,{asChild:!0,container:l,children:a})})})};VN.displayName=Xp;var _r="TooltipContent",YN=u.forwardRef((e,t)=>{const n=f$(_r,e.__scopeTooltip),{forceMount:a=n.forceMount,side:l="top",...r}=e,i=To(_r,e.__scopeTooltip);return s.jsx($n,{present:a||i.open,children:i.disableHoverableContent?s.jsx(FN,{side:l,...r,ref:t}):s.jsx(h$,{side:l,...r,ref:t})})}),h$=u.forwardRef((e,t)=>{const n=To(_r,e.__scopeTooltip),a=Fp(_r,e.__scopeTooltip),l=u.useRef(null),r=Ie(t,l),[i,o]=u.useState(null),{trigger:c,onClose:d}=n,f=l.current,{onPointerInTransitChange:h}=a,m=u.useCallback(()=>{o(null),h(!1)},[h]),x=u.useCallback((j,v)=>{const y=j.currentTarget,g={x:j.clientX,y:j.clientY},p=v$(g,y.getBoundingClientRect()),b=y$(g,p),_=b$(v.getBoundingClientRect()),N=_$([...b,..._]);o(N),h(!0)},[h]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&f){const j=y=>x(y,f),v=y=>x(y,c);return c.addEventListener("pointerleave",j),f.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",j),f.removeEventListener("pointerleave",v)}}},[c,f,x,m]),u.useEffect(()=>{if(i){const j=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)),b=!j$(g,i);p?m():b&&(m(),d())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[c,f,i,d,m]),s.jsx(FN,{...e,ref:r})}),[m$,p$]=_d(Fi,{isInside:!1}),x$=oE("TooltipContent"),FN=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":l,onEscapeKeyDown:r,onPointerDownOutside:i,...o}=e,c=To(_r,n),d=wd(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(tm,f),()=>document.removeEventListener(tm,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(yo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:s.jsxs(zp,{"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(x$,{children:a}),s.jsx(m$,{scope:n,isInside:!0,children:s.jsx(w4,{id:c.contentId,role:"tooltip",children:l||a})})]})})});YN.displayName=_r;var XN="TooltipArrow",g$=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=wd(n);return p$(XN,n).isInside?null:s.jsx(Lp,{...l,...a,ref:t})});g$.displayName=XN;function v$(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),l=Math.abs(t.right-e.x),r=Math.abs(t.left-e.x);switch(Math.min(n,a,l,r)){case r:return"left";case l:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function y$(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 b$(e){const{top:t,right:n,bottom:a,left:l}=e;return[{x:l,y:t},{x:n,y:t},{x:n,y:a},{x:l,y:a}]}function j$(e,t){const{x:n,y:a}=e;let l=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){const o=t[r],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&&(l=!l)}return l}function _$(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),w$(t)}function w$(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const l=e[a];for(;t.length>=2;){const r=t[t.length-1],i=t[t.length-2];if((r.x-i.x)*(l.y-i.y)>=(r.y-i.y)*(l.x-i.x))t.pop();else break}t.push(l)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const l=e[a];for(;n.length>=2;){const r=n[n.length-1],i=n[n.length-2];if((r.x-i.x)*(l.y-i.y)>=(r.y-i.y)*(l.x-i.x))n.pop();else break}n.push(l)}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 N$=PN,k$=qN,S$=GN,C$=VN,KN=YN;const QN=N$,ZN=k$,WN=S$,Kp=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>{const l=jo(),r=s.jsx(KN,{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 l?s.jsx(C$,{container:l,children:r}):r});Kp.displayName=KN.displayName;function Js({page:e,header:t}){return s.jsxs(s.Fragment,{children:[t??s.jsx(Ft,{title:e}),s.jsx(T$,{page:e})]})}function T$({page:e}){return s.jsxs(me,{variant:"info",role:"status",className:"mt-6","data-testid":"not-installed",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:c0(e)})]})}const _v=["none","read","comment","write","manage","admin"];function bu(e,t){return _v.indexOf(e??"none")>=_v.indexOf(t)}function Qp(e){return e==="api_key"?"API key":e==="sdlc_login"?"sdlc login":null}function Tf(e,t){const n=Qp(e);return e==="sdlc_login"&&t?`${n} on ${JN(t)}`:n}const R$=String.fromCodePoint(8296),E$=String.fromCodePoint(8297);function JN(e){return`${R$}${e}${E$}`}const Xi={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"}},A$={backlog:"neutral",planned:"neutral",in_progress:"info",completed:"success",canceled:"neutral"};function ek(e){return e.name==="Blocked"?"warning":A$[e.category]}const wv=1800;function Qn(e){return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Yn(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function Zp(e){return`${En(e)}, ${Yn(e)}`}function Wr(e){return e<90?`${Math.round(e)} s`:e<5400?`${Math.round(e/60)} min`:`${(e/3600).toFixed(1).replace(/\.0$/,"")} h`}function En(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function tk(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function M$(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 O$(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 la="not_set";function $$({open:e,commands:t,list_id:n,list_revision:a,default_status_id:l,statuses:r,priorities:i,members:o,on_close:c,on_created:d}){var Y;const f=Ar(),[h,m]=u.useState(""),[x,j]=u.useState(""),[v,y]=u.useState(l??((Y=r[0])==null?void 0:Y.id)??""),[g,p]=u.useState(la),[b,_]=u.useState(la),[N,C]=u.useState(!1),[w,k]=u.useState(null),[A,$]=u.useState(!1);u.useEffect(()=>{var L;e&&(m(""),j(""),y(l??((L=r[0])==null?void 0:L.id)??""),p(la),_(la),C(!1),k(null))},[e,l,r]);const X=async L=>{if(L.preventDefault(),!h.trim()){C(!0);return}$(!0),k(null);try{const H=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===la?null:g,primary_user_id:b===la?null:b});if(!H.ok){k(H.refusal.message);return}f.success("Task created."),await d()}finally{$(!1)}};return s.jsx(es,{open:e,onOpenChange:L=>L?null:c(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:L=>void X(L),noValidate:!0,children:[s.jsxs(ns,{children:[s.jsx(as,{children:"New task"}),s.jsx(ls,{children:"Add a task to this List."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[w&&s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(pe,{children:w})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"new-task-title",children:"Title"}),s.jsx(Ot,{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:L=>{m(L.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(Me,{htmlFor:"new-task-description",children:"Description (optional)"}),s.jsx(ks,{id:"new-task-description",rows:4,value:x,onChange:L=>j(L.target.value)})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"new-task-status",children:"Status"}),s.jsxs(dt,{value:v,onValueChange:y,children:[s.jsx(it,{id:"new-task-status",children:s.jsx(ft,{})}),s.jsx(ot,{children:r.map(L=>s.jsx(ke,{value:L.id,children:L.name},L.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"new-task-priority",children:"Priority"}),s.jsxs(dt,{value:g,onValueChange:p,children:[s.jsx(it,{id:"new-task-priority",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:la,children:"Not set"}),i.map(L=>s.jsx(ke,{value:L.id,children:L.name},L.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"new-task-primary",children:"Primary"}),s.jsxs(dt,{value:b,onValueChange:_,children:[s.jsx(it,{id:"new-task-primary",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:la,children:"Not set"}),o.map(L=>s.jsx(ke,{value:L.user_id,children:L.label},L.user_id))]})]})]})]})]}),s.jsxs(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),s.jsx(P,{type:"submit",disabled:A,children:A?"Creating…":"Create task"})]})]})})})}const D$="Your organization's work, in queue order. Claim a task to show you are working on it.",oi="any",nk="none",z$=1,L$=250;function Wp(){const e=en().tasks;if(!e)throw new Error("The Tasks page rendered without the tasks seam.");return e}function U$({org:e}){var j,v;const t=Wp(),{href:n,Link:a}=Ve(),[l,r]=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&&r({state:"loading"});const p=await t.availability({fresh:y});g===f.current&&r(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]),l.state==="off"&&((j=l.refusal)==null?void 0:j.reason)!=="engine_missing")return s.jsx(Ba,{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)??D$;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:l.state==="active"?s.jsx(H$,{active:l,org:e,members:i,description:x,read_only_reason:c==null?void 0:c.read_only_reason,reload_configuration:m}):l.state==="off"&&((v=l.refusal)==null?void 0:v.reason)==="engine_missing"?s.jsx(Js,{page:"Tasks"}):s.jsxs(s.Fragment,{children:[s.jsx(Ft,{title:"Tasks",description:x}),l.state==="loading"&&s.jsx(sk,{}),(l.state==="error"||l.state==="off")&&s.jsx(ak,{refusal:l.refusal,on_retry:m}),l.state==="available"&&s.jsx(B$,{on_done:m})]})})}function sk(){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(pt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function ak({refusal:e,on_retry:t}){const n=Wn();return(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsx(pe,{children:n})]}):s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Tasks could not be loaded"}),s.jsxs(pe,{children:[s.jsx("p",{children:e!=null&&e.reason?e.message:"Check your connection and try again."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function B$({on_done:e}){const{commands:t}=Wp(),n=Ar(),[a,l]=u.useState(!1),r=t==null?void 0:t.activate,i=async()=>{if(!r)return;l(!0);const o=await r();if(l(!1),!o.ok){n.error(o.refusal.message);return}n.success("Tasks are on."),e()};return s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Tasks are not on for this organization"}),s.jsxs(pe,{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."}),r?s.jsx(P,{type:"button",size:"sm",className:"mt-2",disabled:a,onClick:()=>void i(),children:"Turn on Tasks"}):null]})]})}const Rf=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function H$({active:e,org:t,members:n,description:a,read_only_reason:l,reload_configuration:r}){var vx;const{commands:i,listTasks:o,waitingOnYou:c,hierarchyRevision:d}=Wp(),{href:f,Link:h}=Ve(),{self_id:m}=Ku(),x=Ar(),{list:j,workspace:v}=e,y=j.offers,g=y!==void 0,p=u.useMemo(()=>{var U;return((U=v.workflows.find(Ye=>Ye.id===j.workflow_id))==null?void 0:U.statuses)??[]},[v,j]),b=v.priorities,_=!!i&&bu(j.permission,"write"),N=_&&bu(j.permission,"manage"),C=u.useMemo(()=>new Map(n.map(U=>[U.user_id,U])),[n]),w=U=>{var Ye;return U?U===m?"You":((Ye=C.get(U))==null?void 0:Ye.label)??"A member":""},[k,A]=u.useState("active"),[$,X]=u.useState(!1),[Y,L]=u.useState(""),[H,R]=u.useState("");u.useEffect(()=>{const U=setTimeout(()=>R(Y),L$);return()=>clearTimeout(U)},[Y]);const[T,z]=u.useState(null),[S,O]=u.useState(oi),[Z,E]=u.useState(!1),[I,ne]=u.useState(!1),[ee,ge]=u.useState(null),[G,M]=u.useState([]),[V,ae]=u.useState(null),[B,te]=u.useState(0),[J,le]=u.useState(!1),[W,Qe]=u.useState(null),[oe,Oe]=u.useState(null),K=Wn(),[Ne,ze]=u.useState(!1),[xt,ye]=u.useState(null),[St,Lt]=u.useState({}),[yn,Ss]=u.useState(""),{confirm:bn,confirm_dialog:tn}=_o(),Cs=u.useRef(null),Ts=u.useRef(null),re=u.useRef(null),De=u.useRef(null),[Ce,Rs]=u.useState(void 0),Dn=!!(H.trim()||T||S!==oi||Z||I),zn=u.useRef(0),Ct=u.useCallback(async(U,Ye=!1)=>{const Ze=U?zn.current:zn.current+=1,st={state:k,assigned_to_me:$||void 0,cursor:U,search:H.trim()||void 0,group:T??void 0,owner:S===oi?void 0:S===nk?"":S,urgent:Z||void 0,over_estimate:I||void 0},Ut=Xt=>o(j.id,{...st,cursor:Xt});let Tt=await Ut(U),at=!!U;if(!Tt.ok&&Tt.refusal.code==="cursor_stale"&&(Tt=await Ut(),at=!1),Ze!==zn.current)return;if(!Tt.ok){ae(Tt.refusal),te(Xt=>Xt+1);return}const Bt=Tt.data;ae(null),te(0),!(Ye&&Rf(Bt,re.current))&&(re.current=Bt,ge(Bt),Bt.facets&&Rs(Bt.facets),M(Xt=>at?[...Xt,...Bt.tasks]:Bt.tasks))},[o,j.id,k,$,H,T,S,Z,I]),nn=u.useCallback(async()=>{const U=await c();if(Oe(Ze=>U.ok?null:Rf(Ze,U.refusal)?Ze:U.refusal),!U.ok&&g)return;const Ye=U.ok?U.data:null;Rf(Ye,De.current)||(De.current=Ye,Qe(Ye))},[c,g]);u.useEffect(()=>{re.current=null,ge(null)},[k,$]),u.useEffect(()=>{Ct()},[Ct]),u.useEffect(()=>{nn()},[nn]);const rs=u.useCallback(async()=>{await Promise.all([Ct(),nn()])},[Ct,nn]),Ln=y==null?void 0:y.refresh_ms;u.useEffect(()=>{if(!Ln)return;const U=setInterval(()=>{Ct(void 0,!0),nn()},Ln);return()=>clearInterval(U)},[Ln,Ct,nn]);const ea=u.useCallback(async(U,Ye,Ze)=>{if(!i)return;const st=await i.run(U,Ye);st.ok?Ze&&x.success(Ze):(x.error(st.refusal.message),st.refusal.code==="revision_conflict"&&r()),await rs()},[i,x,rs,r]),D=p.find(U=>U.category==="completed"),be=async(U,Ye,Ze)=>{const st=Ye+Ze,Ut=G[st];if(!Ut||!ee||!i)return;const Tt=async(at,Bt)=>{const Xt=await i.run(at,Bt);if(!Xt.ok)throw Xt.refusal;return Xt.data};try{let at=ee.list.order_revision,Bt=U.revision;if(Ut.queue_rank===null){const Xt=G.findIndex(ta=>ta.queue_rank===null);for(const ta of G.slice(Xt,st+1)){const $o=await Tt("reorder",{task_id:ta.id,expected_revision:ta.revision,expected_order_revision:at,placement:"end"});at=$o.list.order_revision,ta.id===U.id&&(Bt=$o.task.revision)}}await Tt("reorder",{task_id:U.id,expected_revision:Bt,expected_order_revision:at,placement:Ze<0?"before":"after",anchor_task_id:Ut.id})}catch(at){x.error(at.message)}await rs()},se=U=>{D&&ea("update_task",{task_id:U.id,expected_revision:U.revision,changes:{status_id:D.id}},`${U.title} completed.`)},_e=async U=>{if(!ee||!await bn({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[Ze,st]=await Promise.all([o(j.id,{limit:1}),d(v.id)]);if(!Ze.ok||!st.ok){x.error(Ze.ok?st.ok?"":st.refusal.message:Ze.refusal.message);return}await ea("archive_task",{task_id:U.id,expected_revision:U.revision,expected_order_revision:Ze.data.list.order_revision,expected_hierarchy_revision:st.data},`${U.title} archived.`)},Es=async U=>{await ea("release_hold",{hold_id:U},"Hold released.")},qa=async(U,Ye,Ze,st)=>{var Xt;if(!(i!=null&&i.complete)||!await bn({title:`Mark ${Ye} done?`,description:Ze.reason?`“${Ze.reason}”
383
+ 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},CA="DialogDescriptionWarning",RA=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Z0(CA).contentName}}.`;return u.useEffect(()=>{var r;const l=(r=e.current)==null?void 0:r.getAttribute("aria-describedby");t&&l&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},W0=U0,J0=I0,e_=P0,t_=q0,n_=V0,s_=F0,jp=K0;function gn({className:e,...t}){return s.jsx(CR,{role:"status","aria-label":"Loading",className:ie("size-4 animate-spin",e),...t})}const ar="aria-pressed:border aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:text-accent-foreground",TA="border border-primary bg-accent text-accent-foreground hover:bg-accent",rd=vo("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"}}),P=u.forwardRef(({className:e,disabled:t,variant:n,size:a,asChild:l=!1,loading:r,children:i,...o},c)=>{const d=l?oE:"button",f=a==="icon"||a==="sm-icon"||a==="control-icon"||a==="xs-icon",h=s.jsx(gn,{"aria-hidden":"true","aria-label":void 0,role:void 0,className:ie(!f&&"mr-2")}),m=l?i:r&&f?h:s.jsxs(s.Fragment,{children:[r?h:null,i]});return s.jsx(d,{className:ie(rd({variant:n,size:a,className:e})),ref:c,disabled:t||r,...o,children:m})});P.displayName="Button";const a_=u.createContext(null);function EA({container:e,children:t}){return s.jsx(a_.Provider,{value:e,children:t})}function jo(){return u.useContext(a_)??void 0}function l_(e){return s.jsx(W0,{"data-slot":"alert-dialog",...e})}function AA({className:e,...t}){return s.jsx(e_,{"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 r_({className:e,onOpenAutoFocus:t,onPointerDownOutside:n,onInteractOutside:a,...l}){return s.jsxs(J0,{container:jo(),children:[s.jsx(AA,{}),s.jsx(t_,{"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:r=>{if(t==null||t(r),r.defaultPrevented)return;const i=r.currentTarget,o=i instanceof HTMLElement?i.querySelector('[data-slot="alert-dialog-cancel"]'):null;o&&(r.preventDefault(),o.focus())},onPointerDownOutside:r=>{n==null||n(r),r.preventDefault()},onInteractOutside:r=>{a==null||a(r),r.preventDefault()},...l})]})}function i_({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 o_({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 c_({className:e,...t}){return s.jsx(n_,{"data-slot":"alert-dialog-title",className:ie("text-lg font-semibold",e),...t})}function u_({className:e,...t}){return s.jsx(s_,{"data-slot":"alert-dialog-description",className:ie("text-muted-foreground text-sm",e),...t})}function d_({className:e,variant:t,...n}){return s.jsx(jp,{"data-slot":"alert-dialog-action",className:ie(rd({variant:t}),e),...n})}function f_({className:e,...t}){return s.jsx(jp,{"data-slot":"alert-dialog-cancel",className:ie(rd({variant:"outline"}),e),...t})}function MA(){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 OA(e,t){t!=null&&t.isConnected&&(e.preventDefault(),t.focus())}function _o(){const[e,t]=u.useState(null),n=u.useRef(null),a=u.useRef(null),l=u.useCallback(o=>{var c;(c=n.current)==null||c.resolve(o),n.current=null,t(null)},[]),r=u.useCallback(o=>new Promise(c=>{var f;(f=n.current)==null||f.resolve(!1),a.current=MA();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(l_,{open:e!==null,onOpenChange:o=>{o||l(!1)},children:s.jsxs(r_,{onCloseAutoFocus:o=>OA(o,a.current),children:[s.jsxs(i_,{children:[s.jsx(c_,{children:e==null?void 0:e.title}),s.jsx(u_,{className:"whitespace-pre-line",children:e==null?void 0:e.description})]}),s.jsxs(o_,{children:[s.jsx(f_,{children:"Cancel"}),s.jsx(d_,{variant:e!=null&&e.destructive?"destructive":"default",onClick:()=>l(!0),children:e==null?void 0:e.action_label})]})]})});return{confirm:r,confirm_dialog:i}}const Ds="px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",$A=vo("inline-flex items-center rounded-md border transition-colors",{variants:{variant:{default:`${Ds} border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80`,secondary:`${Ds} border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`${Ds} border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80`,outline:`${Ds} text-foreground`,success:`${Ds} border-success/40 bg-success/10 text-success`,warning:`${Ds} border-warning/40 bg-warning/10 text-warning`,info:`${Ds} border-info/40 bg-info/10 text-info`,error:`${Ds} border-destructive/40 bg-destructive/10 text-destructive`,neutral:`${Ds} 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 he({className:e,variant:t,size:n,...a}){return s.jsx("div",{className:ie($A({variant:t,size:n}),e),...a})}function h_(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 m_(e){const[t,n]=u.useState(void 0);return Pt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const r=l[0];let i,o;if("borderBoxSize"in r){const c=r.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 id="Checkbox",[DA]=ws(id),[zA,_p]=DA(id);function LA(e){const{__scopeCheckbox:t,checked:n,children:a,defaultChecked:l,disabled:r,form:i,name:o,onCheckedChange:c,required:d,value:f="on",internal_do_not_use_render:h}=e,[m,g]=Oa({prop:n,defaultProp:l??!1,onChange:c,caller:id}),[j,v]=u.useState(null),[y,x]=u.useState(null),p=u.useRef(!1),b=j?!!i||!!j.closest("form"):!0,_={checked:m,disabled:r,setChecked:g,control:j,setControl:v,name:o,form:i,value:f,hasConsumerStoppedPropagationRef:p,required:d,defaultChecked:Ta(l)?!1:l,isFormControl:b,bubbleInput:y,setBubbleInput:x};return s.jsx(zA,{scope:t,..._,children:UA(h)?h(_):a})}var p_="CheckboxTrigger",x_=u.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},l)=>{const{control:r,value:i,disabled:o,checked:c,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:g,bubbleInput:j}=_p(p_,e),v=Ie(l,f),y=u.useRef(c);return u.useEffect(()=>{const x=r==null?void 0:r.form;if(x){const p=()=>h(y.current);return x.addEventListener("reset",p),()=>x.removeEventListener("reset",p)}},[r,h]),s.jsx(we.button,{type:"button",role:"checkbox","aria-checked":Ta(c)?"mixed":c,"aria-required":d,"data-state":j_(c),"data-disabled":o?"":void 0,disabled:o,value:i,...a,ref:v,onKeyDown:ce(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:ce(n,x=>{h(p=>Ta(p)?!0:!p),j&&g&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});x_.displayName=p_;var wp=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:a,checked:l,defaultChecked:r,required:i,disabled:o,value:c,onCheckedChange:d,form:f,...h}=e;return s.jsx(LA,{__scopeCheckbox:n,checked:l,defaultChecked:r,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(x_,{...h,ref:t,__scopeCheckbox:n}),m&&s.jsx(b_,{__scopeCheckbox:n})]})})});wp.displayName=id;var g_="CheckboxIndicator",v_=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...l}=e,r=_p(g_,n);return s.jsx($n,{present:a||Ta(r.checked)||r.checked===!0,children:s.jsx(we.span,{"data-state":j_(r.checked),"data-disabled":r.disabled?"":void 0,...l,ref:t,style:{pointerEvents:"none",...e.style}})})});v_.displayName=g_;var y_="CheckboxBubbleInput",b_=u.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:a,hasConsumerStoppedPropagationRef:l,checked:r,defaultChecked:i,required:o,disabled:c,name:d,value:f,form:h,bubbleInput:m,setBubbleInput:g}=_p(y_,e),j=Ie(n,g),v=h_(r),y=m_(a);u.useEffect(()=>{const p=m;if(!p)return;const b=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(b,"checked").set,C=!l.current;if(v!==r&&N){const w=new Event("click",{bubbles:C});p.indeterminate=Ta(r),N.call(p,Ta(r)?!1:r),p.dispatchEvent(w)}},[m,v,r,l]);const x=u.useRef(Ta(r)?!1:r);return s.jsx(we.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:o,disabled:c,name:d,value:f,form:h,...t,tabIndex:-1,ref:j,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});b_.displayName=y_;function UA(e){return typeof e=="function"}function Ta(e){return e==="indeterminate"}function j_(e){return Ta(e)?"indeterminate":e?"checked":"unchecked"}const zr=u.forwardRef(({className:e,...t},n)=>s.jsx(wp,{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(v_,{className:ie("flex items-center justify-center text-current"),children:t.checked==="indeterminate"?s.jsx(OR,{className:"size-4","aria-hidden":"true"}):s.jsx(Mr,{className:"size-4","aria-hidden":"true"})})}));zr.displayName=wp.displayName;const BA=vo("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 es({...e}){return s.jsx(W0,{"data-slot":"dialog",...e})}function HA({...e}){const t=jo();return s.jsx(J0,{"data-slot":"dialog-portal",container:t,...e})}function IA({className:e,...t}){return s.jsx(e_,{"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 ts({className:e,children:t,showCloseButton:n=!0,size:a,...l}){return s.jsxs(HA,{"data-slot":"dialog-portal",children:[s.jsx(IA,{}),s.jsxs(t_,{"data-slot":"dialog-content",className:ie(BA({size:a}),e),...l,children:[t,n&&s.jsxs(jp,{"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(Ju,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ns({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 ss({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 as({className:e,...t}){return s.jsx(n_,{"data-slot":"dialog-title",className:ie("text-lg leading-none font-semibold",e),...t})}function ls({className:e,...t}){return s.jsx(s_,{"data-slot":"dialog-description",className:ie("text-muted-foreground text-sm",e),...t})}function Np(e){const t=e+"CollectionProvider",[n,a]=ws(t),[l,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=v=>{const{scope:y,children:x}=v,p=ra.useRef(null),b=ra.useRef(new Map).current;return s.jsx(l,{scope:y,itemMap:b,collectionRef:p,children:x})};i.displayName=t;const o=e+"CollectionSlot",c=cl(o),d=ra.forwardRef((v,y)=>{const{scope:x,children:p}=v,b=r(o,x),_=Ie(y,b.collectionRef);return s.jsx(c,{ref:_,children:p})});d.displayName=o;const f=e+"CollectionItemSlot",h="data-radix-collection-item",m=cl(f),g=ra.forwardRef((v,y)=>{const{scope:x,children:p,...b}=v,_=ra.useRef(null),N=Ie(y,_),C=r(f,x);return ra.useEffect(()=>(C.itemMap.set(_,{ref:_,...b}),()=>void C.itemMap.delete(_))),s.jsx(m,{[h]:"",ref:N,children:p})});g.displayName=f;function j(v){const y=r(e+"CollectionConsumer",v);return ra.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const b=Array.from(p.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((C,w)=>b.indexOf(C.ref.current)-b.indexOf(w.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:d,ItemSlot:g},j,a]}var PA=u.createContext(void 0);function od(e){const t=u.useContext(PA);return e||t||"ltr"}const qA=["top","right","bottom","left"],$a=Math.min,on=Math.max,hu=Math.round,sc=Math.floor,gs=e=>({x:e,y:e}),GA={left:"right",right:"left",bottom:"top",top:"bottom"},VA={start:"end",end:"start"};function Gh(e,t,n){return on(e,$a(t,n))}function Qs(e,t){return typeof e=="function"?e(t):e}function Zs(e){return e.split("-")[0]}function Lr(e){return e.split("-")[1]}function kp(e){return e==="x"?"y":"x"}function Sp(e){return e==="y"?"height":"width"}function fs(e){return["top","bottom"].includes(Zs(e))?"y":"x"}function Cp(e){return kp(fs(e))}function YA(e,t,n){n===void 0&&(n=!1);const a=Lr(e),l=Cp(e),r=Sp(l);let i=l==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(i=mu(i)),[i,mu(i)]}function FA(e){const t=mu(e);return[Vh(e),t,Vh(t)]}function Vh(e){return e.replace(/start|end/g,t=>VA[t])}function XA(e,t,n){const a=["left","right"],l=["right","left"],r=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?l:a:t?a:l;case"left":case"right":return t?r:i;default:return[]}}function KA(e,t,n,a){const l=Lr(e);let r=XA(Zs(e),n==="start",a);return l&&(r=r.map(i=>i+"-"+l),t&&(r=r.concat(r.map(Vh)))),r}function mu(e){return e.replace(/left|right|bottom|top/g,t=>GA[t])}function QA(e){return{top:0,right:0,bottom:0,left:0,...e}}function __(e){return typeof e!="number"?QA(e):{top:e,right:e,bottom:e,left:e}}function pu(e){const{x:t,y:n,width:a,height:l}=e;return{width:a,height:l,top:n,left:t,right:t+a,bottom:n+l,x:t,y:n}}function fv(e,t,n){let{reference:a,floating:l}=e;const r=fs(t),i=Cp(t),o=Sp(i),c=Zs(t),d=r==="y",f=a.x+a.width/2-l.width/2,h=a.y+a.height/2-l.height/2,m=a[o]/2-l[o]/2;let g;switch(c){case"top":g={x:f,y:a.y-l.height};break;case"bottom":g={x:f,y:a.y+a.height};break;case"right":g={x:a.x+a.width,y:h};break;case"left":g={x:a.x-l.width,y:h};break;default:g={x:a.x,y:a.y}}switch(Lr(t)){case"start":g[i]-=m*(n&&d?-1:1);break;case"end":g[i]+=m*(n&&d?-1:1);break}return g}const ZA=async(e,t,n)=>{const{placement:a="bottom",strategy:l="absolute",middleware:r=[],platform:i}=n,o=r.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:l}),{x:f,y:h}=fv(d,a,c),m=a,g={},j=0;for(let v=0;v<o.length;v++){const{name:y,fn:x}=o[v],{x:p,y:b,data:_,reset:N}=await x({x:f,y:h,initialPlacement:a,placement:m,strategy:l,middlewareData:g,rects:d,platform:i,elements:{reference:e,floating:t}});f=p??f,h=b??h,g={...g,[y]:{...g[y],..._}},N&&j<=50&&(j++,typeof N=="object"&&(N.placement&&(m=N.placement),N.rects&&(d=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:l}):N.rects),{x:f,y:h}=fv(d,m,c)),v=-1)}return{x:f,y:h,placement:m,strategy:l,middlewareData:g}};async function qi(e,t){var n;t===void 0&&(t={});const{x:a,y:l,platform:r,rects:i,elements:o,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:g=0}=Qs(t,e),j=__(g),y=o[m?h==="floating"?"reference":"floating":h],x=pu(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(y)))==null||n?y:y.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(o.floating)),boundary:d,rootBoundary:f,strategy:c})),p=h==="floating"?{x:a,y:l,width:i.floating.width,height:i.floating.height}:i.reference,b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(o.floating)),_=await(r.isElement==null?void 0:r.isElement(b))?await(r.getScale==null?void 0:r.getScale(b))||{x:1,y:1}:{x:1,y:1},N=pu(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:p,offsetParent:b,strategy:c}):p);return{top:(x.top-N.top+j.top)/_.y,bottom:(N.bottom-x.bottom+j.bottom)/_.y,left:(x.left-N.left+j.left)/_.x,right:(N.right-x.right+j.right)/_.x}}const WA=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:l,rects:r,platform:i,elements:o,middlewareData:c}=t,{element:d,padding:f=0}=Qs(e,t)||{};if(d==null)return{};const h=__(f),m={x:n,y:a},g=Cp(l),j=Sp(g),v=await i.getDimensions(d),y=g==="y",x=y?"top":"left",p=y?"bottom":"right",b=y?"clientHeight":"clientWidth",_=r.reference[j]+r.reference[g]-m[g]-r.floating[j],N=m[g]-r.reference[g],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let w=C?C[b]:0;(!w||!await(i.isElement==null?void 0:i.isElement(C)))&&(w=o.floating[b]||r.floating[j]);const k=_/2-N/2,A=w/2-v[j]/2-1,$=$a(h[x],A),X=$a(h[p],A),Y=$,L=w-v[j]-X,H=w/2-v[j]/2+k,T=Gh(Y,H,L),R=!c.arrow&&Lr(l)!=null&&H!==T&&r.reference[j]/2-(H<Y?$:X)-v[j]/2<0,z=R?H<Y?H-Y:H-L:0;return{[g]:m[g]+z,data:{[g]:T,centerOffset:H-T-z,...R&&{alignmentOffset:z}},reset:R}}}),JA=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:l,middlewareData:r,rects:i,initialPlacement:o,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:v=!0,...y}=Qs(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const x=Zs(l),p=fs(o),b=Zs(o)===o,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=m||(b||!v?[mu(o)]:FA(o)),C=j!=="none";!m&&C&&N.push(...KA(o,v,j,_));const w=[o,...N],k=await qi(t,y),A=[];let $=((a=r.flip)==null?void 0:a.overflows)||[];if(f&&A.push(k[x]),h){const H=YA(l,i,_);A.push(k[H[0]],k[H[1]])}if($=[...$,{placement:l,overflows:A}],!A.every(H=>H<=0)){var X,Y;const H=(((X=r.flip)==null?void 0:X.index)||0)+1,T=w[H];if(T&&(!(h==="alignment"?p!==fs(T):!1)||$.every(S=>S.overflows[0]>0&&fs(S.placement)===p)))return{data:{index:H,overflows:$},reset:{placement:T}};let R=(Y=$.filter(z=>z.overflows[0]<=0).sort((z,S)=>z.overflows[1]-S.overflows[1])[0])==null?void 0:Y.placement;if(!R)switch(g){case"bestFit":{var L;const z=(L=$.filter(S=>{if(C){const O=fs(S.placement);return O===p||O==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(O=>O>0).reduce((O,Z)=>O+Z,0)]).sort((S,O)=>S[1]-O[1])[0])==null?void 0:L[0];z&&(R=z);break}case"initialPlacement":R=o;break}if(l!==R)return{reset:{placement:R}}}return{}}}};function hv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function mv(e){return qA.some(t=>e[t]>=0)}const eM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...l}=Qs(e,t);switch(a){case"referenceHidden":{const r=await qi(t,{...l,elementContext:"reference"}),i=hv(r,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:mv(i)}}}case"escaped":{const r=await qi(t,{...l,altBoundary:!0}),i=hv(r,n.floating);return{data:{escapedOffsets:i,escaped:mv(i)}}}default:return{}}}}};async function tM(e,t){const{placement:n,platform:a,elements:l}=e,r=await(a.isRTL==null?void 0:a.isRTL(l.floating)),i=Zs(n),o=Lr(n),c=fs(n)==="y",d=["left","top"].includes(i)?-1:1,f=r&&c?-1:1,h=Qs(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:j}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof j=="number"&&(g=o==="end"?j*-1:j),c?{x:g*f,y:m*d}:{x:m*d,y:g*f}}const nM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:l,y:r,placement:i,middlewareData:o}=t,c=await tM(t,e);return i===((n=o.offset)==null?void 0:n.placement)&&(a=o.arrow)!=null&&a.alignmentOffset?{}:{x:l+c.x,y:r+c.y,data:{...c,placement:i}}}}},sM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:l}=t,{mainAxis:r=!0,crossAxis:i=!1,limiter:o={fn:y=>{let{x,y:p}=y;return{x,y:p}}},...c}=Qs(e,t),d={x:n,y:a},f=await qi(t,c),h=fs(Zs(l)),m=kp(h);let g=d[m],j=d[h];if(r){const y=m==="y"?"top":"left",x=m==="y"?"bottom":"right",p=g+f[y],b=g-f[x];g=Gh(p,g,b)}if(i){const y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",p=j+f[y],b=j-f[x];j=Gh(p,j,b)}const v=o.fn({...t,[m]:g,[h]:j});return{...v,data:{x:v.x-n,y:v.y-a,enabled:{[m]:r,[h]:i}}}}}},aM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:l,rects:r,middlewareData:i}=t,{offset:o=0,mainAxis:c=!0,crossAxis:d=!0}=Qs(e,t),f={x:n,y:a},h=fs(l),m=kp(h);let g=f[m],j=f[h];const v=Qs(o,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const b=m==="y"?"height":"width",_=r.reference[m]-r.floating[b]+y.mainAxis,N=r.reference[m]+r.reference[b]-y.mainAxis;g<_?g=_:g>N&&(g=N)}if(d){var x,p;const b=m==="y"?"width":"height",_=["top","left"].includes(Zs(l)),N=r.reference[h]-r.floating[b]+(_&&((x=i.offset)==null?void 0:x[h])||0)+(_?0:y.crossAxis),C=r.reference[h]+r.reference[b]+(_?0:((p=i.offset)==null?void 0:p[h])||0)-(_?y.crossAxis:0);j<N?j=N:j>C&&(j=C)}return{[m]:g,[h]:j}}}},lM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:l,rects:r,platform:i,elements:o}=t,{apply:c=()=>{},...d}=Qs(e,t),f=await qi(t,d),h=Zs(l),m=Lr(l),g=fs(l)==="y",{width:j,height:v}=r.floating;let y,x;h==="top"||h==="bottom"?(y=h,x=m===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(x=h,y=m==="end"?"top":"bottom");const p=v-f.top-f.bottom,b=j-f.left-f.right,_=$a(v-f[y],p),N=$a(j-f[x],b),C=!t.middlewareData.shift;let w=_,k=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=b),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(w=p),C&&!m){const $=on(f.left,0),X=on(f.right,0),Y=on(f.top,0),L=on(f.bottom,0);g?k=j-2*($!==0||X!==0?$+X:on(f.left,f.right)):w=v-2*(Y!==0||L!==0?Y+L:on(f.top,f.bottom))}await c({...t,availableWidth:k,availableHeight:w});const A=await i.getDimensions(o.floating);return j!==A.width||v!==A.height?{reset:{rects:!0}}:{}}}};function cd(){return typeof window<"u"}function Ur(e){return w_(e)?(e.nodeName||"").toLowerCase():"#document"}function mn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ns(e){var t;return(t=(w_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function w_(e){return cd()?e instanceof Node||e instanceof mn(e).Node:!1}function Xn(e){return cd()?e instanceof Element||e instanceof mn(e).Element:!1}function bs(e){return cd()?e instanceof HTMLElement||e instanceof mn(e).HTMLElement:!1}function pv(e){return!cd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof mn(e).ShadowRoot}function wo(e){const{overflow:t,overflowX:n,overflowY:a,display:l}=Kn(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!["inline","contents"].includes(l)}function rM(e){return["table","td","th"].includes(Ur(e))}function ud(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Rp(e){const t=Tp(),n=Xn(e)?Kn(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=Da(e);for(;bs(t)&&!br(t);){if(Rp(t))return t;if(ud(t))return null;t=Da(t)}return null}function Tp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function br(e){return["html","body","#document"].includes(Ur(e))}function Kn(e){return mn(e).getComputedStyle(e)}function dd(e){return Xn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Da(e){if(Ur(e)==="html")return e;const t=e.assignedSlot||e.parentNode||pv(e)&&e.host||Ns(e);return pv(t)?t.host:t}function N_(e){const t=Da(e);return br(t)?e.ownerDocument?e.ownerDocument.body:e.body:bs(t)&&wo(t)?t:N_(t)}function Gi(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const l=N_(e),r=l===((a=e.ownerDocument)==null?void 0:a.body),i=mn(l);if(r){const o=Yh(i);return t.concat(i,i.visualViewport||[],wo(l)?l:[],o&&n?Gi(o):[])}return t.concat(l,Gi(l,[],n))}function Yh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function k_(e){const t=Kn(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const l=bs(e),r=l?e.offsetWidth:n,i=l?e.offsetHeight:a,o=hu(n)!==r||hu(a)!==i;return o&&(n=r,a=i),{width:n,height:a,$:o}}function Ep(e){return Xn(e)?e:e.contextElement}function lr(e){const t=Ep(e);if(!bs(t))return gs(1);const n=t.getBoundingClientRect(),{width:a,height:l,$:r}=k_(t);let i=(r?hu(n.width):n.width)/a,o=(r?hu(n.height):n.height)/l;return(!i||!Number.isFinite(i))&&(i=1),(!o||!Number.isFinite(o))&&(o=1),{x:i,y:o}}const oM=gs(0);function S_(e){const t=mn(e);return!Tp()||!t.visualViewport?oM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cM(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==mn(e)?!1:t}function dl(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const l=e.getBoundingClientRect(),r=Ep(e);let i=gs(1);t&&(a?Xn(a)&&(i=lr(a)):i=lr(e));const o=cM(r,n,a)?S_(r):gs(0);let c=(l.left+o.x)/i.x,d=(l.top+o.y)/i.y,f=l.width/i.x,h=l.height/i.y;if(r){const m=mn(r),g=a&&Xn(a)?mn(a):a;let j=m,v=Yh(j);for(;v&&a&&g!==j;){const y=lr(v),x=v.getBoundingClientRect(),p=Kn(v),b=x.left+(v.clientLeft+parseFloat(p.paddingLeft))*y.x,_=x.top+(v.clientTop+parseFloat(p.paddingTop))*y.y;c*=y.x,d*=y.y,f*=y.x,h*=y.y,c+=b,d+=_,j=mn(v),v=Yh(j)}}return pu({width:f,height:h,x:c,y:d})}function Ap(e,t){const n=dd(e).scrollLeft;return t?t.left+n:dl(Ns(e)).left+n}function C_(e,t,n){n===void 0&&(n=!1);const a=e.getBoundingClientRect(),l=a.left+t.scrollLeft-(n?0:Ap(e,a)),r=a.top+t.scrollTop;return{x:l,y:r}}function uM(e){let{elements:t,rect:n,offsetParent:a,strategy:l}=e;const r=l==="fixed",i=Ns(a),o=t?ud(t.floating):!1;if(a===i||o&&r)return n;let c={scrollLeft:0,scrollTop:0},d=gs(1);const f=gs(0),h=bs(a);if((h||!h&&!r)&&((Ur(a)!=="body"||wo(i))&&(c=dd(a)),bs(a))){const g=dl(a);d=lr(a),f.x=g.x+a.clientLeft,f.y=g.y+a.clientTop}const m=i&&!h&&!r?C_(i,c,!0):gs(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 dM(e){return Array.from(e.getClientRects())}function fM(e){const t=Ns(e),n=dd(e),a=e.ownerDocument.body,l=on(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),r=on(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-n.scrollLeft+Ap(e);const o=-n.scrollTop;return Kn(a).direction==="rtl"&&(i+=on(t.clientWidth,a.clientWidth)-l),{width:l,height:r,x:i,y:o}}function hM(e,t){const n=mn(e),a=Ns(e),l=n.visualViewport;let r=a.clientWidth,i=a.clientHeight,o=0,c=0;if(l){r=l.width,i=l.height;const d=Tp();(!d||d&&t==="fixed")&&(o=l.offsetLeft,c=l.offsetTop)}return{width:r,height:i,x:o,y:c}}function mM(e,t){const n=dl(e,!0,t==="fixed"),a=n.top+e.clientTop,l=n.left+e.clientLeft,r=bs(e)?lr(e):gs(1),i=e.clientWidth*r.x,o=e.clientHeight*r.y,c=l*r.x,d=a*r.y;return{width:i,height:o,x:c,y:d}}function xv(e,t,n){let a;if(t==="viewport")a=hM(e,n);else if(t==="document")a=fM(Ns(e));else if(Xn(t))a=mM(t,n);else{const l=S_(e);a={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return pu(a)}function R_(e,t){const n=Da(e);return n===t||!Xn(n)||br(n)?!1:Kn(n).position==="fixed"||R_(n,t)}function pM(e,t){const n=t.get(e);if(n)return n;let a=Gi(e,[],!1).filter(o=>Xn(o)&&Ur(o)!=="body"),l=null;const r=Kn(e).position==="fixed";let i=r?Da(e):e;for(;Xn(i)&&!br(i);){const o=Kn(i),c=Rp(i);!c&&o.position==="fixed"&&(l=null),(r?!c&&!l:!c&&o.position==="static"&&!!l&&["absolute","fixed"].includes(l.position)||wo(i)&&!c&&R_(e,i))?a=a.filter(f=>f!==i):l=o,i=Da(i)}return t.set(e,a),a}function xM(e){let{element:t,boundary:n,rootBoundary:a,strategy:l}=e;const i=[...n==="clippingAncestors"?ud(t)?[]:pM(t,this._c):[].concat(n),a],o=i[0],c=i.reduce((d,f)=>{const h=xv(t,f,l);return d.top=on(h.top,d.top),d.right=$a(h.right,d.right),d.bottom=$a(h.bottom,d.bottom),d.left=on(h.left,d.left),d},xv(t,o,l));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function gM(e){const{width:t,height:n}=k_(e);return{width:t,height:n}}function vM(e,t,n){const a=bs(t),l=Ns(t),r=n==="fixed",i=dl(e,!0,r,t);let o={scrollLeft:0,scrollTop:0};const c=gs(0);function d(){c.x=Ap(l)}if(a||!a&&!r)if((Ur(t)!=="body"||wo(l))&&(o=dd(t)),a){const g=dl(t,!0,r,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}else l&&d();r&&!a&&l&&d();const f=l&&!a&&!r?C_(l,o):gs(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 kf(e){return Kn(e).position==="static"}function gv(e,t){if(!bs(e)||Kn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ns(e)===n&&(n=n.ownerDocument.body),n}function T_(e,t){const n=mn(e);if(ud(e))return n;if(!bs(e)){let l=Da(e);for(;l&&!br(l);){if(Xn(l)&&!kf(l))return l;l=Da(l)}return n}let a=gv(e,t);for(;a&&rM(a)&&kf(a);)a=gv(a,t);return a&&br(a)&&kf(a)&&!Rp(a)?n:a||iM(e)||n}const yM=async function(e){const t=this.getOffsetParent||T_,n=this.getDimensions,a=await n(e.floating);return{reference:vM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function bM(e){return Kn(e).direction==="rtl"}const jM={convertOffsetParentRelativeRectToViewportRelativeRect:uM,getDocumentElement:Ns,getClippingRect:xM,getOffsetParent:T_,getElementRects:yM,getClientRects:dM,getDimensions:gM,getScale:lr,isElement:Xn,isRTL:bM};function E_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _M(e,t){let n=null,a;const l=Ns(e);function r(){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),r();const d=e.getBoundingClientRect(),{left:f,top:h,width:m,height:g}=d;if(o||t(),!m||!g)return;const j=sc(h),v=sc(l.clientWidth-(f+m)),y=sc(l.clientHeight-(h+g)),x=sc(f),b={rootMargin:-j+"px "+-v+"px "+-y+"px "+-x+"px",threshold:on(0,$a(1,c))||1};let _=!0;function N(C){const w=C[0].intersectionRatio;if(w!==c){if(!_)return i();w?i(!1,w):a=setTimeout(()=>{i(!1,1e-7)},1e3)}w===1&&!E_(d,e.getBoundingClientRect())&&i(),_=!1}try{n=new IntersectionObserver(N,{...b,root:l.ownerDocument})}catch{n=new IntersectionObserver(N,b)}n.observe(e)}return i(!0),r}function wM(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:l=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,d=Ep(e),f=l||r?[...d?Gi(d):[],...Gi(t)]:[];f.forEach(x=>{l&&x.addEventListener("scroll",n,{passive:!0}),r&&x.addEventListener("resize",n)});const h=d&&o?_M(d,n):null;let m=-1,g=null;i&&(g=new ResizeObserver(x=>{let[p]=x;p&&p.target===d&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=g)==null||b.observe(t)})),n()}),d&&!c&&g.observe(d),g.observe(t));let j,v=c?dl(e):null;c&&y();function y(){const x=dl(e);v&&!E_(v,x)&&n(),v=x,j=requestAnimationFrame(y)}return n(),()=>{var x;f.forEach(p=>{l&&p.removeEventListener("scroll",n),r&&p.removeEventListener("resize",n)}),h==null||h(),(x=g)==null||x.disconnect(),g=null,c&&cancelAnimationFrame(j)}}const NM=nM,kM=sM,SM=JA,CM=lM,RM=eM,vv=WA,TM=aM,EM=(e,t,n)=>{const a=new Map,l={platform:jM,...n},r={...l.platform,_c:a};return ZA(e,t,{...l,platform:r})};var AM=typeof document<"u",MM=function(){},Cc=AM?u.useLayoutEffect:MM;function xu(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,l;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(!xu(e[a],t[a]))return!1;return!0}if(l=Object.keys(e),n=l.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,l[a]))return!1;for(a=n;a--!==0;){const r=l[a];if(!(r==="_owner"&&e.$$typeof)&&!xu(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function A_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yv(e,t){const n=A_(e);return Math.round(t*n)/n}function Sf(e){const t=u.useRef(e);return Cc(()=>{t.current=e}),t}function OM(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:l,elements:{reference:r,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,g]=u.useState(a);xu(m,a)||g(a);const[j,v]=u.useState(null),[y,x]=u.useState(null),p=u.useCallback(S=>{S!==C.current&&(C.current=S,v(S))},[]),b=u.useCallback(S=>{S!==w.current&&(w.current=S,x(S))},[]),_=r||j,N=i||y,C=u.useRef(null),w=u.useRef(null),k=u.useRef(f),A=c!=null,$=Sf(c),X=Sf(l),Y=Sf(d),L=u.useCallback(()=>{if(!C.current||!w.current)return;const S={placement:t,strategy:n,middleware:m};X.current&&(S.platform=X.current),EM(C.current,w.current,S).then(O=>{const Z={...O,isPositioned:Y.current!==!1};H.current&&!xu(k.current,Z)&&(k.current=Z,Nr.flushSync(()=>{h(Z)}))})},[m,t,n,X,Y]);Cc(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,h(S=>({...S,isPositioned:!1})))},[d]);const H=u.useRef(!1);Cc(()=>(H.current=!0,()=>{H.current=!1}),[]),Cc(()=>{if(_&&(C.current=_),N&&(w.current=N),_&&N){if($.current)return $.current(_,N,L);L()}},[_,N,L,$,A]);const T=u.useMemo(()=>({reference:C,floating:w,setReference:p,setFloating:b}),[p,b]),R=u.useMemo(()=>({reference:_,floating:N}),[_,N]),z=u.useMemo(()=>{const S={position:n,left:0,top:0};if(!R.floating)return S;const O=yv(R.floating,f.x),Z=yv(R.floating,f.y);return o?{...S,transform:"translate("+O+"px, "+Z+"px)",...A_(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:Z}},[n,o,R.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:L,refs:T,elements:R,floatingStyles:z}),[f,L,T,R,z])}const $M=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:a,padding:l}=typeof e=="function"?e(n):e;return a&&t(a)?a.current!=null?vv({element:a.current,padding:l}).fn(n):{}:a?vv({element:a,padding:l}).fn(n):{}}}},DM=(e,t)=>({...NM(e),options:[e,t]}),zM=(e,t)=>({...kM(e),options:[e,t]}),LM=(e,t)=>({...TM(e),options:[e,t]}),UM=(e,t)=>({...SM(e),options:[e,t]}),BM=(e,t)=>({...CM(e),options:[e,t]}),HM=(e,t)=>({...RM(e),options:[e,t]}),IM=(e,t)=>({...$M(e),options:[e,t]});var PM="Arrow",M_=u.forwardRef((e,t)=>{const{children:n,width:a=10,height:l=5,...r}=e;return s.jsx(we.svg,{...r,ref:t,width:a,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});M_.displayName=PM;var qM=M_,Mp="Popper",[O_,Br]=ws(Mp),[GM,$_]=O_(Mp),D_=e=>{const{__scopePopper:t,children:n}=e,[a,l]=u.useState(null);return s.jsx(GM,{scope:t,anchor:a,onAnchorChange:l,children:n})};D_.displayName=Mp;var z_="PopperAnchor",L_=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...l}=e,r=$_(z_,n),i=u.useRef(null),o=Ie(t,i);return u.useEffect(()=>{r.onAnchorChange((a==null?void 0:a.current)||i.current)}),a?null:s.jsx(we.div,{...l,ref:o})});L_.displayName=z_;var Op="PopperContent",[VM,YM]=O_(Op),U_=u.forwardRef((e,t)=>{var M,V,ae,B,te,J;const{__scopePopper:n,side:a="bottom",sideOffset:l=0,align:r="center",alignOffset:i=0,arrowPadding:o=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:j,...v}=e,y=$_(Op,n),[x,p]=u.useState(null),b=Ie(t,le=>p(le)),[_,N]=u.useState(null),C=m_(_),w=(C==null?void 0:C.width)??0,k=(C==null?void 0:C.height)??0,A=a+(r!=="center"?"-"+r:""),$=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},X=Array.isArray(d)?d:[d],Y=X.length>0,L={padding:$,boundary:X.filter(XM),altBoundary:Y},{refs:H,floatingStyles:T,placement:R,isPositioned:z,middlewareData:S}=OM({strategy:"fixed",placement:A,whileElementsMounted:(...le)=>wM(...le,{animationFrame:g==="always"}),elements:{reference:y.anchor},middleware:[DM({mainAxis:l+k,alignmentAxis:i}),c&&zM({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?LM():void 0,...L}),c&&UM({...L}),BM({...L,apply:({elements:le,rects:W,availableWidth:Qe,availableHeight:oe})=>{const{width:Oe,height:K}=W.reference,Ne=le.floating.style;Ne.setProperty("--radix-popper-available-width",`${Qe}px`),Ne.setProperty("--radix-popper-available-height",`${oe}px`),Ne.setProperty("--radix-popper-anchor-width",`${Oe}px`),Ne.setProperty("--radix-popper-anchor-height",`${K}px`)}}),_&&IM({element:_,padding:o}),KM({arrowWidth:w,arrowHeight:k}),m&&HM({strategy:"referenceHidden",...L})]}),[O,Z]=I_(R),E=ys(j);Pt(()=>{z&&(E==null||E())},[z,E]);const I=(M=S.arrow)==null?void 0:M.x,ne=(V=S.arrow)==null?void 0:V.y,ee=((ae=S.arrow)==null?void 0:ae.centerOffset)!==0,[ge,G]=u.useState();return Pt(()=>{x&&G(window.getComputedStyle(x).zIndex)},[x]),s.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...T,transform:z?T.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(B=S.transformOrigin)==null?void 0:B.x,(te=S.transformOrigin)==null?void 0:te.y].join(" "),...((J=S.hide)==null?void 0:J.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(VM,{scope:n,placedSide:O,onArrowChange:N,arrowX:I,arrowY:ne,shouldHideArrow:ee,children:s.jsx(we.div,{"data-side":O,"data-align":Z,...v,ref:b,style:{...v.style,animation:z?void 0:"none"}})})})});U_.displayName=Op;var B_="PopperArrow",FM={top:"bottom",right:"left",bottom:"top",left:"right"},H_=u.forwardRef(function(t,n){const{__scopePopper:a,...l}=t,r=YM(B_,a),i=FM[r.placedSide];return s.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:s.jsx(qM,{...l,ref:n,style:{...l.style,display:"block"}})})});H_.displayName=B_;function XM(e){return e!==null}var KM=e=>({name:"transformOrigin",options:e,fn(t){var y,x,p;const{placement:n,rects:a,middlewareData:l}=t,i=((y=l.arrow)==null?void 0:y.centerOffset)!==0,o=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=I_(n),h={start:"0%",center:"50%",end:"100%"}[f],m=(((x=l.arrow)==null?void 0:x.x)??0)+o/2,g=(((p=l.arrow)==null?void 0:p.y)??0)+c/2;let j="",v="";return d==="bottom"?(j=i?h:`${m}px`,v=`${-c}px`):d==="top"?(j=i?h:`${m}px`,v=`${a.floating.height+c}px`):d==="right"?(j=`${-c}px`,v=i?h:`${g}px`):d==="left"&&(j=`${a.floating.width+c}px`,v=i?h:`${g}px`),{data:{x:j,y:v}}}});function I_(e){const[t,n="center"]=e.split("-");return[t,n]}var $p=D_,Dp=L_,zp=U_,Lp=H_,Cf="rovingFocusGroup.onEntryFocus",QM={bubbles:!1,cancelable:!0},No="RovingFocusGroup",[Fh,P_,ZM]=Np(No),[WM,fd]=ws(No,[ZM]),[JM,eO]=WM(No),q_=u.forwardRef((e,t)=>s.jsx(Fh.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Fh.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(tO,{...e,ref:t})})}));q_.displayName=No;var tO=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:l=!1,dir:r,currentTabStopId:i,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,m=u.useRef(null),g=Ie(t,m),j=od(r),[v,y]=Oa({prop:i,defaultProp:o??null,onChange:c,caller:No}),[x,p]=u.useState(!1),b=ys(d),_=P_(n),N=u.useRef(!1),[C,w]=u.useState(0);return u.useEffect(()=>{const k=m.current;if(k)return k.addEventListener(Cf,b),()=>k.removeEventListener(Cf,b)},[b]),s.jsx(JM,{scope:n,orientation:a,dir:j,loop:l,currentTabStopId:v,onItemFocus:u.useCallback(k=>y(k),[y]),onItemShiftTab:u.useCallback(()=>p(!0),[]),onFocusableItemAdd:u.useCallback(()=>w(k=>k+1),[]),onFocusableItemRemove:u.useCallback(()=>w(k=>k-1),[]),children:s.jsx(we.div,{tabIndex:x||C===0?-1:0,"data-orientation":a,...h,ref:g,style:{outline:"none",...e.style},onMouseDown:ce(e.onMouseDown,()=>{N.current=!0}),onFocus:ce(e.onFocus,k=>{const A=!N.current;if(k.target===k.currentTarget&&A&&!x){const $=new CustomEvent(Cf,QM);if(k.currentTarget.dispatchEvent($),!$.defaultPrevented){const X=_().filter(R=>R.focusable),Y=X.find(R=>R.active),L=X.find(R=>R.id===v),T=[Y,L,...X].filter(Boolean).map(R=>R.ref.current);Y_(T,f)}}N.current=!1}),onBlur:ce(e.onBlur,()=>p(!1))})})}),G_="RovingFocusGroupItem",V_=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:l=!1,tabStopId:r,children:i,...o}=e,c=Vn(),d=r||c,f=eO(G_,n),h=f.currentTabStopId===d,m=P_(n),{onFocusableItemAdd:g,onFocusableItemRemove:j,currentTabStopId:v}=f;return u.useEffect(()=>{if(a)return g(),()=>j()},[a,g,j]),s.jsx(Fh.ItemSlot,{scope:n,id:d,focusable:a,active:l,children:s.jsx(we.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...o,ref:t,onMouseDown:ce(e.onMouseDown,y=>{a?f.onItemFocus(d):y.preventDefault()}),onFocus:ce(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:ce(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=aO(y,f.orientation,f.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let b=m().filter(_=>_.focusable).map(_=>_.ref.current);if(x==="last")b.reverse();else if(x==="prev"||x==="next"){x==="prev"&&b.reverse();const _=b.indexOf(y.currentTarget);b=f.loop?lO(b,_+1):b.slice(_+1)}setTimeout(()=>Y_(b))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:v!=null}):i})})});V_.displayName=G_;var nO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function sO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function aO(e,t,n){const a=sO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return nO[a]}function Y_(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function lO(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var F_=q_,X_=V_,Xh=["Enter"," "],rO=["ArrowDown","PageUp","Home"],K_=["ArrowUp","PageDown","End"],iO=[...rO,...K_],oO={ltr:[...Xh,"ArrowRight"],rtl:[...Xh,"ArrowLeft"]},cO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ko="Menu",[Vi,uO,dO]=Np(ko),[yl,Q_]=ws(ko,[dO,Br,fd]),hd=Br(),Z_=fd(),[fO,bl]=yl(ko),[hO,So]=yl(ko),W_=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:l,onOpenChange:r,modal:i=!0}=e,o=hd(t),[c,d]=u.useState(null),f=u.useRef(!1),h=ys(r),m=od(l);return u.useEffect(()=>{const g=()=>{f.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>f.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),s.jsx($p,{...o,children:s.jsx(fO,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:s.jsx(hO,{scope:t,onClose:u.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:m,modal:i,children:a})})})};W_.displayName=ko;var mO="MenuAnchor",Up=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=hd(n);return s.jsx(Dp,{...l,...a,ref:t})});Up.displayName=mO;var Bp="MenuPortal",[pO,J_]=yl(Bp,{forceMount:void 0}),ew=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:l}=e,r=bl(Bp,t);return s.jsx(pO,{scope:t,forceMount:n,children:s.jsx($n,{present:n||r.open,children:s.jsx(bo,{asChild:!0,container:l,children:a})})})};ew.displayName=Bp;var Tn="MenuContent",[xO,Hp]=yl(Tn),tw=u.forwardRef((e,t)=>{const n=J_(Tn,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,r=bl(Tn,e.__scopeMenu),i=So(Tn,e.__scopeMenu);return s.jsx(Vi.Provider,{scope:e.__scopeMenu,children:s.jsx($n,{present:a||r.open,children:s.jsx(Vi.Slot,{scope:e.__scopeMenu,children:i.modal?s.jsx(gO,{...l,ref:t}):s.jsx(vO,{...l,ref:t})})})})}),gO=u.forwardRef((e,t)=>{const n=bl(Tn,e.__scopeMenu),a=u.useRef(null),l=Ie(t,a);return u.useEffect(()=>{const r=a.current;if(r)return gp(r)},[]),s.jsx(Ip,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ce(e.onFocusOutside,r=>r.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),vO=u.forwardRef((e,t)=>{const n=bl(Tn,e.__scopeMenu);return s.jsx(Ip,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),yO=cl("MenuContent.ScrollLock"),Ip=u.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:l,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,disableOutsideScroll:j,...v}=e,y=bl(Tn,n),x=So(Tn,n),p=hd(n),b=Z_(n),_=uO(n),[N,C]=u.useState(null),w=u.useRef(null),k=Ie(t,w,y.onContentChange),A=u.useRef(0),$=u.useRef(""),X=u.useRef(0),Y=u.useRef(null),L=u.useRef("right"),H=u.useRef(0),T=j?ad:u.Fragment,R=j?{as:yO,allowPinchZoom:!0}:void 0,z=O=>{var M,V;const Z=$.current+O,E=_().filter(ae=>!ae.disabled),I=document.activeElement,ne=(M=E.find(ae=>ae.ref.current===I))==null?void 0:M.textValue,ee=E.map(ae=>ae.textValue),ge=AO(ee,Z,ne),G=(V=E.find(ae=>ae.textValue===ge))==null?void 0:V.ref.current;(function ae(B){$.current=B,window.clearTimeout(A.current),B!==""&&(A.current=window.setTimeout(()=>ae(""),1e3))})(Z),G&&setTimeout(()=>G.focus())};u.useEffect(()=>()=>window.clearTimeout(A.current),[]),xp();const S=u.useCallback(O=>{var E,I;return L.current===((E=Y.current)==null?void 0:E.side)&&OO(O,(I=Y.current)==null?void 0:I.area)},[]);return s.jsx(xO,{scope:n,searchRef:$,onItemEnter:u.useCallback(O=>{S(O)&&O.preventDefault()},[S]),onItemLeave:u.useCallback(O=>{var Z;S(O)||((Z=w.current)==null||Z.focus(),C(null))},[S]),onTriggerLeave:u.useCallback(O=>{S(O)&&O.preventDefault()},[S]),pointerGraceTimerRef:X,onPointerGraceIntentChange:u.useCallback(O=>{Y.current=O},[]),children:s.jsx(T,{...R,children:s.jsx(nd,{asChild:!0,trapped:l,onMountAutoFocus:ce(r,O=>{var Z;O.preventDefault(),(Z=w.current)==null||Z.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:s.jsx(yo,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,children:s.jsx(F_,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:a,currentTabStopId:N,onCurrentTabStopIdChange:C,onEntryFocus:ce(c,O=>{x.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(zp,{role:"menu","aria-orientation":"vertical","data-state":gw(y.open),"data-radix-menu-content":"",dir:x.dir,...p,...v,ref:k,style:{outline:"none",...v.style},onKeyDown:ce(v.onKeyDown,O=>{const E=O.target.closest("[data-radix-menu-content]")===O.currentTarget,I=O.ctrlKey||O.altKey||O.metaKey,ne=O.key.length===1;E&&(O.key==="Tab"&&O.preventDefault(),!I&&ne&&z(O.key));const ee=w.current;if(O.target!==ee||!iO.includes(O.key))return;O.preventDefault();const G=_().filter(M=>!M.disabled).map(M=>M.ref.current);K_.includes(O.key)&&G.reverse(),TO(G)}),onBlur:ce(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(A.current),$.current="")}),onPointerMove:ce(e.onPointerMove,Yi(O=>{const Z=O.target,E=H.current!==O.clientX;if(O.currentTarget.contains(Z)&&E){const I=O.clientX>H.current?"right":"left";L.current=I,H.current=O.clientX}}))})})})})})})});tw.displayName=Tn;var bO="MenuGroup",Pp=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(we.div,{role:"group",...a,ref:t})});Pp.displayName=bO;var jO="MenuLabel",nw=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(we.div,{...a,ref:t})});nw.displayName=jO;var gu="MenuItem",bv="menu.itemSelect",md=u.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...l}=e,r=u.useRef(null),i=So(gu,e.__scopeMenu),o=Hp(gu,e.__scopeMenu),c=Ie(t,r),d=u.useRef(!1),f=()=>{const h=r.current;if(!n&&h){const m=new CustomEvent(bv,{bubbles:!0,cancelable:!0});h.addEventListener(bv,g=>a==null?void 0:a(g),{once:!0}),k0(h,m),m.defaultPrevented?d.current=!1:i.onClose()}};return s.jsx(sw,{...l,ref:c,disabled:n,onClick:ce(e.onClick,f),onPointerDown:h=>{var m;(m=e.onPointerDown)==null||m.call(e,h),d.current=!0},onPointerUp:ce(e.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:ce(e.onKeyDown,h=>{const m=o.searchRef.current!=="";n||m&&h.key===" "||Xh.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});md.displayName=gu;var sw=u.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:l,...r}=e,i=Hp(gu,n),o=Z_(n),c=u.useRef(null),d=Ie(t,c),[f,h]=u.useState(!1),[m,g]=u.useState("");return u.useEffect(()=>{const j=c.current;j&&g((j.textContent??"").trim())},[r.children]),s.jsx(Vi.ItemSlot,{scope:n,disabled:a,textValue:l??m,children:s.jsx(X_,{asChild:!0,...o,focusable:!a,children:s.jsx(we.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...r,ref:d,onPointerMove:ce(e.onPointerMove,Yi(j=>{a?i.onItemLeave(j):(i.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(e.onPointerLeave,Yi(j=>i.onItemLeave(j))),onFocus:ce(e.onFocus,()=>h(!0)),onBlur:ce(e.onBlur,()=>h(!1))})})})}),_O="MenuCheckboxItem",aw=u.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...l}=e;return s.jsx(cw,{scope:e.__scopeMenu,checked:n,children:s.jsx(md,{role:"menuitemcheckbox","aria-checked":vu(n)?"mixed":n,...l,ref:t,"data-state":Gp(n),onSelect:ce(l.onSelect,()=>a==null?void 0:a(vu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});aw.displayName=_O;var lw="MenuRadioGroup",[wO,NO]=yl(lw,{value:void 0,onValueChange:()=>{}}),rw=u.forwardRef((e,t)=>{const{value:n,onValueChange:a,...l}=e,r=ys(a);return s.jsx(wO,{scope:e.__scopeMenu,value:n,onValueChange:r,children:s.jsx(Pp,{...l,ref:t})})});rw.displayName=lw;var iw="MenuRadioItem",ow=u.forwardRef((e,t)=>{const{value:n,...a}=e,l=NO(iw,e.__scopeMenu),r=n===l.value;return s.jsx(cw,{scope:e.__scopeMenu,checked:r,children:s.jsx(md,{role:"menuitemradio","aria-checked":r,...a,ref:t,"data-state":Gp(r),onSelect:ce(a.onSelect,()=>{var i;return(i=l.onValueChange)==null?void 0:i.call(l,n)},{checkForDefaultPrevented:!1})})})});ow.displayName=iw;var qp="MenuItemIndicator",[cw,kO]=yl(qp,{checked:!1}),uw=u.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...l}=e,r=kO(qp,n);return s.jsx($n,{present:a||vu(r.checked)||r.checked===!0,children:s.jsx(we.span,{...l,ref:t,"data-state":Gp(r.checked)})})});uw.displayName=qp;var SO="MenuSeparator",dw=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(we.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});dw.displayName=SO;var CO="MenuArrow",fw=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=hd(n);return s.jsx(Lp,{...l,...a,ref:t})});fw.displayName=CO;var RO="MenuSub",[Z6,hw]=yl(RO),ri="MenuSubTrigger",mw=u.forwardRef((e,t)=>{const n=bl(ri,e.__scopeMenu),a=So(ri,e.__scopeMenu),l=hw(ri,e.__scopeMenu),r=Hp(ri,e.__scopeMenu),i=u.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:c}=r,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(Up,{asChild:!0,...d,children:s.jsx(sw,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":l.contentId,"data-state":gw(n.open),...e,ref:td(t,l.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:ce(e.onPointerMove,Yi(h=>{r.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(r.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:ce(e.onPointerLeave,Yi(h=>{var g,j;f();const m=(g=n.content)==null?void 0:g.getBoundingClientRect();if(m){const v=(j=n.content)==null?void 0:j.dataset.side,y=v==="right",x=y?-5:5,p=m[y?"left":"right"],b=m[y?"right":"left"];r.onPointerGraceIntentChange({area:[{x:h.clientX+x,y:h.clientY},{x:p,y:m.top},{x:b,y:m.top},{x:b,y:m.bottom},{x:p,y:m.bottom}],side:v}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>r.onPointerGraceIntentChange(null),300)}else{if(r.onTriggerLeave(h),h.defaultPrevented)return;r.onPointerGraceIntentChange(null)}})),onKeyDown:ce(e.onKeyDown,h=>{var g;const m=r.searchRef.current!=="";e.disabled||m&&h.key===" "||oO[a.dir].includes(h.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),h.preventDefault())})})})});mw.displayName=ri;var pw="MenuSubContent",xw=u.forwardRef((e,t)=>{const n=J_(Tn,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,r=bl(Tn,e.__scopeMenu),i=So(Tn,e.__scopeMenu),o=hw(pw,e.__scopeMenu),c=u.useRef(null),d=Ie(t,c);return s.jsx(Vi.Provider,{scope:e.__scopeMenu,children:s.jsx($n,{present:a||r.open,children:s.jsx(Vi.Slot,{scope:e.__scopeMenu,children:s.jsx(Ip,{id:o.contentId,"aria-labelledby":o.triggerId,...l,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:ce(e.onFocusOutside,f=>{f.target!==o.trigger&&r.onOpenChange(!1)}),onEscapeKeyDown:ce(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:ce(e.onKeyDown,f=>{var g;const h=f.currentTarget.contains(f.target),m=cO[i.dir].includes(f.key);h&&m&&(r.onOpenChange(!1),(g=o.trigger)==null||g.focus(),f.preventDefault())})})})})})});xw.displayName=pw;function gw(e){return e?"open":"closed"}function vu(e){return e==="indeterminate"}function Gp(e){return vu(e)?"indeterminate":e?"checked":"unchecked"}function TO(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function EO(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function AO(e,t,n){const l=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,r=n?e.indexOf(n):-1;let i=EO(e,Math.max(r,0));l.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(l.toLowerCase()));return c!==n?c:void 0}function MO(e,t){const{x:n,y:a}=e;let l=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){const o=t[r],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&&(l=!l)}return l}function OO(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return MO(n,t)}function Yi(e){return t=>t.pointerType==="mouse"?e(t):void 0}var $O=W_,DO=Up,zO=ew,LO=tw,UO=Pp,BO=nw,HO=md,IO=aw,PO=rw,qO=ow,GO=uw,VO=dw,YO=fw,FO=mw,XO=xw,pd="DropdownMenu",[KO]=ws(pd,[Q_]),Yt=Q_(),[QO,vw]=KO(pd),yw=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:l,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,c=Yt(t),d=u.useRef(null),[f,h]=Oa({prop:l,defaultProp:r??!1,onChange:i,caller:pd});return s.jsx(QO,{scope:t,triggerId:Vn(),triggerRef:d,contentId:Vn(),open:f,onOpenChange:h,onOpenToggle:u.useCallback(()=>h(m=>!m),[h]),modal:o,children:s.jsx($O,{...c,open:f,onOpenChange:h,dir:a,modal:o,children:n})})};yw.displayName=pd;var bw="DropdownMenuTrigger",jw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...l}=e,r=vw(bw,n),i=Yt(n);return s.jsx(DO,{asChild:!0,...i,children:s.jsx(we.button,{type:"button",id:r.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":r.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...l,ref:td(t,r.triggerRef),onPointerDown:ce(e.onPointerDown,o=>{!a&&o.button===0&&o.ctrlKey===!1&&(r.onOpenToggle(),r.open||o.preventDefault())}),onKeyDown:ce(e.onKeyDown,o=>{a||(["Enter"," "].includes(o.key)&&r.onOpenToggle(),o.key==="ArrowDown"&&r.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});jw.displayName=bw;var ZO="DropdownMenuPortal",_w=e=>{const{__scopeDropdownMenu:t,...n}=e,a=Yt(t);return s.jsx(zO,{...a,...n})};_w.displayName=ZO;var ww="DropdownMenuContent",Nw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=vw(ww,n),r=Yt(n),i=u.useRef(!1);return s.jsx(LO,{id:l.contentId,"aria-labelledby":l.triggerId,...r,...a,ref:t,onCloseAutoFocus:ce(e.onCloseAutoFocus,o=>{var c;i.current||(c=l.triggerRef.current)==null||c.focus(),i.current=!1,o.preventDefault()}),onInteractOutside:ce(e.onInteractOutside,o=>{const c=o.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!l.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)"}})});Nw.displayName=ww;var WO="DropdownMenuGroup",JO=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(UO,{...l,...a,ref:t})});JO.displayName=WO;var e4="DropdownMenuLabel",kw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(BO,{...l,...a,ref:t})});kw.displayName=e4;var t4="DropdownMenuItem",Sw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(HO,{...l,...a,ref:t})});Sw.displayName=t4;var n4="DropdownMenuCheckboxItem",Cw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(IO,{...l,...a,ref:t})});Cw.displayName=n4;var s4="DropdownMenuRadioGroup",a4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(PO,{...l,...a,ref:t})});a4.displayName=s4;var l4="DropdownMenuRadioItem",Rw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(qO,{...l,...a,ref:t})});Rw.displayName=l4;var r4="DropdownMenuItemIndicator",Tw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(GO,{...l,...a,ref:t})});Tw.displayName=r4;var i4="DropdownMenuSeparator",Ew=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(VO,{...l,...a,ref:t})});Ew.displayName=i4;var o4="DropdownMenuArrow",c4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(YO,{...l,...a,ref:t})});c4.displayName=o4;var u4="DropdownMenuSubTrigger",Aw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(FO,{...l,...a,ref:t})});Aw.displayName=u4;var d4="DropdownMenuSubContent",Mw=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Yt(n);return s.jsx(XO,{...l,...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)"}})});Mw.displayName=d4;var f4=yw,h4=jw,m4=_w,Ow=Nw,$w=kw,Dw=Sw,zw=Cw,Lw=Rw,Uw=Tw,Bw=Ew,Hw=Aw,Iw=Mw;const xd=f4,gd=h4,p4=u.forwardRef(({className:e,inset:t,children:n,...a},l)=>s.jsxs(Hw,{ref:l,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(a0,{className:"ml-auto"})]}));p4.displayName=Hw.displayName;const x4=u.forwardRef(({className:e,...t},n)=>s.jsx(Iw,{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}));x4.displayName=Iw.displayName;const Co=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>s.jsx(m4,{container:jo(),children:s.jsx(Ow,{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})}));Co.displayName=Ow.displayName;const jr=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(Dw,{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}));jr.displayName=Dw.displayName;const g4=u.forwardRef(({className:e,children:t,checked:n,...a},l)=>s.jsxs(zw,{ref:l,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(Uw,{children:s.jsx(Mr,{className:"h-4 w-4"})})}),t]}));g4.displayName=zw.displayName;const v4=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(Lw,{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(Uw,{children:s.jsx(ZC,{className:"h-2 w-2 fill-current"})})}),t]}));v4.displayName=Lw.displayName;const y4=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx($w,{ref:a,className:ie("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));y4.displayName=$w.displayName;const b4=u.forwardRef(({className:e,...t},n)=>s.jsx(Bw,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));b4.displayName=Bw.displayName;const j4={default:"h-9 px-3 py-1 text-sm",control:"h-7 px-2 py-1 text-xs"},Ot=u.forwardRef(({className:e,type:t,inputSize:n="default",...a},l)=>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",j4[n],e),ref:l,...a}));Ot.displayName="Input";var _4="Label",Pw=u.forwardRef((e,t)=>s.jsx(we.label,{...e,ref:t,onMouseDown:n=>{var l;n.target.closest("button, input, select, textarea")||((l=e.onMouseDown)==null||l.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Pw.displayName=_4;var qw=Pw;const w4=vo("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Me=u.forwardRef(({className:e,...t},n)=>s.jsx(qw,{ref:n,className:ie(w4(),e),...t}));Me.displayName=qw.displayName;function Ba({title:e,description:t,backHref:n,backLabel:a,className:l,icon:r,link:i}){const o=s.jsx(P,{asChild:!0,variant:"outline",size:"sm",className:"mt-4 no-underline",children:s.jsx(i,{href:n,children:a})});return r?s.jsx("div",{className:ie("flex-1 px-4 py-8 sm:px-6 lg:px-8",l),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:r}),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",l),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 Ft({title:e,description:t,actions:n,className:a,children:l,...r}){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),...r,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,l]}),n?s.jsx("div",{"data-slot":"page-header-actions",className:"flex shrink-0 items-center gap-2",children:n}):null]})}function jt({as:e="div",className:t,...n}){return s.jsx(e,{className:ie("rounded-lg border",t),...n})}function jv(e,[t,n]){return Math.min(n,Math.max(t,e))}var Gw=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"}),N4="VisuallyHidden",Vw=u.forwardRef((e,t)=>s.jsx(we.span,{...e,ref:t,style:{...Gw,...e.style}}));Vw.displayName=N4;var k4=Vw,S4=[" ","Enter","ArrowUp","ArrowDown"],C4=[" ","Enter"],fl="Select",[vd,yd,R4]=Np(fl),[Hr]=ws(fl,[R4,Br]),bd=Br(),[T4,Ha]=Hr(fl),[E4,A4]=Hr(fl),Yw=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:l,onOpenChange:r,value:i,defaultValue:o,onValueChange:c,dir:d,name:f,autoComplete:h,disabled:m,required:g,form:j}=e,v=bd(t),[y,x]=u.useState(null),[p,b]=u.useState(null),[_,N]=u.useState(!1),C=od(d),[w,k]=Oa({prop:a,defaultProp:l??!1,onChange:r,caller:fl}),[A,$]=Oa({prop:i,defaultProp:o,onChange:c,caller:fl}),X=u.useRef(null),Y=y?j||!!y.closest("form"):!0,[L,H]=u.useState(new Set),T=Array.from(L).map(R=>R.props.value).join(";");return s.jsx($p,{...v,children:s.jsxs(T4,{required:g,scope:t,trigger:y,onTriggerChange:x,valueNode:p,onValueNodeChange:b,valueNodeHasChildren:_,onValueNodeHasChildrenChange:N,contentId:Vn(),value:A,onValueChange:$,open:w,onOpenChange:k,dir:C,triggerPointerDownPosRef:X,disabled:m,children:[s.jsx(vd.Provider,{scope:t,children:s.jsx(E4,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(R=>{H(z=>new Set(z).add(R))},[]),onNativeOptionRemove:u.useCallback(R=>{H(z=>{const S=new Set(z);return S.delete(R),S})},[]),children:n})}),Y?s.jsxs(xN,{"aria-hidden":!0,required:g,tabIndex:-1,name:f,autoComplete:h,value:A,onChange:R=>$(R.target.value),disabled:m,form:j,children:[A===void 0?s.jsx("option",{value:""}):null,Array.from(L)]},T):null]})})};Yw.displayName=fl;var Fw="SelectTrigger",Xw=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...l}=e,r=bd(n),i=Ha(Fw,n),o=i.disabled||a,c=Ie(t,i.onTriggerChange),d=yd(n),f=u.useRef("touch"),[h,m,g]=vN(v=>{const y=d().filter(b=>!b.disabled),x=y.find(b=>b.value===i.value),p=yN(y,v,x);p!==void 0&&i.onValueChange(p.value)}),j=v=>{o||(i.onOpenChange(!0),g()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return s.jsx(Dp,{asChild:!0,...r,children:s.jsx(we.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":gN(i.value)?"":void 0,...l,ref:c,onClick:ce(l.onClick,v=>{v.currentTarget.focus(),f.current!=="mouse"&&j(v)}),onPointerDown:ce(l.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"&&(j(v),v.preventDefault())}),onKeyDown:ce(l.onKeyDown,v=>{const y=h.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(y&&v.key===" ")&&S4.includes(v.key)&&(j(),v.preventDefault())})})})});Xw.displayName=Fw;var Kw="SelectValue",Qw=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:l,children:r,placeholder:i="",...o}=e,c=Ha(Kw,n),{onValueNodeHasChildrenChange:d}=c,f=r!==void 0,h=Ie(t,c.onValueNodeChange);return Pt(()=>{d(f)},[d,f]),s.jsx(we.span,{...o,ref:h,style:{pointerEvents:"none"},children:gN(c.value)?s.jsx(s.Fragment,{children:i}):r})});Qw.displayName=Kw;var M4="SelectIcon",Zw=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...l}=e;return s.jsx(we.span,{"aria-hidden":!0,...l,ref:t,children:a||"▼"})});Zw.displayName=M4;var O4="SelectPortal",Ww=e=>s.jsx(bo,{asChild:!0,...e});Ww.displayName=O4;var hl="SelectContent",Jw=u.forwardRef((e,t)=>{const n=Ha(hl,e.__scopeSelect),[a,l]=u.useState();if(Pt(()=>{l(new DocumentFragment)},[]),!n.open){const r=a;return r?Nr.createPortal(s.jsx(eN,{scope:e.__scopeSelect,children:s.jsx(vd.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),r):null}return s.jsx(tN,{...e,ref:t})});Jw.displayName=hl;var Un=10,[eN,Ia]=Hr(hl),$4="SelectContentImpl",D4=cl("SelectContent.RemoveScroll"),tN=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:r,onPointerDownOutside:i,side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:g,sticky:j,hideWhenDetached:v,avoidCollisions:y,...x}=e,p=Ha(hl,n),[b,_]=u.useState(null),[N,C]=u.useState(null),w=Ie(t,M=>_(M)),[k,A]=u.useState(null),[$,X]=u.useState(null),Y=yd(n),[L,H]=u.useState(!1),T=u.useRef(!1);u.useEffect(()=>{if(b)return gp(b)},[b]),xp();const R=u.useCallback(M=>{const[V,...ae]=Y().map(J=>J.ref.current),[B]=ae.slice(-1),te=document.activeElement;for(const J of M)if(J===te||(J==null||J.scrollIntoView({block:"nearest"}),J===V&&N&&(N.scrollTop=0),J===B&&N&&(N.scrollTop=N.scrollHeight),J==null||J.focus(),document.activeElement!==te))return},[Y,N]),z=u.useCallback(()=>R([k,b]),[R,k,b]);u.useEffect(()=>{L&&z()},[L,z]);const{onOpenChange:S,triggerPointerDownPosRef:O}=p;u.useEffect(()=>{if(b){let M={x:0,y:0};const V=B=>{var te,J;M={x:Math.abs(Math.round(B.pageX)-(((te=O.current)==null?void 0:te.x)??0)),y:Math.abs(Math.round(B.pageY)-(((J=O.current)==null?void 0:J.y)??0))}},ae=B=>{M.x<=10&&M.y<=10?B.preventDefault():b.contains(B.target)||S(!1),document.removeEventListener("pointermove",V),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",V),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",V),document.removeEventListener("pointerup",ae,{capture:!0})}}},[b,S,O]),u.useEffect(()=>{const M=()=>S(!1);return window.addEventListener("blur",M),window.addEventListener("resize",M),()=>{window.removeEventListener("blur",M),window.removeEventListener("resize",M)}},[S]);const[Z,E]=vN(M=>{const V=Y().filter(te=>!te.disabled),ae=V.find(te=>te.ref.current===document.activeElement),B=yN(V,M,ae);B&&setTimeout(()=>B.ref.current.focus())}),I=u.useCallback((M,V,ae)=>{const B=!T.current&&!ae;(p.value!==void 0&&p.value===V||B)&&(A(M),B&&(T.current=!0))},[p.value]),ne=u.useCallback(()=>b==null?void 0:b.focus(),[b]),ee=u.useCallback((M,V,ae)=>{const B=!T.current&&!ae;(p.value!==void 0&&p.value===V||B)&&X(M)},[p.value]),ge=a==="popper"?Kh:nN,G=ge===Kh?{side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:g,sticky:j,hideWhenDetached:v,avoidCollisions:y}:{};return s.jsx(eN,{scope:n,content:b,viewport:N,onViewportChange:C,itemRefCallback:I,selectedItem:k,onItemLeave:ne,itemTextRefCallback:ee,focusSelectedItem:z,selectedItemText:$,position:a,isPositioned:L,searchRef:Z,children:s.jsx(ad,{as:D4,allowPinchZoom:!0,children:s.jsx(nd,{asChild:!0,trapped:p.open,onMountAutoFocus:M=>{M.preventDefault()},onUnmountAutoFocus:ce(l,M=>{var V;(V=p.trigger)==null||V.focus({preventScroll:!0}),M.preventDefault()}),children:s.jsx(yo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:M=>M.preventDefault(),onDismiss:()=>p.onOpenChange(!1),children:s.jsx(ge,{role:"listbox",id:p.contentId,"data-state":p.open?"open":"closed",dir:p.dir,onContextMenu:M=>M.preventDefault(),...x,...G,onPlaced:()=>H(!0),ref:w,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:ce(x.onKeyDown,M=>{const V=M.ctrlKey||M.altKey||M.metaKey;if(M.key==="Tab"&&M.preventDefault(),!V&&M.key.length===1&&E(M.key),["ArrowUp","ArrowDown","Home","End"].includes(M.key)){let B=Y().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(M.key)&&(B=B.slice().reverse()),["ArrowUp","ArrowDown"].includes(M.key)){const te=M.target,J=B.indexOf(te);B=B.slice(J+1)}setTimeout(()=>R(B)),M.preventDefault()}})})})})})})});tN.displayName=$4;var z4="SelectItemAlignedPosition",nN=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...l}=e,r=Ha(hl,n),i=Ia(hl,n),[o,c]=u.useState(null),[d,f]=u.useState(null),h=Ie(t,w=>f(w)),m=yd(n),g=u.useRef(!1),j=u.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:x,focusSelectedItem:p}=i,b=u.useCallback(()=>{if(r.trigger&&r.valueNode&&o&&d&&v&&y&&x){const w=r.trigger.getBoundingClientRect(),k=d.getBoundingClientRect(),A=r.valueNode.getBoundingClientRect(),$=x.getBoundingClientRect();if(r.dir!=="rtl"){const te=$.left-k.left,J=A.left-te,le=w.left-J,W=w.width+le,Qe=Math.max(W,k.width),oe=window.innerWidth-Un,Oe=jv(J,[Un,Math.max(Un,oe-Qe)]);o.style.minWidth=W+"px",o.style.left=Oe+"px"}else{const te=k.right-$.right,J=window.innerWidth-A.right-te,le=window.innerWidth-w.right-J,W=w.width+le,Qe=Math.max(W,k.width),oe=window.innerWidth-Un,Oe=jv(J,[Un,Math.max(Un,oe-Qe)]);o.style.minWidth=W+"px",o.style.right=Oe+"px"}const X=m(),Y=window.innerHeight-Un*2,L=v.scrollHeight,H=window.getComputedStyle(d),T=parseInt(H.borderTopWidth,10),R=parseInt(H.paddingTop,10),z=parseInt(H.borderBottomWidth,10),S=parseInt(H.paddingBottom,10),O=T+R+L+S+z,Z=Math.min(y.offsetHeight*5,O),E=window.getComputedStyle(v),I=parseInt(E.paddingTop,10),ne=parseInt(E.paddingBottom,10),ee=w.top+w.height/2-Un,ge=Y-ee,G=y.offsetHeight/2,M=y.offsetTop+G,V=T+R+M,ae=O-V;if(V<=ee){const te=X.length>0&&y===X[X.length-1].ref.current;o.style.bottom="0px";const J=d.clientHeight-v.offsetTop-v.offsetHeight,le=Math.max(ge,G+(te?ne:0)+J+z),W=V+le;o.style.height=W+"px"}else{const te=X.length>0&&y===X[0].ref.current;o.style.top="0px";const le=Math.max(ee,T+v.offsetTop+(te?I:0)+G)+ae;o.style.height=le+"px",v.scrollTop=V-ee+v.offsetTop}o.style.margin=`${Un}px 0`,o.style.minHeight=Z+"px",o.style.maxHeight=Y+"px",a==null||a(),requestAnimationFrame(()=>g.current=!0)}},[m,r.trigger,r.valueNode,o,d,v,y,x,r.dir,a]);Pt(()=>b(),[b]);const[_,N]=u.useState();Pt(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const C=u.useCallback(w=>{w&&j.current===!0&&(b(),p==null||p(),j.current=!1)},[b,p]);return s.jsx(U4,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:g,onScrollButtonChange:C,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:s.jsx(we.div,{...l,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});nN.displayName=z4;var L4="SelectPopperPosition",Kh=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:l=Un,...r}=e,i=bd(n);return s.jsx(zp,{...i,...r,ref:t,align:a,collisionPadding:l,style:{boxSizing:"border-box",...r.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Kh.displayName=L4;var[U4,Vp]=Hr(hl,{}),Qh="SelectViewport",sN=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...l}=e,r=Ia(Qh,n),i=Vp(Qh,n),o=Ie(t,r.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(vd.Slot,{scope:n,children:s.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:ce(l.onScroll,d=>{const f=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&h){const g=Math.abs(c.current-f.scrollTop);if(g>0){const j=window.innerHeight-Un*2,v=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),x=Math.max(v,y);if(x<j){const p=x+g,b=Math.min(j,p),_=p-b;h.style.height=b+"px",h.style.bottom==="0px"&&(f.scrollTop=_>0?_:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});sN.displayName=Qh;var aN="SelectGroup",[B4,H4]=Hr(aN),I4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,l=Vn();return s.jsx(B4,{scope:n,id:l,children:s.jsx(we.div,{role:"group","aria-labelledby":l,...a,ref:t})})});I4.displayName=aN;var lN="SelectLabel",rN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,l=H4(lN,n);return s.jsx(we.div,{id:l.id,...a,ref:t})});rN.displayName=lN;var yu="SelectItem",[P4,iN]=Hr(yu),oN=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:l=!1,textValue:r,...i}=e,o=Ha(yu,n),c=Ia(yu,n),d=o.value===a,[f,h]=u.useState(r??""),[m,g]=u.useState(!1),j=Ie(t,p=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,p,a,l)}),v=Vn(),y=u.useRef("touch"),x=()=>{l||(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(P4,{scope:n,value:a,disabled:l,textId:v,isSelected:d,onItemTextChange:u.useCallback(p=>{h(b=>b||((p==null?void 0:p.textContent)??"").trim())},[]),children:s.jsx(vd.ItemSlot,{scope:n,value:a,disabled:l,textValue:f,children:s.jsx(we.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...i,ref:j,onFocus:ce(i.onFocus,()=>g(!0)),onBlur:ce(i.onBlur,()=>g(!1)),onClick:ce(i.onClick,()=>{y.current!=="mouse"&&x()}),onPointerUp:ce(i.onPointerUp,()=>{y.current==="mouse"&&x()}),onPointerDown:ce(i.onPointerDown,p=>{y.current=p.pointerType}),onPointerMove:ce(i.onPointerMove,p=>{var b;y.current=p.pointerType,l?(b=c.onItemLeave)==null||b.call(c):y.current==="mouse"&&p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(i.onPointerLeave,p=>{var b;p.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:ce(i.onKeyDown,p=>{var _;((_=c.searchRef)==null?void 0:_.current)!==""&&p.key===" "||(C4.includes(p.key)&&x(),p.key===" "&&p.preventDefault())})})})})});oN.displayName=yu;var ii="SelectItemText",cN=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:l,...r}=e,i=Ha(ii,n),o=Ia(ii,n),c=iN(ii,n),d=A4(ii,n),[f,h]=u.useState(null),m=Ie(t,x=>h(x),c.onItemTextChange,x=>{var p;return(p=o.itemTextRefCallback)==null?void 0:p.call(o,x,c.value,c.disabled)}),g=f==null?void 0:f.textContent,j=u.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=d;return Pt(()=>(v(j),()=>y(j)),[v,y,j]),s.jsxs(s.Fragment,{children:[s.jsx(we.span,{id:c.textId,...r,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Nr.createPortal(r.children,i.valueNode):null]})});cN.displayName=ii;var uN="SelectItemIndicator",dN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return iN(uN,n).isSelected?s.jsx(we.span,{"aria-hidden":!0,...a,ref:t}):null});dN.displayName=uN;var Zh="SelectScrollUpButton",fN=u.forwardRef((e,t)=>{const n=Ia(Zh,e.__scopeSelect),a=Vp(Zh,e.__scopeSelect),[l,r]=u.useState(!1),i=Ie(t,a.onScrollButtonChange);return Pt(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollTop>0;r(d)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),l?s.jsx(mN,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop-c.offsetHeight)}}):null});fN.displayName=Zh;var Wh="SelectScrollDownButton",hN=u.forwardRef((e,t)=>{const n=Ia(Wh,e.__scopeSelect),a=Vp(Wh,e.__scopeSelect),[l,r]=u.useState(!1),i=Ie(t,a.onScrollButtonChange);return Pt(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;r(f)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),l?s.jsx(mN,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop+c.offsetHeight)}}):null});hN.displayName=Wh;var mN=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...l}=e,r=Ia("SelectScrollButton",n),i=u.useRef(null),o=yd(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),Pt(()=>{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(we.div,{"aria-hidden":!0,...l,ref:t,style:{flexShrink:0,...l.style},onPointerDown:ce(l.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:ce(l.onPointerMove,()=>{var d;(d=r.onItemLeave)==null||d.call(r),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:ce(l.onPointerLeave,()=>{c()})})}),q4="SelectSeparator",pN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return s.jsx(we.div,{"aria-hidden":!0,...a,ref:t})});pN.displayName=q4;var Jh="SelectArrow",G4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,l=bd(n),r=Ha(Jh,n),i=Ia(Jh,n);return r.open&&i.position==="popper"?s.jsx(Lp,{...l,...a,ref:t}):null});G4.displayName=Jh;var V4="SelectBubbleInput",xN=u.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const l=u.useRef(null),r=Ie(a,l),i=h_(t);return u.useEffect(()=>{const o=l.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(we.select,{...n,style:{...Gw,...n.style},ref:r,defaultValue:t})});xN.displayName=V4;function gN(e){return e===""||e===void 0}function vN(e){const t=ys(e),n=u.useRef(""),a=u.useRef(0),l=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]),r=u.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,l,r]}function yN(e,t,n){const l=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,r=n?e.indexOf(n):-1;let i=Y4(e,Math.max(r,0));l.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(l.toLowerCase()));return c!==n?c:void 0}function Y4(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var F4=Yw,bN=Xw,X4=Qw,K4=Zw,Q4=Ww,jN=Jw,Z4=sN,_N=rN,wN=oN,W4=cN,J4=dN,NN=fN,kN=hN,SN=pN;const e$={default:"h-9 px-3 py-2 text-sm",control:"h-7 px-2 py-1 text-xs"},dt=F4,ft=X4,it=u.forwardRef(({className:e,children:t,triggerSize:n="default",...a},l)=>s.jsxs(bN,{ref:l,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",e$[n],e),...a,children:[t,s.jsx(K4,{asChild:!0,children:s.jsx(l0,{className:"text-muted-foreground size-4","aria-hidden":"true"})})]}));it.displayName=bN.displayName;const CN=u.forwardRef(({className:e,...t},n)=>s.jsx(NN,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(YC,{className:"size-4","aria-hidden":"true"})}));CN.displayName=NN.displayName;const RN=u.forwardRef(({className:e,...t},n)=>s.jsx(kN,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(qC,{className:"size-4","aria-hidden":"true"})}));RN.displayName=kN.displayName;const ot=u.forwardRef(({className:e,children:t,position:n="popper",...a},l)=>s.jsx(Q4,{container:jo(),children:s.jsxs(jN,{ref:l,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(CN,{}),s.jsx(Z4,{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(RN,{})]})}));ot.displayName=jN.displayName;const t$=u.forwardRef(({className:e,...t},n)=>s.jsx(_N,{ref:n,className:ie("px-2 py-1.5 text-sm font-semibold",e),...t}));t$.displayName=_N.displayName;const ke=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(J4,{children:s.jsx(Mr,{className:"size-4","aria-hidden":"true"})})}),s.jsx(W4,{children:t})]}));ke.displayName=wN.displayName;const n$=u.forwardRef(({className:e,...t},n)=>s.jsx(SN,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));n$.displayName=SN.displayName;function pt({className:e,...t}){return s.jsx("div",{className:ie("animate-pulse rounded-md bg-primary/10",e),...t})}const Be=u.forwardRef(({className:e,containerClassName:t,containerRef:n,containerTabIndex:a,containerAriaLabel:l,...r},i)=>s.jsx("div",{ref:n,tabIndex:a,"aria-label":l,className:ie("relative w-full overflow-auto",t),children:s.jsx("table",{ref:i,className:ie("w-full caption-bottom text-sm",e),...r})}));Be.displayName="Table";const Ge=u.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));Ge.displayName="TableHeader";const He=u.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));He.displayName="TableBody";const s$=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}));s$.displayName="TableFooter";const ue=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}));ue.displayName="TableRow";const F=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}));F.displayName="TableHead";const q=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}));q.displayName="TableCell";const a$=u.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:ie("text-muted-foreground mt-4 text-sm",e),...t}));a$.displayName="TableCaption";var jd="Tabs",[l$]=ws(jd,[fd]),TN=fd(),[r$,Yp]=l$(jd),EN=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:l,defaultValue:r,orientation:i="horizontal",dir:o,activationMode:c="automatic",...d}=e,f=od(o),[h,m]=Oa({prop:a,onChange:l,defaultProp:r??"",caller:jd});return s.jsx(r$,{scope:n,baseId:Vn(),value:h,onValueChange:m,orientation:i,dir:f,activationMode:c,children:s.jsx(we.div,{dir:f,"data-orientation":i,...d,ref:t})})});EN.displayName=jd;var AN="TabsList",MN=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...l}=e,r=Yp(AN,n),i=TN(n);return s.jsx(F_,{asChild:!0,...i,orientation:r.orientation,dir:r.dir,loop:a,children:s.jsx(we.div,{role:"tablist","aria-orientation":r.orientation,...l,ref:t})})});MN.displayName=AN;var ON="TabsTrigger",$N=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:l=!1,...r}=e,i=Yp(ON,n),o=TN(n),c=LN(i.baseId,a),d=UN(i.baseId,a),f=a===i.value;return s.jsx(X_,{asChild:!0,...o,focusable:!l,active:f,children:s.jsx(we.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:c,...r,ref:t,onMouseDown:ce(e.onMouseDown,h=>{!l&&h.button===0&&h.ctrlKey===!1?i.onValueChange(a):h.preventDefault()}),onKeyDown:ce(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(a)}),onFocus:ce(e.onFocus,()=>{const h=i.activationMode!=="manual";!f&&!l&&h&&i.onValueChange(a)})})})});$N.displayName=ON;var DN="TabsContent",zN=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:l,children:r,...i}=e,o=Yp(DN,n),c=LN(o.baseId,a),d=UN(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($n,{present:l||f,children:({present:m})=>s.jsx(we.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&&r})})});zN.displayName=DN;function LN(e,t){return`${e}-trigger-${t}`}function UN(e,t){return`${e}-content-${t}`}var i$=EN,BN=MN,HN=$N,IN=zN;const o$=i$,PN=u.forwardRef(({className:e,...t},n)=>s.jsx(BN,{ref:n,className:ie("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));PN.displayName=BN.displayName;const em=u.forwardRef(({className:e,...t},n)=>s.jsx(HN,{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}));em.displayName=HN.displayName;const c$=u.forwardRef(({className:e,...t},n)=>s.jsx(IN,{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}));c$.displayName=IN.displayName;const ks=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}));ks.displayName="Textarea";var[_d]=ws("Tooltip",[Br]),wd=Br(),qN="TooltipProvider",u$=700,tm="tooltip.open",[d$,Fp]=_d(qN),GN=e=>{const{__scopeTooltip:t,delayDuration:n=u$,skipDelayDuration:a=300,disableHoverableContent:l=!1,children:r}=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(d$,{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:l,children:r})};GN.displayName=qN;var Fi="Tooltip",[f$,Ro]=_d(Fi),VN=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:l,onOpenChange:r,disableHoverableContent:i,delayDuration:o}=e,c=Fp(Fi,e.__scopeTooltip),d=wd(t),[f,h]=u.useState(null),m=Vn(),g=u.useRef(0),j=i??c.disableHoverableContent,v=o??c.delayDuration,y=u.useRef(!1),[x,p]=Oa({prop:a,defaultProp:l??!1,onChange:w=>{w?(c.onOpen(),document.dispatchEvent(new CustomEvent(tm))):c.onClose(),r==null||r(w)},caller:Fi}),b=u.useMemo(()=>x?y.current?"delayed-open":"instant-open":"closed",[x]),_=u.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,p(!0)},[p]),N=u.useCallback(()=>{window.clearTimeout(g.current),g.current=0,p(!1)},[p]),C=u.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,p(!0),g.current=0},v)},[v,p]);return u.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),s.jsx($p,{...d,children:s.jsx(f$,{scope:t,contentId:m,open:x,stateAttribute:b,trigger:f,onTriggerChange:h,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?C():_()},[c.isOpenDelayedRef,C,_]),onTriggerLeave:u.useCallback(()=>{j?N():(window.clearTimeout(g.current),g.current=0)},[N,j]),onOpen:_,onClose:N,disableHoverableContent:j,children:n})})};VN.displayName=Fi;var nm="TooltipTrigger",YN=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=Ro(nm,n),r=Fp(nm,n),i=wd(n),o=u.useRef(null),c=Ie(t,o,l.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(Dp,{asChild:!0,...i,children:s.jsx(we.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...a,ref:c,onPointerMove:ce(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!r.isPointerInTransitRef.current&&(l.onTriggerEnter(),f.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{l.onTriggerLeave(),f.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{l.open&&l.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ce(e.onFocus,()=>{d.current||l.onOpen()}),onBlur:ce(e.onBlur,l.onClose),onClick:ce(e.onClick,l.onClose)})})});YN.displayName=nm;var Xp="TooltipPortal",[h$,m$]=_d(Xp,{forceMount:void 0}),FN=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:l}=e,r=Ro(Xp,t);return s.jsx(h$,{scope:t,forceMount:n,children:s.jsx($n,{present:n||r.open,children:s.jsx(bo,{asChild:!0,container:l,children:a})})})};FN.displayName=Xp;var _r="TooltipContent",XN=u.forwardRef((e,t)=>{const n=m$(_r,e.__scopeTooltip),{forceMount:a=n.forceMount,side:l="top",...r}=e,i=Ro(_r,e.__scopeTooltip);return s.jsx($n,{present:a||i.open,children:i.disableHoverableContent?s.jsx(KN,{side:l,...r,ref:t}):s.jsx(p$,{side:l,...r,ref:t})})}),p$=u.forwardRef((e,t)=>{const n=Ro(_r,e.__scopeTooltip),a=Fp(_r,e.__scopeTooltip),l=u.useRef(null),r=Ie(t,l),[i,o]=u.useState(null),{trigger:c,onClose:d}=n,f=l.current,{onPointerInTransitChange:h}=a,m=u.useCallback(()=>{o(null),h(!1)},[h]),g=u.useCallback((j,v)=>{const y=j.currentTarget,x={x:j.clientX,y:j.clientY},p=b$(x,y.getBoundingClientRect()),b=j$(x,p),_=_$(v.getBoundingClientRect()),N=N$([...b,..._]);o(N),h(!0)},[h]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&f){const j=y=>g(y,f),v=y=>g(y,c);return c.addEventListener("pointerleave",j),f.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",j),f.removeEventListener("pointerleave",v)}}},[c,f,g,m]),u.useEffect(()=>{if(i){const j=v=>{const y=v.target,x={x:v.clientX,y:v.clientY},p=(c==null?void 0:c.contains(y))||(f==null?void 0:f.contains(y)),b=!w$(x,i);p?m():b&&(m(),d())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[c,f,i,d,m]),s.jsx(KN,{...e,ref:r})}),[x$,g$]=_d(Fi,{isInside:!1}),v$=uE("TooltipContent"),KN=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":l,onEscapeKeyDown:r,onPointerDownOutside:i,...o}=e,c=Ro(_r,n),d=wd(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(tm,f),()=>document.removeEventListener(tm,f)),[f]),u.useEffect(()=>{if(c.trigger){const h=m=>{const g=m.target;g!=null&&g.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),s.jsx(yo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:s.jsxs(zp,{"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(v$,{children:a}),s.jsx(x$,{scope:n,isInside:!0,children:s.jsx(k4,{id:c.contentId,role:"tooltip",children:l||a})})]})})});XN.displayName=_r;var QN="TooltipArrow",y$=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=wd(n);return g$(QN,n).isInside?null:s.jsx(Lp,{...l,...a,ref:t})});y$.displayName=QN;function b$(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),l=Math.abs(t.right-e.x),r=Math.abs(t.left-e.x);switch(Math.min(n,a,l,r)){case r:return"left";case l:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function j$(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 _$(e){const{top:t,right:n,bottom:a,left:l}=e;return[{x:l,y:t},{x:n,y:t},{x:n,y:a},{x:l,y:a}]}function w$(e,t){const{x:n,y:a}=e;let l=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){const o=t[r],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&&(l=!l)}return l}function N$(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),k$(t)}function k$(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const l=e[a];for(;t.length>=2;){const r=t[t.length-1],i=t[t.length-2];if((r.x-i.x)*(l.y-i.y)>=(r.y-i.y)*(l.x-i.x))t.pop();else break}t.push(l)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const l=e[a];for(;n.length>=2;){const r=n[n.length-1],i=n[n.length-2];if((r.x-i.x)*(l.y-i.y)>=(r.y-i.y)*(l.x-i.x))n.pop();else break}n.push(l)}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 S$=GN,C$=VN,R$=YN,T$=FN,ZN=XN;const WN=S$,JN=C$,ek=R$,Kp=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>{const l=jo(),r=s.jsx(ZN,{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 l?s.jsx(T$,{container:l,children:r}):r});Kp.displayName=ZN.displayName;function Js({page:e,header:t}){return s.jsxs(s.Fragment,{children:[t??s.jsx(Ft,{title:e}),s.jsx(E$,{page:e})]})}function E$({page:e}){return s.jsxs(me,{variant:"info",role:"status",className:"mt-6","data-testid":"not-installed",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:d0(e)})]})}const _v=["none","read","comment","write","manage","admin"];function bu(e,t){return _v.indexOf(e??"none")>=_v.indexOf(t)}function Qp(e){return e==="api_key"?"API key":e==="sdlc_login"?"sdlc login":null}function Rf(e,t){const n=Qp(e);return e==="sdlc_login"&&t?`${n} on ${tk(t)}`:n}const A$=String.fromCodePoint(8296),M$=String.fromCodePoint(8297);function tk(e){return`${A$}${e}${M$}`}const Xi={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"}},O$={backlog:"neutral",planned:"neutral",in_progress:"info",completed:"success",canceled:"neutral"};function nk(e){return e.name==="Blocked"?"warning":O$[e.category]}const wv=1800;function Qn(e){return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Yn(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function Zp(e){return`${En(e)}, ${Yn(e)}`}function Wr(e){return e<90?`${Math.round(e)} s`:e<5400?`${Math.round(e/60)} min`:`${(e/3600).toFixed(1).replace(/\.0$/,"")} h`}function En(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function sk(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function $$(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 D$(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 la="not_set";function z$({open:e,commands:t,list_id:n,list_revision:a,default_status_id:l,statuses:r,priorities:i,members:o,on_close:c,on_created:d}){var Y;const f=Ar(),[h,m]=u.useState(""),[g,j]=u.useState(""),[v,y]=u.useState(l??((Y=r[0])==null?void 0:Y.id)??""),[x,p]=u.useState(la),[b,_]=u.useState(la),[N,C]=u.useState(!1),[w,k]=u.useState(null),[A,$]=u.useState(!1);u.useEffect(()=>{var L;e&&(m(""),j(""),y(l??((L=r[0])==null?void 0:L.id)??""),p(la),_(la),C(!1),k(null))},[e,l,r]);const X=async L=>{if(L.preventDefault(),!h.trim()){C(!0);return}$(!0),k(null);try{const H=await t.run("create_task",{list_id:n,expected_list_revision:a,title:h.trim(),description:g.trim()||null,status_id:v||null,priority_id:x===la?null:x,primary_user_id:b===la?null:b});if(!H.ok){k(H.refusal.message);return}f.success("Task created."),await d()}finally{$(!1)}};return s.jsx(es,{open:e,onOpenChange:L=>L?null:c(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:L=>void X(L),noValidate:!0,children:[s.jsxs(ns,{children:[s.jsx(as,{children:"New task"}),s.jsx(ls,{children:"Add a task to this List."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[w&&s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(pe,{children:w})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"new-task-title",children:"Title"}),s.jsx(Ot,{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:L=>{m(L.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(Me,{htmlFor:"new-task-description",children:"Description (optional)"}),s.jsx(ks,{id:"new-task-description",rows:4,value:g,onChange:L=>j(L.target.value)})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"new-task-status",children:"Status"}),s.jsxs(dt,{value:v,onValueChange:y,children:[s.jsx(it,{id:"new-task-status",children:s.jsx(ft,{})}),s.jsx(ot,{children:r.map(L=>s.jsx(ke,{value:L.id,children:L.name},L.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"new-task-priority",children:"Priority"}),s.jsxs(dt,{value:x,onValueChange:p,children:[s.jsx(it,{id:"new-task-priority",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:la,children:"Not set"}),i.map(L=>s.jsx(ke,{value:L.id,children:L.name},L.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"new-task-primary",children:"Primary"}),s.jsxs(dt,{value:b,onValueChange:_,children:[s.jsx(it,{id:"new-task-primary",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:la,children:"Not set"}),o.map(L=>s.jsx(ke,{value:L.user_id,children:L.label},L.user_id))]})]})]})]})]}),s.jsxs(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),s.jsx(P,{type:"submit",disabled:A,children:A?"Creating…":"Create task"})]})]})})})}const L$="Your organization's work, in queue order. Claim a task to show you are working on it.",oi="any",ak="none",U$=1,B$=250;function Wp(){const e=en().tasks;if(!e)throw new Error("The Tasks page rendered without the tasks seam.");return e}function H$({org:e}){var j,v;const t=Wp(),{href:n,Link:a}=Ve(),[l,r]=u.useState({state:"loading"}),[i,o]=u.useState([]),[c,d]=u.useState(null),f=u.useRef(0),h=u.useCallback(async y=>{const x=f.current+=1;y&&r({state:"loading"});const p=await t.availability({fresh:y});x===f.current&&r(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(x=>{y&&x.ok&&o(x.data)}),()=>{y=!1}},[t.members]),u.useEffect(()=>{if(!t.access)return;let y=!0;return t.access().then(x=>{y&&x.ok&&d(x.data)}),()=>{y=!1}},[t.access]),l.state==="off"&&((j=l.refusal)==null?void 0:j.reason)!=="engine_missing")return s.jsx(Ba,{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 g=(c==null?void 0:c.read_only_reason)??L$;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:l.state==="active"?s.jsx(P$,{active:l,org:e,members:i,description:g,read_only_reason:c==null?void 0:c.read_only_reason,reload_configuration:m}):l.state==="off"&&((v=l.refusal)==null?void 0:v.reason)==="engine_missing"?s.jsx(Js,{page:"Tasks"}):s.jsxs(s.Fragment,{children:[s.jsx(Ft,{title:"Tasks",description:g}),l.state==="loading"&&s.jsx(lk,{}),(l.state==="error"||l.state==="off")&&s.jsx(rk,{refusal:l.refusal,on_retry:m}),l.state==="available"&&s.jsx(I$,{on_done:m})]})})}function lk(){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(pt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function rk({refusal:e,on_retry:t}){const n=Wn();return(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsx(pe,{children:n})]}):s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Tasks could not be loaded"}),s.jsxs(pe,{children:[s.jsx("p",{children:e!=null&&e.reason?e.message:"Check your connection and try again."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function I$({on_done:e}){const{commands:t}=Wp(),n=Ar(),[a,l]=u.useState(!1),r=t==null?void 0:t.activate,i=async()=>{if(!r)return;l(!0);const o=await r();if(l(!1),!o.ok){n.error(o.refusal.message);return}n.success("Tasks are on."),e()};return s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Tasks are not on for this organization"}),s.jsxs(pe,{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."}),r?s.jsx(P,{type:"button",size:"sm",className:"mt-2",disabled:a,onClick:()=>void i(),children:"Turn on Tasks"}):null]})]})}const Tf=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function P$({active:e,org:t,members:n,description:a,read_only_reason:l,reload_configuration:r}){var vx;const{commands:i,listTasks:o,waitingOnYou:c,hierarchyRevision:d}=Wp(),{href:f,Link:h}=Ve(),{self_id:m}=Ku(),g=Ar(),{list:j,workspace:v}=e,y=j.offers,x=y!==void 0,p=u.useMemo(()=>{var U;return((U=v.workflows.find(Ye=>Ye.id===j.workflow_id))==null?void 0:U.statuses)??[]},[v,j]),b=v.priorities,_=!!i&&bu(j.permission,"write"),N=_&&bu(j.permission,"manage"),C=u.useMemo(()=>new Map(n.map(U=>[U.user_id,U])),[n]),w=U=>{var Ye;return U?U===m?"You":((Ye=C.get(U))==null?void 0:Ye.label)??"A member":""},[k,A]=u.useState("active"),[$,X]=u.useState(!1),[Y,L]=u.useState(""),[H,T]=u.useState("");u.useEffect(()=>{const U=setTimeout(()=>T(Y),B$);return()=>clearTimeout(U)},[Y]);const[R,z]=u.useState(null),[S,O]=u.useState(oi),[Z,E]=u.useState(!1),[I,ne]=u.useState(!1),[ee,ge]=u.useState(null),[G,M]=u.useState([]),[V,ae]=u.useState(null),[B,te]=u.useState(0),[J,le]=u.useState(!1),[W,Qe]=u.useState(null),[oe,Oe]=u.useState(null),K=Wn(),[Ne,ze]=u.useState(!1),[xt,ye]=u.useState(null),[St,Lt]=u.useState({}),[yn,Ss]=u.useState(""),{confirm:bn,confirm_dialog:tn}=_o(),Cs=u.useRef(null),Rs=u.useRef(null),re=u.useRef(null),De=u.useRef(null),[Ce,Ts]=u.useState(void 0),Dn=!!(H.trim()||R||S!==oi||Z||I),zn=u.useRef(0),Ct=u.useCallback(async(U,Ye=!1)=>{const Ze=U?zn.current:zn.current+=1,st={state:k,assigned_to_me:$||void 0,cursor:U,search:H.trim()||void 0,group:R??void 0,owner:S===oi?void 0:S===ak?"":S,urgent:Z||void 0,over_estimate:I||void 0},Ut=Xt=>o(j.id,{...st,cursor:Xt});let Rt=await Ut(U),at=!!U;if(!Rt.ok&&Rt.refusal.code==="cursor_stale"&&(Rt=await Ut(),at=!1),Ze!==zn.current)return;if(!Rt.ok){ae(Rt.refusal),te(Xt=>Xt+1);return}const Bt=Rt.data;ae(null),te(0),!(Ye&&Tf(Bt,re.current))&&(re.current=Bt,ge(Bt),Bt.facets&&Ts(Bt.facets),M(Xt=>at?[...Xt,...Bt.tasks]:Bt.tasks))},[o,j.id,k,$,H,R,S,Z,I]),nn=u.useCallback(async()=>{const U=await c();if(Oe(Ze=>U.ok?null:Tf(Ze,U.refusal)?Ze:U.refusal),!U.ok&&x)return;const Ye=U.ok?U.data:null;Tf(Ye,De.current)||(De.current=Ye,Qe(Ye))},[c,x]);u.useEffect(()=>{re.current=null,ge(null)},[k,$]),u.useEffect(()=>{Ct()},[Ct]),u.useEffect(()=>{nn()},[nn]);const rs=u.useCallback(async()=>{await Promise.all([Ct(),nn()])},[Ct,nn]),Ln=y==null?void 0:y.refresh_ms;u.useEffect(()=>{if(!Ln)return;const U=setInterval(()=>{Ct(void 0,!0),nn()},Ln);return()=>clearInterval(U)},[Ln,Ct,nn]);const ea=u.useCallback(async(U,Ye,Ze)=>{if(!i)return;const st=await i.run(U,Ye);st.ok?Ze&&g.success(Ze):(g.error(st.refusal.message),st.refusal.code==="revision_conflict"&&r()),await rs()},[i,g,rs,r]),D=p.find(U=>U.category==="completed"),be=async(U,Ye,Ze)=>{const st=Ye+Ze,Ut=G[st];if(!Ut||!ee||!i)return;const Rt=async(at,Bt)=>{const Xt=await i.run(at,Bt);if(!Xt.ok)throw Xt.refusal;return Xt.data};try{let at=ee.list.order_revision,Bt=U.revision;if(Ut.queue_rank===null){const Xt=G.findIndex(ta=>ta.queue_rank===null);for(const ta of G.slice(Xt,st+1)){const $o=await Rt("reorder",{task_id:ta.id,expected_revision:ta.revision,expected_order_revision:at,placement:"end"});at=$o.list.order_revision,ta.id===U.id&&(Bt=$o.task.revision)}}await Rt("reorder",{task_id:U.id,expected_revision:Bt,expected_order_revision:at,placement:Ze<0?"before":"after",anchor_task_id:Ut.id})}catch(at){g.error(at.message)}await rs()},se=U=>{D&&ea("update_task",{task_id:U.id,expected_revision:U.revision,changes:{status_id:D.id}},`${U.title} completed.`)},_e=async U=>{if(!ee||!await bn({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[Ze,st]=await Promise.all([o(j.id,{limit:1}),d(v.id)]);if(!Ze.ok||!st.ok){g.error(Ze.ok?st.ok?"":st.refusal.message:Ze.refusal.message);return}await ea("archive_task",{task_id:U.id,expected_revision:U.revision,expected_order_revision:Ze.data.list.order_revision,expected_hierarchy_revision:st.data},`${U.title} archived.`)},Es=async U=>{await ea("release_hold",{hold_id:U},"Hold released.")},qa=async(U,Ye,Ze,st)=>{var Xt;if(!(i!=null&&i.complete)||!await bn({title:`Mark ${Ye} done?`,description:Ze.reason?`“${Ze.reason}”
384
384
 
385
- It leaves the open tasks.`:"It leaves the open tasks.",action_label:"Mark done"}))return;ye(U);const Tt=await i.complete(Ze);if(ye(null),!Tt.ok){Lt(ta=>({...ta,[U]:Tt.refusal.message}));return}Lt(({[U]:ta,...$o})=>$o),Ss(`${Ye} marked done.`),await rs();const at=Ts.current;(Xt=(st?(at==null?void 0:at.querySelector(`[data-done-key="${CSS.escape(st)}"]`))??(at==null?void 0:at.querySelector(`[data-title-key="${CSS.escape(st)}"] a`)):null)??Cs.current)==null||Xt.focus()},gx=()=>{var U;L(""),R(""),z(null),O(oi),E(!1),ne(!1),(U=Cs.current)==null||U.focus()},m1=new Map(p.map(U=>[U.id,U])),p1=new Map(b.map(U=>[U.id,U])),Ed=new Map(G.map(U=>[U.id,U.title])),Ad=_&&k==="active",x1=G.some(U=>U.local_done),Md=Ad||x1,Od=!g||b.length>0,g1=!$&&!Dn,v1=5+(Od?1:0)+(Md?1:0),y1=V!==null&&(V.reason==="store_locked"||V.reason==="engine_failed")&&B<=z$,Oo=(W==null?void 0:W.holds)??[],b1=G.map(U=>U.id),j1=Oo.map(U=>U.id);return s.jsxs("div",{ref:Ts,className:"contents",children:[s.jsx(Ft,{title:"Tasks",description:a,actions:_?s.jsxs(P,{type:"button",onClick:()=>ze(!0),children:[s.jsx(yr,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]}):null}),g&&(ee!=null&&ee.open)?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[ee.open," open"]}):null,Ln?s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",role:"status",children:V?`Not reading · trying again every ${Math.round(Ln/1e3)}s`:ee?`Live · refreshes every ${Math.round(Ln/1e3)}s`:"Connecting…"}):null,g?s.jsx("p",{className:"sr-only",role:"status",children:yn}):null,(g||Oo.length>0)&&s.jsxs(jt,{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"}),Oo.length>0?s.jsx("ul",{className:"mt-2 divide-y","aria-labelledby":"waiting-title",children:Oo.map((U,Ye)=>{var Tt,at;const Ze=Xi[U.hold_type],st=U.target.kind==="task"?`Because you claim ${Ed.get(U.target.task_id)??"the task it waits on"} · `:"",Ut=U.local_done;return s.jsxs("li",{id:`waiting-${U.id}`,"data-title-key":U.id,className:"flex flex-wrap items-center gap-3 py-2",children:[U.task?s.jsx(h,{className:"text-primary min-w-40 flex-1 hover:underline",href:f(`/org/${t}/tasks/${U.task.id}`),children:U.task.title}):s.jsx("span",{className:"min-w-40 flex-1",children:U.reason}),s.jsx(he,{variant:Ze.tone,children:U.local_label??Ze.label}),s.jsxs("div",{className:"min-w-48 flex-2",children:[U.task?s.jsx("div",{className:"text-sm",children:U.reason}):null,s.jsxs("div",{className:"text-muted-foreground text-xs",children:[st,"From ",w(U.opened_by)," · ",En(U.opened_at)]}),(Tt=U.local_threads)!=null&&Tt.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"}),": ",U.local_threads.join(" · ")]}):null,St[U.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:St[U.id]}):null]}),Ut&&(i!=null&&i.complete)?s.jsx(P,{type:"button",variant:"outline",size:"sm","data-done-key":U.id,"aria-label":`Mark ${((at=U.task)==null?void 0:at.title)??U.reason} done`,loading:xt===U.id,onClick:()=>{var Bt;return void qa(U.id,((Bt=U.task)==null?void 0:Bt.title)??U.reason,Ut,j1[Ye+1]??null)},children:"Done"}):null,g?null:s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void Es(U.id),children:"Release"})]},U.id)})}):W?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Nothing in this checkout waits on you."}):null,g&&oe?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status",children:oe.reason==="view_outdated"?`Waiting on you is not read here. ${K}`:"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."})]}),!_&&!l&&s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(go,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"You can view these tasks"}),s.jsx(pe,{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(r$,{value:k,onValueChange:U=>A(U),children:s.jsxs(HN,{"aria-label":"Which tasks",children:[s.jsx(em,{value:"active",children:"Active"}),s.jsx(em,{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(zr,{id:"tasks-mine",checked:$,onCheckedChange:U=>X(U===!0)}),s.jsx(Me,{htmlFor:"tasks-mine",children:"Assigned to me"})]}):null,y!=null&&y.search?s.jsx(Ot,{ref:Cs,type:"search",className:"w-64","aria-label":"Search tasks",placeholder:"Search title, ID or detail",value:Y,onChange:U=>L(U.target.value)}):null,Ce!=null&&Ce.owners?s.jsx(P$,{owners:Ce.owners,no_owner:Ce.no_owner,value:S,on_change:O}):null]}),(vx=Ce==null?void 0:Ce.groups)!=null&&vx.length?s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Status",children:[Ce.groups.map(U=>s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":T===U.id,onClick:()=>z(Ye=>Ye===U.id?null:U.id),children:[U.label," ",U.count]},U.id)),Ce.marks?s.jsxs(s.Fragment,{children:[s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":Z,onClick:()=>E(U=>!U),children:["Urgent ",Ce.marks.urgent]}),s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":I,onClick:()=>ne(U=>!U),children:["Over estimate ",Ce.marks.over_estimate]})]}):null]}):null,Dn&&(ee==null?void 0:ee.matched)!==void 0&&ee.total!==void 0?s.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:[ee.matched," of ",ee.total," match ·"," ",s.jsx(P,{type:"button",variant:"link",size:"inline-sm",onClick:gx,children:"Clear"})]}):null,y1?s.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:"Tasks are busy. Reading them again…"}):V?s.jsx(ak,{refusal:V,on_retry:()=>void Ct()}):null,!ee&&!V&&s.jsx(sk,{}),ee&&G.length===0&&Dn?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(Wu,{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(P,{type:"button",variant:"outline",onClick:gx,children:"Clear filters"})]}):ee&&G.length===0&&k==="active"&&!$&&g?s.jsx("p",{className:"text-muted-foreground mt-6 text-sm",children:"No tasks recorded yet."}):ee&&G.length===0&&k==="active"&&!$?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(l0,{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."}),_&&s.jsxs(P,{type:"button",onClick:()=>ze(!0),children:[s.jsx(yr,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]})]}):ee?s.jsxs(s.Fragment,{children:[s.jsx(jt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Tasks",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Title"}),s.jsx(F,{children:"Status"}),Od?s.jsx(F,{className:"hidden md:table-cell",children:"Priority"}):null,s.jsx(F,{className:"hidden md:table-cell",children:"Primary"}),s.jsx(F,{className:"hidden md:table-cell",children:"Holds"}),s.jsx(F,{children:"Claimed by"}),Md?s.jsx(F,{className:"text-right",children:"Actions"}):null]})}),s.jsxs(He,{children:[G.map((U,Ye)=>{var Tt,at;const Ze=m1.get(U.status_id),st=M$(U),Ut=U.local_done;return s.jsxs(ue,{"data-testid":"tasks-row",children:[s.jsxs(q,{"data-title-key":U.id,children:[U.no_page?s.jsx("span",{children:U.title}):s.jsx(h,{className:"text-primary hover:underline",href:f(`/org/${t}/tasks/${U.id}`),children:U.title}),U.parent_task_id&&Ed.get(U.parent_task_id)?s.jsx("div",{className:"text-muted-foreground text-xs",children:Ed.get(U.parent_task_id)}):null,g?s.jsx(I$,{row:U}):null,St[U.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:St[U.id]}):null]}),s.jsx(q,{children:Ze?s.jsx(he,{variant:ek(Ze),children:Ze.name}):null}),Od?s.jsx(q,{className:"hidden md:table-cell",children:U.priority_id?((Tt=p1.get(U.priority_id))==null?void 0:Tt.name)??"":s.jsx("span",{className:"text-muted-foreground",children:"Not set"})}):null,s.jsx(q,{className:"hidden md:table-cell",children:U.owner_title?U.owner_title:U.primary_user_id?w(U.primary_user_id):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}),s.jsx(q,{className:"hidden md:table-cell",children:st?s.jsx(he,{variant:st.tone,children:st.label}):s.jsx("span",{className:"text-muted-foreground",children:"None"})}),s.jsx(q,{"data-testid":"tasks-claim",children:s.jsx(q$,{row:U,holder:w((at=U.claim)==null?void 0:at.user_id)})}),Md?s.jsx(q,{className:"text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[Ut&&"hold"in Ut?s.jsx("a",{className:"text-primary text-sm hover:underline",href:`#waiting-${Ut.hold}`,children:"In Waiting on you"}):Ut&&(i!=null&&i.complete)?s.jsx(P,{type:"button",variant:"outline",size:"sm","data-done-key":U.id,"aria-label":`Mark ${U.title} done`,loading:xt===U.id,onClick:()=>void qa(U.id,U.title,Ut,b1[Ye+1]??null),children:"Done"}):null,Ad&&g1?s.jsxs(s.Fragment,{children:[s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${U.title} up`,disabled:Ye===0,onClick:()=>void be(U,Ye,-1),children:s.jsx(OC,{className:"size-4","aria-hidden":"true"})}),s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${U.title} down`,disabled:Ye===G.length-1,onClick:()=>void be(U,Ye,1),children:s.jsx(EC,{className:"size-4","aria-hidden":"true"})})]}):null,Ad?s.jsxs(xd,{children:[s.jsx(gd,{asChild:!0,children:s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`More actions for ${U.title}`,children:s.jsx(fp,{className:"size-4","aria-hidden":"true"})})}),s.jsxs(Co,{align:"end",children:[D&&U.status_id!==D.id?s.jsx(jr,{onSelect:()=>se(U),children:"Complete"}):null,N?s.jsx(jr,{className:"text-destructive focus:text-destructive",onSelect:()=>void _e(U),children:"Archive"}):null]})]}):null]})}):null]},U.id)}),G.length===0&&s.jsx(ue,{children:s.jsx(q,{colSpan:v1,className:"text-muted-foreground h-24 text-center",children:k==="archived"?"No archived tasks.":"No tasks are assigned to you."})})]})]})}),ee.next_cursor?s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2 self-start",disabled:J,onClick:async()=>{le(!0),await Ct(ee.next_cursor??void 0),le(!1)},children:"Load more"}):null]}):null,_&&i&&s.jsx($$,{open:Ne,commands:i,list_id:j.id,list_revision:(ee==null?void 0:ee.list.revision)??j.revision,default_status_id:j.default_status_id,statuses:p,priorities:b,members:n,on_close:()=>ze(!1),on_created:async()=>{ze(!1),await rs()}}),tn]})}function I$({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(he,{variant:a.tone??"neutral",children:a.label},a.label))}):null]})}function P$({owners:e,no_owner:t,value:n,on_change:a}){return s.jsxs(dt,{value:n,onValueChange:a,children:[s.jsx(it,{className:"w-56","aria-label":"Owner",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:oi,children:"Any owner"}),e.map(l=>s.jsxs(ke,{value:l.id,children:[l.label," (",l.count,")"]},l.id)),t!==void 0?s.jsxs(ke,{value:nk,children:["No owner (",t,")"]}):null]})]})}function q$({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 ${Qn(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?` · ${Qp(n.via)}`:""]}),s.jsxs("div",{className:"text-muted-foreground truncate text-xs",title:n.via==="sdlc_login"&&n.via_device?JN(n.via_device):void 0,children:["Until ",Qn(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 G$={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 V$({open:e,members:t,tasks:n,holds_my_web_claim:a,on_close:l,on_submit:r}){const[i,o]=u.useState("waiting_for_user"),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(!1),[j,v]=u.useState({}),[y,g]=u.useState(null),[p,b]=u.useState(!1);u.useEffect(()=>{e&&(o("waiting_for_user"),d(""),h(""),x(!1),v({}),g(null))},[e]);const _=G$[i],N=async C=>{C.preventDefault();const w={target:_!==null&&!c.trim(),reason:!f.trim()};if(v(w),w.target||w.reason)return;b(!0);const k={hold_type:i,reason:f.trim(),release_claim:m};i==="waiting_for_user"&&(k.target_user_id=c),i==="blocked"&&(k.target_task_id=c),i==="waiting_for_external"&&(k.target_label=c.trim());const A=await r(k);b(!1),g(A)};return s.jsx(es,{open:e,onOpenChange:C=>C?null:l(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:C=>void N(C),noValidate:!0,children:[s.jsxs(ns,{children:[s.jsx(as,{children:"Add hold"}),s.jsx(ls,{children:"Say what this task is waiting for."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y&&s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(pe,{children:y})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"hold-type",children:"Type"}),s.jsxs(dt,{value:i,onValueChange:C=>{o(C),d(""),v({})},children:[s.jsx(it,{id:"hold-type",children:s.jsx(ft,{})}),s.jsx(ot,{children:Object.keys(Xi).map(C=>s.jsx(ke,{value:C,children:Xi[C].label},C))})]})]}),_?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"hold-target",children:_.label}),i==="waiting_for_external"?s.jsx(Ot,{id:"hold-target",value:c,"aria-invalid":j.target,onChange:C=>d(C.target.value)}):s.jsxs(dt,{value:c,onValueChange:d,children:[s.jsx(it,{id:"hold-target","aria-invalid":j.target,children:s.jsx(ft,{placeholder:i==="blocked"?"Choose a task":"Choose a member"})}),s.jsx(ot,{children:i==="blocked"?n.map(C=>s.jsx(ke,{value:C.id,children:C.title},C.id)):t.map(C=>s.jsx(ke,{value:C.user_id,children:C.label},C.user_id))})]}),s.jsx("p",{className:j.target?"text-destructive text-xs":"text-muted-foreground text-xs",children:j.target?"Choose what it waits for.":_.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(Me,{htmlFor:"hold-reason",children:"Reason"}),s.jsx(ks,{id:"hold-reason",rows:3,placeholder:"What the task is waiting for",value:f,"aria-invalid":j.reason,onChange:C=>h(C.target.value)}),j.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(zr,{id:"hold-release-claim",checked:m,onCheckedChange:C=>x(C===!0)}),s.jsx(Me,{htmlFor:"hold-release-claim",children:"Also release my claim"})]})]}),s.jsxs(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",onClick:l,children:"Cancel"}),s.jsx(P,{type:"submit",disabled:p,children:p?"Adding…":"Add hold"})]})]})})})}function Ro(){const e=en().tasks;if(!e)throw new Error("The Task page rendered without the tasks seam.");return e}function Jp(){return s.jsxs("div",{className:"grid gap-3",role:"status","aria-label":"Loading task",children:[s.jsx(pt,{className:"h-8 w-1/2"}),Array.from({length:7},(e,t)=>s.jsx(pt,{className:t===6?"h-6 w-2/3":"h-6 w-full"},t))]})}function ju({back:e,description:t}){const{href:n,Link:a}=Ve();return s.jsx(Ba,{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 Tl="not_set",Y$=10*60*1e3,Nv=20;function F$(){const{members:e}=Ro(),[t,n]=u.useState([]);u.useEffect(()=>{let r=!0;return e().then(i=>{r&&i.ok&&n(i.data)}),()=>{r=!1}},[e]);const a=u.useMemo(()=>new Map(t.map(r=>[r.user_id,r])),[t]),l=u.useCallback((r,i)=>{var o;return r?r===i?"You":((o=a.get(r))==null?void 0:o.label)??"A member":""},[a]);return{members:t,name:l}}function X$({active:e,task_id:t,back:n}){const a=Ro(),{task:l,activity:r,listTasks:i,hierarchyRevision:o,commands:c}=a,{href:d,Link:f}=Ve(),h=Ar(),{self_id:m}=Ku(),{members:x,name:j}=F$(),{workspace:v}=e,{confirm:y,confirm_dialog:g}=_o(),[p,b]=u.useState(null),[_,N]=u.useState(!1),[C,w]=u.useState(!1),[k,A]=u.useState(null),[$,X]=u.useState([]),[Y,L]=u.useState(Nv),[H,R]=u.useState([]),[T,z]=u.useState(!1),[S,O]=u.useState(null),[Z,E]=u.useState(null),[I,ne]=u.useState(""),[ee,ge]=u.useState(null),G=u.useCallback(async()=>{if(!l)return;const D=await l(t);D.ok?(b(D.data),w(!1)):D.refusal.status===404||D.refusal.status===400?N(!0):w(!0)},[l,t]),M=u.useRef(0),V=u.useCallback(async()=>{if(!r)return;const D=M.current+=1;let be=[],se;for(;;){const _e=await r(t,se);if(D!==M.current||!_e.ok)return;if(be=[...be,..._e.data.events].slice(-1e3),!_e.data.more||!_e.data.next_cursor)break;se=_e.data.next_cursor}D===M.current&&X(be.reverse())},[r,t]);u.useEffect(()=>{G(),V()},[G,V]);const ae=p?v.lists.find(D=>D.id===p.task.list_id):void 0,B=u.useMemo(()=>{var D;return((D=v.workflows.find(be=>be.id===(p==null?void 0:p.task.workflow_id)))==null?void 0:D.statuses)??[]},[v,p==null?void 0:p.task.workflow_id]);u.useEffect(()=>{if(!p)return;let D=!0;return i(p.task.list_id,{limit:100}).then(be=>{D&&R(be.ok?be.data.tasks.filter(se=>se.id!==p.task.id).map(se=>({id:se.id,title:se.title})):[])}),()=>{D=!1}},[i,p==null?void 0:p.task.list_id,p==null?void 0:p.task.id,p]);const te=u.useCallback(async()=>{await Promise.all([G(),V()])},[G,V]),J=u.useCallback((D,be)=>c?c.run(D,be):Promise.resolve({ok:!1,refusal:{status:0,message:"This page cannot change tasks."}}),[c]),le=u.useCallback(async(D,be,se)=>{const _e=await J(D,be);return _e.ok?(se&&h.success(se),await te(),_e.data):(_e.refusal.code==="revision_conflict"?A({tone:"warning",title:"This task changed while you were editing",body:"We reloaded it. Check the change, then save again."}):_e.refusal.code==="claim_held"?(await G(),A({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(_e.refusal.message),await te(),null)},[J,h,te,G]),W=(p==null?void 0:p.claim)??null,Qe=W!==null&&W.id===ee&&!W.lapsed&&!W.via?W.id:null;if(u.useEffect(()=>{if(!Qe)return;const D=window.setInterval(()=>{J("renew_claim",{claim_id:Qe,lease_seconds:wv}).then(()=>G())},Y$);return()=>window.clearInterval(D)},[Qe,J,G]),_)return s.jsx(ju,{back:n});if(C&&!p)return s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This task could not be loaded"}),s.jsxs(pe,{children:[s.jsx("p",{children:"Check your connection and try again."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void G(),children:"Retry"})]})]});if(!p)return s.jsx(Jp,{});const{task:oe}=p,Oe=oe.archived_at!==null,K=bu(p.permission,"write")&&!Oe,Ne=bu(p.permission,"manage"),ze=B.find(D=>D.id===oe.status_id),xt=B.find(D=>D.category==="completed"),ye=v.priorities.find(D=>D.id===oe.priority_id),St=p.contributors.map(D=>D.user_id),Lt=W!==null&&W.user_id===m,yn=W!==null&&!W.lapsed,Ss=p.checklist.filter(D=>D.is_complete).length,bn=async()=>{const[D,be]=await Promise.all([i(oe.list_id,{limit:1}),o(v.id)]);return D.ok?be.ok?{ok:!0,data:{task_id:oe.id,expected_revision:oe.revision,expected_order_revision:D.data.list.order_revision,expected_hierarchy_revision:be.data}}:be:D},tn=(D,be)=>le("update_task",{task_id:oe.id,expected_revision:oe.revision,changes:D},be),Cs=D=>y(D.via==="sdlc_login"?{title:"Release this claim?",description:`You claimed it via ${Tf(D.via,D.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}),Ts=async()=>{if(!xt)return;if(yn&&(!Lt||W.via)){const be=W.via==="api_key"?`${Lt?"Your":`${j(W.user_id)}'s`} agent is still working on it.`:W.via==="sdlc_login"?`${Lt?"You are":`${j(W.user_id)} is`} still working on it via ${Tf(W.via,W.via_device)}.`:`${j(W.user_id)} is still working on it.`;if(!await y({title:"Complete this task?",description:be,action_label:"Mark complete"}))return}await tn({status_id:xt.id},"Task completed.")!==null&&W&&Lt&&yn&&await le("end_claim",{claim_id:W.id,outcome:"completed"})},re=async(D,be)=>{const se=await bn();if(!se.ok){h.error(se.refusal.message);return}await le(D,se.data,be)},De=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 re("archive_task","Task archived.")},Ce=async()=>{await re("restore_task","Task restored.")},Rs=async()=>{var _e;const D=W,be=await le("claim_task",{task_id:oe.id,lease_seconds:wv}),se=(_e=be==null?void 0:be.claim)==null?void 0:_e.id;se&&!(D&&D.id===se&&D.via)&&ge(se)},Dn=async()=>{W&&(W.via&&!await Cs(W)||(await le("end_claim",{claim_id:W.id,outcome:"released"},"Claim released."),ge(null)))},zn=async()=>{W&&await le("end_claim",{claim_id:W.id,outcome:"expired"},"Claim cleared.")},Ct=async D=>{D.hold_type==="paused"&&m&&(D={...D,target_user_id:m});const be=await J("open_hold",{task_id:oe.id,hold_type:D.hold_type,reason:D.reason,...D.target_user_id?{target_user_id:D.target_user_id}:{},...D.target_task_id?{target_task_id:D.target_task_id}:{},...D.target_label?{target_label:D.target_label}:{}});return be.ok?(z(!1),h.success("Hold added."),D.release_claim&&W&&Lt&&!W.via&&(await le("end_claim",{claim_id:W.id,outcome:"released"}),ge(null)),await te(),null):be.refusal.message},nn=D=>le("checklist",{task_id:oe.id,expected_revision:oe.revision,...D}),rs=async D=>{for(const be of D.filter(se=>!St.includes(se)))await le("set_contributor",{task_id:oe.id,expected_revision:oe.revision,user_id:be,action:"add"});for(const be of p.contributors.filter(se=>!D.includes(se.user_id)))await le("set_contributor",{task_id:oe.id,expected_revision:oe.revision,user_id:be.user_id,action:"remove",expected_contributor_revision:be.revision})},Ln=D=>{var se;if(D.target.kind==="user")return j(D.target.user_id,m);if(D.target.kind==="external")return D.target.label;if(D.target.hidden||!D.target.task_id)return"A task you cannot see";const be=D.target.task_id;return s.jsx(f,{className:"text-primary hover:underline",href:d(`${n}/${be}`),children:((se=H.find(_e=>_e.id===be))==null?void 0:se.title)??"Another task"})},ea=D=>D.target.kind==="user"&&D.target.user_id===m&&!D.released_at?s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void le("release_hold",{hold_id:D.id},"Hold released."),children:"Release"}):K?s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void le("resolve_hold",{hold_id:D.id},"Hold resolved."),children:"Resolve"}):null;return s.jsxs(s.Fragment,{children:[s.jsx(Ft,{title:oe.title,description:`Created ${En(oe.created_at)} by ${j(oe.created_by,m)}`,actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[K&&s.jsxs(s.Fragment,{children:[s.jsxs(P,{type:"button",variant:"outline",onClick:()=>O(oe.title),children:[s.jsx(Zu,{className:"mr-2 size-4","aria-hidden":"true"}),"Edit title"]}),xt&&oe.status_id!==xt.id&&s.jsxs(P,{type:"button",variant:"outline",onClick:()=>void Ts(),children:[s.jsx(Mr,{className:"mr-2 size-4","aria-hidden":"true"}),"Mark complete"]})]}),Ne&&!Oe&&s.jsxs(P,{type:"button",variant:"outline",onClick:()=>void De(),children:[s.jsx(Vg,{className:"mr-2 size-4","aria-hidden":"true"}),"Archive"]})]}),children:S!==null?s.jsxs("form",{className:"flex flex-wrap items-center gap-2 pt-1",onSubmit:async D=>{D.preventDefault(),S.trim()&&await tn({title:S.trim()})!==null&&O(null)},children:[s.jsx(Me,{htmlFor:"task-title",className:"sr-only",children:"Title"}),s.jsx(Ot,{id:"task-title",className:"max-w-xl",value:S,onChange:D=>O(D.target.value)}),s.jsx(P,{type:"submit",size:"sm",children:"Save"}),s.jsx(P,{type:"button",size:"sm",variant:"outline",onClick:()=>O(null),children:"Cancel"})]}):null}),k&&s.jsxs(me,{variant:k.tone,className:"mt-4","data-testid":"task-notice",children:[k.tone==="warning"?s.jsx(vl,{className:"size-4","aria-hidden":"true"}):s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:k.title}),s.jsx(pe,{children:k.body})]}),Oe?s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(Vg,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This task is archived"}),s.jsx(pe,{children:Ne?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(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void Ce(),children:[s.jsx(CC,{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."})})]}):K?null:s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(go,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"You can view this task"}),s.jsx(pe,{children:"Ask an organization admin for write access to change it."})]}),K?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(Me,{htmlFor:"task-status",children:"Status"}),s.jsxs(dt,{value:oe.status_id,onValueChange:D=>void tn({status_id:D}),children:[s.jsx(it,{id:"task-status",children:s.jsx(ft,{})}),s.jsx(ot,{children:B.map(D=>s.jsx(ke,{value:D.id,children:D.name},D.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"task-priority",children:"Priority"}),s.jsxs(dt,{value:oe.priority_id??Tl,onValueChange:D=>void tn({priority_id:D===Tl?null:D}),children:[s.jsx(it,{id:"task-priority",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:Tl,children:"Not set"}),v.priorities.map(D=>s.jsx(ke,{value:D.id,children:D.name},D.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"task-primary",children:"Primary"}),s.jsxs(dt,{value:oe.primary_user_id??Tl,onValueChange:D=>void tn({primary_user_id:D===Tl?null:D}),children:[s.jsx(it,{id:"task-primary",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:Tl,children:"Not set"}),x.map(D=>s.jsx(ke,{value:D.user_id,children:D.label},D.user_id))]})]})]}),s.jsx(K$,{members:x,selected:St,on_change:D=>void rs(D)})]}):s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(ac,{label:"Status",value:(ze==null?void 0:ze.name)??""}),s.jsx(ac,{label:"Priority",value:(ye==null?void 0:ye.name)??"Not set"}),s.jsx(ac,{label:"Primary",value:oe.primary_user_id?j(oe.primary_user_id,m):"Not set"}),s.jsx(ac,{label:"Contributors",value:St.map(D=>j(D,m)).join(", ")||"None"})]}),!Oe&&s.jsx(Q$,{claim:W,mine:Lt,holder:W?j(W.user_id):"",own:W!==null&&W.id===ee,can_write:K,on_claim:()=>void Rs(),on_release:()=>void Dn(),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"}),K&&Z===null&&s.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(oe.description??""),children:"Edit description"})]}),Z!==null?s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async D=>{D.preventDefault(),await tn({description:Z})!==null&&E(null)},children:[s.jsx(Me,{htmlFor:"task-description",className:"sr-only",children:"Description"}),s.jsx(ks,{id:"task-description",rows:5,value:Z,onChange:D=>E(D.target.value)}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(P,{type:"submit",size:"sm",children:"Save"}),s.jsx(P,{type:"button",size:"sm",variant:"outline",onClick:()=>E(null),children:"Cancel"})]})]}):s.jsx("p",{className:"mt-2 text-sm whitespace-pre-wrap",children:oe.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?` · ${Ss} of ${p.checklist.length} done`:""]}),s.jsx("ul",{className:"mt-2 grid gap-1",children:p.checklist.map(D=>s.jsxs("li",{className:"flex items-center justify-between gap-2 py-1","data-testid":"task-checklist-item",children:[K?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(zr,{id:`check-${D.id}`,checked:D.is_complete,onCheckedChange:be=>void nn({action:"toggle",item_id:D.id,expected_item_revision:D.revision,is_complete:be===!0})}),s.jsx(Me,{htmlFor:`check-${D.id}`,className:"font-normal",children:D.label})]}):s.jsxs("span",{className:"text-sm",children:[D.is_complete?"Done: ":"To do: ",D.label]}),K&&s.jsxs(xd,{children:[s.jsx(gd,{asChild:!0,children:s.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":`Item actions for ${D.label}`,children:s.jsx(fp,{className:"size-4","aria-hidden":"true"})})}),s.jsx(Co,{align:"end",children:s.jsx(jr,{className:"text-destructive focus:text-destructive",onSelect:()=>void nn({action:"archive",item_id:D.id,expected_item_revision:D.revision}),children:"Remove"})})]})]},D.id))}),p.checklist.length===0&&!K&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"No checklist items."}),K&&s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async D=>{D.preventDefault(),I.trim()&&await nn({action:"add",label:I.trim()})!==null&&ne("")},children:[s.jsx(Me,{htmlFor:"task-new-item",children:"Add an item"}),s.jsx(Ot,{id:"task-new-item",placeholder:"Add an item and press Enter",value:I,onChange:D=>ne(D.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"}),K&&s.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:()=>z(!0),children:[s.jsx(i0,{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(Be,{containerAriaLabel:"Holds",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Type"}),s.jsx(F,{children:"Reason"}),s.jsx(F,{children:"Waiting on"}),s.jsx(F,{className:"text-right",children:"Actions"})]})}),s.jsxs(He,{children:[p.holds.map(D=>{const be=Xi[D.hold_type];return s.jsxs(ue,{"data-testid":"task-hold",children:[s.jsx(q,{children:s.jsx(he,{variant:be.tone,children:be.label})}),s.jsxs(q,{children:[s.jsx("div",{children:D.reason}),s.jsx("div",{className:"text-muted-foreground text-xs",children:D.released_at?`Released by ${j(D.released_by,m)} · ${En(D.released_at)} · Ready to resolve`:`Opened by ${j(D.opened_by,m)} · ${En(D.opened_at)} · Open`})]}),s.jsx(q,{children:Ln(D)}),s.jsx(q,{className:"text-right",children:ea(D)})]},D.id)}),p.holds.length===0&&s.jsx(ue,{children:s.jsx(q,{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:[$.slice(0,Y).map(D=>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:O$(D)}),s.jsxs("span",{className:"min-w-0 text-right sm:text-left",children:[s.jsx("span",{children:D.actor_id?j(D.actor_id,m):"The system"}),D.via?s.jsxs("span",{className:"text-muted-foreground block max-w-64 truncate text-xs sm:max-w-none",title:`via ${Tf(D.via,D.via_device)}`,children:["via ",Qp(D.via),s.jsx(lk,{via:D.via,device:D.via_device})]}):null]}),s.jsx("span",{className:"text-muted-foreground col-span-2 sm:col-span-1 sm:text-right",children:tk(D.created_at)})]},D.id)),$.length===0&&s.jsx("li",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No activity yet."})]}),$.length>Y&&s.jsx(P,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>L(D=>D+Nv),children:"Load more"})]}),K&&ae&&s.jsx(V$,{open:T,members:x,tasks:H,holds_my_web_claim:Lt&&yn&&!(W!=null&&W.via),on_close:()=>z(!1),on_submit:Ct}),g]})}function ac({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 K$({members:e,selected:t,on_change:n}){return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"task-contributors",children:"Contributors"}),s.jsxs(xd,{children:[s.jsx(gd,{asChild:!0,children:s.jsxs(P,{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(s0,{className:"text-muted-foreground size-4","aria-hidden":"true"})]})}),s.jsx(Co,{align:"start",children:e.map(a=>{const l=t.includes(a.user_id);return s.jsxs(jr,{onSelect:()=>n(l?t.filter(r=>r!==a.user_id):[...t,a.user_id]),children:[l?s.jsx(Mr,{className:"mr-2 size-4","aria-hidden":"true"}):s.jsx("span",{className:"mr-2 size-4"}),a.label]},a.user_id)})})]})]})}function lk({via:e,device:t}){return e!=="sdlc_login"||!t?null:s.jsxs(s.Fragment,{children:[" on ",s.jsx("bdi",{children:t})]})}function Q$({claim:e,mine:t,holder:n,own:a,can_write:l,on_claim:r,on_release:i,on_clear:o}){let c=s.jsx(hp,{className:"size-4","aria-hidden":"true"}),d="Nobody is working on this",f=l?"Claim it to show others you are.":"",h=l?s.jsx(P,{type:"button",size:"sm",onClick:r,children:"Claim"}):null;if(e&&e.lapsed){const m=new Date(e.lease_expires_at)<=new Date;c=s.jsx(ZC,{className:"size-4","aria-hidden":"true"}),d=m?`${t?"Your":`${n}'s`} claim lapsed at ${Qn(e.lease_expires_at)}`:`${t?"Your":`${n}'s`} claim lapsed`,f=m?"Its time ran out.":`${n} can no longer edit this task.`,l&&(f+=" Take it over to work on it yourself, or clear it so anyone can claim it."),h=l?s.jsxs(s.Fragment,{children:[s.jsx(P,{type:"button",size:"sm",variant:"outline",onClick:o,children:"Clear claim"}),s.jsx(P,{type:"button",size:"sm",onClick:r,children:"Take over"})]}):null}else if(e){const m=Qn(e.lease_expires_at);c=e.via==="api_key"?s.jsx(dp,{className:"size-4","aria-hidden":"true"}):e.via==="sdlc_login"?s.jsx(yT,{className:"size-4","aria-hidden":"true"}):s.jsx(WT,{className:"size-4","aria-hidden":"true"});const x=s.jsxs(s.Fragment,{children:["Claimed via sdlc login",s.jsx(lk,{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=l?"Claimed on the web. You can take it over if the claim lapses.":"Claimed on the web."),h=t?s.jsx(P,{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 Z$=10,rk=5,W$=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,ik="Not available",J$={added:"Added",changed:"Changed",removed:"Removed"},eD={thread:"Thread",task:"Task",issue:"Issue",release:"Release",test:"Test"},kv=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;function tD(e,t){const n=t!=null&&t.startsWith("task:")?t.slice(5):null;if(n&&W$.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 l=t!=null&&t.startsWith("release:")?t.slice(8):null;if(l&&kv.test(l))return{label:l==="candidate"?"Candidate":`Release ${l}`,path:`/releases?release=${l}`};const r=t!=null&&t.startsWith("planned:")?t.slice(8):null;return r&&kv.test(r)?{label:`Planned Release ${r}`,path:`/releases?planned=${r}`}:{label:"Tasks",path:`/org/${e}/tasks`}}const ok=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function nD({org:e,task_id:t,from:n}){var Ts;const a=Ro(),{href:l,Link:r}=Ve(),{confirm:i,confirm_dialog:o}=_o(),c=tD(e,n),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState([]),[x,j]=u.useState([]),[v,y]=u.useState(null),[g,p]=u.useState(null),[b,_]=u.useState({state:"loading"}),[N,C]=u.useState({state:"loading"}),[w,k]=u.useState(null),[A,$]=u.useState(null),[X,Y]=u.useState(!1),L=u.useRef(null),H=Wn(),R=u.useRef(null),T=u.useRef(null),z=u.useRef(null),S=u.useRef(null),O=u.useRef(!1),Z=u.useRef(0),E=u.useRef(0),I=u.useCallback(async()=>{if(!a.taskSections)return;_({state:"loading"});const re=await a.taskSections(t);_(re.ok?{state:"ok",data:re.data}:{state:"failed",refusal:re.refusal})},[a.taskSections,t]),ne=u.useCallback(async()=>{if(!a.taskRelated)return;C({state:"loading"});const re=await a.taskRelated(t);C(re.ok?{state:"ok",data:re.data}:{state:"failed",refusal:re.refusal})},[a.taskRelated,t]),ee=u.useCallback(async()=>{var Dn,zn;const re=E.current+=1;p(null),I(),ne();const[De,Ce]=await Promise.all([a.availability(),a.task?a.task(t):Promise.resolve(null)]);if(re!==E.current)return;De.state==="active"&&m(((Dn=De.workspace.workflows.find(Ct=>Ct.id===De.list.workflow_id))==null?void 0:Dn.statuses)??[]);const Rs=De.state==="off"&&((zn=De.refusal)==null?void 0:zn.reason)==="engine_missing"?De.refusal:null;if(!Ce||!Ce.ok&&Ce.refusal.reason==="engine_missing"||Rs){f({state:"engine_missing",refusal:Rs??(Ce&&!Ce.ok?Ce.refusal:{status:0,message:""})});return}if(Ce.ok){Z.current=0,y(null),$(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(Z.current+=1,Z.current===1&&ok(Ce.refusal)){p(Ce.refusal.retry_after??Z$);return}y(Ce.refusal),f(Ct=>Ct.state==="loading"?{state:"loading"}:Ct)},[a,t,I,ne]);u.useEffect(()=>{ee()},[ee]),u.useEffect(()=>{if(g===null)return;const re=setTimeout(()=>void ee(),g*1e3);return()=>clearTimeout(re)},[g,ee]),u.useEffect(()=>{let re=!0;return a.members().then(De=>{re&&De.ok&&j(De.data)}),()=>{re=!1}},[a.members]),u.useEffect(()=>{var De;if(O.current||d.state!=="ok")return;O.current=!0;const re=(De=L.current)==null?void 0:De.querySelector("h1");re&&(re.tabIndex=-1,re.focus())},[d.state]),u.useEffect(()=>{var re;w&&((re=T.current)==null||re.focus())},[w]),u.useEffect(()=>{if(A===null)return;const re=setTimeout(()=>{var De;return(De=R.current)==null?void 0:De.focus()},0);return()=>clearTimeout(re)},[A]);const ge=u.useMemo(()=>new Map(x.map(re=>[re.user_id,re.label])),[x]),G=re=>re?ge.get(re)??re:"",M=()=>{k(null),ee()},V=u.useRef(null),ae=re=>(V.current=re,re==="graph"?I():ne());if(u.useEffect(()=>{var Ce;const re=V.current;if(re===null||(re==="graph"?b:N).state==="loading")return;V.current=null;const De=(re==="graph"?z:S).current??((Ce=L.current)==null?void 0:Ce.querySelector("h1"));De==null||De.focus()},[b,N]),d.state==="missing")return s.jsx(ya,{children:s.jsx(ju,{back:`/org/${e}/tasks`,description:`No task ${t} in this checkout. It may have finished and been archived, or never been recorded.`})});const B=s.jsx(P,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(r,{href:l(c.path),children:[s.jsx(t0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(d.state==="engine_missing")return s.jsx(ya,{children:s.jsx("div",{ref:L,className:"contents",children:s.jsx(Js,{page:"Task",header:s.jsx(Si,{back:B,id:null,title:t})})})});const te=v?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Could not read this task"}),s.jsxs(pe,{children:[s.jsxs("p",{children:[v.message,v.since?` Since ${Yn(v.since)}.`:"",d.state==="ok"?` This page was read at ${Yn(d.at)}.`:""," See the sdlc viewer terminal for more."]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:M,children:"Retry"})]})]}):null,J=g!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(gn,{"aria-hidden":"true"}),"Could not read this task. Trying again in ",g," seconds."]}):null,le=s.jsx("div",{role:"status","aria-live":"polite",children:J});if(d.state==="loading")return s.jsxs(ya,{children:[le,te,!v&&g===null?s.jsx(Jp,{}):null]});const{detail:W,at:Qe}=d,{task:oe}=W,Oe=h.find(re=>re.id===oe.status_id),K=W.local_done&&"task"in W.local_done?W.local_done:null,Ne=W.local_waits??[],ze=K?Ne[0]??null:null,xt=ze?G(ze.opened_by):W.owner_title??G(W.thread),ye=b.state==="ok"?b.data:null,St=(ye==null?void 0:ye.lifecycle)==="finished",Lt=St&&(ye==null?void 0:ye.outcome)==="cancelled",yn=St&&(ye==null?void 0:ye.outcome)==="complete",Ss=!!oe.created_at,bn=W.acceptance??[],tn=async()=>{var Ce;if(!K||!((Ce=a.commands)!=null&&Ce.complete)||!await i({title:`Mark ${oe.title} done?`,description:ze?`This answers ${xt}'s ask, “${ze.reason}”, closes that wait, and tells ${xt} to check and continue.`:`This tells ${xt||"its thread"} to check and continue.`,action_label:"Mark done"}))return;Y(!0);const De=await a.commands.complete(K);if(Y(!1),!De.ok){$(De.refusal.message);return}await ee(),k({title:oe.title,asker:xt||"Its thread"})},Cs=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[K&&!w?s.jsxs(s.Fragment,{children:[s.jsxs(P,{ref:R,type:"button",variant:"outline",disabled:X,"aria-disabled":A!==null?!0:void 0,"aria-describedby":A!==null?"task-done-why":void 0,onClick:()=>{A===null&&tn()},children:[s.jsx(Mr,{className:"mr-2 size-4","aria-hidden":"true"}),"Done"]}),A!==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 ",Yn(Qe)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:M,children:[s.jsx(vl,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsxs(ya,{children:[s.jsxs("div",{ref:L,className:"contents",children:[s.jsx(Si,{back:B,id:oe.id,badge:Oe?s.jsx(he,{variant:ek(Oe),children:Oe.name}):null,title:oe.title,created:Ss?`Created ${En(oe.created_at)}${xt||W.owner_title?` by ${W.owner_title??xt}`:""}`:null,actions:Cs}),le,te,w?s.jsx("div",{ref:T,tabIndex:-1,role:"status","aria-live":"polite",className:"outline-none",children:s.jsxs(me,{variant:"success",className:"mt-4",children:[s.jsx(Qu,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:["Marked ",w.title," done"]}),s.jsxs(pe,{children:[w.asker," is told to check and continue."]})]})}):null,A!==null?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Done was not recorded"}),s.jsxs(pe,{children:[A," Read again to see the task as it is now."]})]}):null,ze&&!w?s.jsxs(me,{variant:"warning",className:"mt-4",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:[xt," asks: ",ze.reason]}),s.jsxs(pe,{children:["Waiting on you since ",Zp(ze.opened_at),". Done answers it and tells ",xt," to check and continue."]})]}):null,W.view_outdated?s.jsxs(me,{variant:"warning",className:"mt-4",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsxs(pe,{children:[H," 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(hs,{label:"Owner thread",value:W.owner_title??(G(W.thread)||"None")}),s.jsx(hs,{label:"Release",value:W.release??"None"}),s.jsx(hs,{label:"Session",value:b.state==="loading"?"Loading…":b.state==="failed"?"Not available":ye!=null&&ye.session?s.jsxs(s.Fragment,{children:[ye.session.provider," ",s.jsx("span",{className:"font-mono break-all",children:ye.session.id})]}):"None"}),s.jsx(hs,{label:"Now",value:W.local_detail??(Oe==null?void 0:Oe.name)??""})]}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Local tasks have no priority or contributors."}),s.jsx(sD,{detail:W,holder:G((Ts=W.claim)==null?void 0:Ts.user_id),finished_at:St?(ye==null?void 0:ye.finished_at)??null:null,read_at:Qe}),s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(go,{className:"text-info size-4","aria-hidden":"true"}),K?s.jsxs(s.Fragment,{children:[s.jsx(ve,{children:"Done is the one change this page makes"}),s.jsx(pe,{children:"Everything else about this task changes through its thread."})]}):s.jsxs(s.Fragment,{children:[s.jsx(ve,{children:"This page only reads tasks"}),s.jsx(pe,{children:"A task changes through the agent thread working on it."})]})]}),Ss?ye!=null&&ye.record?s.jsxs("p",{className:"mt-4 text-sm",children:["Record ",s.jsx("span",{className:"font-mono break-all",children:ye.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."}),K?s.jsx(vt,{id:"task-done-needs",title:"What Done needs",children:bn.length>0?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The task's acceptance; ",xt||"its thread"," checks these after Done."]}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:bn.map(re=>s.jsx("li",{children:re},re))})]}):s.jsxs("p",{className:"text-sm",children:["Its thread gave no acceptance. Ask ",xt||"its thread"," what Done needs before marking it."]})}):bn.length>0?s.jsxs(vt,{id:"task-acceptance",title:"Acceptance",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:yn?"All met: the task finished complete":Lt&&(ye!=null&&ye.finished_at)?`Cancelled ${En(ye.finished_at)}`:"Met when the task finishes complete"}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:bn.map(re=>s.jsx("li",{children:yn?`Met: ${re}`:re},re))})]}):null,s.jsx(aD,{detail:W,waits:Ne,given:K!==null,threadName:G,threadsLink:s.jsx(r,{className:"text-primary hover:underline",href:l(`/org/${e}/threads`),children:"Threads"})}),b.state==="loading"?s.jsxs("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading the task's sections",children:[s.jsx(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-2/3"})]}):null,ye?s.jsx(vt,{id:"task-stands",title:"Where it stands",children:s.jsxs("p",{className:"text-sm",children:[(Oe==null?void 0:Oe.name)??oe.status_id,W.local_detail?` · ${W.local_detail}`:""]})}):null,ye!=null&&ye.time?s.jsx(lD,{time:ye.time}):null,s.jsx(rD,{sections:b,heading_ref:z,on_retry:()=>void ae("graph"),taskLink:re=>s.jsx(r,{className:"text-primary hover:underline",href:l(`/org/${e}/tasks/${re}?from=task:${oe.id}`),children:re})}),ye!=null&&ye.files?s.jsx(iD,{files:ye.files,finished:St}):null,ye!=null&&ye.proof?s.jsx(oD,{proof:ye.proof,finished_at:ye.finished_at,who:W.owner_title??null}):null,ye&&ye.history.length>0?s.jsx(cD,{history:ye.history}):null,s.jsx(ck,{related:N,heading_ref:S,on_retry:()=>void ae("related"),link:re=>{const De=re.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(re.id)}`:re.kind==="task"?`/org/${e}/tasks/${re.id}?from=task:${oe.id}`:re.kind==="issue"?`/org/${e}/issues/${encodeURIComponent(re.id)}?from=task:${oe.id}`:re.kind==="release"?`/releases?${re.planned?"planned":"release"}=${encodeURIComponent(re.id)}`:null;return De?s.jsx(r,{className:ie("text-primary hover:underline",re.kind!=="thread"&&re.label===re.id&&"font-mono"),href:l(De),children:re.label}):re.label}})]}),o]})}function ya({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 Si({back:e,id:t,badge:n,title:a,created:l,actions:r}){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(Ft,{title:a,description:l??void 0,actions:r})]})}function hs({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 vt({id:e,title:t,aside:n,heading_ref:a,children:l}){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:l})]})}function sD({detail:e,holder:t,finished_at:n,read_at:a}){const l=e.claim,[,r]=u.useReducer(f=>f+1,0),i=l&&!e.view_outdated?new Date(l.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(r,Math.min(f+50,2147483647));return()=>clearTimeout(h)},[i]);let o=s.jsx(hp,{className:"size-4","aria-hidden":"true"}),c="Nobody is working on this",d=null;if(e.view_outdated)c=`Claimed by: ${ik}`;else if(l){const f=new Date(l.lease_expires_at)<=new Date(Math.max(Date.now(),new Date(a).getTime()));o=s.jsx(dp,{className:"size-4","aria-hidden":"true"}),c=`${t} is working on this until ${Yn(l.lease_expires_at)}${f||l.lapsed?" · passed":""}`,d="Claimed in the coordination registry; its thread renews the claim."}else n&&(o=s.jsx(Qu,{className:"size-4","aria-hidden":"true"}),d=`Finished ${En(n)}. Its claim ended when it finished.`);return s.jsxs(jt,{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 aD({detail:e,waits:t,given:n,threadName:a,threadsLink:l}){if(e.view_outdated)return s.jsx(vt,{id:"task-holds",title:"Holds",children:s.jsx("p",{className:"text-sm",children:ik})});if(e.holds.length===0)return null;const r=new Map(t.map(i=>[i.id,i]));return s.jsxs(vt,{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(jt,{className:"mt-2 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Holds",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Type"}),s.jsx(F,{children:"Reason"}),s.jsx(F,{children:"Waiting on"}),s.jsx(F,{children:"Opened"})]})}),s.jsx(He,{children:e.holds.map(i=>{var f;const o=r.get(i.id),c=Xi[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 ",l,": ",o.local_threads.join(" · ")]}):null;return s.jsxs(ue,{"data-testid":"task-hold",children:[s.jsx(q,{children:s.jsx(he,{variant:c.tone,children:(o==null?void 0:o.local_label)??c.label})}),s.jsxs(q,{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(q,{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(q,{children:Zp(i.opened_at)})]},i.id)})})]})})]})}function lD({time:e}){return s.jsx(vt,{id:"task-time",title:"Time",children:s.jsxs("dl",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsx(hs,{label:"Estimate",value:e.estimate?`${Wr(e.estimate.low)}–${Wr(e.estimate.high)}`:e.unknown_reason??"None"}),s.jsx(hs,{label:"Time taken",value:e.elapsed!==null?`${Wr(e.elapsed)}${e.over_estimate?" · over estimate":""}`:"Not started"}),e.forecast?s.jsx(hs,{label:"Reforecast",value:s.jsxs("span",{className:"text-muted-foreground",children:[Wr(e.forecast.low),"–",Wr(e.forecast.high)," left",e.forecast.reason?` · ${e.forecast.reason}`:""]})}):null]})})}function ex({what:e,again:t,refusal:n,on_retry:a}){return s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:["Could not read ",e]}),s.jsxs(pe,{children:[s.jsx("p",{children:n.message}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:t})]})]})}function rD({sections:e,heading_ref:t,on_retry:n,taskLink:a}){const[l,r]=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(vt,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsx(ex,{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(vt,{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=l?o.changes:o.changes.slice(0,rk),d=o.changes.length-c.length;return s.jsxs(vt,{id:"task-graph",title:"Graph changes",aside:o.document,heading_ref:t,children:[s.jsx(jt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Graph changes",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Change"}),s.jsx(F,{children:"Kind of change"}),s.jsx(F,{children:"Also in"}),s.jsx(F,{children:"In the plan"})]})}),s.jsx(He,{children:c.map(f=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx("div",{children:f.label}),s.jsx("div",{className:"text-muted-foreground text-xs",children:f.type})]}),s.jsx(q,{children:J$[f.change]}),s.jsx(q,{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(q,{children:f.planned?"Yes":s.jsx(he,{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(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(!0),children:["Show all ",o.changes.length]})]}):null]})}function iD({files:e,finished:t}){const[n,a]=u.useState(!1),l=n?e.paths:e.paths.slice(0,rk);return s.jsxs(vt,{id:"task-files",title:"Files",children:[l.length>0?s.jsx("ul",{className:"grid gap-1 text-sm",children:l.map(r=>s.jsx("li",{children:s.jsx("span",{className:"font-mono break-all",children:r})},r))}):null,e.paths.length>l.length?s.jsxs(P,{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 oD({proof:e,finished_at:t,who:n}){return s.jsxs(vt,{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 ",En(t),n?` by ${n}`:""]}):null]})}function cD({history:e}){return s.jsxs(vt,{id:"task-history",title:"History",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"From the task record, newest first"}),s.jsx(jt,{className:"mt-2 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"History",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"What"}),s.jsx(F,{children:"Who"}),s.jsx(F,{children:"When"})]})}),s.jsx(He,{children:e.map((t,n)=>s.jsxs(ue,{children:[s.jsx(q,{children:t.what}),s.jsx(q,{children:t.who??"Its thread"}),s.jsx(q,{children:Zp(t.at)})]},`${t.at}:${n}`))})]})})]})}function ck({id:e="task-related",related:t,heading_ref:n,on_retry:a,link:l,fixed:r=!1}){return t.state==="ok"&&t.data.length===0?null:s.jsx(vt,{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(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-2/3"})]}):t.state==="failed"?s.jsx(ex,{what:"related work",again:"Read related work again",refusal:t.refusal,on_retry:a}):s.jsx(jt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Related",className:r?"table-fixed":void 0,children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{className:r?"w-[14%]":void 0,children:"Kind"}),s.jsx(F,{className:r?"w-[45%]":void 0,children:"Item"}),s.jsx(F,{className:r?"w-[41%]":void 0,children:"How it relates"})]})}),s.jsx(He,{children:t.data.map(i=>s.jsxs(ue,{children:[s.jsx(q,{children:eD[i.kind]}),s.jsx(q,{className:r?"break-words":void 0,children:l(i)}),s.jsx(q,{className:r?"break-words":void 0,children:i.relation})]},`${i.kind}:${i.planned?"planned:":""}${i.id}`))})]})})})}function uD({org:e,task_id:t,from:n}){const a=Ro(),l=`/org/${e}/tasks`;return a.taskSections?s.jsx(nD,{org:e,task_id:t,from:n??null}):s.jsx(dD,{task_id:t,back:l})}function dD({task_id:e,back:t}){const{availability:n}=Ro(),[a,l]=u.useState({state:"loading"});return u.useEffect(()=>{let r=!0;return n().then(i=>{r&&l(i)}),()=>{r=!1}},[n]),a.state==="off"?s.jsx(ju,{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(X$,{active:a,task_id:e,back:t}):a.state==="error"?s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This task could not be loaded"}),s.jsx(pe,{children:"Check your connection and try again."})]}):a.state==="available"?s.jsx(ju,{back:t}):s.jsx(Jp,{})})}function Pn({children:e}){return s.jsx("p",{role:"alert",className:"text-destructive text-sm",children:e})}const fD=["open","triaged","resolved","closed"],tx=["low","normal","high","urgent"],hD=["fixed","works_as_intended","planned","duplicate","wont_fix","cannot_reproduce"],mD=["title","description","external_reference"],_u={open:"Open",triaged:"Triaged",escalated:"Escalated",waiting_on_fix:"Waiting on fix",resolved:"Resolved",closed:"Closed"},uk={open:"warning",triaged:"info",escalated:"info",waiting_on_fix:"info",resolved:"success",closed:"neutral"},Ki={low:"Low",normal:"Normal",high:"High",urgent:"Urgent"},nx={fixed:"Fixed",works_as_intended:"Works as intended",planned:"Planned",duplicate:"Duplicate",wont_fix:"Won't fix",cannot_reproduce:"Cannot reproduce"},dk={title:"Title",description:"Description",external_reference:"External reference"},pD=[["year",365*24*3600],["month",30*24*3600],["week",7*24*3600],["day",24*3600],["hour",3600],["minute",60]];function Tc(e,t=Date.now()){const n=Math.round((new Date(e).getTime()-t)/1e3),a=new Intl.RelativeTimeFormat("en",{numeric:"auto"});for(const[l,r]of pD)if(Math.abs(n)>=r)return a.format(Math.round(n/r),l);return"just now"}function sm(e,t,n){const a=`/org/${encodeURIComponent(e)}/proj/${encodeURIComponent(t)}/support`;return n?`${a}/${encodeURIComponent(n)}`:a}function sx(e,t){return e?t??"Not available":"A former member"}const xD="the issue integration";function gD(e){return!e.created_by&&e.reporter_kind==="customer"?xD:sx(e.created_by,e.created_by_username)}function vD(e,t){return!e.actor_id&&e.kind==="created"&&t.reporter_kind==="customer"?"The issue integration":sx(e.actor_id,e.actor_username)}const lc="not_set",yD="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 bD({create:e,open:t,onOpenChange:n,onCreated:a}){const[l,r]=u.useState(""),[i,o]=u.useState(""),[c,d]=u.useState(!1),[f,h]=u.useState(""),[m,x]=u.useState(lc),[j,v]=u.useState(!1),[y,g]=u.useState(null),p=u.useRef(null),b=()=>{r(""),o(""),d(!1),h(""),x(lc),g(null),p.current=null},_=w=>{var k;return((k=y==null?void 0:y.personal_data)==null?void 0:k.field)===w?y.message:void 0},N=async w=>{if(w.preventDefault(),j)return;v(!0),p.current??(p.current=crypto.randomUUID());const k=await e({request_id:p.current,title:i.trim()||void 0,description:f||void 0,external_reference:l.trim()||void 0,priority:m===lc?null:m});if(v(!1),!k.ok){k.refusal.status!==0&&(p.current=null),g(k.refusal);return}b(),a(k.data.issue,k.data.duplicates)},C=y&&!y.personal_data?y.message:void 0;return s.jsx(es,{open:t,onOpenChange:w=>{w||b(),n(w)},children:s.jsx(ts,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:N,className:"grid gap-4",children:[s.jsxs(ns,{children:[s.jsx(as,{children:"New support issue"}),s.jsx(ls,{children:"Log one help-desk report. Text is shown exactly as entered."})]}),s.jsxs(me,{variant:"warning",children:[s.jsx(xn,{}),s.jsx(pe,{children:yD})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-issue-reference",children:"External reference"}),s.jsx(Ot,{id:"maintain-issue-reference",value:l,"aria-invalid":!!_("external_reference"),onChange:w=>{r(w.target.value),c||o(w.target.value)}}),_("external_reference")?s.jsx(Pn,{children:_("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(Me,{htmlFor:"maintain-issue-title",children:"Title"}),s.jsx(Ot,{id:"maintain-issue-title",value:i,"aria-invalid":!!_("title"),onChange:w=>{o(w.target.value),d(!0)}}),_("title")?s.jsx(Pn,{children:_("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(Me,{htmlFor:"maintain-issue-description",children:"Description"}),s.jsx(ks,{id:"maintain-issue-description",rows:4,placeholder:"What the end user reported, without personal data",value:f,"aria-invalid":!!_("description"),onChange:w=>h(w.target.value)}),_("description")?s.jsx(Pn,{children:_("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-issue-priority",children:"Priority"}),s.jsxs(dt,{value:m,onValueChange:x,children:[s.jsx(it,{id:"maintain-issue-priority",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:lc,children:"Not set"}),tx.map(w=>s.jsx(ke,{value:w,children:Ki[w]},w))]})]})]}),C?s.jsx(Pn,{children:C}):null,s.jsxs(ss,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>{b(),n(!1)},children:"Cancel"}),s.jsx(P,{type:"submit",loading:j,disabled:!i.trim()&&!l.trim(),children:"Log issue"})]})]})})})}const jD=["supportAccess","assigneeCandidates","create","update","assign","transition","redact"];function fk(){return _D(en().issues)}function _D(e){return e&&jD.every(t=>typeof e[t]=="function")?e:null}function hk(e){const[t,n]=u.useState(null);return u.useEffect(()=>{if(!e)return;let a=!1;return e.supportAccess().then(l=>{a||n({contract:e,state:l.ok?{state:"ready",access:l.data}:{state:"error"}})}),()=>{a=!0}},[e]),t&&e&&t.contract===e?t.state:{state:"loading"}}function mk({access:e,header:t,back_href:n,children:a}){const{href:l,Link:r}=Ve();return e.state==="loading"?s.jsxs("div",{className:"flex flex-1 items-center justify-center py-24",children:[s.jsx(gn,{className:"size-5"}),s.jsx("span",{className:"sr-only",children:"Loading…"})]}):e.state==="error"||!e.access.enabled?s.jsx(Ba,{title:"Page not found",description:"This page does not exist or you do not have access to it.",backHref:l(n),backLabel:"Back to the project",link:r}):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 wD(){const e=Ve();return t=>{e.navigate?e.navigate(t):window.location.assign(e.href(t))}}const ln="all",rc=25;function am({action:e}){return s.jsx(Ft,{title:"Support",description:"Help-desk reports logged against this project.",actions:e})}function ND({org:e,project:t,query:n}){const a=fk(),l=hk(a),r=`/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(mk,{access:l,header:s.jsx(am,{}),back_href:r,children:i=>a?s.jsx(kD,{contract:a,access:i,org_name:e,proj_name:t,query:n}):null})})}function kD({contract:e,access:t,org_name:n,proj_name:a,query:l}){const{href:r,Link:i}=Ve(),o=wD(),[c,d]=u.useState(()=>new URLSearchParams(l).get("external_reference")??""),[f,h]=u.useState(ln),[m,x]=u.useState(ln),[j,v]=u.useState(ln),[y,g]=u.useState(0),[p,b]=u.useState(null),[_,N]=u.useState(0),[C,w]=u.useState(null),[k,A]=u.useState([]),[$,X]=u.useState(!1),Y=c.trim()!==""||f!==ln||m!==ln||j!==ln,L=u.useCallback(async()=>{const S=await e.list({external_reference:c.trim()||void 0,status:f===ln?void 0:f,priority:m===ln?void 0:m,assignee:j===ln?void 0:j,limit:rc,offset:y*rc});if(!S.ok){w(S.refusal.message);return}w(null),b(S.data.issues),N(S.data.total)},[e,c,f,m,j,y]);u.useEffect(()=>{const S=setTimeout(()=>void L(),200);return()=>clearTimeout(S)},[L]),u.useEffect(()=>{e.assigneeCandidates().then(S=>{S.ok&&A(S.data.candidates)})},[e]);const H=t.can_change?s.jsxs(P,{onClick:()=>X(!0),children:[s.jsx(yr,{className:"mr-2 size-4"}),"New issue"]}):void 0,R=s.jsx(bD,{create:e.create,open:$,onOpenChange:X,onCreated:(S,O)=>{X(!1);const Z=sm(n,a,S.id);o(O.length?`${Z}?duplicates=${O.length}`:Z)}});if(p!==null&&_===0&&!Y&&y===0)return s.jsxs(s.Fragment,{children:[s.jsx(am,{}),s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(jT,{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(P,{onClick:()=>X(!0),children:[s.jsx(yr,{className:"mr-2 size-4"}),"Log the first issue"]}):null]}),R]});const T=_===0?0:y*rc+1,z=Math.min(_,(y+1)*rc);return s.jsxs(s.Fragment,{children:[s.jsx(am,{action:H}),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(GT,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2","aria-hidden":!0}),s.jsx(Ot,{"aria-label":"Filter by external reference",placeholder:"Filter by external reference",className:"pl-9",value:c,onChange:S=>{d(S.target.value),g(0)}})]}),s.jsx(Ef,{label:"Status",value:f,onChange:S=>{h(S),g(0)},options:fD.map(S=>({value:S,label:_u[S]}))}),s.jsx(Ef,{label:"Priority",value:m,onChange:S=>{x(S),g(0)},options:tx.map(S=>({value:S,label:Ki[S]}))}),s.jsx(Ef,{label:"Assignee",value:j,onChange:S=>{v(S),g(0)},options:[{value:"unassigned",label:"Unassigned"},{value:"cannot_act",label:"Assignee cannot act"},...k.map(S=>({value:S.user_id,label:S.username??"Not available"}))]})]}),C?s.jsx(Pn,{children:C}):null,s.jsx("div",{className:"rounded-md border",children:s.jsxs(Be,{children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Title"}),s.jsx(F,{children:"External reference"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Priority"}),s.jsx(F,{children:"Assignee"}),s.jsx(F,{children:"Updated"})]})}),s.jsx(He,{children:p===null?s.jsx(ue,{children:s.jsx(q,{colSpan:6,className:"h-24 text-center",children:"Loading…"})}):p.length===0?s.jsx(ue,{children:s.jsx(q,{colSpan:6,className:"h-24 text-center",children:"No issues match these filters."})}):p.map(S=>s.jsxs(ue,{children:[s.jsx(q,{className:"max-w-md",children:s.jsx(i,{href:r(sm(n,a,S.id)),className:"font-medium hover:underline",children:S.title})}),s.jsx(q,{className:"font-mono text-xs",children:S.external_reference??""}),s.jsx(q,{children:s.jsx(he,{variant:uk[S.status],children:_u[S.status]})}),s.jsx(q,{children:S.priority?Ki[S.priority]:""}),s.jsx(q,{children:s.jsx(SD,{issue:S})}),s.jsx(q,{className:"text-muted-foreground",children:Tc(S.updated_at)})]},S.id))})]})}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-muted-foreground text-sm",children:_===0?"No issues.":`Showing ${T}–${z} of ${_} issue${_===1?"":"s"}.`}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(P,{variant:"outline",size:"sm",disabled:y===0,onClick:()=>g(S=>Math.max(0,S-1)),children:"Previous"}),s.jsx(P,{variant:"outline",size:"sm",disabled:z>=_,onClick:()=>g(S=>S+1),children:"Next"})]})]}),R]})}function SD({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(he,{variant:"error",children:"Assignee cannot act"}):null]}):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}function Ef({label:e,value:t,onChange:n,options:a}){var r;const l=u.useMemo(()=>t===ln||a.some(i=>i.value===t),[a,t]);return s.jsxs(dt,{value:l?t:ln,onValueChange:n,children:[s.jsx(it,{className:"w-44","aria-label":e,children:s.jsx(ft,{placeholder:e,children:t===ln?e:(r=a.find(i=>i.value===t))==null?void 0:r.label})}),s.jsxs(ot,{children:[s.jsx(ke,{value:ln,children:"All"}),a.map(i=>s.jsx(ke,{value:i.value,children:i.label},i.value))]})]})}const pk=[{key:"local",label:"Local"},{key:"staging",label:"Staging"},{key:"production",label:"Production"}],CD=/^iss-\d{1,9}$/,TD=/^col-\d{1,9}$/,RD=e=>e&&e[0].toUpperCase()+e.slice(1);function xk(e){const t=RD(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 Ci(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 lm={search:"",owner:null,urgent:!1,seen:[],label:null,collection:null};function Rc(e){const t=new URLSearchParams(e),n=t.getAll("seen").filter(l=>pk.some(r=>r.key===l)),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&&TD.test(a)?a:null}}function Xl(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 ED(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 Sv=e=>!!(e.search.trim()||e.owner||e.urgent||e.seen.length||e.label||e.collection),AD={agent:"Filed by an agent",user:"Filed by you",tool:"Filed by a tool"},MD={graph:"Placed on the graph by its anchors",files:"Placed by its files",unplaced:"Triaged, not placed yet"},OD={handoff:"Handed to its owner",backlog:"Sent to the unowned backlog",batch:"Routed to a batch"};function $D(e,t=""){const n=(e??t).trim();if(!n)return"";const a=n.indexOf(": "),l=(a===-1?n:n.slice(0,a)).trim(),r=a===-1?"":n.slice(a+2).trim(),i=o=>r?`${o} ${r}`:o;switch(l){case"filed":return AD[r]??i("Filed by");case"labelled":return i("Labelled");case"unlabelled":return r?`Label removed: ${r}`:"Label removed";case"anchored":return r?`Anchored to ${r}`:"Anchored";case"triaged":return MD[r]??(r?`Triaged: ${r}`:"Triaged");case"routed":return OD[r]??(r?`Routed: ${r}`:"Routed");case"route closed":return r==="backlog"?"Taken off the unowned backlog":r?`Route closed: ${r}`:"Route closed";case"released":return r?`Released by its owner (task ${r})`:"Released by its owner";case"resolved":return r==="duplicate"?"Resolved as a duplicate":r?`Resolved · ${r.replace(/_/g," ")}`:"Resolved";case"reopened":return r?`Reopened: ${r}`:"Reopened";case"fix landed":return r?`Fix landed in ${r.slice(0,10)}`:"Fix landed";case"merged":return r?`Merged ${r} into this issue`:"Merged a duplicate into this issue";default:return n}}const DD=e=>e.replace(/`+/g,"").replace(/\s+/g," ").trim(),gk="This page only reads issues",vk="File, route and resolve issues with the issue command or through the thread working on them.",zD=10,LD=250,Rl="__all",UD="none",BD=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function yk(){const e=en().issues;if(!e)throw new Error("The Issues page rendered without the issues seam.");return e}const HD=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 ID({project:e,query:t,onQuery:n}){var G;const a=yk(),{href:l,Link:r}=Ve(),i=u.useMemo(()=>Rc(t),[t]),o=Xl(i),c=Sv(i),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState(null),[x,j]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(null),b=Wn(),_=u.useRef(!1),[N,C]=u.useState(i.search),w=u.useCallback(M=>n(Xl({...i,...M})),[i,n]),k=u.useCallback(async()=>{const M=y.current+=1;j(null);const V=await a.list(ED(Rc(o)));if(M!==y.current)return;if(V.ok){v.current=0,m(null),f({state:"ok",list:V.data,local:V.data.local??HD(new Date().toISOString()),key:o});return}const ae=V.refusal.reason;if(ae==="engine_missing")return f({state:"engine_missing",refusal:V.refusal});if(ae==="view_outdated")return f({state:"view_outdated"});if(v.current+=1,v.current===1&&BD(V.refusal)){j(V.refusal.retry_after??zD);return}m(V.refusal)},[a.list,o]);u.useEffect(()=>{k()},[k]),u.useEffect(()=>{if(x===null)return;const M=setTimeout(()=>void k(),x*1e3);return()=>clearTimeout(M)},[x,k]),u.useEffect(()=>{document.activeElement!==g.current&&C(i.search)},[i.search]),u.useEffect(()=>{if(N===i.search)return;const M=setTimeout(()=>w({search:N}),LD);return()=>clearTimeout(M)},[N,i.search,w]),u.useEffect(()=>{const M=V=>{if(V.key!=="/"||V.metaKey||V.ctrlKey||V.altKey)return;const ae=V.target;ae&&(ae.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(ae.tagName))||g.current&&(V.preventDefault(),g.current.focus())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[]);const A=()=>{var M;C(""),n(Xl(lm)),(M=g.current)==null||M.focus()},$=()=>{v.current=0,k()},X=()=>{_.current=!0,$()};u.useEffect(()=>{var V;if(!_.current||d.state==="loading"||x!==null)return;_.current=!1;const M=(V=p.current)==null?void 0:V.querySelector("h1");M&&(M.tabIndex=-1,M.focus())},[d,h,x]);const Y=M=>`/proj/${encodeURIComponent(e)}/issues${M?`?${M}`:""}`,L=M=>`/proj/${encodeURIComponent(e)}/issues/${encodeURIComponent(M)}?from=issues${o?`&${o}`:""}`,H=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(gn,{"aria-hidden":"true"}),"Issues are busy. Reading them again…"]}):null}),R=h?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Issues could not be loaded"}),s.jsxs(pe,{children:[s.jsxs("p",{children:[h.message,h.since?` Since ${Yn(h.since)}.`:"",d.state==="ok"?` The list below was read at ${Yn(d.local.read_at)}.`:"",h.message.includes(ol)?"":` ${ol}`]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:X,children:"Retry"})]})]}):null,T=s.jsx(Ft,{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 ",Yn(d.local.read_at)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:$,children:[s.jsx(vl,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]}):null});if(d.state==="engine_missing")return s.jsx(ic,{ref:p,children:s.jsx(Js,{page:"Issues"})});if(d.state==="view_outdated")return s.jsxs(ic,{ref:p,children:[T,s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsx(pe,{children:b})]})]});if(d.state==="loading")return s.jsxs(ic,{ref:p,children:[T,H,R,!h&&x===null?s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading issues",children:Array.from({length:6},(M,V)=>s.jsx(pt,{className:V===5?"h-10 w-2/3":"h-10 w-full"},V))}):null]});const{list:z,local:S}=d,O=!h&&x===null&&(d.key!==o||N!==i.search),Z=Sv(Rc(d.key)),E=S.scope==="folder",I=S.listed===0&&!c,ne=Math.max(0,S.listed-S.facets.owners.reduce((M,V)=>M+V.count,0)),ee=i.collection?((G=S.collections.find(M=>M.collection===i.collection))==null?void 0:G.title)??i.collection:null,ge=new Map;for(const M of z.issues){const V=M.group??"unplaced";ge.set(V,[...ge.get(V)??[],M])}return s.jsxs(ic,{ref:p,children:[T,E&&S.folder?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Issues of the folder ",S.folder,", from its issue store."]}):null,s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(go,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:gk}),s.jsx(pe,{children:vk})]}),H,R,I?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(xT,{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(Ot,{ref:g,type:"search",className:"w-64","aria-label":"Search issues",placeholder:"Search issues",value:N,onChange:M=>C(M.target.value)}),s.jsxs(dt,{value:i.owner??Rl,onValueChange:M=>w({owner:M===Rl?null:M}),children:[s.jsx(it,{className:"w-56","aria-label":"Owner",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:Rl,children:"All owners"}),s.jsxs(ke,{value:UD,children:["Unowned (",ne,")"]}),S.facets.owners.map(M=>s.jsxs(ke,{value:M.key,children:[M.title," (",M.count,")"]},M.key))]})]}),s.jsxs(dt,{value:i.label??Rl,onValueChange:M=>w({label:M===Rl?null:M}),children:[s.jsx(it,{className:"w-48","aria-label":"Label",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:Rl,children:"All labels"}),S.facets.labels.map(M=>s.jsxs(ke,{value:M.label,children:[M.label," (",M.count,")"]},M.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(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":i.urgent,onClick:()=>w({urgent:!i.urgent}),children:["Urgent ",S.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"}),pk.map(M=>{const V=i.seen.includes(M.key);return s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":V,onClick:()=>w({seen:V?i.seen.filter(ae=>ae!==M.key):[...i.seen,M.key]}),children:[M.label," ",S.facets.seen[M.key]]},M.key)}),ee!==null?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{"data-testid":"issues-collection-chip",className:ie(rd({variant:"outline",size:"sm"}),CA),children:["Collection ",ee]}),s.jsx(P,{type:"button",variant:"ghost",size:"sm-icon","aria-label":"Remove the collection filter",onClick:()=>{var M;w({collection:null}),(M=g.current)==null||M.focus()},children:s.jsx(Ju,{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(gn,{"aria-hidden":"true"}),"Searching…"]}):c&&z.total>0?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:[z.total," of ",S.listed," issues ·"," ",s.jsx(P,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:A,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:Z&&z.total===0?s.jsxs("p",{className:"mt-6 flex items-center gap-2 text-sm",children:[s.jsx(Wu,{className:"text-muted-foreground size-4","aria-hidden":"true"}),"No issues match."," ",s.jsx(P,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:A,children:"Clear"})]}):S.groups.map(M=>s.jsx(PD,{id:`issues-${M.key}`,title:`${M.label} · ${M.count}`,issues:ge.get(M.key)??[],folder:E,link:V=>s.jsx(r,{className:"text-primary hover:underline",href:l(L(V.id)),children:V.title})},M.key))}),!c&&S.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 · ",S.collections.length]}),s.jsx(jt,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Collections",className:"table-fixed",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{className:"w-1/2",children:"Collection"}),s.jsx(F,{className:"w-1/4",children:"Resolved"}),s.jsx(F,{className:"w-1/4",children:"Updated"})]})}),s.jsx(He,{children:S.collections.map(M=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx(r,{className:"text-primary hover:underline",href:l(Y(Xl({...lm,collection:M.collection}))),children:M.title}),s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:M.collection})]}),s.jsxs(q,{children:[M.resolved," of ",M.total," resolved"]}),s.jsx(q,{className:"text-muted-foreground",children:Ci(M.updated_at)})]},M.collection))})]})})]}):null]})]})}const ic=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 PD({id:e,title:t,issues:n,folder:a,link:l}){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(jt,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:t,className:"table-fixed",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{className:a?"w-[30%]":"w-[36%]",children:"Title"}),s.jsx(F,{className:"w-[10%]",children:"Issue"}),a?s.jsx(F,{className:"w-[12%]",children:"Project"}):null,s.jsx(F,{className:"w-[16%]",children:"Status"}),s.jsx(F,{className:"w-[8%]",children:"Urgent"}),s.jsx(F,{className:a?"w-[14%]":"w-[18%]",children:"Owner"}),s.jsx(F,{className:"w-[12%]",children:"Updated"})]})}),s.jsx(He,{children:n.map(r=>{var o;const i=xk(r);return s.jsxs(ue,{"data-testid":"issues-row",children:[s.jsxs(q,{className:"break-words",children:[l(r),(o=r.labels)!=null&&o.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:r.labels.map(c=>s.jsx(he,{variant:"neutral",size:"dense",children:c},c))}):null]}),s.jsx(q,{className:"font-mono text-xs",children:r.id}),a?s.jsx(q,{className:"break-words",children:r.project_id??"Folder"}):null,s.jsx(q,{children:s.jsx(he,{variant:i.tone,children:i.label})}),s.jsx(q,{children:r.urgent&&r.status!=="resolved"&&r.group!=="resolved"?s.jsx(he,{variant:"warning",children:"Urgent"}):null}),s.jsx(q,{className:"break-words",children:r.owner_title?r.owner_title:s.jsx("span",{className:"text-muted-foreground",children:"Unowned"})}),s.jsx(q,{className:"text-muted-foreground",children:Ci(r.updated_at)})]},r.id)})})]})})]})}function qD(e){var t;return(t=en().issues)!=null&&t.issueSections?s.jsx(ID,{...e}):s.jsx(ND,{org:e.org,project:e.project,query:e.query})}function GD({update:e,issue:t,open:n,onOpenChange:a,onDone:l,onReload:r}){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),[j,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=j==null?void 0:j.personal_data)==null?void 0:C.field)===N?j.message:void 0},b=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}l(C.data.issue)},_=async()=>{const N=await r();N&&(x(N),v(null))};return s.jsx(es,{open:n,onOpenChange:a,children:s.jsx(ts,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:b,className:"grid gap-4",children:[s.jsxs(ns,{children:[s.jsx(as,{children:"Edit issue"}),s.jsx(ls,{children:"Text is shown exactly as entered."})]}),j!=null&&j.conflict?s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{}),s.jsx(pe,{children:"Someone else saved this issue after you opened it, so nothing was saved. Your text is kept below; reload the latest issue, then save to apply it."})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-edit-title",children:"Title"}),s.jsx(Ot,{id:"maintain-edit-title",value:i,"aria-invalid":!!p("title"),onChange:N=>o(N.target.value)}),p("title")?s.jsx(Pn,{children:p("title")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-edit-description",children:"Description"}),s.jsx(ks,{id:"maintain-edit-description",rows:4,value:c,"aria-invalid":!!p("description"),onChange:N=>d(N.target.value)}),p("description")?s.jsx(Pn,{children:p("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-edit-reference",children:"External reference"}),s.jsx(Ot,{id:"maintain-edit-reference",value:f,"aria-invalid":!!p("external_reference"),onChange:N=>h(N.target.value)}),p("external_reference")?s.jsx(Pn,{children:p("external_reference")}):null]}),j&&!j.conflict&&!j.personal_data?s.jsx(Pn,{children:j.message}):null,s.jsxs(ss,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),j!=null&&j.conflict?s.jsxs(P,{type:"button",variant:"outline",onClick:_,children:[s.jsx(vl,{className:"mr-2 size-4"}),"Reload latest"]}):null,s.jsx(P,{type:"submit",loading:y,disabled:!!(j!=null&&j.conflict),children:"Save"})]})]})})})}function Cv(e){return e.map(t=>dk[t].toLowerCase()).join(", ")}function VD(e){switch(e.kind){case"created":return"Logged the issue";case"updated":return`Edited the ${Cv(e.fields)}`;case"redacted":return`Redacted the ${Cv(e.fields)}`;case"priority_set":return e.priority?`Set priority to ${Ki[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?_u[e.to_status]:"";return e.resolution_reason?`Moved to ${t}: ${nx[e.resolution_reason]}`:`Moved to ${t}`}}}function Tv(e,t){return t==="external_reference"?e.external_reference??"":e[t]}function YD({redact:e,issue:t,open:n,onOpenChange:a,onDone:l,onReload:r}){const[i,o]=u.useState("description"),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,x]=u.useState(null),[j,v]=u.useState(t);u.useEffect(()=>{n&&(v(t),d(Tv(t,i)),x(null))},[n]);const y=async g=>{g.preventDefault(),h(!0);const p=await e(j.id,j.revision,i,c);if(h(!1),!p.ok){if(p.refusal.conflict){const b=await r();b&&v(b),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}l(p.data.issue)};return s.jsx(es,{open:n,onOpenChange:a,children:s.jsx(ts,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:y,className:"grid gap-4",children:[s.jsxs(ns,{children:[s.jsx(as,{children:"Redact text"}),s.jsx(ls,{children:"Replace text that holds personal data, such as a name."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-redact-field",children:"Field"}),s.jsxs(dt,{value:i,onValueChange:g=>{const p=g;o(p),d(Tv(j,p))},children:[s.jsx(it,{id:"maintain-redact-field",children:s.jsx(ft,{})}),s.jsx(ot,{children:mD.map(g=>s.jsx(ke,{value:g,children:dk[g]},g))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-redact-replacement",children:"Replacement text"}),s.jsx(ks,{id:"maintain-redact-replacement",rows:4,value:c,onChange:g=>d(g.target.value)})]}),s.jsxs(me,{variant:"warning",children:[s.jsx(xn,{}),s.jsx(pe,{children:"This cannot be undone: the original text is removed for good. History records only that this field was redacted."})]}),m?s.jsx(Pn,{children:m}):null,s.jsxs(ss,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(P,{type:"submit",variant:"destructive",loading:f,children:"Redact"})]})]})})})}function FD({transition:e,issue:t,open:n,onOpenChange:a,onDone:l}){const[r,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",r);if(c(!1),!x.ok){if(x.refusal.conflict){l(null);return}f(x.refusal.message);return}f(null),l(x.data.issue)};return s.jsx(es,{open:n,onOpenChange:a,children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:h,className:"grid gap-4",children:[s.jsxs(ns,{children:[s.jsx(as,{children:"Resolve issue"}),s.jsx(ls,{children:"Choose how this report ended."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-resolution-reason",children:"Resolution reason *"}),s.jsxs(dt,{value:r,onValueChange:m=>i(m),children:[s.jsx(it,{id:"maintain-resolution-reason",children:s.jsx(ft,{})}),s.jsx(ot,{children:hD.map(m=>s.jsx(ke,{value:m,children:nx[m]},m))})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopening the issue clears its reason."})]}),d?s.jsx(Pn,{children:d}):null,s.jsxs(ss,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(P,{type:"submit",loading:o,children:"Resolve"})]})]})})})}const El="not_set";function XD({org:e,project:t,issue_id:n,query:a}){const l=fk(),r=hk(l),i=sm(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(mk,{access:r,header:s.jsx(Ft,{title:"Support"}),back_href:i,children:o=>l?s.jsx(KD,{contract:l,issue_id:n,access:o,list_href:i,duplicates:Number(new URLSearchParams(a).get("duplicates")??0)}):null})})}function KD({contract:e,issue_id:t,access:n,list_href:a,duplicates:l}){const{href:r,Link:i}=Ve(),o=Ar(),[c,d]=u.useState(null),[f,h]=u.useState([]),[m,x]=u.useState(!1),[j,v]=u.useState([]),[y,g]=u.useState(null),p=u.useCallback(async()=>{const w=await e.issue(t);return w.ok?(d(w.data.issue),h(w.data.events),w.data.issue):(w.refusal.status===404?x(!0):o.error(w.refusal.message),null)},[e,t,o]);u.useEffect(()=>{let w=!1;return e.issue(t).then(k=>{if(!w){if(!k.ok){k.refusal.status===404?x(!0):o.error(k.refusal.message);return}d(k.data.issue),h(k.data.events)}}),()=>{w=!0}},[e,t]),u.useEffect(()=>{n.can_change&&e.assigneeCandidates().then(w=>{w.ok&&v(w.data.candidates)})},[e,n.can_change]);const b=async w=>{const k=await w;if(!k.ok){o.error(k.refusal.message),k.refusal.conflict&&await p();return}await p()};if(m)return s.jsx(Ba,{title:"Support issue not found",description:"This issue does not exist in this project.",backHref:r(a),backLabel:"Back to Support",link:i});if(!c)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading…"});const _=c.status==="closed",N=n.can_change,C=w=>b(e.transition(c.id,c.revision,w));return s.jsxs(s.Fragment,{children:[s.jsx(Ft,{title:c.title,actions:N?s.jsxs(s.Fragment,{children:[_?null:s.jsxs(P,{variant:"outline",onClick:()=>g("edit"),children:[s.jsx(Zu,{className:"mr-2 size-4"}),"Edit"]}),s.jsxs(P,{variant:"outline",onClick:()=>g("redact"),children:[s.jsx(nT,{className:"mr-2 size-4"}),"Redact"]}),c.status==="open"?s.jsx(P,{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(P,{onClick:()=>g("resolve"),children:[s.jsx(Qu,{className:"mr-2 size-4"}),"Resolve"]}):null,c.status==="resolved"?s.jsxs(s.Fragment,{children:[s.jsxs(P,{variant:"outline",onClick:()=>void C("open"),children:[s.jsx(IT,{className:"mr-2 size-4"}),"Reopen"]}),s.jsx(P,{onClick:()=>void C("closed"),children:"Close"})]}):null]}):void 0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(he,{variant:uk[c.status],children:_u[c.status]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Logged by ",gD(c)," ",Tc(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:[l>0&&c.external_reference?s.jsxs(me,{variant:"info",children:[s.jsx(Ua,{}),s.jsxs(pe,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[s.jsxs("span",{children:[c.external_reference," is already logged on"," ",l===1?"another issue":`${l} other issues`," in this project."]}),s.jsx(P,{asChild:!0,variant:"outline",size:"sm",children:s.jsx(i,{href:r(`${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(Be,{children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"When"}),s.jsx(F,{children:"Who"}),s.jsx(F,{children:"What"})]})}),s.jsx(He,{children:f.map(w=>s.jsxs(ue,{children:[s.jsx(q,{className:"text-muted-foreground",children:Tc(w.created_at)}),s.jsx(q,{children:vD(w,c)}),s.jsx(q,{children:VD(w)})]},w.id))})]})})]})]}),s.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-5 lg:w-72",children:[s.jsx(Jr,{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(Jr,{label:"Resolution",children:s.jsx("span",{className:"text-sm",children:nx[c.resolution_reason]})}):null,s.jsx(Jr,{label:"Priority",id:"maintain-issue-priority",children:s.jsxs(dt,{value:c.priority??El,disabled:!N||_,onValueChange:w=>void b(e.update(c.id,c.revision,{priority:w===El?null:w})),children:[s.jsx(it,{id:"maintain-issue-priority",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:El,children:"Not set"}),tx.map(w=>s.jsx(ke,{value:w,children:Ki[w]},w))]})]})}),s.jsxs(Jr,{label:"Assignee",id:"maintain-issue-assignee",children:[s.jsxs(dt,{value:c.assignee_id??El,disabled:!N||_,onValueChange:w=>void b(e.assign(c.id,c.revision,w===El?null:w)),children:[s.jsx(it,{id:"maintain-issue-assignee",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:El,children:"Not set"}),c.assignee_id&&!j.some(w=>w.user_id===c.assignee_id)?s.jsx(ke,{value:c.assignee_id,children:sx(c.assignee_id,c.assignee_username)}):null,j.map(w=>s.jsx(ke,{value:w.user_id,children:w.username??"Not available"},w.user_id))]})]}),c.assignee_can_act===!1?s.jsx(he,{variant:"error",className:"self-start",children:"Assignee cannot act"}):null]}),s.jsx(Jr,{label:"Updated",children:s.jsx("span",{className:"text-sm",children:Tc(c.updated_at)})})]})]}),s.jsx(GD,{update:e.update,issue:c,open:y==="edit",onOpenChange:w=>g(w?"edit":null),onReload:p,onDone:()=>{g(null),p()}}),s.jsx(YD,{redact:e.redact,issue:c,open:y==="redact",onOpenChange:w=>g(w?"redact":null),onReload:p,onDone:()=>{g(null),o.success("The text was redacted."),p()}}),s.jsx(FD,{transition:e.transition,issue:c,open:y==="resolve",onOpenChange:w=>g(w?"resolve":null),onDone:w=>{g(null),w||o.error("Someone else changed this issue; it is reloaded."),p()}})]})}function Jr({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 QD=10,ZD=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Rv=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;function WD(e,t,n,a=""){const l=n!=null&&n.startsWith("task:")?n.slice(5):null;if(l&&ZD.test(l))return{label:l,path:`/org/${e}/tasks/${l}`};const r=`/proj/${encodeURIComponent(t)}/releases`,i=n!=null&&n.startsWith("release:")?n.slice(8):null;if(i&&Rv.test(i))return{label:i==="candidate"?"Candidate":i,path:`${r}?release=${encodeURIComponent(i)}`};const o=n!=null&&n.startsWith("planned:")?n.slice(8):null;if(o&&Rv.test(o))return{label:o,path:`${r}?planned=${encodeURIComponent(o)}`};const c=Xl(Rc(a));return{label:"Issues",path:`/proj/${encodeURIComponent(t)}/issues${c?`?${c}`:""}`}}const JD=["Fixed in","Being fixed in","The release planned to fix it"];function e3(e){const t=e.filter(n=>n.kind==="release");for(const n of JD){const a=t.find(l=>l.relation===n);if(a)return a}return t[0]??null}function t3({org:e,project:t,issue_id:n,from:a,query:l=""}){var Oe;const r=yk(),{href:i,Link:o}=Ve(),c=WD(e,t,a,l),d=`/proj/${encodeURIComponent(t)}/issues`,f=K=>`${d}/${encodeURIComponent(K)}`,[h,m]=u.useState({state:"loading"}),[x,j]=u.useState(null),[v,y]=u.useState(null),[g,p]=u.useState({state:"loading"}),[b,_]=u.useState({state:"loading"}),N=u.useRef(null),C=Wn(),w=u.useRef(null),k=u.useRef(!1),A=u.useRef(0),$=u.useRef(0),X=u.useCallback(async()=>{if(!r.issueSections)return;p({state:"loading"});const K=await r.issueSections(n);p(K.ok?{state:"ok",data:K.data}:{state:"failed",refusal:K.refusal})},[r.issueSections,n]),Y=u.useCallback(async()=>{if(!r.issueRelated)return;_({state:"loading"});const K=await r.issueRelated(n);_(K.ok?{state:"ok",data:K.data}:{state:"failed",refusal:K.refusal})},[r.issueRelated,n]),L=u.useCallback(async()=>{const K=$.current+=1;if(y(null),!CD.test(n)){m({state:"missing"});return}X(),Y();const Ne=await r.issue(n);if(K!==$.current)return;if(Ne.ok){A.current=0,j(null),m({state:"ok",issue:Ne.data.issue,events:Ne.data.events,at:new Date().toISOString()});return}const ze=Ne.refusal.reason;if(Ne.refusal.status===404||ze==="not_found")return m({state:"missing"});if(ze==="engine_missing")return m({state:"engine_missing",refusal:Ne.refusal});if(ze==="view_outdated")return m({state:"view_outdated"});if(A.current+=1,A.current===1&&ok(Ne.refusal)){y(Ne.refusal.retry_after??QD);return}j(Ne.refusal)},[r.issue,n,X,Y]);u.useEffect(()=>{L()},[L]),u.useEffect(()=>{if(v===null)return;const K=setTimeout(()=>void L(),v*1e3);return()=>clearTimeout(K)},[v,L]),u.useEffect(()=>{var Ne;if(k.current||h.state!=="ok")return;k.current=!0;const K=(Ne=N.current)==null?void 0:Ne.querySelector("h1");K&&(K.tabIndex=-1,K.focus())},[h.state]);const H=u.useRef(null);u.useEffect(()=>{var ze;const K=H.current;if(K===null||(K==="sections"?g:b).state==="loading")return;H.current=null;const Ne=(K==="related"?w.current:null)??((ze=N.current)==null?void 0:ze.querySelector("h1"));Ne==null||Ne.focus()},[g,b]);const R=K=>{H.current=K,K==="sections"?X():Y()},T=()=>{A.current=0,L()},z=u.useRef(!1),S=()=>{z.current=!0,T()};if(u.useEffect(()=>{var Ne;if(!z.current||h.state==="loading"||v!==null)return;z.current=!1;const K=(Ne=N.current)==null?void 0:Ne.querySelector("h1");K&&(K.tabIndex=-1,K.focus())},[h,x,v]),h.state==="missing")return s.jsx(ya,{children:s.jsx(Ba,{icon:s.jsx(Wu,{"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(P,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(o,{href:i(c.path),children:[s.jsx(t0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(h.state==="engine_missing"||h.state==="view_outdated")return s.jsx(ya,{children:h.state==="engine_missing"?s.jsx(Js,{page:"Issue",header:s.jsx(Si,{back:O,id:null,title:n})}):s.jsxs(s.Fragment,{children:[s.jsx(Si,{back:O,id:null,title:n}),s.jsxs(me,{variant:"warning",className:"mt-4",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsx(pe,{children:C})]})]})});const Z=x?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This issue could not be loaded"}),s.jsxs(pe,{children:[s.jsxs("p",{children:[x.message,x.since?` Since ${Yn(x.since)}.`:"",h.state==="ok"?` This page was read at ${Yn(h.at)}.`:"",x.message.includes(ol)?"":` ${ol}`]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:S,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(gn,{"aria-hidden":"true"}),"This issue is busy. Reading it again…"]}):null});if(h.state==="loading")return s.jsxs(ya,{children:[s.jsx("div",{children:O}),E,Z,!x&&v===null?s.jsxs("div",{className:"mt-4 grid gap-3",role:"status","aria-label":"Loading issue",children:[s.jsx(pt,{className:"h-6 w-40"}),s.jsx(pt,{className:"h-9 w-2/3"}),s.jsx(pt,{className:"h-24 w-full"})]}):null]});const{issue:I,events:ne,at:ee}=h,ge=xk(I),G=g.state==="ok"?g.data:null,M=(G==null?void 0:G.reporter)??I.created_by_username??null,V=b.state==="ok"?e3(b.data):null,ae=I.status==="resolved"||I.group==="resolved",B=!!(G!=null&&G.duplicate_of),te=g.state==="loading"?"Loading…":(G==null?void 0:G.routing.owner)??I.owner_title??s.jsx("span",{className:"text-muted-foreground",children:"Unowned"}),J=K=>`${d}?${Xl({...lm,collection:K})}`,le=G==null?void 0:G.report,W=!!(le&&(le.actual||le.expected||le.steps.length||le.where)),Qe=[...ne].reverse(),oe=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 ",Yn(ee)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:T,children:[s.jsx(vl,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsx(ya,{children:s.jsxs("div",{ref:N,className:"contents",children:[s.jsx(Si,{back:O,id:I.id,badge:s.jsxs(s.Fragment,{children:[s.jsx(he,{variant:ge.tone,children:ge.label}),I.urgent&&!ae?s.jsx(he,{variant:"warning",children:"Urgent"}):null]}),title:I.title,created:`Reported${M?` by ${M}`:""} · ${Ci(I.created_at)}`,actions:oe}),G!=null&&G.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(G.duplicate_of)),children:G.duplicate_of})]}):null,E,Z,g.state==="loading"?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",role:"status",children:[s.jsx(gn,{"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(hs,{label:"Owner",value:te}),B?null:s.jsx(hs,{label:"Release",value:b.state==="loading"?"Loading…":V?s.jsx("span",{className:ie(V.label===V.id&&"font-mono"),children:V.label}):s.jsx("span",{className:"text-muted-foreground",children:"No release yet"})}),s.jsx(hs,{label:"Reported",value:[M,I.created_at?En(I.created_at):null].filter(Boolean).join(" · ")})]}),s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(go,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:gk}),s.jsx(pe,{children:vk})]}),g.state==="failed"?s.jsx("div",{className:"mt-6",children:s.jsx(ex,{what:"this issue's sections",again:"Read the issue again",refusal:g.refusal,on_retry:()=>R("sections")})}):null,G&&W&&le?s.jsxs(vt,{id:"issue-report",title:"What happens",children:[le.actual?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:le.actual}):null,le.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:le.expected})]}):null,le.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:le.steps.map((K,Ne)=>s.jsx("li",{children:K},Ne))})]}):null,(Oe=le.where)!=null&&Oe.env?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:["Seen on ",le.where.env,le.where.sha?s.jsxs(s.Fragment,{children:[" ","at ",s.jsx("span",{className:"font-mono",children:le.where.sha})]}):null]}):null]}):null,G&&(G.placement.placed||G.placement.unplaced_why)?s.jsx(vt,{id:"issue-placement",title:"Placement",children:G.placement.placed?s.jsxs("p",{className:"text-sm",children:["Placed in ",G.placement.placed]}):s.jsxs(me,{variant:"warning",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:["Not placed yet: ",G.placement.unplaced_why]})]})}):null,G&&(G.routing.route||G.routing.owner||G.routing.none)?s.jsxs(vt,{id:"issue-routing",title:"Routing",children:[G.routing.route?s.jsx("p",{className:"text-sm",children:G.routing.route}):null,G.routing.owner?s.jsxs("p",{className:"text-sm",children:["Owner: ",G.routing.owner]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"Owner: none yet"})]}):null,G&&(G.labels.length>0||G.collections.length>0)?s.jsxs(vt,{id:"issue-labels",title:"Labels and collections",children:[G.labels.length?s.jsx("div",{className:"flex flex-wrap gap-1",children:G.labels.map(K=>s.jsx(he,{variant:"neutral",size:"dense",children:K},K))}):null,G.collections.length?s.jsx("ul",{className:"mt-2 grid gap-1 text-sm",children:G.collections.map(K=>s.jsxs("li",{children:[s.jsx(o,{className:"text-primary hover:underline",href:i(J(K.collection)),children:K.title}),K.ref?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",K.ref]}):null,s.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",K.resolved," of ",K.total," resolved"]})]},K.collection))}):null]}):null,G&&G.anchors.length>0?s.jsx(vt,{id:"issue-anchors",title:"Anchors",children:s.jsx(Af,{label:"Anchors",heads:["Kind","Value","By"],rows:G.anchors.map(K=>[K.kind,s.jsx("span",{className:"font-mono text-xs break-all",children:K.value}),K.by??""])})}):null,G&&G.seen.length>0?s.jsx(vt,{id:"issue-seen",title:"Seen",aside:`${G.seen.length} of ${Math.max(I.occurrences??0,G.seen.length)} sightings`,children:s.jsx(Af,{label:"Seen",heads:["When","Where","Who","Note"],rows:G.seen.map(K=>[Ci(K.at),s.jsxs(s.Fragment,{children:[K.sha?s.jsx("div",{className:"font-mono text-xs",children:K.sha}):null,K.env?s.jsx("div",{className:"text-muted-foreground text-xs",children:K.env}):null]}),K.who??"",K.note??""])})}):null,Qe.length>0?s.jsx(vt,{id:"issue-history",title:"History",aside:"From the issue store, newest first",children:s.jsx(Af,{label:"History",heads:["When","Who","What"],rows:Qe.map(K=>[Ci(K.created_at),K.actor_username??"",$D(K.note,K.kind)])})}):null,s.jsx(ck,{id:"issue-related",related:b,heading_ref:w,on_retry:()=>R("related"),fixed:!0,link:K=>{const Ne=K.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(K.id)}`:K.kind==="task"?`/org/${e}/tasks/${encodeURIComponent(K.id)}?from=issue:${I.id}`:K.kind==="issue"?f(K.id):K.kind==="release"?`/proj/${encodeURIComponent(t)}/releases?${K.planned?"planned":"release"}=${encodeURIComponent(K.id)}`:null;if(K.kind==="task"&&Ne){const ze=DD(K.label);return s.jsxs("div",{className:"min-w-0",children:[s.jsx(o,{className:"text-primary font-mono text-xs hover:underline",href:i(Ne),children:K.id}),ze&&ze!==K.id?s.jsx("div",{className:"text-muted-foreground line-clamp-1 text-xs",title:ze,"data-testid":"related-task-title",children:ze}):null]})}return Ne?s.jsx(o,{className:ie("text-primary hover:underline",K.kind!=="thread"&&K.label===K.id&&"font-mono"),href:i(Ne),children:K.label}):K.label}})]})})}function Af({label:e,heads:t,rows:n}){return s.jsx(jt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:e,children:[s.jsx(Ge,{children:s.jsx(ue,{children:t.map(a=>s.jsx(F,{children:a},a))})}),s.jsx(He,{children:n.map((a,l)=>s.jsx(ue,{children:a.map((r,i)=>s.jsx(q,{className:"break-words",children:r},i))},l))})]})})}function n3({org:e,project:t,issue_id:n,from:a,query:l}){var r;return(r=en().issues)!=null&&r.issueSections?s.jsx(t3,{org:e,project:t,issue_id:n,from:a,query:l}):s.jsx(XD,{org:e,project:t,issue_id:n,query:l})}function wu(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 bk={integration:"Integration",deploy:"Deploy",publish:"Publish",accept:"Accept",custom:"Custom"},s3={self_service:"Self-service",managed:"Managed",manager_only:"Manager only"},a3={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"},l3={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 r3(e){return l3[e??"in_batch"]}function i3(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 jk=(e,t)=>`Holds ${e.toLowerCase()}${t?`: ${t}`:""}`;function o3(e,t,n,a=!0){return e.fixing_since!==void 0?{label:`Fixing forward since ${Hn(e.fixing_since)}`,tone:"warning"}:e.ref===t?{label:"Landing",tone:"info"}:a&&e.hold?{label:jk(n),tone:"info"}:{label:"Running",tone:"info"}}function Hn(e){return new Date(e*1e3).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Al(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 c3(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 u3(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 d3(e,t){var o,c;const{policy:n,management:a}=e,l=(o=e.layer)==null?void 0:o.kind,r=d=>u3(d,t),i=[["Mode",a3[a.mode]],["Who can join",r(a.joiners)]];return l==="implement"&&i.push(["Managers",r(a.managers)],["Manager lease",Al(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 ${Al(n.freeze.max_seconds)}, ${Al(n.freeze.default_seconds)} by default`+(e.layer.freezers?` · ${r(e.layer.freezers)}`:""):"Off"],["Fix forward",n.fix_forward?"Yes: a failed turn keeps its turn until fixed":"No"],["Stalled turns",a.stall_takers.kind==="none"?"Nobody takes one":`${r(a.stall_takers)} may take one after ${Al(n.stall_seconds)}`])),i.push(["Reorder",r(a.reorderers)]),n.max_turns>1&&i.push(["Turns at once",`Up to ${n.max_turns} independent turns`]),i.push(["Turn lease",Al(n.lease_seconds)],["Time to start",`${Al(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 _k="Where your organization's agents take turns at a shared branch, environment or proposal. One turn runs at a time in each queue.",wk="A task you cannot see",f3="A former member",h3="A member";function Nk(){const e=en().queues;if(!e)throw new Error("The Queues page rendered without the queues seam.");return e}function m3({org:e,open:t,path:n}){var h,m;const a=Nk(),{href:l,Link:r}=Ve(),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(Ba,{title:"Page not found",description:"This page does not exist, or you do not have access to it.",backHref:l(`/org/${e}`),backLabel:"Back to the organization",link:r}):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(x3,{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(Js,{page:"Queues"}):s.jsxs(s.Fragment,{children:[s.jsx(Ft,{title:"Queues",description:a.description??_k}),o.state==="loading"&&s.jsx(kk,{}),(o.state==="error"||o.state==="off")&&s.jsx(rm,{refusal:o.refusal,on_retry:()=>void d(!0)}),o.state==="available"&&s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Tasks are not on for this organization"}),s.jsxs(pe,{children:["Queues hold turns for tasks, so they show once Tasks are on."," ",s.jsx(r,{className:"text-primary hover:underline",href:l(`/org/${e}/tasks`),children:"Go to Tasks"})]})]})]})})}function kk(){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(pt,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function rm({refusal:e,on_retry:t}){const n=Wn();return(e==null?void 0:e.reason)==="store_locked"?s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"The local stores are busy"}),s.jsxs(pe,{children:[s.jsx("p",{children:e.message}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]}):(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsx(pe,{children:n})]}):s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Queues could not be loaded"}),s.jsxs(pe,{children:[s.jsx("p",{children:"The read did not answer. Try again in a moment."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}const Mf=e=>e.status===404||e.reason==="not_found"||e.code==="not_found";function p3(e,t,n,a){return t?e===null?`Not reading · trying again every ${n}s`:`Not reading since ${Hn(e)} · trying again every ${n}s`:e===null?"Connecting…":`Live · read ${Hn(e)} · refreshes every ${n}s${a?` · ${a}`:""}`}function x3({org:e,open:t,path:n}){var M;const{listQueues:a,queue:l,members:r,refresh_ms:i,settings_note:o,description:c,read_scope:d,subject_label:f="Task",thread_subjects:h=!1}=Nk(),{self_id:m}=Ku(),[x,j]=u.useState(null),[v,y]=u.useState(null),[g,p]=u.useState(null),[b,_]=u.useState(null),[N,C]=u.useState({state:"pending",members:[]});u.useEffect(()=>{let V=!0;return r().then(ae=>{V&&C(B=>ae.ok?{state:"answered",members:ae.data}:{state:"failed",members:B.members})}),()=>{V=!1}},[r]);const w=u.useMemo(()=>new Map(N.members.map(V=>[V.user_id,V])),[N.members]),k=N.state==="answered"?f3:h3,A=u.useCallback((V,ae)=>{var B;return(ae==null?void 0:ae.title)??(h?(ae==null?void 0:ae.id)??V:V===m?"You":((B=w.get(V))==null?void 0:B.label)??k)},[w,k,m,h]),$=u.useRef({list:{last:null,fresh:!1},detail:{last:null,fresh:!1}}),[X,Y]=u.useState(null),[L,H]=u.useState(!1),R=u.useCallback((V,ae)=>{$.current[V]={last:ae,fresh:!0};const{list:B,detail:te}=$.current;H(B.last==="failed"||te.last==="failed"),B.fresh&&te.fresh&&B.last==="ok"&&te.last==="ok"&&Y(Date.now()/1e3)},[]),T=t??((M=x==null?void 0:x.queues[0])==null?void 0:M.id)??null,z=u.useRef(T);u.useEffect(()=>{z.current=T},[T]);const S=u.useRef(0),O=u.useCallback(async()=>{var B;const V=S.current+=1;$.current.list.fresh=!1;const ae=await a();if(V===S.current)if(ae.ok){if(j(ae.data),y(null),!t){const te=((B=ae.data.queues[0])==null?void 0:B.id)??null;te===null?$.current.detail={last:"ok",fresh:!0}:te!==z.current&&($.current.detail.fresh=!1)}R("list","ok")}else y(ae.refusal),R("list","failed")},[a,t,R]),Z=u.useRef(0),E=u.useCallback(async()=>{const V=Z.current+=1;if(!T)return;$.current.detail.fresh=!1;const ae=await l(T);V===Z.current&&(ae.ok?(p(ae.data),_(null),R("detail","ok")):(_(ae.refusal),Mf(ae.refusal)&&p(null),R("detail",Mf(ae.refusal)?"ok":"failed")))},[T,l,R]);u.useEffect(()=>{O()},[O]),u.useEffect(()=>{p(null),_(null),E()},[E]);const I=u.useCallback(()=>{O(),E()},[O,E]),ne=!x&&(v==null?void 0:v.reason)==="engine_missing",ee=u.useCallback(()=>{ne||I()},[ne,I]);if(wu(ee,i),ne)return s.jsx(Js,{page:"Queues"});const ge=Math.round(i/1e3),G=b!==null&&Mf(b);return s.jsxs(s.Fragment,{children:[s.jsxs(Ft,{title:"Queues",description:c??_k,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:p3(X,L,ge,d)}),s.jsx("span",{className:"sr-only",role:"status",children:L?"Not reading":X===null?"Connecting":"Live"})]}),!x&&!v&&s.jsx(kk,{}),!x&&v&&s.jsx(rm,{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(r0,{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(v3,{path:n,queues:x.queues,open_id:T,name:A,held:h}),G?s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This queue is no longer available"}),s.jsx(pe,{children:"It was archived, or you can no longer read its Workspace. Pick another queue above."})]}):g&&g.queue.id===T?s.jsx(y3,{org:e,detail:g,name:A,settings_note:o,subject_label:f,thread_subjects:h}):b?s.jsx(rm,{refusal:b,on_retry:()=>void E()}):s.jsx(pt,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"})]}):null]})}function im({org:e,subject:t,link:n}){const{href:a,Link:l}=Ve();return!t||t.hidden?s.jsx("span",{className:"text-muted-foreground",children:wk}):t.kind==="task"&&n?s.jsx(l,{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 g3(e,t,n){const a=e.freeze?`frozen until ${Hn(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 ${Hn(e.batch.opened_at)}`,a].filter(Boolean).join(" · "),warn:!1};if(e.turn){const l=e.turn.subject,r=l.hidden?wk:l.title??l.id,i=(e.running_count??1)>1?`${e.running_count} turns · `:"",o=e.turn.landing?" landing":"",c=n&&!!e.turn.hold,d=[c?jk(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}${r}${o}`,secondary:Of(d.join(" · ")),warn:!1}:{primary:`${i}${r}${o}`,secondary:d.length?Of(d.join(" · ")):null,warn:d.length>0}}return{primary:"Nothing running",secondary:a?Of(a):null,warn:!!a}}const Of=e=>e.charAt(0).toUpperCase()+e.slice(1);function v3({path:e,queues:t,open_id:n,name:a,held:l}){const{href:r,Link:i}=Ve();return s.jsx(jt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Queues",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Queue"}),s.jsx(F,{className:"hidden md:table-cell",children:"Step"}),s.jsx(F,{children:"Running turn"}),s.jsx(F,{className:"hidden text-right md:table-cell",children:"Waiting"})]})}),s.jsx(He,{children:t.map(o=>{var m;const c=o.id===n,d=c3(o),f=g3(o,a,l),h=o.waiting-(((m=o.batch)==null?void 0:m.remaining)??0);return s.jsxs(ue,{"data-testid":"queues-row",className:ie(c&&"bg-accent"),children:[s.jsxs(q,{children:[s.jsx(i,{className:"text-primary hover:underline",href:r(`${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(q,{className:"hidden md:table-cell",children:s.jsx(he,{variant:"neutral",children:bk[o.policy.step]})}),s.jsxs(q,{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(q,{className:"hidden text-right md:table-cell",children:h})]},o.id)})})]})})}function oc({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 Ev({org:e,entries:t,landing:n,queue_name:a,subject_label:l,held:r,label:i}){return s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Be,{containerAriaLabel:i,children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:l}),s.jsx(F,{children:"State"})]})}),s.jsx(He,{children:t.map(o=>{const c=o3(o,n,a,r);return s.jsxs(ue,{"data-testid":"queues-running",children:[s.jsxs(q,{children:[s.jsx(im,{org:e,subject:o.subject,link:!r}),r&&o.hold&&o.note&&!o.subject.hidden?s.jsx("div",{className:"text-muted-foreground text-xs",children:o.note}):null]}),s.jsx(q,{children:s.jsx(he,{variant:c.tone,children:c.label})})]},o.ref)})})]})})}function y3({org:e,detail:t,name:n,settings_note:a,subject_label:l,thread_subjects:r}){var _;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),j=m&&i.policy.independent_turns?f.filter(N=>N.batching!=="in_batch"&&N.ref!==m.holder):[],v=o.manager,y=o.freeze,g=((_=i.layer)==null?void 0:_.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,b=!m&&f.length===0&&h.length===0;return s.jsxs(jt,{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(he,{variant:"neutral",children:bk[i.policy.step]}),s.jsx(he,{variant:"neutral",children:s3[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(eR,{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 ",Hn(v.lease_until),v.serving_until!==void 0?" · serving now":""]})]}):null,y?s.jsxs(me,{variant:"warning",children:[s.jsx(XT,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:["Frozen until ",Hn(y.lease_until)]}),s.jsxs(pe,{children:[n(y.holder,y.holder_subject)," froze this queue at ",Hn(y.since),y.label?`: ${y.label}`:"",". Only ",n(y.holder,y.holder_subject),"'s entries start until it thaws."]})]}):null,p?s.jsxs(me,{variant:"info",children:[s.jsx(i0,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:["Stall hold until ",Hn(p.until)]}),s.jsxs(pe,{children:[p.who,p.why?`: ${p.why}`:"",". The first entry is not treated as stalled while it lasts."]})]}):null,b?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(oc,{id:"queue-running",title:"Running turn",side:`Batch opened by ${n(m.holder,m.holder_subject)} at ${Hn(m.opened_at)}`,children:[s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Be,{containerAriaLabel:"Batch members",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Landing order"}),s.jsx(F,{children:l}),s.jsx(F,{children:"Outcome"})]})}),s.jsx(He,{children:m.members.map((N,C)=>{const w=r3(N.outcome);return s.jsxs(ue,{"data-testid":"queues-member",children:[s.jsx(q,{children:C+1}),s.jsx(q,{children:s.jsx(im,{org:e,subject:N.subject??d.get(N.ref)??(r?{kind:"thread",id:N.ref}:void 0),link:!r})}),s.jsx(q,{children:s.jsx(he,{variant:w.tone,children:w.label})})]},N.ref)})})]})}),j.length>0?s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"text-muted-foreground text-xs font-medium",children:"Also running"}),s.jsx(Ev,{org:e,entries:j,landing:o.landing,queue_name:i.name,subject_label:l,held:r,label:"Turns running beside the batch"})]}):null]}):s.jsx(oc,{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(Ev,{org:e,entries:f,landing:o.landing,queue_name:i.name,subject_label:l,held:r,label:"Running turns"})}),s.jsx(oc,{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(Be,{containerAriaLabel:"Waiting entries",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Position"}),s.jsx(F,{children:l}),s.jsx(F,{className:"hidden md:table-cell",children:"Joined"}),s.jsx(F,{children:"Turn"}),s.jsx(F,{className:"hidden md:table-cell",children:"Note"})]})}),s.jsx(He,{children:h.map((N,C)=>{const w=i3(N);return s.jsxs(ue,{"data-testid":"queues-waiting",children:[s.jsx(q,{children:m?x+C+1:N.position}),s.jsx(q,{children:s.jsx(im,{org:e,subject:N.subject,link:!r})}),s.jsx(q,{className:"hidden md:table-cell",children:Hn(N.joined_at)}),s.jsx(q,{children:s.jsx(he,{variant:w.tone,children:w.label})}),s.jsx(q,{className:"hidden md:table-cell",children:N.subject.hidden?"":N.note??""})]},N.ref)})})]})})})]}),s.jsx(oc,{id:"queue-settings",title:"Settings",children:s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsx(Be,{containerAriaLabel:"Queue settings",children:s.jsx(He,{children:d3(i,c).map(([N,C])=>s.jsxs(ue,{children:[s.jsx(F,{scope:"row",className:"h-auto w-48 py-2 font-normal",children:N}),s.jsx(q,{children:C})]},N))})})})}),s.jsx("p",{className:"text-muted-foreground text-xs",children:a})]})}const us="__no_parent__";function Sk(e,t){const n=new Set([t]);for(let a=!0;a;){a=!1;for(const l of e)l.parent&&n.has(l.parent)&&!n.has(l.key)&&(n.add(l.key),a=!0)}return n}const Qi=(e,t)=>(e.label||e.key).localeCompare(t.label||t.key);function qn({id:e,label:t,help:n,error:a,children:l}){const r=[n?`${e}-help`:null,a?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:e,children:t}),l(r),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 Av({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 Mv({id:e,label:t,help:n,checked:a,on_change:l}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(zr,{id:e,className:"mt-0.5",checked:a,"aria-describedby":n?`${e}-help`:void 0,onCheckedChange:r=>l(r===!0)}),s.jsx(Me,{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 Ck({id:e,legend:t,help:n,error:a,options:l,checked:r,on_change:i,empty:o}){const c=[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":c,"aria-invalid":a?!0:void 0,children:[s.jsx("legend",{className:"mb-2 text-sm leading-none font-medium",children:t}),l.length===0&&o?s.jsx("p",{className:"text-muted-foreground text-sm",children:o}):null,s.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:l.map((d,f)=>s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(zr,{id:`${e}-${f}`,className:"mt-0.5",checked:r.has(d.value),onCheckedChange:h=>{const m=new Set(r);h===!0?m.add(d.value):m.delete(d.value),i(m)}}),s.jsx(Me,{htmlFor:`${e}-${f}`,className:"min-w-0 font-normal break-words",children:d.label})]},d.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 om({context:e,action:t,title:n="Two-factor sign-in needed"}){const a=e.two_factor==="enroll";return s.jsxs(me,{variant:"destructive",role:"alert",children:[s.jsx(YT,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:n}),s.jsxs(pe,{children:[s.jsx("p",{children:a?`Turn on two-factor sign-in in Account Settings, then come back here and ${t}.`:`Changing the org needs a two-factor sign-in. Sign in again with your authenticator in Account Settings, then come back here and ${t}.`}),s.jsx(P,{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 Ir=e=>e.two_factor==="ok";function Eo({refusal:e,context:t,subject:n,action:a}){if((e==null?void 0:e.kind)==="two_factor")return s.jsx(om,{context:t,action:a,title:`Could not save ${n}`});const l=Ir(t)?null:s.jsx(om,{context:t,action:a});if(!e)return l;const r=e.kind==="changed"?"The org changed since you opened this":e.kind==="authority"?`Could not save ${n}`:null;return s.jsxs(s.Fragment,{children:[l,s.jsxs(me,{variant:"destructive",role:"alert",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),r?s.jsx(ve,{children:r}):null,s.jsx(pe,{children:e.message})]})]})}function Tk({id:e,value:t,on_change:n,none:a,options:l,described_by:r}){return s.jsxs(dt,{value:t,onValueChange:n,children:[s.jsx(it,{id:e,"aria-describedby":r,children:s.jsx(ft,{placeholder:"Choose a team"})}),s.jsxs(ot,{children:[a?s.jsx(ke,{value:us,children:a}):null,l.map(i=>s.jsx(ke,{value:i.key,children:i.label||i.key},i.key))]})]})}function Ao(e){const[t,n]=u.useState(!1),[a,l]=u.useState(null);return{saving:t,refusal:a,set_refusal:l,run:async i=>{n(!0),l(null);try{const o=await i();o?l(o):e()}finally{n(!1)}}}}function Nd({saving:e,blocked:t,described_by:n,children:a}){return s.jsx(P,{type:"submit",disabled:e,"aria-disabled":t||void 0,"aria-describedby":t?n:void 0,children:a})}const Rk=(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 b3({open:e,chart:t,team:n,save:a,on_close:l,context:r=kd,scope:i="full",parents:o}){var S;const c=r.host==="hosted",[d,f]=u.useState(""),[h,m]=u.useState(""),[x,j]=u.useState(""),[v,y]=u.useState(us),[g,p]=u.useState({}),{saving:b,refusal:_,set_refusal:N,run:C}=Ao(l),w=((S=t.teams.find(O=>O.parent===null))==null?void 0:S.key)??null;u.useEffect(()=>{e&&(f(""),m((n==null?void 0:n.label)??""),j((n==null?void 0:n.description)??""),y((n==null?void 0:n.parent)??(c&&w&&(!o||o.includes(w))?w:us)),p({}),N(null))},[e,n,N,c,w,o]);const k=O=>{const Z=t.teams.find(E=>E.key===O);return Z?Z.label||Z.key:O??""},A=n?Sk(t.teams,n.key):new Set,$=[...t.teams].filter(O=>!A.has(O.key)&&(!o||o.includes(O.key))).sort((O,Z)=>O.key===w?-1:Z.key===w?1:Qi(O,Z)),X=n?n.label||n.key:"",Y=i==="description",L=!Ir(r),H=n?Y?"save the description":"save the team":"add the team",R=O=>{if(O.preventDefault(),L)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===us){p({parent:"Choose the parent team."});return}const ne=c?I:h.trim()||I;C(()=>a({action:"add",kind:"team",key:I,...h.trim()?{label:h.trim()}:{},...x.trim()?{description:x.trim()}:{},...v!==us?{parent:v}:{}},`Team ${ne} added.`));return}if(!Y&&!h.trim()){p({label:c?"Give the team a name.":"Give the team a label."});return}const Z=v===us?null:v,E={...!Y&&h.trim()!==n.label.trim()?{label:h.trim()}:{},...x.trim()!==(n.description??"").trim()?{description:x.trim()}:{},...!c&&Z!==n.parent?{parent:Z}:{}};if(Object.keys(E).length===0){l();return}C(()=>a({action:"edit",kind:"team",key:n.key,...E},Y?`Saved the description of ${X}.`:`Team ${h.trim()} saved.`))},T=n?Y?`Edit the description of ${X}`:`Edit team ${X}`:"Add team";let z;return Y?z="Say what the team works on. Only the description is yours to change here.":c?z=n?"Rename the team or say what it works on.":"Add a team to the organization.":n?z=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."]}):z="Add a team to this repository's local org.",s.jsx(es,{open:e,onOpenChange:O=>O||b?null:l(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:R,noValidate:!0,children:[s.jsxs(ns,{children:[s.jsx(as,{children:T}),s.jsx(ls,{children:z})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Eo,{refusal:_,context:r,subject:Y?"the description":"the team",action:H}),!n&&!c?s.jsx(qn,{id:"org-team-key",label:"Key",help:Rk("team",r.host),error:g.key,children:O=>s.jsx(Ot,{id:"org-team-key",className:"font-mono",value:d,autoComplete:"off","aria-invalid":g.key?!0:void 0,"aria-describedby":O,onChange:Z=>{f(Z.target.value),p({})}})}):null,Y&&n?s.jsx(Av,{label:"Name",children:n.parent?`${X} · under ${k(n.parent)}`:X}):s.jsx(qn,{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(Ot,{id:"org-team-label",value:h,"aria-invalid":g.label?!0:void 0,"aria-describedby":O,onChange:Z=>{m(Z.target.value),p({})}})}),s.jsx(qn,{id:"org-team-description",label:Y?"Description":"Description (optional)",children:()=>s.jsx(ks,{id:"org-team-description",rows:3,placeholder:"What the team does",value:x,onChange:O=>j(O.target.value)})}),Y?null:c&&n?s.jsx(Av,{label:"Parent team",children:n.parent?k(n.parent):"None: the organization itself"}):s.jsx(qn,{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(Tk,{id:"org-team-parent",value:v,on_change:Z=>{y(Z),p({})},none:c?void 0:"No parent (a root team)",options:$,described_by:O})})]}),s.jsxs(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:b,onClick:l,children:"Cancel"}),s.jsx(Nd,{saving:b,blocked:L,children:n?b?"Saving…":"Save":b?"Adding…":"Add team"})]})]})})})}const j3=(e,t)=>e.length===t.size&&e.every(n=>t.has(n));function _3({open:e,chart:t,job:n,save:a,on_close:l,context:r=kd}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(us),[j,v]=u.useState(new Set),[y,g]=u.useState(!1),[p,b]=u.useState(!0),[_,N]=u.useState({}),{saving:C,refusal:w,set_refusal:k,run:A}=Ao(l);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)??us),v(new Set((n==null?void 0:n.fills)??[])),g((n==null?void 0:n.requires_person)??!1),b((n==null?void 0:n.escalable)??!0),N({}),k(null))},[e,n,k]);const $=n?Sk(t.job_functions,n.key):new Set,X=[...t.job_functions].filter(T=>!$.has(T.key)).sort(Qi),Y=[...t.slots].sort(Qi).map(T=>({value:T.key,label:T.label||T.key})),L=!Ir(r),H=n?"save the job function":"add the job function",R=T=>{if(T.preventDefault(),L)return;if(!n){if(!i.trim()){N({key:"Give the job function a key."});return}A(()=>a({action:"add",kind:"job_function",key:i.trim(),...c.trim()?{label:c.trim()}:{},...f.trim()?{description:f.trim()}:{},...m!==us?{parent:m}:{},fills:[...j],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 z=m===us?null:m,S={...c.trim()!==n.label.trim()?{label:c.trim()}:{},...f.trim()!==(n.description??"").trim()?{description:f.trim()}:{},...z!==n.parent?{parent:z}:{},...j3(n.fills,j)?{}:{fills:[...j]},...y!==n.requires_person?{requires_person:y}:{},...p!==n.escalable?{escalable:p}:{}};if(Object.keys(S).length===0){l();return}A(()=>a({action:"edit",kind:"job_function",key:n.key,...S},`Job function ${c.trim()} saved.`))};return s.jsx(es,{open:e,onOpenChange:T=>T||C?null:l(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:R,noValidate:!0,children:[s.jsxs(ns,{children:[s.jsx(as,{children:n?`Edit job function ${n.label||n.key}`:"Add job function"}),s.jsxs(ls,{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(Eo,{refusal:w,context:r,subject:"the job function",action:H}),n?null:s.jsx(qn,{id:"org-function-key",label:"Key",help:Rk("job function",r.host),error:_.key,children:T=>s.jsx(Ot,{id:"org-function-key",className:"font-mono",value:i,autoComplete:"off","aria-invalid":_.key?!0:void 0,"aria-describedby":T,onChange:z=>{o(z.target.value),N({})}})}),s.jsx(qn,{id:"org-function-label",label:n?"Label":"Label (optional)",error:_.label,children:T=>s.jsx(Ot,{id:"org-function-label",value:c,"aria-invalid":_.label?!0:void 0,"aria-describedby":T,onChange:z=>{d(z.target.value),N({})}})}),s.jsx(qn,{id:"org-function-description",label:"Job description (optional)",children:()=>s.jsx(ks,{id:"org-function-description",rows:3,placeholder:"What this job function does",value:f,onChange:T=>h(T.target.value)})}),s.jsx(qn,{id:"org-function-parent",label:"Parent function",help:"Its posts report to the post of the parent function.",children:T=>s.jsx(Tk,{id:"org-function-parent",value:m,on_change:x,none:"No parent (a root function)",options:X,described_by:T})}),s.jsx(Ck,{id:"org-function-fills",legend:"Slots it fills",options:Y,checked:j,on_change:v,empty:r.host==="hosted"?"This organization has no slots yet.":"This org has no slots yet; add them with sdlc org add slot."}),s.jsx(Mv,{id:"org-function-requires-person",label:"Requires a person",help:"Only a person may hold its posts.",checked:y,on_change:g}),s.jsx(Mv,{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:b})]}),s.jsxs(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:C,onClick:l,children:"Cancel"}),s.jsx(Nd,{saving:C,blocked:L,children:n?C?"Saving…":"Save":C?"Adding…":"Add job function"})]})]})})})}function w3({open:e,chart:t,binding:n,names:a,save:l,confirm:r,on_close:i}){var k;const[o,c]=u.useState(new Set),[d,f]=u.useState(""),[h,m]=u.useState({}),{saving:x,refusal:j,set_refusal:v,run:y}=Ao(i);if(u.useEffect(()=>{!e||!n||(c(new Set(n.posts.map(A=>A.post))),f(n.source==="override"?n.reason??"":""),m({}),v(null))},[e,n,v]),!n)return null;const g=a.slot(n.slot),p=(k=t.project)!=null&&k.team?t.teams.find(A=>{var $;return A.key===(($=t.project)==null?void 0:$.team)}):void 0,b=p?p.label||p.key:"the owning team",_=new Set(t.job_functions.filter(A=>A.fills.includes(n.slot)).map(A=>A.key)),N=[...t.posts].map(A=>A.post).sort(a.byPost).map(A=>({value:A,label:_.has(A.split("/")[1]??"")?`${a.post(A)} (fills ${g})`:a.post(A)})),C=A=>{A.preventDefault();const $={...o.size===0?{posts:"Choose at least one post."}:{},...d.trim()?{}:{reason:"Give the reason for the override."}};m($),!($.posts||$.reason)&&y(()=>l({action:"bind",slot:n.slot,posts:[...o],reason:d.trim()},`Override of ${g} saved.`))},w=async()=>{await r({title:`Clear the override of ${g}?`,description:"It goes back to the posts its job descriptions name, and its reason is not kept.",action_label:"Clear",destructive:!0})&&y(()=>l({action:"unbind",slot:n.slot},`Override of ${g} cleared.`))};return s.jsx(es,{open:e,onOpenChange:A=>A||x?null:i(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:C,noValidate:!0,children:[s.jsxs(ns,{children:[s.jsxs(as,{children:["Override ",g]}),s.jsxs(ls,{children:["Bind ",g," in this project to the posts you choose instead of its 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:[s.jsx(Eo,{refusal:j,context:kd,subject:"the override",action:"save the override"}),s.jsx(Ck,{id:"org-override-posts",legend:"Posts",help:"A post outside its job description is marked on the chart.",error:h.posts,options:N,checked:o,on_change:A=>{c(A),m($=>({...$,posts:void 0}))}}),s.jsx(qn,{id:"org-override-reason",label:"Reason",error:h.reason,children:A=>s.jsx(ks,{id:"org-override-reason",rows:2,placeholder:"Why this slot needs other posts",value:d,"aria-invalid":h.reason?!0:void 0,"aria-describedby":A,onChange:$=>{f($.target.value),m(X=>({...X,reason:void 0}))}})}),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 ",b," or of a team above it."]})]}),s.jsxs(ss,{className:"mt-6",children:[n.source==="override"?s.jsx(P,{type:"button",variant:"ghost",className:"sm:mr-auto",disabled:x,onClick:()=>void w(),children:"Clear override"}):null,s.jsx(P,{type:"button",variant:"outline",disabled:x,onClick:i,children:"Cancel"}),s.jsx(P,{type:"submit",disabled:x,children:x?"Saving…":"Save override"})]})]})})})}function N3(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function k3({open:e,chart:t,names:n,save:a,on_close:l,context:r}){var L;const i=t.authority,o=u.useMemo(()=>new Set((i==null?void 0:i.post_pairs)??[]),[i]),c=((L=t.teams.find(H=>H.parent===null))==null?void 0:L.key)??null,d=[...t.teams].filter(H=>[...o].some(R=>R.startsWith(`${H.key}/`))).sort((H,R)=>H.key===c?-1:R.key===c?1:Qi(H,R)),[f,h]=u.useState(""),[m,x]=u.useState(""),[j,v]=u.useState({}),{saving:y,refusal:g,set_refusal:p,run:b}=Ao(l);u.useEffect(()=>{var H;e&&(h(((H=d[0])==null?void 0:H.key)??""),x(""),v({}),p(null))},[e,p]);const _=new Set(t.posts.filter(H=>H.post.startsWith(`${f}/`)).map(H=>H.post.split("/")[1])),N=[],C=H=>{for(const R of[...t.job_functions].filter(T=>T.parent===H).sort(Qi))N.push(R),C(R.key)};C(null);const w=N.filter(H=>o.has(`${f}/${H.key}`)&&!_.has(H.key)),k=f!==""&&w.length===0,A=!Ir(r)||k,$=H=>{if(H.preventDefault(),A)return;const R={...f?{}:{team:"Choose a team."},...m?{}:{job:"Choose a job function."}};v(R),!(R.team||R.job)&&b(()=>a({action:"add",kind:"post",key:`${f}/${m}`},`Added post ${n.job(m)} · ${n.team(f)}.`))},X=k?"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.",Y=(i==null?void 0:i.ask)??[];return s.jsx(es,{open:e,onOpenChange:H=>H||y?null:l(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:$,noValidate:!0,children:[s.jsxs(ns,{children:[s.jsx(as,{children:"Add post"}),s.jsx(ls,{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(Eo,{refusal:g,context:r,subject:"the post",action:"add the post"}),s.jsx(qn,{id:"org-post-team",label:"Team",help:"The team the post is in.",error:j.team,children:H=>s.jsxs(dt,{value:f,onValueChange:R=>{h(R),x(""),v({})},children:[s.jsx(it,{id:"org-post-team","aria-describedby":H,"aria-invalid":j.team?!0:void 0,children:s.jsx(ft,{placeholder:"Choose a team"})}),s.jsx(ot,{children:d.map(R=>s.jsx(ke,{value:R.key,children:R.label||R.key},R.key))})]})}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(qn,{id:"org-post-function",label:"Job function",help:X,error:j.job,children:H=>s.jsxs(dt,{value:m,disabled:k,onValueChange:R=>{x(R),v({})},children:[s.jsx(it,{id:"org-post-function","aria-describedby":H,"aria-invalid":j.job?!0:void 0,children:s.jsx(ft,{placeholder:k?"Every job function has a post here":"Choose a job function"})}),s.jsx(ot,{children:w.map(R=>s.jsx(ke,{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.",Y.length?` For others, ask ${N3(Y)}.`:""]}):null]})]}),s.jsxs(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:y,onClick:l,children:"Cancel"}),s.jsx(Nd,{saving:y,blocked:A,described_by:k?"org-post-function-help":void 0,children:y?"Adding…":"Add post"})]})]})})})}function S3({open:e,chart:t,post:n,names:a,members:l,save:r,on_close:i,context:o}){const[c,d]=u.useState({state:"loading"}),[f,h]=u.useState(""),[m,x]=u.useState(null),[j,v]=u.useState(-1),{saving:y,refusal:g,set_refusal:p,run:b}=Ao(i),_=u.useRef(0),N=u.useCallback(async()=>{const E=_.current+=1;d({state:"loading"});const I=await l();E===_.current&&d(I.ok?{state:"read",members:I.data}:{state:"failed"})},[l]);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 w=a.post(n),k=new Set(C.holders.map(E=>E.id)),$=t.posts.some(E=>E.reports_to===n)&&C.holders.length>0?C.holders[0]:null,X=f.trim().toLowerCase(),Y=c.state==="read"?c.members.filter(E=>!k.has(E.id)).filter(E=>!X||[E.label,E.detail,E.email].some(I=>I==null?void 0:I.toLowerCase().includes(X))):[],L=c.state==="read"&&c.members.every(E=>k.has(E.id)),H=c.state==="read"&&!L&&Y.length>0,R=H&&j>=0&&j<Y.length?Y[j]:null,T=E=>`org-holder-option-${E.id}`,z=!Ir(o)||!m||$!==null,S=E=>{if(!H)return;const I=Y.length-1,ne=ee=>{var ge,G;E.preventDefault(),v(ee),(G=(ge=document.getElementById(T(Y[ee])))==null?void 0:ge.scrollIntoView)==null||G.call(ge,{block:"nearest"})};E.key==="ArrowDown"?ne(Math.min(R?j+1:0,I)):E.key==="ArrowUp"?ne(R?Math.max(j-1,0):I):E.key==="Home"&&R?ne(0):E.key==="End"&&R?ne(I):E.key==="Enter"&&R&&(m==null?void 0:m.id)!==R.id&&(E.preventDefault(),x(R))},O=$?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.",Z=E=>{E.preventDefault(),!(z||!m)&&b(()=>r({action:"hold",post:n,member:m.id},`Added ${m.label} to ${w}.`))};return s.jsx(es,{open:e,onOpenChange:E=>E||y?null:i(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:Z,noValidate:!0,children:[s.jsxs(ns,{children:[s.jsxs(as,{children:["Add holder to ",w]}),s.jsx(ls,{children:"The member holds this post and reports as it does."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Eo,{refusal:g,context:o,subject:"the holder",action:"add the holder"}),$?s.jsxs(me,{variant:"info",id:"org-holder-one",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsxs(pe,{children:["This post takes one holder. Remove ",a.member($)," first, then add the new holder."]})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"org-holder-member",children:"Member"}),s.jsx(Ot,{id:"org-holder-member",role:"combobox","aria-expanded":H,"aria-controls":H?"org-holder-members":void 0,"aria-activedescendant":R?T(R):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:$!==null,onChange:E=>{h(E.target.value),v(-1)},onKeyDown:S}),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(gn,{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(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void N(),children:"Retry"})]}):L?s.jsx("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"Every member already holds this post."}):Y.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:Y.map((E,I)=>{const ne=(m==null?void 0:m.id)===E.id,ee=(R==null?void 0:R.id)===E.id;return s.jsxs("li",{id:T(E),role:"option","aria-selected":ne,className:`cursor-pointer rounded-sm px-2 py-1.5 ${ne?"bg-accent text-accent-foreground":ee?"bg-muted":"hover:bg-muted"} ${ee?"ring-ring ring-2 ring-inset":""}`,onClick:()=>{$||(v(I),x(E))},children:[s.jsxs("div",{className:"text-sm font-medium break-words",children:[E.label,E.detail&&Y.filter(ge=>ge.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(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:y,onClick:i,children:"Cancel"}),s.jsx(Nd,{saving:y,blocked:z,described_by:$?"org-holder-one":O?"org-holder-member-help":void 0,children:y?"Adding…":"Add holder"})]})]})})})}function C3(e){const[t,n]=u.useState(null),a=u.useRef(t);u.useEffect(()=>{a.current=t},[t]);const l=u.useCallback(c=>{var d;(d=a.current)==null||d.resolve(c),n(null)},[]),r=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=!Ir(e),o=s.jsx(s_,{open:t!==null,onOpenChange:c=>c?null:l(!1),children:s.jsxs(a_,{children:[s.jsxs(l_,{children:[s.jsx(i_,{children:t==null?void 0:t.title}),s.jsx(o_,{className:"whitespace-pre-line",children:t==null?void 0:t.description})]}),t&&i?s.jsx(om,{context:e,action:t.action}):null,s.jsxs(r_,{children:[s.jsx(u_,{children:"Cancel"}),s.jsx(c_,{variant:t!=null&&t.destructive?"destructive":"default","aria-disabled":i||void 0,onClick:c=>{if(i){c.preventDefault();return}l(!0)},children:t==null?void 0:t.action_label})]})]})});return{confirm:r,confirm_dialog:o}}function Nu({label:e,on_edit:t,on_remove:n,items:a}){const l=a??[...t?[{label:"Edit",on_select:t}]:[],...n?[{label:"Remove",on_select:n,destructive:!0}]:[]];return s.jsxs(xd,{children:[s.jsx(gd,{asChild:!0,children:s.jsx(P,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`More actions for ${e}`,children:s.jsx(fp,{className:"size-3.5","aria-hidden":"true"})})}),s.jsx(Co,{align:"end",children:l.map(r=>s.jsx(jr,{className:r.destructive?"text-destructive focus:text-destructive":void 0,onSelect:r.on_select,children:r.label},r.label))})]})}function T3({label:e,message:t,on_dismiss:n}){return s.jsxs(me,{variant:"destructive",role:"alert",className:"mb-3",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:[e," was not removed"]}),s.jsxs(pe,{children:[s.jsx("p",{children:t}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Dismiss"})]})]})}const kd={host:"local",two_factor:"ok",settings_href:""},R3={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."},E3="Covered: someone holds a post that fills the slot. Vacant: posts fill it but nobody holds them. Uncovered: no job function fills it.",A3=4,ax=e=>({paddingLeft:16+24*Math.min(e,A3)}),ku={covered:{label:"Covered",tone:"success"},vacant:{label:"Vacant",tone:"warning"},uncovered:{label:"Uncovered",tone:"error"}};function M3(){const e=en().org;if(!e)throw new Error("The Org chart page rendered without the org seam.");return e}function O3({host:e="local",org:t=""}={}){const n=M3(),[a,l]=u.useState({state:"loading"}),[r,i]=u.useState(null),o=u.useRef(0),c=u.useRef(null),d=u.useCallback(j=>{const v=async y=>{const g=o.current+=1;c.current&&clearTimeout(c.current);const p=await n.chart();if(g!==o.current)return;if(p.ok){i({chart:p.data,at:new Date().toISOString()}),l({state:"read"});return}const{refusal:b}=p;if(b.reason==="no_local_org"){i(null),l({state:"none",seedable:b.seedable!==!1});return}if(e==="hosted"&&(b.reason==="not_found"||b.status===404)){i(null),l({state:"missing"});return}if(b.retry&&b.reason==="store_locked"&&y>0){const _=b.retry_after??10;l({state:"busy",retry_after:_}),c.current=setTimeout(()=>void v(y-1),_*1e3);return}l({state:"failed",refusal:b})};return v(j)},[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:r,{href:m}=Ve(),x=H3(n,()=>void d(1),(h==null?void 0:h.chart)??$3,e,m("/settings/account"));return a.state==="missing"?s.jsx(q3,{org:t}):s.jsx(QN,{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(Ft,{title:"Org chart",description:R3[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(I3,{quiet:a.state==="busy"}):null,a.state==="none"?s.jsx(P3,{edit:(x==null?void 0:x.actions)??null,seedable:a.seedable}):null,a.state==="failed"?s.jsx(V3,{host:e,kept_at:(h==null?void 0:h.at)??null,on_retry:f}):null,h?s.jsx(Y3,{chart:h.chart,host:e,edit:(x==null?void 0:x.actions)??null}):null,(x==null?void 0:x.dialogs)??null]})})}const $3={org:"",workflow:!1,teams:[],job_functions:[],slots:[],posts:[],members:[],slot_resolution:[],project:{team:null,roots:[]}};function D3(e){var i;const t=e.authority;if(!t)return{functions:!0,team_add:!0,team:()=>"full",post_add:!1,post:()=>!1,override:!0};const n=((i=e.teams.find(o=>o.parent===null))==null?void 0:i.key)??null,a=new Set(t.teams),l=new Set(t.team_descriptions),r=new Set(t.posts);return{functions:t.administer,team_add:a.size>0,team:o=>o===n?t.administer?"root":l.has(o)?"description":null:a.has(o)?"full":l.has(o)?"description":null,post_add:t.post_pairs.length>0,post:o=>r.has(o),override:!1}}function z3(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 L3={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."},U3={mfa_challenge_required:"challenge",mfa_enrollment_required:"enroll"};function B3(e,t,n){var c;const a=t==="hosted"&&!!n.authority,l=((c=n.authority)==null?void 0:c.two_factor)??!0,[r,i]=u.useState("ok"),o=u.useCallback(async()=>{a&&i(e.twoFactor?await e.twoFactor():l?"ok":"challenge")},[e,a,l]);return u.useEffect(()=>{if(!a){i("ok");return}l?i("ok"):o();const d=()=>void o();return window.addEventListener("focus",d),()=>window.removeEventListener("focus",d)},[a,l,o]),{state:r,set_state:i,check:o}}function H3(e,t,n,a,l){const r=Ar(),i=Ek(n),o=B3(e,a,n),c=a==="hosted"?{host:a,two_factor:o.state,settings_href:l}:kd,{confirm:d,confirm_dialog:f}=C3(c),[h,m]=u.useState(null),[x,j]=u.useState({}),v=R=>j(T=>{if(!T[R])return T;const{[R]:z,...S}=T;return S}),y=e.members,g=u.useCallback(async()=>{if(!y)return{ok:!1};const R=await y();return R.ok?{ok:!0,data:R.data}:{ok:!1}},[y]),p=e.change;if(!p||a==="hosted"&&(!n.authority||!z3(n)))return null;const b=D3(n),_=R=>{const T=R.code?U3[R.code]:void 0;return T?(o.set_state(T),{kind:"two_factor",message:R.message}):R.code==="revision_conflict"?(t(),{kind:"changed",message:R.message}):R.code==="outside_authority"?(t(),{kind:"authority",message:R.message}):{message:R.message}},N=R=>R.action==="hold"||R.action==="release"?"posts":"kind"in R?R.kind==="team"?"teams":R.kind==="post"?"posts":"functions":null,C=(R,T)=>{const z=R==null?void 0:R.warning;z?r.error(z):r.success(T),t()},w=async(R,T)=>{const z=await p(R);if(!z.ok)return _(z.refusal);const S=N(R);return S&&v(S),C(z.data,T),null},k=R=>{o.check(),m(R)},A=async(R,T,z,S)=>{const O=await p(z);if(!O.ok){const Z=_(O.refusal);j(E=>({...E,[R]:{label:T,message:Z.message}}));return}v(R),C(O.data,S)},$=async(R,T,z)=>{const S=R==="team"?"team":"job function";o.check(),await d({title:`Remove ${S} ${z}?`,description:L3[a],action_label:"Remove",destructive:!0,action:`remove the ${S}`})&&await A(R==="team"?"teams":"functions",z,{action:"remove",kind:R,key:T},`${R==="team"?"Team":"Job function"} ${z} removed.`)},X=async R=>{const T=i.post(R);o.check(),await d({title:`Remove post ${T}?`,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 A("posts",T,{action:"remove",kind:"post",key:R},`Removed post ${T}.`)},Y=async(R,T)=>{const z=i.post(R),S=i.member(T),O=n.posts.find(ee=>ee.post===R),E=((O==null?void 0:O.holders.length)??0)<=1?O!=null&&O.escalates_to?` The post becomes vacant. Until someone holds it, its reports and the slots it fills go to ${i.manager(O.escalates_to)}.`:" The post becomes vacant.":"";if(o.check(),!await d({title:`Remove ${S} from ${z}?`,description:`They stop holding this post and no longer report through it.${E}`,action_label:"Remove",action:"remove the holder"}))return;const ne=await p({action:"release",post:R,member:T.id});if(!ne.ok){r.error(_(ne.refusal).message),t();return}v("posts"),C(ne.data,`Removed ${S} from ${z}.`)},L=()=>m(null),H=(h==null?void 0:h.kind)==="override"&&n.project&&n.project.team!==null?n.project.slots.find(R=>R.slot===h.slot)??null:null;return{actions:{can:b,host:a,team:(R,T="full")=>k({kind:"team",team:R,scope:T}),job:R=>k({kind:"function",job:R}),override:R=>k({kind:"override",slot:R}),remove:(R,T,z)=>void $(R,T,z),post_add:()=>k({kind:"post"}),post_remove:R=>void X(R),holder_add:R=>k({kind:"holder",post:R}),holder_remove:(R,T)=>void Y(R,T),refused:R=>{const T=x[R];return T?s.jsx(T3,{label:T.label,message:T.message,on_dismiss:()=>v(R)}):null}},dialogs:s.jsxs(s.Fragment,{children:[s.jsx(b3,{open:(h==null?void 0:h.kind)==="team",chart:n,team:(h==null?void 0:h.kind)==="team"?h.team:null,scope:(h==null?void 0:h.kind)==="team"?h.scope:"full",parents:n.authority?n.authority.teams:void 0,save:w,on_close:L,context:c}),s.jsx(_3,{open:(h==null?void 0:h.kind)==="function",chart:n,job:(h==null?void 0:h.kind)==="function"?h.job:null,save:w,on_close:L,context:c}),s.jsx(w3,{open:H!==null,chart:n,binding:H,names:i,save:w,confirm:R=>d({...R,action:"clear the override"}),on_close:L}),s.jsx(k3,{open:(h==null?void 0:h.kind)==="post",chart:n,names:i,save:w,on_close:L,context:c}),s.jsx(S3,{open:(h==null?void 0:h.kind)==="holder",chart:n,post:(h==null?void 0:h.kind)==="holder"?h.post:null,names:i,members:g,save:w,on_close:L,context:c}),f]})}}function I3({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(pt,{className:n===3?"h-10 w-2/3":"h-10 w-full"},n))})}function rr({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 P3({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(me,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This repository has no local org yet"}),s.jsxs(pe,{children:[s.jsx("p",{children:n}),t||!e?s.jsxs("div",{className:"mt-2 grid w-full gap-2",children:[t?s.jsx(rr,{children:"sdlc org seed"}):null,e?null:s.jsx(rr,{children:"sdlc org add team <key>"})]}):null,e?s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>e.team(null),children:[s.jsx(yr,{className:"size-4","aria-hidden":"true"}),"Add team"]}):null]})]})}function q3({org:e}){const{href:t,Link:n}=Ve();return s.jsx(Ba,{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 G3(e){return new Date(e).toDateString()===new Date().toDateString()?`today at ${Qn(e)}`:`on ${En(e)} at ${Qn(e)}`}function V3({host:e,kept_at:t,on_retry:n}){const a=t?`The chart read ${G3(t)} is kept below. `:"";return s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:e==="hosted"?"Could not read the org chart":"Could not read the local org"}),s.jsxs(pe,{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(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function Ek(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])),l=new Map(e.posts.map(y=>[y.post,y.holders])),r=y=>y.label||y.id,i=new Map;for(const y of[...e.members,...e.posts.flatMap(g=>g.holders)]){const g=r(y);i.set(g,(i.get(g)??new Set).add(`${y.kind}:${y.id}`))}const o=y=>{var g;return(((g=i.get(r(y)))==null?void 0:g.size)??0)>1},c=y=>{const g=o(y)?y.detail??y.id:null;return g&&g!==r(y)?g:null},d=y=>{const g=c(y);return g&&g!==r(y)?`${r(y)} (${g})`:r(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=(l.get(y)??[]).map(d);return g.length?`${h(y)} (${g.join(", ")})`:h(y)},x=new Map(e.teams.map(y=>[y.key,y.parent])),j=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:r,memberDetail:c,manager:m,byPost:(y,g)=>{const[p="",b=""]=[y.split("/")[0],g.split("/")[0]],[_,N]=[f(y),f(g)];return j(p)-j(b)||_.team.localeCompare(N.team)||_.job.localeCompare(N.job)},slot:y=>a.get(y)??y,job:y=>n.get(y)??y,team:y=>t.get(y)??y}},[e])}function Ka({id:e,title:t,description:n,actions:a,children:l}){return s.jsxs("section",{"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,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:l})]})}function $f({children:e,on_click:t}){return s.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(yr,{className:"size-4","aria-hidden":"true"}),e]})}const Ov={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 Y3({chart:e,host:t,edit:n}){const a=Ek(e),l=e.members.some(r=>r.kind==="agent");return s.jsxs(s.Fragment,{children:[s.jsxs(Ka,{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($f,{on_click:n.post_add,children:"Add post"}):void 0,children:[n==null?void 0:n.refused("posts"),s.jsx(K3,{chart:e,names:a,agents:l,host:t,edit:n})]}),s.jsx(Ka,{id:"org-chart-members",title:"Members",description:l?`${Ov[t]} Each agent answers to the nearest person in its reporting chain.`:Ov[t],children:s.jsx(ez,{chart:e,names:a,host:t,agents:l})}),n?s.jsxs(Ka,{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($f,{on_click:()=>n.team(null),children:"Add team"}):void 0,children:[n.refused("teams"),s.jsx(F3,{chart:e,edit:n})]}):null,s.jsxs("div",{className:"grid items-start gap-x-6 xl:grid-cols-2",children:[s.jsxs(Ka,{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($f,{on_click:()=>n.job(null),children:"Add job function"}):void 0,children:[n!=null&&n.can.functions?n.refused("functions"):null,s.jsx(tz,{chart:e,names:a,edit:n!=null&&n.can.functions?n:null})]}),s.jsxs(Ka,{id:"org-chart-slots",title:"Slots",description:E3,children:[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(sz,{chart:e,names:a})]})]}),e.project?s.jsx(lz,{project:e.project,chart:e,names:a,edit:n!=null&&n.can.override?n:null}):null]})}function F3({chart:e,edit:t}){var c;const n=lx([...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,l=t.host==="hosted",r=(d,f)=>{const h=t.can.team(d.key);return h==="full"?s.jsx(Nu,{label:f,on_edit:()=>t.team(d),on_remove:()=>t.remove("team",d.key,f)}):h==="root"?s.jsx(Nu,{label:f,on_edit:()=>t.team(d,"description")}):h==="description"?s.jsx(P,{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(Zu,{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})=>{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:ax(f),"data-testid":"org-chart-team",children:[s.jsx("span",{className:"text-sm font-medium",children:x}),s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[l?null:s.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:h.key}),a===h.key?s.jsx(he,{variant:"neutral",children:"Owns this project"}):null,r(h,x)]})]}),m.length>0?i(m,f+1):null]},h.key)})}),o=l&&e.teams.length===1;return s.jsxs(s.Fragment,{children:[s.jsx(jt,{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 lx(e,t,n){const a=new Set(e.map(t)),l=new Map(e.map(i=>[t(i),{item:i,children:[]}])),r=[];for(const i of e){const o=n(i),c=l.get(t(i));o&&a.has(o)&&o!==t(i)?l.get(o).children.push(c):r.push(c)}return r}const X3={local:"No posts yet.",hosted:"No posts yet. An org admin can add them."};function K3({chart:e,names:t,agents:n,host:a,edit:l}){const r=lx([...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(r.length===0){const c=a==="hosted"&&(l==null?void 0:l.can.functions)&&!l.can.post_add;return s.jsx("p",{className:"text-muted-foreground text-sm",children:l!=null&&l.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.":X3[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})=>{const{team:m}=t.parts(f.post),x=typeof f.reports_to=="object"?f.reports_to:null,j=!!(l!=null&&l.can.post(f.post));return s.jsxs("li",{children:[s.jsxs("div",{className:"border-b py-2 pr-4",style:ax(d),"data-testid":"org-chart-post",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(zC,{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}),j&&l?s.jsx("span",{className:"ml-auto",children:s.jsx(Nu,{label:t.post(f.post),items:[{label:"Add holder",on_select:()=>l.holder_add(f.post)},{label:"Remove post",on_select:()=>l.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(he,{variant:ku.vacant.tone,children:ku.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(v=>s.jsx(W3,{holder:v,post:f.post,member:i.get(`${v.kind}:${v.id}`),names:t,agents:n,host:a,on_remove:j&&l?()=>l.holder_remove(f.post,v):void 0},`${v.kind}:${v.id}`))})]}),h.length>0?o(h,d+1):null]},f.post)})});return s.jsx(jt,{className:"overflow-hidden",children:o(r,0)})}function Q3(e){return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function Z3(e){if(!e.held_since)return null;const t=Q3(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 W3({holder:e,post:t,member:n,names:a,agents:l,host:r,on_remove:i}){const o=e.kind==="person"?hp:dp,c=n==null?void 0:n.posts.find(j=>j.post===t),d=n==null?void 0:n.posts.find(j=>j.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=r==="hosted"?Z3(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(ZN,{children:[s.jsx(WN,{asChild:!0,children:s.jsx(P,{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(Ju,{className:"size-3.5","aria-hidden":"true"})})}),s.jsxs(Kp,{children:["Remove ",x]})]}):null,f?s.jsx("span",{className:"text-muted-foreground text-xs break-all",children:f}):null,l?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 J3=["sdlc org hold <team>/<function> --person <id>","sdlc org hold <team>/<function> --agent <id>"];function ez({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:"}),J3.map(r=>s.jsx(rr,{children:r},r))]});const l=[...e.members].sort((r,i)=>r.kind===i.kind?t.memberLabel(r).localeCompare(t.memberLabel(i))||r.id.localeCompare(i.id):r.kind==="person"?-1:1);return s.jsx(jt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Members",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Member"}),s.jsx(F,{children:"Posts"}),s.jsx(F,{children:"Primary manager"}),s.jsx(F,{children:"Dotted lines"}),a?s.jsx(F,{children:"Accountable person"}):null]})}),s.jsx(He,{children:l.map(r=>{const i=r.posts.find(d=>d.primary),o=r.posts.filter(d=>d.dotted),c=t.memberDetail(r);return s.jsxs(ue,{"data-testid":"org-chart-member",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:t.memberLabel(r)}),c?s.jsx("div",{className:"text-muted-foreground text-xs",children:c}):null,a?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.kind==="person"?"Person":"Agent"}):null]}),s.jsx(q,{children:r.posts.map(d=>t.post(d.post)).join(", ")}),s.jsx(q,{children:i?t.manager(i.reports_to):"None"}),s.jsx(q,{children:o.length?o.map(d=>t.manager(d.reports_to)).join(", "):"None"}),a?s.jsx(q,{children:r.kind==="person"?"Not an agent":r.accountable_person?t.member(r.accountable_person):"None"}):null]},`${r.kind}:${r.id}`)})})]})})}function tz({chart:e,names:t,edit:n}){const a=lx([...e.job_functions].sort((r,i)=>(r.label||r.key).localeCompare(i.label||i.key)),r=>r.key,r=>r.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 l=(r,i)=>s.jsx("ul",{role:"list",className:i===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:r.map(({item:o,children:c})=>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:ax(i),"data-testid":"org-chart-function",children:[s.jsx("span",{className:"text-sm font-medium",children:o.label||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(he,{variant:"neutral",children:"Requires a person"}):null,n?s.jsx(Nu,{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?l(c,i+1):null]},o.key))});return s.jsx(jt,{className:"overflow-hidden",children:l(a,0)})}function nz(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 Su={covered:0,vacant:1,uncovered:2};function Ak(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 sz({chart:e,names:t}){const n=Ak(e);return s.jsx(jt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Slots",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Slot"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Resolves to"})]})}),s.jsxs(He,{children:[[...e.slot_resolution].sort((a,l)=>Su[a.status]-Su[l.status]||t.slot(a.slot).localeCompare(t.slot(l.slot))).map(a=>{const l=ku[a.status];return s.jsxs(ue,{"data-testid":"org-chart-slot",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:t.slot(a.slot)}),n.has(a.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:n.get(a.slot)}):null]}),s.jsx(q,{children:s.jsx(he,{variant:l.tone,children:l.label})}),s.jsxs(q,{children:[nz(a,t),a.status==="covered"&&a.needs_person?s.jsx("div",{className:"text-muted-foreground text-xs",children:"Needs a person"}):null]})]},a.slot)}),e.slot_resolution.length===0?s.jsx(ue,{children:s.jsx(q,{colSpan:3,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})})}const az="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.",Df=["sdlc org own <team>","sdlc org bind <slot> <team>/<function>... --reason <text>","sdlc org unbind <slot>"];function lz({project:e,chart:t,names:n,edit:a}){if(e.team===null){const i=e.roots.map(n.team);return s.jsx(Ka,{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(rr,{children:i.length?Df[0]:"sdlc org add team <key>"})})})}const l=Ak(t),r=[...e.slots].sort((i,o)=>Su[i.status]-Su[o.status]||n.slot(i.slot).localeCompare(n.slot(o.slot)));return s.jsxs(Ka,{id:"org-chart-project",title:"This project",description:az,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(jt,{className:"mt-3 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Slots in this project",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Slot"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Bound to"}),s.jsx(F,{children:"Source"}),a?s.jsx(F,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(He,{children:[r.map(i=>{const o=ku[i.status];return s.jsxs(ue,{"data-testid":"org-chart-project-slot",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:n.slot(i.slot)}),l.has(i.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:l.get(i.slot)}):null]}),s.jsx(q,{children:s.jsx(he,{variant:o.tone,children:o.label})}),s.jsx(q,{children:s.jsx(rz,{binding:i,names:n})}),s.jsx(q,{children:s.jsx(iz,{binding:i})}),a?s.jsx(q,{className:"text-right",children:s.jsx(P,{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(Zu,{className:"size-3.5","aria-hidden":"true"})})}):null]},i.slot)}),r.length===0?s.jsx(ue,{children:s.jsx(q,{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(rr,{children:Df[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:"}),Df.map(i=>s.jsx(rr,{children:i},i))]})]})}function rz({binding:e,names:t}){const n=[];e.status==="covered"&&e.needs_person&&n.push("Needs a person");for(const l of e.posts)l.off_description&&n.push(`${t.post(l.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(l=>t.post(l.post)).join(", ")} has no holder`:a=e.posts.map(l=>l.holders.length?`${t.post(l.post)}: ${l.holders.map(t.member).join(", ")}`:`${t.post(l.post)}: no holder`).join("; "),s.jsxs(s.Fragment,{children:[a,n.map(l=>s.jsx("div",{className:"text-muted-foreground text-xs",children:l},l))]})}function iz({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?En(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 oz={breaking:"Breaking",new:"New",improved:"Improved",other:"Other changes"},cz=["breaking","new","improved","other"],uz={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 Mk(e){return uz[e]??e.replace(/_/g," ")}function dz(e){return e.bump==="major"?"breaking":e.change==="added"?"new":e.change==="changed"?"improved":"other"}function Zi(e){const t=new Map;let n=0,a=0;for(const r of e){if(r.modeling_only){a+=1;continue}if(!r.bump){n+=1;continue}const i=dz(r);t.set(i,[...t.get(i)??[],r])}return{sections:cz.filter(r=>t.has(r)).map(r=>({key:r,label:oz[r],lines:t.get(r)})),breaking:t.has("breaking"),unlisted_count:n,modeling_only_count:a}}function fz(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 l of a.lines){const r=l.why?`: ${l.why}`:"";n.push(`- ${l.label} (${Mk(l.node_type)})${r}`)}}return`${n.join(`
385
+ It leaves the open tasks.`:"It leaves the open tasks.",action_label:"Mark done"}))return;ye(U);const Rt=await i.complete(Ze);if(ye(null),!Rt.ok){Lt(ta=>({...ta,[U]:Rt.refusal.message}));return}Lt(({[U]:ta,...$o})=>$o),Ss(`${Ye} marked done.`),await rs();const at=Rs.current;(Xt=(st?(at==null?void 0:at.querySelector(`[data-done-key="${CSS.escape(st)}"]`))??(at==null?void 0:at.querySelector(`[data-title-key="${CSS.escape(st)}"] a`)):null)??Cs.current)==null||Xt.focus()},gx=()=>{var U;L(""),T(""),z(null),O(oi),E(!1),ne(!1),(U=Cs.current)==null||U.focus()},x1=new Map(p.map(U=>[U.id,U])),g1=new Map(b.map(U=>[U.id,U])),Ed=new Map(G.map(U=>[U.id,U.title])),Ad=_&&k==="active",v1=G.some(U=>U.local_done),Md=Ad||v1,Od=!x||b.length>0,y1=!$&&!Dn,b1=5+(Od?1:0)+(Md?1:0),j1=V!==null&&(V.reason==="store_locked"||V.reason==="engine_failed")&&B<=U$,Oo=(W==null?void 0:W.holds)??[],_1=G.map(U=>U.id),w1=Oo.map(U=>U.id);return s.jsxs("div",{ref:Rs,className:"contents",children:[s.jsx(Ft,{title:"Tasks",description:a,actions:_?s.jsxs(P,{type:"button",onClick:()=>ze(!0),children:[s.jsx(yr,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]}):null}),x&&(ee!=null&&ee.open)?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[ee.open," open"]}):null,Ln?s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",role:"status",children:V?`Not reading · trying again every ${Math.round(Ln/1e3)}s`:ee?`Live · refreshes every ${Math.round(Ln/1e3)}s`:"Connecting…"}):null,x?s.jsx("p",{className:"sr-only",role:"status",children:yn}):null,(x||Oo.length>0)&&s.jsxs(jt,{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"}),Oo.length>0?s.jsx("ul",{className:"mt-2 divide-y","aria-labelledby":"waiting-title",children:Oo.map((U,Ye)=>{var Rt,at;const Ze=Xi[U.hold_type],st=U.target.kind==="task"?`Because you claim ${Ed.get(U.target.task_id)??"the task it waits on"} · `:"",Ut=U.local_done;return s.jsxs("li",{id:`waiting-${U.id}`,"data-title-key":U.id,className:"flex flex-wrap items-center gap-3 py-2",children:[U.task?s.jsx(h,{className:"text-primary min-w-40 flex-1 hover:underline",href:f(`/org/${t}/tasks/${U.task.id}`),children:U.task.title}):s.jsx("span",{className:"min-w-40 flex-1",children:U.reason}),s.jsx(he,{variant:Ze.tone,children:U.local_label??Ze.label}),s.jsxs("div",{className:"min-w-48 flex-2",children:[U.task?s.jsx("div",{className:"text-sm",children:U.reason}):null,s.jsxs("div",{className:"text-muted-foreground text-xs",children:[st,"From ",w(U.opened_by)," · ",En(U.opened_at)]}),(Rt=U.local_threads)!=null&&Rt.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"}),": ",U.local_threads.join(" · ")]}):null,St[U.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:St[U.id]}):null]}),Ut&&(i!=null&&i.complete)?s.jsx(P,{type:"button",variant:"outline",size:"sm","data-done-key":U.id,"aria-label":`Mark ${((at=U.task)==null?void 0:at.title)??U.reason} done`,loading:xt===U.id,onClick:()=>{var Bt;return void qa(U.id,((Bt=U.task)==null?void 0:Bt.title)??U.reason,Ut,w1[Ye+1]??null)},children:"Done"}):null,x?null:s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void Es(U.id),children:"Release"})]},U.id)})}):W?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Nothing in this checkout waits on you."}):null,x&&oe?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status",children:oe.reason==="view_outdated"?`Waiting on you is not read here. ${K}`:"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:x?"This checkout only. Teammates' agents are not listed here.":"Release a hold when you have done your part. Whoever can edit the task then resolves it."})]}),!_&&!l&&s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(go,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"You can view these tasks"}),s.jsx(pe,{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(o$,{value:k,onValueChange:U=>A(U),children:s.jsxs(PN,{"aria-label":"Which tasks",children:[s.jsx(em,{value:"active",children:"Active"}),s.jsx(em,{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(zr,{id:"tasks-mine",checked:$,onCheckedChange:U=>X(U===!0)}),s.jsx(Me,{htmlFor:"tasks-mine",children:"Assigned to me"})]}):null,y!=null&&y.search?s.jsx(Ot,{ref:Cs,type:"search",className:"w-64","aria-label":"Search tasks",placeholder:"Search title, ID or detail",value:Y,onChange:U=>L(U.target.value)}):null,Ce!=null&&Ce.owners?s.jsx(G$,{owners:Ce.owners,no_owner:Ce.no_owner,value:S,on_change:O}):null]}),(vx=Ce==null?void 0:Ce.groups)!=null&&vx.length?s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Status",children:[Ce.groups.map(U=>s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":R===U.id,onClick:()=>z(Ye=>Ye===U.id?null:U.id),children:[U.label," ",U.count]},U.id)),Ce.marks?s.jsxs(s.Fragment,{children:[s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":Z,onClick:()=>E(U=>!U),children:["Urgent ",Ce.marks.urgent]}),s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":I,onClick:()=>ne(U=>!U),children:["Over estimate ",Ce.marks.over_estimate]})]}):null]}):null,Dn&&(ee==null?void 0:ee.matched)!==void 0&&ee.total!==void 0?s.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:[ee.matched," of ",ee.total," match ·"," ",s.jsx(P,{type:"button",variant:"link",size:"inline-sm",onClick:gx,children:"Clear"})]}):null,j1?s.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:"Tasks are busy. Reading them again…"}):V?s.jsx(rk,{refusal:V,on_retry:()=>void Ct()}):null,!ee&&!V&&s.jsx(lk,{}),ee&&G.length===0&&Dn?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(Wu,{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(P,{type:"button",variant:"outline",onClick:gx,children:"Clear filters"})]}):ee&&G.length===0&&k==="active"&&!$&&x?s.jsx("p",{className:"text-muted-foreground mt-6 text-sm",children:"No tasks recorded yet."}):ee&&G.length===0&&k==="active"&&!$?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(i0,{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."}),_&&s.jsxs(P,{type:"button",onClick:()=>ze(!0),children:[s.jsx(yr,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]})]}):ee?s.jsxs(s.Fragment,{children:[s.jsx(jt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Tasks",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Title"}),s.jsx(F,{children:"Status"}),Od?s.jsx(F,{className:"hidden md:table-cell",children:"Priority"}):null,s.jsx(F,{className:"hidden md:table-cell",children:"Primary"}),s.jsx(F,{className:"hidden md:table-cell",children:"Holds"}),s.jsx(F,{children:"Claimed by"}),Md?s.jsx(F,{className:"text-right",children:"Actions"}):null]})}),s.jsxs(He,{children:[G.map((U,Ye)=>{var Rt,at;const Ze=x1.get(U.status_id),st=$$(U),Ut=U.local_done;return s.jsxs(ue,{"data-testid":"tasks-row",children:[s.jsxs(q,{"data-title-key":U.id,children:[U.no_page?s.jsx("span",{children:U.title}):s.jsx(h,{className:"text-primary hover:underline",href:f(`/org/${t}/tasks/${U.id}`),children:U.title}),U.parent_task_id&&Ed.get(U.parent_task_id)?s.jsx("div",{className:"text-muted-foreground text-xs",children:Ed.get(U.parent_task_id)}):null,x?s.jsx(q$,{row:U}):null,St[U.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:St[U.id]}):null]}),s.jsx(q,{children:Ze?s.jsx(he,{variant:nk(Ze),children:Ze.name}):null}),Od?s.jsx(q,{className:"hidden md:table-cell",children:U.priority_id?((Rt=g1.get(U.priority_id))==null?void 0:Rt.name)??"":s.jsx("span",{className:"text-muted-foreground",children:"Not set"})}):null,s.jsx(q,{className:"hidden md:table-cell",children:U.owner_title?U.owner_title:U.primary_user_id?w(U.primary_user_id):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}),s.jsx(q,{className:"hidden md:table-cell",children:st?s.jsx(he,{variant:st.tone,children:st.label}):s.jsx("span",{className:"text-muted-foreground",children:"None"})}),s.jsx(q,{"data-testid":"tasks-claim",children:s.jsx(V$,{row:U,holder:w((at=U.claim)==null?void 0:at.user_id)})}),Md?s.jsx(q,{className:"text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[Ut&&"hold"in Ut?s.jsx("a",{className:"text-primary text-sm hover:underline",href:`#waiting-${Ut.hold}`,children:"In Waiting on you"}):Ut&&(i!=null&&i.complete)?s.jsx(P,{type:"button",variant:"outline",size:"sm","data-done-key":U.id,"aria-label":`Mark ${U.title} done`,loading:xt===U.id,onClick:()=>void qa(U.id,U.title,Ut,_1[Ye+1]??null),children:"Done"}):null,Ad&&y1?s.jsxs(s.Fragment,{children:[s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${U.title} up`,disabled:Ye===0,onClick:()=>void be(U,Ye,-1),children:s.jsx(DC,{className:"size-4","aria-hidden":"true"})}),s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${U.title} down`,disabled:Ye===G.length-1,onClick:()=>void be(U,Ye,1),children:s.jsx(MC,{className:"size-4","aria-hidden":"true"})})]}):null,Ad?s.jsxs(xd,{children:[s.jsx(gd,{asChild:!0,children:s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`More actions for ${U.title}`,children:s.jsx(fp,{className:"size-4","aria-hidden":"true"})})}),s.jsxs(Co,{align:"end",children:[D&&U.status_id!==D.id?s.jsx(jr,{onSelect:()=>se(U),children:"Complete"}):null,N?s.jsx(jr,{className:"text-destructive focus:text-destructive",onSelect:()=>void _e(U),children:"Archive"}):null]})]}):null]})}):null]},U.id)}),G.length===0&&s.jsx(ue,{children:s.jsx(q,{colSpan:b1,className:"text-muted-foreground h-24 text-center",children:k==="archived"?"No archived tasks.":"No tasks are assigned to you."})})]})]})}),ee.next_cursor?s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2 self-start",disabled:J,onClick:async()=>{le(!0),await Ct(ee.next_cursor??void 0),le(!1)},children:"Load more"}):null]}):null,_&&i&&s.jsx(z$,{open:Ne,commands:i,list_id:j.id,list_revision:(ee==null?void 0:ee.list.revision)??j.revision,default_status_id:j.default_status_id,statuses:p,priorities:b,members:n,on_close:()=>ze(!1),on_created:async()=>{ze(!1),await rs()}}),tn]})}function q$({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(he,{variant:a.tone??"neutral",children:a.label},a.label))}):null]})}function G$({owners:e,no_owner:t,value:n,on_change:a}){return s.jsxs(dt,{value:n,onValueChange:a,children:[s.jsx(it,{className:"w-56","aria-label":"Owner",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:oi,children:"Any owner"}),e.map(l=>s.jsxs(ke,{value:l.id,children:[l.label," (",l.count,")"]},l.id)),t!==void 0?s.jsxs(ke,{value:ak,children:["No owner (",t,")"]}):null]})]})}function V$({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 ${Qn(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?` · ${Qp(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 ",Qn(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 Y$={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 F$({open:e,members:t,tasks:n,holds_my_web_claim:a,on_close:l,on_submit:r}){const[i,o]=u.useState("waiting_for_user"),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,g]=u.useState(!1),[j,v]=u.useState({}),[y,x]=u.useState(null),[p,b]=u.useState(!1);u.useEffect(()=>{e&&(o("waiting_for_user"),d(""),h(""),g(!1),v({}),x(null))},[e]);const _=Y$[i],N=async C=>{C.preventDefault();const w={target:_!==null&&!c.trim(),reason:!f.trim()};if(v(w),w.target||w.reason)return;b(!0);const k={hold_type:i,reason:f.trim(),release_claim:m};i==="waiting_for_user"&&(k.target_user_id=c),i==="blocked"&&(k.target_task_id=c),i==="waiting_for_external"&&(k.target_label=c.trim());const A=await r(k);b(!1),x(A)};return s.jsx(es,{open:e,onOpenChange:C=>C?null:l(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:C=>void N(C),noValidate:!0,children:[s.jsxs(ns,{children:[s.jsx(as,{children:"Add hold"}),s.jsx(ls,{children:"Say what this task is waiting for."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y&&s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(pe,{children:y})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"hold-type",children:"Type"}),s.jsxs(dt,{value:i,onValueChange:C=>{o(C),d(""),v({})},children:[s.jsx(it,{id:"hold-type",children:s.jsx(ft,{})}),s.jsx(ot,{children:Object.keys(Xi).map(C=>s.jsx(ke,{value:C,children:Xi[C].label},C))})]})]}),_?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"hold-target",children:_.label}),i==="waiting_for_external"?s.jsx(Ot,{id:"hold-target",value:c,"aria-invalid":j.target,onChange:C=>d(C.target.value)}):s.jsxs(dt,{value:c,onValueChange:d,children:[s.jsx(it,{id:"hold-target","aria-invalid":j.target,children:s.jsx(ft,{placeholder:i==="blocked"?"Choose a task":"Choose a member"})}),s.jsx(ot,{children:i==="blocked"?n.map(C=>s.jsx(ke,{value:C.id,children:C.title},C.id)):t.map(C=>s.jsx(ke,{value:C.user_id,children:C.label},C.user_id))})]}),s.jsx("p",{className:j.target?"text-destructive text-xs":"text-muted-foreground text-xs",children:j.target?"Choose what it waits for.":_.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(Me,{htmlFor:"hold-reason",children:"Reason"}),s.jsx(ks,{id:"hold-reason",rows:3,placeholder:"What the task is waiting for",value:f,"aria-invalid":j.reason,onChange:C=>h(C.target.value)}),j.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(zr,{id:"hold-release-claim",checked:m,onCheckedChange:C=>g(C===!0)}),s.jsx(Me,{htmlFor:"hold-release-claim",children:"Also release my claim"})]})]}),s.jsxs(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",onClick:l,children:"Cancel"}),s.jsx(P,{type:"submit",disabled:p,children:p?"Adding…":"Add hold"})]})]})})})}function To(){const e=en().tasks;if(!e)throw new Error("The Task page rendered without the tasks seam.");return e}function Jp(){return s.jsxs("div",{className:"grid gap-3",role:"status","aria-label":"Loading task",children:[s.jsx(pt,{className:"h-8 w-1/2"}),Array.from({length:7},(e,t)=>s.jsx(pt,{className:t===6?"h-6 w-2/3":"h-6 w-full"},t))]})}function ju({back:e,description:t}){const{href:n,Link:a}=Ve();return s.jsx(Ba,{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 Rl="not_set",X$=10*60*1e3,Nv=20;function K$(){const{members:e}=To(),[t,n]=u.useState([]);u.useEffect(()=>{let r=!0;return e().then(i=>{r&&i.ok&&n(i.data)}),()=>{r=!1}},[e]);const a=u.useMemo(()=>new Map(t.map(r=>[r.user_id,r])),[t]),l=u.useCallback((r,i)=>{var o;return r?r===i?"You":((o=a.get(r))==null?void 0:o.label)??"A member":""},[a]);return{members:t,name:l}}function Q$({active:e,task_id:t,back:n}){const a=To(),{task:l,activity:r,listTasks:i,hierarchyRevision:o,commands:c}=a,{href:d,Link:f}=Ve(),h=Ar(),{self_id:m}=Ku(),{members:g,name:j}=K$(),{workspace:v}=e,{confirm:y,confirm_dialog:x}=_o(),[p,b]=u.useState(null),[_,N]=u.useState(!1),[C,w]=u.useState(!1),[k,A]=u.useState(null),[$,X]=u.useState([]),[Y,L]=u.useState(Nv),[H,T]=u.useState([]),[R,z]=u.useState(!1),[S,O]=u.useState(null),[Z,E]=u.useState(null),[I,ne]=u.useState(""),[ee,ge]=u.useState(null),G=u.useCallback(async()=>{if(!l)return;const D=await l(t);D.ok?(b(D.data),w(!1)):D.refusal.status===404||D.refusal.status===400?N(!0):w(!0)},[l,t]),M=u.useRef(0),V=u.useCallback(async()=>{if(!r)return;const D=M.current+=1;let be=[],se;for(;;){const _e=await r(t,se);if(D!==M.current||!_e.ok)return;if(be=[...be,..._e.data.events].slice(-1e3),!_e.data.more||!_e.data.next_cursor)break;se=_e.data.next_cursor}D===M.current&&X(be.reverse())},[r,t]);u.useEffect(()=>{G(),V()},[G,V]);const ae=p?v.lists.find(D=>D.id===p.task.list_id):void 0,B=u.useMemo(()=>{var D;return((D=v.workflows.find(be=>be.id===(p==null?void 0:p.task.workflow_id)))==null?void 0:D.statuses)??[]},[v,p==null?void 0:p.task.workflow_id]);u.useEffect(()=>{if(!p)return;let D=!0;return i(p.task.list_id,{limit:100}).then(be=>{D&&T(be.ok?be.data.tasks.filter(se=>se.id!==p.task.id).map(se=>({id:se.id,title:se.title})):[])}),()=>{D=!1}},[i,p==null?void 0:p.task.list_id,p==null?void 0:p.task.id,p]);const te=u.useCallback(async()=>{await Promise.all([G(),V()])},[G,V]),J=u.useCallback((D,be)=>c?c.run(D,be):Promise.resolve({ok:!1,refusal:{status:0,message:"This page cannot change tasks."}}),[c]),le=u.useCallback(async(D,be,se)=>{const _e=await J(D,be);return _e.ok?(se&&h.success(se),await te(),_e.data):(_e.refusal.code==="revision_conflict"?A({tone:"warning",title:"This task changed while you were editing",body:"We reloaded it. Check the change, then save again."}):_e.refusal.code==="claim_held"?(await G(),A({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(_e.refusal.message),await te(),null)},[J,h,te,G]),W=(p==null?void 0:p.claim)??null,Qe=W!==null&&W.id===ee&&!W.lapsed&&!W.via?W.id:null;if(u.useEffect(()=>{if(!Qe)return;const D=window.setInterval(()=>{J("renew_claim",{claim_id:Qe,lease_seconds:wv}).then(()=>G())},X$);return()=>window.clearInterval(D)},[Qe,J,G]),_)return s.jsx(ju,{back:n});if(C&&!p)return s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This task could not be loaded"}),s.jsxs(pe,{children:[s.jsx("p",{children:"Check your connection and try again."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void G(),children:"Retry"})]})]});if(!p)return s.jsx(Jp,{});const{task:oe}=p,Oe=oe.archived_at!==null,K=bu(p.permission,"write")&&!Oe,Ne=bu(p.permission,"manage"),ze=B.find(D=>D.id===oe.status_id),xt=B.find(D=>D.category==="completed"),ye=v.priorities.find(D=>D.id===oe.priority_id),St=p.contributors.map(D=>D.user_id),Lt=W!==null&&W.user_id===m,yn=W!==null&&!W.lapsed,Ss=p.checklist.filter(D=>D.is_complete).length,bn=async()=>{const[D,be]=await Promise.all([i(oe.list_id,{limit:1}),o(v.id)]);return D.ok?be.ok?{ok:!0,data:{task_id:oe.id,expected_revision:oe.revision,expected_order_revision:D.data.list.order_revision,expected_hierarchy_revision:be.data}}:be:D},tn=(D,be)=>le("update_task",{task_id:oe.id,expected_revision:oe.revision,changes:D},be),Cs=D=>y(D.via==="sdlc_login"?{title:"Release this claim?",description:`You claimed it via ${Rf(D.via,D.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}),Rs=async()=>{if(!xt)return;if(yn&&(!Lt||W.via)){const be=W.via==="api_key"?`${Lt?"Your":`${j(W.user_id)}'s`} agent is still working on it.`:W.via==="sdlc_login"?`${Lt?"You are":`${j(W.user_id)} is`} still working on it via ${Rf(W.via,W.via_device)}.`:`${j(W.user_id)} is still working on it.`;if(!await y({title:"Complete this task?",description:be,action_label:"Mark complete"}))return}await tn({status_id:xt.id},"Task completed.")!==null&&W&&Lt&&yn&&await le("end_claim",{claim_id:W.id,outcome:"completed"})},re=async(D,be)=>{const se=await bn();if(!se.ok){h.error(se.refusal.message);return}await le(D,se.data,be)},De=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 re("archive_task","Task archived.")},Ce=async()=>{await re("restore_task","Task restored.")},Ts=async()=>{var _e;const D=W,be=await le("claim_task",{task_id:oe.id,lease_seconds:wv}),se=(_e=be==null?void 0:be.claim)==null?void 0:_e.id;se&&!(D&&D.id===se&&D.via)&&ge(se)},Dn=async()=>{W&&(W.via&&!await Cs(W)||(await le("end_claim",{claim_id:W.id,outcome:"released"},"Claim released."),ge(null)))},zn=async()=>{W&&await le("end_claim",{claim_id:W.id,outcome:"expired"},"Claim cleared.")},Ct=async D=>{D.hold_type==="paused"&&m&&(D={...D,target_user_id:m});const be=await J("open_hold",{task_id:oe.id,hold_type:D.hold_type,reason:D.reason,...D.target_user_id?{target_user_id:D.target_user_id}:{},...D.target_task_id?{target_task_id:D.target_task_id}:{},...D.target_label?{target_label:D.target_label}:{}});return be.ok?(z(!1),h.success("Hold added."),D.release_claim&&W&&Lt&&!W.via&&(await le("end_claim",{claim_id:W.id,outcome:"released"}),ge(null)),await te(),null):be.refusal.message},nn=D=>le("checklist",{task_id:oe.id,expected_revision:oe.revision,...D}),rs=async D=>{for(const be of D.filter(se=>!St.includes(se)))await le("set_contributor",{task_id:oe.id,expected_revision:oe.revision,user_id:be,action:"add"});for(const be of p.contributors.filter(se=>!D.includes(se.user_id)))await le("set_contributor",{task_id:oe.id,expected_revision:oe.revision,user_id:be.user_id,action:"remove",expected_contributor_revision:be.revision})},Ln=D=>{var se;if(D.target.kind==="user")return j(D.target.user_id,m);if(D.target.kind==="external")return D.target.label;if(D.target.hidden||!D.target.task_id)return"A task you cannot see";const be=D.target.task_id;return s.jsx(f,{className:"text-primary hover:underline",href:d(`${n}/${be}`),children:((se=H.find(_e=>_e.id===be))==null?void 0:se.title)??"Another task"})},ea=D=>D.target.kind==="user"&&D.target.user_id===m&&!D.released_at?s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void le("release_hold",{hold_id:D.id},"Hold released."),children:"Release"}):K?s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void le("resolve_hold",{hold_id:D.id},"Hold resolved."),children:"Resolve"}):null;return s.jsxs(s.Fragment,{children:[s.jsx(Ft,{title:oe.title,description:`Created ${En(oe.created_at)} by ${j(oe.created_by,m)}`,actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[K&&s.jsxs(s.Fragment,{children:[s.jsxs(P,{type:"button",variant:"outline",onClick:()=>O(oe.title),children:[s.jsx(Zu,{className:"mr-2 size-4","aria-hidden":"true"}),"Edit title"]}),xt&&oe.status_id!==xt.id&&s.jsxs(P,{type:"button",variant:"outline",onClick:()=>void Rs(),children:[s.jsx(Mr,{className:"mr-2 size-4","aria-hidden":"true"}),"Mark complete"]})]}),Ne&&!Oe&&s.jsxs(P,{type:"button",variant:"outline",onClick:()=>void De(),children:[s.jsx(Vg,{className:"mr-2 size-4","aria-hidden":"true"}),"Archive"]})]}),children:S!==null?s.jsxs("form",{className:"flex flex-wrap items-center gap-2 pt-1",onSubmit:async D=>{D.preventDefault(),S.trim()&&await tn({title:S.trim()})!==null&&O(null)},children:[s.jsx(Me,{htmlFor:"task-title",className:"sr-only",children:"Title"}),s.jsx(Ot,{id:"task-title",className:"max-w-xl",value:S,onChange:D=>O(D.target.value)}),s.jsx(P,{type:"submit",size:"sm",children:"Save"}),s.jsx(P,{type:"button",size:"sm",variant:"outline",onClick:()=>O(null),children:"Cancel"})]}):null}),k&&s.jsxs(me,{variant:k.tone,className:"mt-4","data-testid":"task-notice",children:[k.tone==="warning"?s.jsx(vl,{className:"size-4","aria-hidden":"true"}):s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:k.title}),s.jsx(pe,{children:k.body})]}),Oe?s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(Vg,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This task is archived"}),s.jsx(pe,{children:Ne?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(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void Ce(),children:[s.jsx(TC,{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."})})]}):K?null:s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(go,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"You can view this task"}),s.jsx(pe,{children:"Ask an organization admin for write access to change it."})]}),K?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(Me,{htmlFor:"task-status",children:"Status"}),s.jsxs(dt,{value:oe.status_id,onValueChange:D=>void tn({status_id:D}),children:[s.jsx(it,{id:"task-status",children:s.jsx(ft,{})}),s.jsx(ot,{children:B.map(D=>s.jsx(ke,{value:D.id,children:D.name},D.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"task-priority",children:"Priority"}),s.jsxs(dt,{value:oe.priority_id??Rl,onValueChange:D=>void tn({priority_id:D===Rl?null:D}),children:[s.jsx(it,{id:"task-priority",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:Rl,children:"Not set"}),v.priorities.map(D=>s.jsx(ke,{value:D.id,children:D.name},D.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"task-primary",children:"Primary"}),s.jsxs(dt,{value:oe.primary_user_id??Rl,onValueChange:D=>void tn({primary_user_id:D===Rl?null:D}),children:[s.jsx(it,{id:"task-primary",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:Rl,children:"Not set"}),g.map(D=>s.jsx(ke,{value:D.user_id,children:D.label},D.user_id))]})]})]}),s.jsx(Z$,{members:g,selected:St,on_change:D=>void rs(D)})]}):s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(ac,{label:"Status",value:(ze==null?void 0:ze.name)??""}),s.jsx(ac,{label:"Priority",value:(ye==null?void 0:ye.name)??"Not set"}),s.jsx(ac,{label:"Primary",value:oe.primary_user_id?j(oe.primary_user_id,m):"Not set"}),s.jsx(ac,{label:"Contributors",value:St.map(D=>j(D,m)).join(", ")||"None"})]}),!Oe&&s.jsx(W$,{claim:W,mine:Lt,holder:W?j(W.user_id):"",own:W!==null&&W.id===ee,can_write:K,on_claim:()=>void Ts(),on_release:()=>void Dn(),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"}),K&&Z===null&&s.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(oe.description??""),children:"Edit description"})]}),Z!==null?s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async D=>{D.preventDefault(),await tn({description:Z})!==null&&E(null)},children:[s.jsx(Me,{htmlFor:"task-description",className:"sr-only",children:"Description"}),s.jsx(ks,{id:"task-description",rows:5,value:Z,onChange:D=>E(D.target.value)}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(P,{type:"submit",size:"sm",children:"Save"}),s.jsx(P,{type:"button",size:"sm",variant:"outline",onClick:()=>E(null),children:"Cancel"})]})]}):s.jsx("p",{className:"mt-2 text-sm whitespace-pre-wrap",children:oe.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?` · ${Ss} of ${p.checklist.length} done`:""]}),s.jsx("ul",{className:"mt-2 grid gap-1",children:p.checklist.map(D=>s.jsxs("li",{className:"flex items-center justify-between gap-2 py-1","data-testid":"task-checklist-item",children:[K?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(zr,{id:`check-${D.id}`,checked:D.is_complete,onCheckedChange:be=>void nn({action:"toggle",item_id:D.id,expected_item_revision:D.revision,is_complete:be===!0})}),s.jsx(Me,{htmlFor:`check-${D.id}`,className:"font-normal",children:D.label})]}):s.jsxs("span",{className:"text-sm",children:[D.is_complete?"Done: ":"To do: ",D.label]}),K&&s.jsxs(xd,{children:[s.jsx(gd,{asChild:!0,children:s.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":`Item actions for ${D.label}`,children:s.jsx(fp,{className:"size-4","aria-hidden":"true"})})}),s.jsx(Co,{align:"end",children:s.jsx(jr,{className:"text-destructive focus:text-destructive",onSelect:()=>void nn({action:"archive",item_id:D.id,expected_item_revision:D.revision}),children:"Remove"})})]})]},D.id))}),p.checklist.length===0&&!K&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"No checklist items."}),K&&s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async D=>{D.preventDefault(),I.trim()&&await nn({action:"add",label:I.trim()})!==null&&ne("")},children:[s.jsx(Me,{htmlFor:"task-new-item",children:"Add an item"}),s.jsx(Ot,{id:"task-new-item",placeholder:"Add an item and press Enter",value:I,onChange:D=>ne(D.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"}),K&&s.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:()=>z(!0),children:[s.jsx(c0,{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(Be,{containerAriaLabel:"Holds",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Type"}),s.jsx(F,{children:"Reason"}),s.jsx(F,{children:"Waiting on"}),s.jsx(F,{className:"text-right",children:"Actions"})]})}),s.jsxs(He,{children:[p.holds.map(D=>{const be=Xi[D.hold_type];return s.jsxs(ue,{"data-testid":"task-hold",children:[s.jsx(q,{children:s.jsx(he,{variant:be.tone,children:be.label})}),s.jsxs(q,{children:[s.jsx("div",{children:D.reason}),s.jsx("div",{className:"text-muted-foreground text-xs",children:D.released_at?`Released by ${j(D.released_by,m)} · ${En(D.released_at)} · Ready to resolve`:`Opened by ${j(D.opened_by,m)} · ${En(D.opened_at)} · Open`})]}),s.jsx(q,{children:Ln(D)}),s.jsx(q,{className:"text-right",children:ea(D)})]},D.id)}),p.holds.length===0&&s.jsx(ue,{children:s.jsx(q,{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:[$.slice(0,Y).map(D=>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:D$(D)}),s.jsxs("span",{className:"min-w-0 text-right sm:text-left",children:[s.jsx("span",{children:D.actor_id?j(D.actor_id,m):"The system"}),D.via?s.jsxs("span",{className:"text-muted-foreground block max-w-64 truncate text-xs sm:max-w-none",title:`via ${Rf(D.via,D.via_device)}`,children:["via ",Qp(D.via),s.jsx(ik,{via:D.via,device:D.via_device})]}):null]}),s.jsx("span",{className:"text-muted-foreground col-span-2 sm:col-span-1 sm:text-right",children:sk(D.created_at)})]},D.id)),$.length===0&&s.jsx("li",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No activity yet."})]}),$.length>Y&&s.jsx(P,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>L(D=>D+Nv),children:"Load more"})]}),K&&ae&&s.jsx(F$,{open:R,members:g,tasks:H,holds_my_web_claim:Lt&&yn&&!(W!=null&&W.via),on_close:()=>z(!1),on_submit:Ct}),x]})}function ac({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 Z$({members:e,selected:t,on_change:n}){return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"task-contributors",children:"Contributors"}),s.jsxs(xd,{children:[s.jsx(gd,{asChild:!0,children:s.jsxs(P,{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(l0,{className:"text-muted-foreground size-4","aria-hidden":"true"})]})}),s.jsx(Co,{align:"start",children:e.map(a=>{const l=t.includes(a.user_id);return s.jsxs(jr,{onSelect:()=>n(l?t.filter(r=>r!==a.user_id):[...t,a.user_id]),children:[l?s.jsx(Mr,{className:"mr-2 size-4","aria-hidden":"true"}):s.jsx("span",{className:"mr-2 size-4"}),a.label]},a.user_id)})})]})]})}function ik({via:e,device:t}){return e!=="sdlc_login"||!t?null:s.jsxs(s.Fragment,{children:[" on ",s.jsx("bdi",{children:t})]})}function W$({claim:e,mine:t,holder:n,own:a,can_write:l,on_claim:r,on_release:i,on_clear:o}){let c=s.jsx(hp,{className:"size-4","aria-hidden":"true"}),d="Nobody is working on this",f=l?"Claim it to show others you are.":"",h=l?s.jsx(P,{type:"button",size:"sm",onClick:r,children:"Claim"}):null;if(e&&e.lapsed){const m=new Date(e.lease_expires_at)<=new Date;c=s.jsx(JC,{className:"size-4","aria-hidden":"true"}),d=m?`${t?"Your":`${n}'s`} claim lapsed at ${Qn(e.lease_expires_at)}`:`${t?"Your":`${n}'s`} claim lapsed`,f=m?"Its time ran out.":`${n} can no longer edit this task.`,l&&(f+=" Take it over to work on it yourself, or clear it so anyone can claim it."),h=l?s.jsxs(s.Fragment,{children:[s.jsx(P,{type:"button",size:"sm",variant:"outline",onClick:o,children:"Clear claim"}),s.jsx(P,{type:"button",size:"sm",onClick:r,children:"Take over"})]}):null}else if(e){const m=Qn(e.lease_expires_at);c=e.via==="api_key"?s.jsx(dp,{className:"size-4","aria-hidden":"true"}):e.via==="sdlc_login"?s.jsx(jR,{className:"size-4","aria-hidden":"true"}):s.jsx(eT,{className:"size-4","aria-hidden":"true"});const g=s.jsxs(s.Fragment,{children:["Claimed via sdlc login",s.jsx(ik,{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:[g," 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=g):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=l?"Claimed on the web. You can take it over if the claim lapses.":"Claimed on the web."),h=t?s.jsx(P,{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 J$=10,ok=5,eD=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,ck="Not available",tD={added:"Added",changed:"Changed",removed:"Removed"},nD={thread:"Thread",task:"Task",issue:"Issue",release:"Release",test:"Test"},kv=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;function sD(e,t){const n=t!=null&&t.startsWith("task:")?t.slice(5):null;if(n&&eD.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 l=t!=null&&t.startsWith("release:")?t.slice(8):null;if(l&&kv.test(l))return{label:l==="candidate"?"Candidate":`Release ${l}`,path:`/releases?release=${l}`};const r=t!=null&&t.startsWith("planned:")?t.slice(8):null;return r&&kv.test(r)?{label:`Planned Release ${r}`,path:`/releases?planned=${r}`}:{label:"Tasks",path:`/org/${e}/tasks`}}const uk=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function aD({org:e,task_id:t,from:n}){var Rs;const a=To(),{href:l,Link:r}=Ve(),{confirm:i,confirm_dialog:o}=_o(),c=sD(e,n),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState([]),[g,j]=u.useState([]),[v,y]=u.useState(null),[x,p]=u.useState(null),[b,_]=u.useState({state:"loading"}),[N,C]=u.useState({state:"loading"}),[w,k]=u.useState(null),[A,$]=u.useState(null),[X,Y]=u.useState(!1),L=u.useRef(null),H=Wn(),T=u.useRef(null),R=u.useRef(null),z=u.useRef(null),S=u.useRef(null),O=u.useRef(!1),Z=u.useRef(0),E=u.useRef(0),I=u.useCallback(async()=>{if(!a.taskSections)return;_({state:"loading"});const re=await a.taskSections(t);_(re.ok?{state:"ok",data:re.data}:{state:"failed",refusal:re.refusal})},[a.taskSections,t]),ne=u.useCallback(async()=>{if(!a.taskRelated)return;C({state:"loading"});const re=await a.taskRelated(t);C(re.ok?{state:"ok",data:re.data}:{state:"failed",refusal:re.refusal})},[a.taskRelated,t]),ee=u.useCallback(async()=>{var Dn,zn;const re=E.current+=1;p(null),I(),ne();const[De,Ce]=await Promise.all([a.availability(),a.task?a.task(t):Promise.resolve(null)]);if(re!==E.current)return;De.state==="active"&&m(((Dn=De.workspace.workflows.find(Ct=>Ct.id===De.list.workflow_id))==null?void 0:Dn.statuses)??[]);const Ts=De.state==="off"&&((zn=De.refusal)==null?void 0:zn.reason)==="engine_missing"?De.refusal:null;if(!Ce||!Ce.ok&&Ce.refusal.reason==="engine_missing"||Ts){f({state:"engine_missing",refusal:Ts??(Ce&&!Ce.ok?Ce.refusal:{status:0,message:""})});return}if(Ce.ok){Z.current=0,y(null),$(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(Z.current+=1,Z.current===1&&uk(Ce.refusal)){p(Ce.refusal.retry_after??J$);return}y(Ce.refusal),f(Ct=>Ct.state==="loading"?{state:"loading"}:Ct)},[a,t,I,ne]);u.useEffect(()=>{ee()},[ee]),u.useEffect(()=>{if(x===null)return;const re=setTimeout(()=>void ee(),x*1e3);return()=>clearTimeout(re)},[x,ee]),u.useEffect(()=>{let re=!0;return a.members().then(De=>{re&&De.ok&&j(De.data)}),()=>{re=!1}},[a.members]),u.useEffect(()=>{var De;if(O.current||d.state!=="ok")return;O.current=!0;const re=(De=L.current)==null?void 0:De.querySelector("h1");re&&(re.tabIndex=-1,re.focus())},[d.state]),u.useEffect(()=>{var re;w&&((re=R.current)==null||re.focus())},[w]),u.useEffect(()=>{if(A===null)return;const re=setTimeout(()=>{var De;return(De=T.current)==null?void 0:De.focus()},0);return()=>clearTimeout(re)},[A]);const ge=u.useMemo(()=>new Map(g.map(re=>[re.user_id,re.label])),[g]),G=re=>re?ge.get(re)??re:"",M=()=>{k(null),ee()},V=u.useRef(null),ae=re=>(V.current=re,re==="graph"?I():ne());if(u.useEffect(()=>{var Ce;const re=V.current;if(re===null||(re==="graph"?b:N).state==="loading")return;V.current=null;const De=(re==="graph"?z:S).current??((Ce=L.current)==null?void 0:Ce.querySelector("h1"));De==null||De.focus()},[b,N]),d.state==="missing")return s.jsx(ya,{children:s.jsx(ju,{back:`/org/${e}/tasks`,description:`No task ${t} in this checkout. It may have finished and been archived, or never been recorded.`})});const B=s.jsx(P,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(r,{href:l(c.path),children:[s.jsx(s0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(d.state==="engine_missing")return s.jsx(ya,{children:s.jsx("div",{ref:L,className:"contents",children:s.jsx(Js,{page:"Task",header:s.jsx(Si,{back:B,id:null,title:t})})})});const te=v?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Could not read this task"}),s.jsxs(pe,{children:[s.jsxs("p",{children:[v.message,v.since?` Since ${Yn(v.since)}.`:"",d.state==="ok"?` This page was read at ${Yn(d.at)}.`:""," See the sdlc viewer terminal for more."]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:M,children:"Retry"})]})]}):null,J=x!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(gn,{"aria-hidden":"true"}),"Could not read this task. Trying again in ",x," seconds."]}):null,le=s.jsx("div",{role:"status","aria-live":"polite",children:J});if(d.state==="loading")return s.jsxs(ya,{children:[le,te,!v&&x===null?s.jsx(Jp,{}):null]});const{detail:W,at:Qe}=d,{task:oe}=W,Oe=h.find(re=>re.id===oe.status_id),K=W.local_done&&"task"in W.local_done?W.local_done:null,Ne=W.local_waits??[],ze=K?Ne[0]??null:null,xt=ze?G(ze.opened_by):W.owner_title??G(W.thread),ye=b.state==="ok"?b.data:null,St=(ye==null?void 0:ye.lifecycle)==="finished",Lt=St&&(ye==null?void 0:ye.outcome)==="cancelled",yn=St&&(ye==null?void 0:ye.outcome)==="complete",Ss=!!oe.created_at,bn=W.acceptance??[],tn=async()=>{var Ce;if(!K||!((Ce=a.commands)!=null&&Ce.complete)||!await i({title:`Mark ${oe.title} done?`,description:ze?`This answers ${xt}'s ask, “${ze.reason}”, closes that wait, and tells ${xt} to check and continue.`:`This tells ${xt||"its thread"} to check and continue.`,action_label:"Mark done"}))return;Y(!0);const De=await a.commands.complete(K);if(Y(!1),!De.ok){$(De.refusal.message);return}await ee(),k({title:oe.title,asker:xt||"Its thread"})},Cs=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[K&&!w?s.jsxs(s.Fragment,{children:[s.jsxs(P,{ref:T,type:"button",variant:"outline",disabled:X,"aria-disabled":A!==null?!0:void 0,"aria-describedby":A!==null?"task-done-why":void 0,onClick:()=>{A===null&&tn()},children:[s.jsx(Mr,{className:"mr-2 size-4","aria-hidden":"true"}),"Done"]}),A!==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 ",Yn(Qe)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:M,children:[s.jsx(vl,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsxs(ya,{children:[s.jsxs("div",{ref:L,className:"contents",children:[s.jsx(Si,{back:B,id:oe.id,badge:Oe?s.jsx(he,{variant:nk(Oe),children:Oe.name}):null,title:oe.title,created:Ss?`Created ${En(oe.created_at)}${xt||W.owner_title?` by ${W.owner_title??xt}`:""}`:null,actions:Cs}),le,te,w?s.jsx("div",{ref:R,tabIndex:-1,role:"status","aria-live":"polite",className:"outline-none",children:s.jsxs(me,{variant:"success",className:"mt-4",children:[s.jsx(Qu,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:["Marked ",w.title," done"]}),s.jsxs(pe,{children:[w.asker," is told to check and continue."]})]})}):null,A!==null?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Done was not recorded"}),s.jsxs(pe,{children:[A," Read again to see the task as it is now."]})]}):null,ze&&!w?s.jsxs(me,{variant:"warning",className:"mt-4",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:[xt," asks: ",ze.reason]}),s.jsxs(pe,{children:["Waiting on you since ",Zp(ze.opened_at),". Done answers it and tells ",xt," to check and continue."]})]}):null,W.view_outdated?s.jsxs(me,{variant:"warning",className:"mt-4",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsxs(pe,{children:[H," 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(hs,{label:"Owner thread",value:W.owner_title??(G(W.thread)||"None")}),s.jsx(hs,{label:"Release",value:W.release??"None"}),s.jsx(hs,{label:"Session",value:b.state==="loading"?"Loading…":b.state==="failed"?"Not available":ye!=null&&ye.session?s.jsxs(s.Fragment,{children:[ye.session.provider," ",s.jsx("span",{className:"font-mono break-all",children:ye.session.id})]}):"None"}),s.jsx(hs,{label:"Now",value:W.local_detail??(Oe==null?void 0:Oe.name)??""})]}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Local tasks have no priority or contributors."}),s.jsx(lD,{detail:W,holder:G((Rs=W.claim)==null?void 0:Rs.user_id),finished_at:St?(ye==null?void 0:ye.finished_at)??null:null,read_at:Qe}),s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(go,{className:"text-info size-4","aria-hidden":"true"}),K?s.jsxs(s.Fragment,{children:[s.jsx(ve,{children:"Done is the one change this page makes"}),s.jsx(pe,{children:"Everything else about this task changes through its thread."})]}):s.jsxs(s.Fragment,{children:[s.jsx(ve,{children:"This page only reads tasks"}),s.jsx(pe,{children:"A task changes through the agent thread working on it."})]})]}),Ss?ye!=null&&ye.record?s.jsxs("p",{className:"mt-4 text-sm",children:["Record ",s.jsx("span",{className:"font-mono break-all",children:ye.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."}),K?s.jsx(vt,{id:"task-done-needs",title:"What Done needs",children:bn.length>0?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The task's acceptance; ",xt||"its thread"," checks these after Done."]}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:bn.map(re=>s.jsx("li",{children:re},re))})]}):s.jsxs("p",{className:"text-sm",children:["Its thread gave no acceptance. Ask ",xt||"its thread"," what Done needs before marking it."]})}):bn.length>0?s.jsxs(vt,{id:"task-acceptance",title:"Acceptance",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:yn?"All met: the task finished complete":Lt&&(ye!=null&&ye.finished_at)?`Cancelled ${En(ye.finished_at)}`:"Met when the task finishes complete"}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:bn.map(re=>s.jsx("li",{children:yn?`Met: ${re}`:re},re))})]}):null,s.jsx(rD,{detail:W,waits:Ne,given:K!==null,threadName:G,threadsLink:s.jsx(r,{className:"text-primary hover:underline",href:l(`/org/${e}/threads`),children:"Threads"})}),b.state==="loading"?s.jsxs("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading the task's sections",children:[s.jsx(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-2/3"})]}):null,ye?s.jsx(vt,{id:"task-stands",title:"Where it stands",children:s.jsxs("p",{className:"text-sm",children:[(Oe==null?void 0:Oe.name)??oe.status_id,W.local_detail?` · ${W.local_detail}`:""]})}):null,ye!=null&&ye.time?s.jsx(iD,{time:ye.time}):null,s.jsx(oD,{sections:b,heading_ref:z,on_retry:()=>void ae("graph"),taskLink:re=>s.jsx(r,{className:"text-primary hover:underline",href:l(`/org/${e}/tasks/${re}?from=task:${oe.id}`),children:re})}),ye!=null&&ye.files?s.jsx(cD,{files:ye.files,finished:St}):null,ye!=null&&ye.proof?s.jsx(uD,{proof:ye.proof,finished_at:ye.finished_at,who:W.owner_title??null}):null,ye&&ye.history.length>0?s.jsx(dD,{history:ye.history}):null,s.jsx(dk,{related:N,heading_ref:S,on_retry:()=>void ae("related"),link:re=>{const De=re.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(re.id)}`:re.kind==="task"?`/org/${e}/tasks/${re.id}?from=task:${oe.id}`:re.kind==="issue"?`/org/${e}/issues/${encodeURIComponent(re.id)}?from=task:${oe.id}`:re.kind==="release"?`/releases?${re.planned?"planned":"release"}=${encodeURIComponent(re.id)}`:null;return De?s.jsx(r,{className:ie("text-primary hover:underline",re.kind!=="thread"&&re.label===re.id&&"font-mono"),href:l(De),children:re.label}):re.label}})]}),o]})}function ya({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 Si({back:e,id:t,badge:n,title:a,created:l,actions:r}){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(Ft,{title:a,description:l??void 0,actions:r})]})}function hs({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 vt({id:e,title:t,aside:n,heading_ref:a,children:l}){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:l})]})}function lD({detail:e,holder:t,finished_at:n,read_at:a}){const l=e.claim,[,r]=u.useReducer(f=>f+1,0),i=l&&!e.view_outdated?new Date(l.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(r,Math.min(f+50,2147483647));return()=>clearTimeout(h)},[i]);let o=s.jsx(hp,{className:"size-4","aria-hidden":"true"}),c="Nobody is working on this",d=null;if(e.view_outdated)c=`Claimed by: ${ck}`;else if(l){const f=new Date(l.lease_expires_at)<=new Date(Math.max(Date.now(),new Date(a).getTime()));o=s.jsx(dp,{className:"size-4","aria-hidden":"true"}),c=`${t} is working on this until ${Yn(l.lease_expires_at)}${f||l.lapsed?" · passed":""}`,d="Claimed in the coordination registry; its thread renews the claim."}else n&&(o=s.jsx(Qu,{className:"size-4","aria-hidden":"true"}),d=`Finished ${En(n)}. Its claim ended when it finished.`);return s.jsxs(jt,{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 rD({detail:e,waits:t,given:n,threadName:a,threadsLink:l}){if(e.view_outdated)return s.jsx(vt,{id:"task-holds",title:"Holds",children:s.jsx("p",{className:"text-sm",children:ck})});if(e.holds.length===0)return null;const r=new Map(t.map(i=>[i.id,i]));return s.jsxs(vt,{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(jt,{className:"mt-2 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Holds",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Type"}),s.jsx(F,{children:"Reason"}),s.jsx(F,{children:"Waiting on"}),s.jsx(F,{children:"Opened"})]})}),s.jsx(He,{children:e.holds.map(i=>{var f;const o=r.get(i.id),c=Xi[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 ",l,": ",o.local_threads.join(" · ")]}):null;return s.jsxs(ue,{"data-testid":"task-hold",children:[s.jsx(q,{children:s.jsx(he,{variant:c.tone,children:(o==null?void 0:o.local_label)??c.label})}),s.jsxs(q,{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(q,{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(q,{children:Zp(i.opened_at)})]},i.id)})})]})})]})}function iD({time:e}){return s.jsx(vt,{id:"task-time",title:"Time",children:s.jsxs("dl",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsx(hs,{label:"Estimate",value:e.estimate?`${Wr(e.estimate.low)}–${Wr(e.estimate.high)}`:e.unknown_reason??"None"}),s.jsx(hs,{label:"Time taken",value:e.elapsed!==null?`${Wr(e.elapsed)}${e.over_estimate?" · over estimate":""}`:"Not started"}),e.forecast?s.jsx(hs,{label:"Reforecast",value:s.jsxs("span",{className:"text-muted-foreground",children:[Wr(e.forecast.low),"–",Wr(e.forecast.high)," left",e.forecast.reason?` · ${e.forecast.reason}`:""]})}):null]})})}function ex({what:e,again:t,refusal:n,on_retry:a}){return s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:["Could not read ",e]}),s.jsxs(pe,{children:[s.jsx("p",{children:n.message}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:t})]})]})}function oD({sections:e,heading_ref:t,on_retry:n,taskLink:a}){const[l,r]=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(vt,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsx(ex,{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(vt,{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=l?o.changes:o.changes.slice(0,ok),d=o.changes.length-c.length;return s.jsxs(vt,{id:"task-graph",title:"Graph changes",aside:o.document,heading_ref:t,children:[s.jsx(jt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Graph changes",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Change"}),s.jsx(F,{children:"Kind of change"}),s.jsx(F,{children:"Also in"}),s.jsx(F,{children:"In the plan"})]})}),s.jsx(He,{children:c.map(f=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx("div",{children:f.label}),s.jsx("div",{className:"text-muted-foreground text-xs",children:f.type})]}),s.jsx(q,{children:tD[f.change]}),s.jsx(q,{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(q,{children:f.planned?"Yes":s.jsx(he,{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(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(!0),children:["Show all ",o.changes.length]})]}):null]})}function cD({files:e,finished:t}){const[n,a]=u.useState(!1),l=n?e.paths:e.paths.slice(0,ok);return s.jsxs(vt,{id:"task-files",title:"Files",children:[l.length>0?s.jsx("ul",{className:"grid gap-1 text-sm",children:l.map(r=>s.jsx("li",{children:s.jsx("span",{className:"font-mono break-all",children:r})},r))}):null,e.paths.length>l.length?s.jsxs(P,{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 uD({proof:e,finished_at:t,who:n}){return s.jsxs(vt,{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 ",En(t),n?` by ${n}`:""]}):null]})}function dD({history:e}){return s.jsxs(vt,{id:"task-history",title:"History",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"From the task record, newest first"}),s.jsx(jt,{className:"mt-2 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"History",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"What"}),s.jsx(F,{children:"Who"}),s.jsx(F,{children:"When"})]})}),s.jsx(He,{children:e.map((t,n)=>s.jsxs(ue,{children:[s.jsx(q,{children:t.what}),s.jsx(q,{children:t.who??"Its thread"}),s.jsx(q,{children:Zp(t.at)})]},`${t.at}:${n}`))})]})})]})}function dk({id:e="task-related",related:t,heading_ref:n,on_retry:a,link:l,fixed:r=!1}){return t.state==="ok"&&t.data.length===0?null:s.jsx(vt,{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(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-2/3"})]}):t.state==="failed"?s.jsx(ex,{what:"related work",again:"Read related work again",refusal:t.refusal,on_retry:a}):s.jsx(jt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Related",className:r?"table-fixed":void 0,children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{className:r?"w-[14%]":void 0,children:"Kind"}),s.jsx(F,{className:r?"w-[45%]":void 0,children:"Item"}),s.jsx(F,{className:r?"w-[41%]":void 0,children:"How it relates"})]})}),s.jsx(He,{children:t.data.map(i=>s.jsxs(ue,{children:[s.jsx(q,{children:nD[i.kind]}),s.jsx(q,{className:r?"break-words":void 0,children:l(i)}),s.jsx(q,{className:r?"break-words":void 0,children:i.relation})]},`${i.kind}:${i.planned?"planned:":""}${i.id}`))})]})})})}function fD({org:e,task_id:t,from:n}){const a=To(),l=`/org/${e}/tasks`;return a.taskSections?s.jsx(aD,{org:e,task_id:t,from:n??null}):s.jsx(hD,{task_id:t,back:l})}function hD({task_id:e,back:t}){const{availability:n}=To(),[a,l]=u.useState({state:"loading"});return u.useEffect(()=>{let r=!0;return n().then(i=>{r&&l(i)}),()=>{r=!1}},[n]),a.state==="off"?s.jsx(ju,{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(Q$,{active:a,task_id:e,back:t}):a.state==="error"?s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This task could not be loaded"}),s.jsx(pe,{children:"Check your connection and try again."})]}):a.state==="available"?s.jsx(ju,{back:t}):s.jsx(Jp,{})})}function Pn({children:e}){return s.jsx("p",{role:"alert",className:"text-destructive text-sm",children:e})}const mD=["open","triaged","resolved","closed"],tx=["low","normal","high","urgent"],pD=["fixed","works_as_intended","planned","duplicate","wont_fix","cannot_reproduce"],xD=["title","description","external_reference"],_u={open:"Open",triaged:"Triaged",escalated:"Escalated",waiting_on_fix:"Waiting on fix",resolved:"Resolved",closed:"Closed"},fk={open:"warning",triaged:"info",escalated:"info",waiting_on_fix:"info",resolved:"success",closed:"neutral"},Ki={low:"Low",normal:"Normal",high:"High",urgent:"Urgent"},nx={fixed:"Fixed",works_as_intended:"Works as intended",planned:"Planned",duplicate:"Duplicate",wont_fix:"Won't fix",cannot_reproduce:"Cannot reproduce"},hk={title:"Title",description:"Description",external_reference:"External reference"},gD=[["year",365*24*3600],["month",30*24*3600],["week",7*24*3600],["day",24*3600],["hour",3600],["minute",60]];function Rc(e,t=Date.now()){const n=Math.round((new Date(e).getTime()-t)/1e3),a=new Intl.RelativeTimeFormat("en",{numeric:"auto"});for(const[l,r]of gD)if(Math.abs(n)>=r)return a.format(Math.round(n/r),l);return"just now"}function sm(e,t,n){const a=`/org/${encodeURIComponent(e)}/proj/${encodeURIComponent(t)}/support`;return n?`${a}/${encodeURIComponent(n)}`:a}function sx(e,t){return e?t??"Not available":"A former member"}const vD="the issue integration";function yD(e){return!e.created_by&&e.reporter_kind==="customer"?vD:sx(e.created_by,e.created_by_username)}function bD(e,t){return!e.actor_id&&e.kind==="created"&&t.reporter_kind==="customer"?"The issue integration":sx(e.actor_id,e.actor_username)}const lc="not_set",jD="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 _D({create:e,open:t,onOpenChange:n,onCreated:a}){const[l,r]=u.useState(""),[i,o]=u.useState(""),[c,d]=u.useState(!1),[f,h]=u.useState(""),[m,g]=u.useState(lc),[j,v]=u.useState(!1),[y,x]=u.useState(null),p=u.useRef(null),b=()=>{r(""),o(""),d(!1),h(""),g(lc),x(null),p.current=null},_=w=>{var k;return((k=y==null?void 0:y.personal_data)==null?void 0:k.field)===w?y.message:void 0},N=async w=>{if(w.preventDefault(),j)return;v(!0),p.current??(p.current=crypto.randomUUID());const k=await e({request_id:p.current,title:i.trim()||void 0,description:f||void 0,external_reference:l.trim()||void 0,priority:m===lc?null:m});if(v(!1),!k.ok){k.refusal.status!==0&&(p.current=null),x(k.refusal);return}b(),a(k.data.issue,k.data.duplicates)},C=y&&!y.personal_data?y.message:void 0;return s.jsx(es,{open:t,onOpenChange:w=>{w||b(),n(w)},children:s.jsx(ts,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:N,className:"grid gap-4",children:[s.jsxs(ns,{children:[s.jsx(as,{children:"New support issue"}),s.jsx(ls,{children:"Log one help-desk report. Text is shown exactly as entered."})]}),s.jsxs(me,{variant:"warning",children:[s.jsx(xn,{}),s.jsx(pe,{children:jD})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-issue-reference",children:"External reference"}),s.jsx(Ot,{id:"maintain-issue-reference",value:l,"aria-invalid":!!_("external_reference"),onChange:w=>{r(w.target.value),c||o(w.target.value)}}),_("external_reference")?s.jsx(Pn,{children:_("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(Me,{htmlFor:"maintain-issue-title",children:"Title"}),s.jsx(Ot,{id:"maintain-issue-title",value:i,"aria-invalid":!!_("title"),onChange:w=>{o(w.target.value),d(!0)}}),_("title")?s.jsx(Pn,{children:_("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(Me,{htmlFor:"maintain-issue-description",children:"Description"}),s.jsx(ks,{id:"maintain-issue-description",rows:4,placeholder:"What the end user reported, without personal data",value:f,"aria-invalid":!!_("description"),onChange:w=>h(w.target.value)}),_("description")?s.jsx(Pn,{children:_("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-issue-priority",children:"Priority"}),s.jsxs(dt,{value:m,onValueChange:g,children:[s.jsx(it,{id:"maintain-issue-priority",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:lc,children:"Not set"}),tx.map(w=>s.jsx(ke,{value:w,children:Ki[w]},w))]})]})]}),C?s.jsx(Pn,{children:C}):null,s.jsxs(ss,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>{b(),n(!1)},children:"Cancel"}),s.jsx(P,{type:"submit",loading:j,disabled:!i.trim()&&!l.trim(),children:"Log issue"})]})]})})})}const wD=["supportAccess","assigneeCandidates","create","update","assign","transition","redact"];function mk(){return ND(en().issues)}function ND(e){return e&&wD.every(t=>typeof e[t]=="function")?e:null}function pk(e){const[t,n]=u.useState(null);return u.useEffect(()=>{if(!e)return;let a=!1;return e.supportAccess().then(l=>{a||n({contract:e,state:l.ok?{state:"ready",access:l.data}:{state:"error"}})}),()=>{a=!0}},[e]),t&&e&&t.contract===e?t.state:{state:"loading"}}function xk({access:e,header:t,back_href:n,children:a}){const{href:l,Link:r}=Ve();return e.state==="loading"?s.jsxs("div",{className:"flex flex-1 items-center justify-center py-24",children:[s.jsx(gn,{className:"size-5"}),s.jsx("span",{className:"sr-only",children:"Loading…"})]}):e.state==="error"||!e.access.enabled?s.jsx(Ba,{title:"Page not found",description:"This page does not exist or you do not have access to it.",backHref:l(n),backLabel:"Back to the project",link:r}):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(TR,{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 kD(){const e=Ve();return t=>{e.navigate?e.navigate(t):window.location.assign(e.href(t))}}const ln="all",rc=25;function am({action:e}){return s.jsx(Ft,{title:"Support",description:"Help-desk reports logged against this project.",actions:e})}function SD({org:e,project:t,query:n}){const a=mk(),l=pk(a),r=`/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(xk,{access:l,header:s.jsx(am,{}),back_href:r,children:i=>a?s.jsx(CD,{contract:a,access:i,org_name:e,proj_name:t,query:n}):null})})}function CD({contract:e,access:t,org_name:n,proj_name:a,query:l}){const{href:r,Link:i}=Ve(),o=kD(),[c,d]=u.useState(()=>new URLSearchParams(l).get("external_reference")??""),[f,h]=u.useState(ln),[m,g]=u.useState(ln),[j,v]=u.useState(ln),[y,x]=u.useState(0),[p,b]=u.useState(null),[_,N]=u.useState(0),[C,w]=u.useState(null),[k,A]=u.useState([]),[$,X]=u.useState(!1),Y=c.trim()!==""||f!==ln||m!==ln||j!==ln,L=u.useCallback(async()=>{const S=await e.list({external_reference:c.trim()||void 0,status:f===ln?void 0:f,priority:m===ln?void 0:m,assignee:j===ln?void 0:j,limit:rc,offset:y*rc});if(!S.ok){w(S.refusal.message);return}w(null),b(S.data.issues),N(S.data.total)},[e,c,f,m,j,y]);u.useEffect(()=>{const S=setTimeout(()=>void L(),200);return()=>clearTimeout(S)},[L]),u.useEffect(()=>{e.assigneeCandidates().then(S=>{S.ok&&A(S.data.candidates)})},[e]);const H=t.can_change?s.jsxs(P,{onClick:()=>X(!0),children:[s.jsx(yr,{className:"mr-2 size-4"}),"New issue"]}):void 0,T=s.jsx(_D,{create:e.create,open:$,onOpenChange:X,onCreated:(S,O)=>{X(!1);const Z=sm(n,a,S.id);o(O.length?`${Z}?duplicates=${O.length}`:Z)}});if(p!==null&&_===0&&!Y&&y===0)return s.jsxs(s.Fragment,{children:[s.jsx(am,{}),s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(wR,{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(P,{onClick:()=>X(!0),children:[s.jsx(yr,{className:"mr-2 size-4"}),"Log the first issue"]}):null]}),T]});const R=_===0?0:y*rc+1,z=Math.min(_,(y+1)*rc);return s.jsxs(s.Fragment,{children:[s.jsx(am,{action:H}),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(YR,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2","aria-hidden":!0}),s.jsx(Ot,{"aria-label":"Filter by external reference",placeholder:"Filter by external reference",className:"pl-9",value:c,onChange:S=>{d(S.target.value),x(0)}})]}),s.jsx(Ef,{label:"Status",value:f,onChange:S=>{h(S),x(0)},options:mD.map(S=>({value:S,label:_u[S]}))}),s.jsx(Ef,{label:"Priority",value:m,onChange:S=>{g(S),x(0)},options:tx.map(S=>({value:S,label:Ki[S]}))}),s.jsx(Ef,{label:"Assignee",value:j,onChange:S=>{v(S),x(0)},options:[{value:"unassigned",label:"Unassigned"},{value:"cannot_act",label:"Assignee cannot act"},...k.map(S=>({value:S.user_id,label:S.username??"Not available"}))]})]}),C?s.jsx(Pn,{children:C}):null,s.jsx("div",{className:"rounded-md border",children:s.jsxs(Be,{children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Title"}),s.jsx(F,{children:"External reference"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Priority"}),s.jsx(F,{children:"Assignee"}),s.jsx(F,{children:"Updated"})]})}),s.jsx(He,{children:p===null?s.jsx(ue,{children:s.jsx(q,{colSpan:6,className:"h-24 text-center",children:"Loading…"})}):p.length===0?s.jsx(ue,{children:s.jsx(q,{colSpan:6,className:"h-24 text-center",children:"No issues match these filters."})}):p.map(S=>s.jsxs(ue,{children:[s.jsx(q,{className:"max-w-md",children:s.jsx(i,{href:r(sm(n,a,S.id)),className:"font-medium hover:underline",children:S.title})}),s.jsx(q,{className:"font-mono text-xs",children:S.external_reference??""}),s.jsx(q,{children:s.jsx(he,{variant:fk[S.status],children:_u[S.status]})}),s.jsx(q,{children:S.priority?Ki[S.priority]:""}),s.jsx(q,{children:s.jsx(RD,{issue:S})}),s.jsx(q,{className:"text-muted-foreground",children:Rc(S.updated_at)})]},S.id))})]})}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-muted-foreground text-sm",children:_===0?"No issues.":`Showing ${R}–${z} of ${_} issue${_===1?"":"s"}.`}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(P,{variant:"outline",size:"sm",disabled:y===0,onClick:()=>x(S=>Math.max(0,S-1)),children:"Previous"}),s.jsx(P,{variant:"outline",size:"sm",disabled:z>=_,onClick:()=>x(S=>S+1),children:"Next"})]})]}),T]})}function RD({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(he,{variant:"error",children:"Assignee cannot act"}):null]}):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}function Ef({label:e,value:t,onChange:n,options:a}){var r;const l=u.useMemo(()=>t===ln||a.some(i=>i.value===t),[a,t]);return s.jsxs(dt,{value:l?t:ln,onValueChange:n,children:[s.jsx(it,{className:"w-44","aria-label":e,children:s.jsx(ft,{placeholder:e,children:t===ln?e:(r=a.find(i=>i.value===t))==null?void 0:r.label})}),s.jsxs(ot,{children:[s.jsx(ke,{value:ln,children:"All"}),a.map(i=>s.jsx(ke,{value:i.value,children:i.label},i.value))]})]})}const gk=[{key:"local",label:"Local"},{key:"staging",label:"Staging"},{key:"production",label:"Production"}],TD=/^iss-\d{1,9}$/,ED=/^col-\d{1,9}$/,AD=e=>e&&e[0].toUpperCase()+e.slice(1);function vk(e){const t=AD(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 Ci(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 lm={search:"",owner:null,urgent:!1,seen:[],label:null,collection:null};function Tc(e){const t=new URLSearchParams(e),n=t.getAll("seen").filter(l=>gk.some(r=>r.key===l)),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&&ED.test(a)?a:null}}function Xl(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 MD(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 Sv=e=>!!(e.search.trim()||e.owner||e.urgent||e.seen.length||e.label||e.collection),OD={agent:"Filed by an agent",user:"Filed by you",tool:"Filed by a tool"},$D={graph:"Placed on the graph by its anchors",files:"Placed by its files",unplaced:"Triaged, not placed yet"},DD={handoff:"Handed to its owner",backlog:"Sent to the unowned backlog",batch:"Routed to a batch"};function zD(e,t=""){const n=(e??t).trim();if(!n)return"";const a=n.indexOf(": "),l=(a===-1?n:n.slice(0,a)).trim(),r=a===-1?"":n.slice(a+2).trim(),i=o=>r?`${o} ${r}`:o;switch(l){case"filed":return OD[r]??i("Filed by");case"labelled":return i("Labelled");case"unlabelled":return r?`Label removed: ${r}`:"Label removed";case"anchored":return r?`Anchored to ${r}`:"Anchored";case"triaged":return $D[r]??(r?`Triaged: ${r}`:"Triaged");case"routed":return DD[r]??(r?`Routed: ${r}`:"Routed");case"route closed":return r==="backlog"?"Taken off the unowned backlog":r?`Route closed: ${r}`:"Route closed";case"released":return r?`Released by its owner (task ${r})`:"Released by its owner";case"resolved":return r==="duplicate"?"Resolved as a duplicate":r?`Resolved · ${r.replace(/_/g," ")}`:"Resolved";case"reopened":return r?`Reopened: ${r}`:"Reopened";case"fix landed":return r?`Fix landed in ${r.slice(0,10)}`:"Fix landed";case"merged":return r?`Merged ${r} into this issue`:"Merged a duplicate into this issue";default:return n}}const LD=e=>e.replace(/`+/g,"").replace(/\s+/g," ").trim(),yk="This page only reads issues",bk="File, route and resolve issues with the issue command or through the thread working on them.",UD=10,BD=250,Tl="__all",HD="none",ID=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function jk(){const e=en().issues;if(!e)throw new Error("The Issues page rendered without the issues seam.");return e}const PD=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 qD({project:e,query:t,onQuery:n}){var G;const a=jk(),{href:l,Link:r}=Ve(),i=u.useMemo(()=>Tc(t),[t]),o=Xl(i),c=Sv(i),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState(null),[g,j]=u.useState(null),v=u.useRef(0),y=u.useRef(0),x=u.useRef(null),p=u.useRef(null),b=Wn(),_=u.useRef(!1),[N,C]=u.useState(i.search),w=u.useCallback(M=>n(Xl({...i,...M})),[i,n]),k=u.useCallback(async()=>{const M=y.current+=1;j(null);const V=await a.list(MD(Tc(o)));if(M!==y.current)return;if(V.ok){v.current=0,m(null),f({state:"ok",list:V.data,local:V.data.local??PD(new Date().toISOString()),key:o});return}const ae=V.refusal.reason;if(ae==="engine_missing")return f({state:"engine_missing",refusal:V.refusal});if(ae==="view_outdated")return f({state:"view_outdated"});if(v.current+=1,v.current===1&&ID(V.refusal)){j(V.refusal.retry_after??UD);return}m(V.refusal)},[a.list,o]);u.useEffect(()=>{k()},[k]),u.useEffect(()=>{if(g===null)return;const M=setTimeout(()=>void k(),g*1e3);return()=>clearTimeout(M)},[g,k]),u.useEffect(()=>{document.activeElement!==x.current&&C(i.search)},[i.search]),u.useEffect(()=>{if(N===i.search)return;const M=setTimeout(()=>w({search:N}),BD);return()=>clearTimeout(M)},[N,i.search,w]),u.useEffect(()=>{const M=V=>{if(V.key!=="/"||V.metaKey||V.ctrlKey||V.altKey)return;const ae=V.target;ae&&(ae.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(ae.tagName))||x.current&&(V.preventDefault(),x.current.focus())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[]);const A=()=>{var M;C(""),n(Xl(lm)),(M=x.current)==null||M.focus()},$=()=>{v.current=0,k()},X=()=>{_.current=!0,$()};u.useEffect(()=>{var V;if(!_.current||d.state==="loading"||g!==null)return;_.current=!1;const M=(V=p.current)==null?void 0:V.querySelector("h1");M&&(M.tabIndex=-1,M.focus())},[d,h,g]);const Y=M=>`/proj/${encodeURIComponent(e)}/issues${M?`?${M}`:""}`,L=M=>`/proj/${encodeURIComponent(e)}/issues/${encodeURIComponent(M)}?from=issues${o?`&${o}`:""}`,H=s.jsx("div",{role:"status","aria-live":"polite",children:g!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(gn,{"aria-hidden":"true"}),"Issues are busy. Reading them again…"]}):null}),T=h?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Issues could not be loaded"}),s.jsxs(pe,{children:[s.jsxs("p",{children:[h.message,h.since?` Since ${Yn(h.since)}.`:"",d.state==="ok"?` The list below was read at ${Yn(d.local.read_at)}.`:"",h.message.includes(ol)?"":` ${ol}`]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:X,children:"Retry"})]})]}):null,R=s.jsx(Ft,{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 ",Yn(d.local.read_at)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:$,children:[s.jsx(vl,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]}):null});if(d.state==="engine_missing")return s.jsx(ic,{ref:p,children:s.jsx(Js,{page:"Issues"})});if(d.state==="view_outdated")return s.jsxs(ic,{ref:p,children:[R,s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsx(pe,{children:b})]})]});if(d.state==="loading")return s.jsxs(ic,{ref:p,children:[R,H,T,!h&&g===null?s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading issues",children:Array.from({length:6},(M,V)=>s.jsx(pt,{className:V===5?"h-10 w-2/3":"h-10 w-full"},V))}):null]});const{list:z,local:S}=d,O=!h&&g===null&&(d.key!==o||N!==i.search),Z=Sv(Tc(d.key)),E=S.scope==="folder",I=S.listed===0&&!c,ne=Math.max(0,S.listed-S.facets.owners.reduce((M,V)=>M+V.count,0)),ee=i.collection?((G=S.collections.find(M=>M.collection===i.collection))==null?void 0:G.title)??i.collection:null,ge=new Map;for(const M of z.issues){const V=M.group??"unplaced";ge.set(V,[...ge.get(V)??[],M])}return s.jsxs(ic,{ref:p,children:[R,E&&S.folder?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Issues of the folder ",S.folder,", from its issue store."]}):null,s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(go,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:yk}),s.jsx(pe,{children:bk})]}),H,T,I?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(vR,{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(Ot,{ref:x,type:"search",className:"w-64","aria-label":"Search issues",placeholder:"Search issues",value:N,onChange:M=>C(M.target.value)}),s.jsxs(dt,{value:i.owner??Tl,onValueChange:M=>w({owner:M===Tl?null:M}),children:[s.jsx(it,{className:"w-56","aria-label":"Owner",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:Tl,children:"All owners"}),s.jsxs(ke,{value:HD,children:["Unowned (",ne,")"]}),S.facets.owners.map(M=>s.jsxs(ke,{value:M.key,children:[M.title," (",M.count,")"]},M.key))]})]}),s.jsxs(dt,{value:i.label??Tl,onValueChange:M=>w({label:M===Tl?null:M}),children:[s.jsx(it,{className:"w-48","aria-label":"Label",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:Tl,children:"All labels"}),S.facets.labels.map(M=>s.jsxs(ke,{value:M.label,children:[M.label," (",M.count,")"]},M.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(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":i.urgent,onClick:()=>w({urgent:!i.urgent}),children:["Urgent ",S.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"}),gk.map(M=>{const V=i.seen.includes(M.key);return s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":V,onClick:()=>w({seen:V?i.seen.filter(ae=>ae!==M.key):[...i.seen,M.key]}),children:[M.label," ",S.facets.seen[M.key]]},M.key)}),ee!==null?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{"data-testid":"issues-collection-chip",className:ie(rd({variant:"outline",size:"sm"}),TA),children:["Collection ",ee]}),s.jsx(P,{type:"button",variant:"ghost",size:"sm-icon","aria-label":"Remove the collection filter",onClick:()=>{var M;w({collection:null}),(M=x.current)==null||M.focus()},children:s.jsx(Ju,{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(gn,{"aria-hidden":"true"}),"Searching…"]}):c&&z.total>0?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:[z.total," of ",S.listed," issues ·"," ",s.jsx(P,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:A,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:Z&&z.total===0?s.jsxs("p",{className:"mt-6 flex items-center gap-2 text-sm",children:[s.jsx(Wu,{className:"text-muted-foreground size-4","aria-hidden":"true"}),"No issues match."," ",s.jsx(P,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:A,children:"Clear"})]}):S.groups.map(M=>s.jsx(GD,{id:`issues-${M.key}`,title:`${M.label} · ${M.count}`,issues:ge.get(M.key)??[],folder:E,link:V=>s.jsx(r,{className:"text-primary hover:underline",href:l(L(V.id)),children:V.title})},M.key))}),!c&&S.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 · ",S.collections.length]}),s.jsx(jt,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Collections",className:"table-fixed",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{className:"w-1/2",children:"Collection"}),s.jsx(F,{className:"w-1/4",children:"Resolved"}),s.jsx(F,{className:"w-1/4",children:"Updated"})]})}),s.jsx(He,{children:S.collections.map(M=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx(r,{className:"text-primary hover:underline",href:l(Y(Xl({...lm,collection:M.collection}))),children:M.title}),s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:M.collection})]}),s.jsxs(q,{children:[M.resolved," of ",M.total," resolved"]}),s.jsx(q,{className:"text-muted-foreground",children:Ci(M.updated_at)})]},M.collection))})]})})]}):null]})]})}const ic=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 GD({id:e,title:t,issues:n,folder:a,link:l}){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(jt,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:t,className:"table-fixed",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{className:a?"w-[30%]":"w-[36%]",children:"Title"}),s.jsx(F,{className:"w-[10%]",children:"Issue"}),a?s.jsx(F,{className:"w-[12%]",children:"Project"}):null,s.jsx(F,{className:"w-[16%]",children:"Status"}),s.jsx(F,{className:"w-[8%]",children:"Urgent"}),s.jsx(F,{className:a?"w-[14%]":"w-[18%]",children:"Owner"}),s.jsx(F,{className:"w-[12%]",children:"Updated"})]})}),s.jsx(He,{children:n.map(r=>{var o;const i=vk(r);return s.jsxs(ue,{"data-testid":"issues-row",children:[s.jsxs(q,{className:"break-words",children:[l(r),(o=r.labels)!=null&&o.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:r.labels.map(c=>s.jsx(he,{variant:"neutral",size:"dense",children:c},c))}):null]}),s.jsx(q,{className:"font-mono text-xs",children:r.id}),a?s.jsx(q,{className:"break-words",children:r.project_id??"Folder"}):null,s.jsx(q,{children:s.jsx(he,{variant:i.tone,children:i.label})}),s.jsx(q,{children:r.urgent&&r.status!=="resolved"&&r.group!=="resolved"?s.jsx(he,{variant:"warning",children:"Urgent"}):null}),s.jsx(q,{className:"break-words",children:r.owner_title?r.owner_title:s.jsx("span",{className:"text-muted-foreground",children:"Unowned"})}),s.jsx(q,{className:"text-muted-foreground",children:Ci(r.updated_at)})]},r.id)})})]})})]})}function VD(e){var t;return(t=en().issues)!=null&&t.issueSections?s.jsx(qD,{...e}):s.jsx(SD,{org:e.org,project:e.project,query:e.query})}function YD({update:e,issue:t,open:n,onOpenChange:a,onDone:l,onReload:r}){const[i,o]=u.useState(t.title),[c,d]=u.useState(t.description),[f,h]=u.useState(t.external_reference??""),[m,g]=u.useState(t),[j,v]=u.useState(null),[y,x]=u.useState(!1);u.useEffect(()=>{n&&(o(t.title),d(t.description),h(t.external_reference??""),g(t),v(null))},[n]);const p=N=>{var C;return((C=j==null?void 0:j.personal_data)==null?void 0:C.field)===N?j.message:void 0},b=async N=>{N.preventDefault(),x(!0);const C=await e(m.id,m.revision,{title:i,description:c,external_reference:f.trim()||null});if(x(!1),!C.ok){v(C.refusal);return}l(C.data.issue)},_=async()=>{const N=await r();N&&(g(N),v(null))};return s.jsx(es,{open:n,onOpenChange:a,children:s.jsx(ts,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:b,className:"grid gap-4",children:[s.jsxs(ns,{children:[s.jsx(as,{children:"Edit issue"}),s.jsx(ls,{children:"Text is shown exactly as entered."})]}),j!=null&&j.conflict?s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{}),s.jsx(pe,{children:"Someone else saved this issue after you opened it, so nothing was saved. Your text is kept below; reload the latest issue, then save to apply it."})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-edit-title",children:"Title"}),s.jsx(Ot,{id:"maintain-edit-title",value:i,"aria-invalid":!!p("title"),onChange:N=>o(N.target.value)}),p("title")?s.jsx(Pn,{children:p("title")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-edit-description",children:"Description"}),s.jsx(ks,{id:"maintain-edit-description",rows:4,value:c,"aria-invalid":!!p("description"),onChange:N=>d(N.target.value)}),p("description")?s.jsx(Pn,{children:p("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-edit-reference",children:"External reference"}),s.jsx(Ot,{id:"maintain-edit-reference",value:f,"aria-invalid":!!p("external_reference"),onChange:N=>h(N.target.value)}),p("external_reference")?s.jsx(Pn,{children:p("external_reference")}):null]}),j&&!j.conflict&&!j.personal_data?s.jsx(Pn,{children:j.message}):null,s.jsxs(ss,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),j!=null&&j.conflict?s.jsxs(P,{type:"button",variant:"outline",onClick:_,children:[s.jsx(vl,{className:"mr-2 size-4"}),"Reload latest"]}):null,s.jsx(P,{type:"submit",loading:y,disabled:!!(j!=null&&j.conflict),children:"Save"})]})]})})})}function Cv(e){return e.map(t=>hk[t].toLowerCase()).join(", ")}function FD(e){switch(e.kind){case"created":return"Logged the issue";case"updated":return`Edited the ${Cv(e.fields)}`;case"redacted":return`Redacted the ${Cv(e.fields)}`;case"priority_set":return e.priority?`Set priority to ${Ki[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?_u[e.to_status]:"";return e.resolution_reason?`Moved to ${t}: ${nx[e.resolution_reason]}`:`Moved to ${t}`}}}function Rv(e,t){return t==="external_reference"?e.external_reference??"":e[t]}function XD({redact:e,issue:t,open:n,onOpenChange:a,onDone:l,onReload:r}){const[i,o]=u.useState("description"),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,g]=u.useState(null),[j,v]=u.useState(t);u.useEffect(()=>{n&&(v(t),d(Rv(t,i)),g(null))},[n]);const y=async x=>{x.preventDefault(),h(!0);const p=await e(j.id,j.revision,i,c);if(h(!1),!p.ok){if(p.refusal.conflict){const b=await r();b&&v(b),g("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}g(p.refusal.message);return}l(p.data.issue)};return s.jsx(es,{open:n,onOpenChange:a,children:s.jsx(ts,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:y,className:"grid gap-4",children:[s.jsxs(ns,{children:[s.jsx(as,{children:"Redact text"}),s.jsx(ls,{children:"Replace text that holds personal data, such as a name."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-redact-field",children:"Field"}),s.jsxs(dt,{value:i,onValueChange:x=>{const p=x;o(p),d(Rv(j,p))},children:[s.jsx(it,{id:"maintain-redact-field",children:s.jsx(ft,{})}),s.jsx(ot,{children:xD.map(x=>s.jsx(ke,{value:x,children:hk[x]},x))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-redact-replacement",children:"Replacement text"}),s.jsx(ks,{id:"maintain-redact-replacement",rows:4,value:c,onChange:x=>d(x.target.value)})]}),s.jsxs(me,{variant:"warning",children:[s.jsx(xn,{}),s.jsx(pe,{children:"This cannot be undone: the original text is removed for good. History records only that this field was redacted."})]}),m?s.jsx(Pn,{children:m}):null,s.jsxs(ss,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(P,{type:"submit",variant:"destructive",loading:f,children:"Redact"})]})]})})})}function KD({transition:e,issue:t,open:n,onOpenChange:a,onDone:l}){const[r,i]=u.useState("fixed"),[o,c]=u.useState(!1),[d,f]=u.useState(null),h=async m=>{m.preventDefault(),c(!0);const g=await e(t.id,t.revision,"resolved",r);if(c(!1),!g.ok){if(g.refusal.conflict){l(null);return}f(g.refusal.message);return}f(null),l(g.data.issue)};return s.jsx(es,{open:n,onOpenChange:a,children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:h,className:"grid gap-4",children:[s.jsxs(ns,{children:[s.jsx(as,{children:"Resolve issue"}),s.jsx(ls,{children:"Choose how this report ended."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"maintain-resolution-reason",children:"Resolution reason *"}),s.jsxs(dt,{value:r,onValueChange:m=>i(m),children:[s.jsx(it,{id:"maintain-resolution-reason",children:s.jsx(ft,{})}),s.jsx(ot,{children:pD.map(m=>s.jsx(ke,{value:m,children:nx[m]},m))})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopening the issue clears its reason."})]}),d?s.jsx(Pn,{children:d}):null,s.jsxs(ss,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(P,{type:"submit",loading:o,children:"Resolve"})]})]})})})}const El="not_set";function QD({org:e,project:t,issue_id:n,query:a}){const l=mk(),r=pk(l),i=sm(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(xk,{access:r,header:s.jsx(Ft,{title:"Support"}),back_href:i,children:o=>l?s.jsx(ZD,{contract:l,issue_id:n,access:o,list_href:i,duplicates:Number(new URLSearchParams(a).get("duplicates")??0)}):null})})}function ZD({contract:e,issue_id:t,access:n,list_href:a,duplicates:l}){const{href:r,Link:i}=Ve(),o=Ar(),[c,d]=u.useState(null),[f,h]=u.useState([]),[m,g]=u.useState(!1),[j,v]=u.useState([]),[y,x]=u.useState(null),p=u.useCallback(async()=>{const w=await e.issue(t);return w.ok?(d(w.data.issue),h(w.data.events),w.data.issue):(w.refusal.status===404?g(!0):o.error(w.refusal.message),null)},[e,t,o]);u.useEffect(()=>{let w=!1;return e.issue(t).then(k=>{if(!w){if(!k.ok){k.refusal.status===404?g(!0):o.error(k.refusal.message);return}d(k.data.issue),h(k.data.events)}}),()=>{w=!0}},[e,t]),u.useEffect(()=>{n.can_change&&e.assigneeCandidates().then(w=>{w.ok&&v(w.data.candidates)})},[e,n.can_change]);const b=async w=>{const k=await w;if(!k.ok){o.error(k.refusal.message),k.refusal.conflict&&await p();return}await p()};if(m)return s.jsx(Ba,{title:"Support issue not found",description:"This issue does not exist in this project.",backHref:r(a),backLabel:"Back to Support",link:i});if(!c)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading…"});const _=c.status==="closed",N=n.can_change,C=w=>b(e.transition(c.id,c.revision,w));return s.jsxs(s.Fragment,{children:[s.jsx(Ft,{title:c.title,actions:N?s.jsxs(s.Fragment,{children:[_?null:s.jsxs(P,{variant:"outline",onClick:()=>x("edit"),children:[s.jsx(Zu,{className:"mr-2 size-4"}),"Edit"]}),s.jsxs(P,{variant:"outline",onClick:()=>x("redact"),children:[s.jsx(aR,{className:"mr-2 size-4"}),"Redact"]}),c.status==="open"?s.jsx(P,{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(P,{onClick:()=>x("resolve"),children:[s.jsx(Qu,{className:"mr-2 size-4"}),"Resolve"]}):null,c.status==="resolved"?s.jsxs(s.Fragment,{children:[s.jsxs(P,{variant:"outline",onClick:()=>void C("open"),children:[s.jsx(qR,{className:"mr-2 size-4"}),"Reopen"]}),s.jsx(P,{onClick:()=>void C("closed"),children:"Close"})]}):null]}):void 0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(he,{variant:fk[c.status],children:_u[c.status]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Logged by ",yD(c)," ",Rc(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:[l>0&&c.external_reference?s.jsxs(me,{variant:"info",children:[s.jsx(Ua,{}),s.jsxs(pe,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[s.jsxs("span",{children:[c.external_reference," is already logged on"," ",l===1?"another issue":`${l} other issues`," in this project."]}),s.jsx(P,{asChild:!0,variant:"outline",size:"sm",children:s.jsx(i,{href:r(`${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(Be,{children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"When"}),s.jsx(F,{children:"Who"}),s.jsx(F,{children:"What"})]})}),s.jsx(He,{children:f.map(w=>s.jsxs(ue,{children:[s.jsx(q,{className:"text-muted-foreground",children:Rc(w.created_at)}),s.jsx(q,{children:bD(w,c)}),s.jsx(q,{children:FD(w)})]},w.id))})]})})]})]}),s.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-5 lg:w-72",children:[s.jsx(Jr,{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(Jr,{label:"Resolution",children:s.jsx("span",{className:"text-sm",children:nx[c.resolution_reason]})}):null,s.jsx(Jr,{label:"Priority",id:"maintain-issue-priority",children:s.jsxs(dt,{value:c.priority??El,disabled:!N||_,onValueChange:w=>void b(e.update(c.id,c.revision,{priority:w===El?null:w})),children:[s.jsx(it,{id:"maintain-issue-priority",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:El,children:"Not set"}),tx.map(w=>s.jsx(ke,{value:w,children:Ki[w]},w))]})]})}),s.jsxs(Jr,{label:"Assignee",id:"maintain-issue-assignee",children:[s.jsxs(dt,{value:c.assignee_id??El,disabled:!N||_,onValueChange:w=>void b(e.assign(c.id,c.revision,w===El?null:w)),children:[s.jsx(it,{id:"maintain-issue-assignee",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[s.jsx(ke,{value:El,children:"Not set"}),c.assignee_id&&!j.some(w=>w.user_id===c.assignee_id)?s.jsx(ke,{value:c.assignee_id,children:sx(c.assignee_id,c.assignee_username)}):null,j.map(w=>s.jsx(ke,{value:w.user_id,children:w.username??"Not available"},w.user_id))]})]}),c.assignee_can_act===!1?s.jsx(he,{variant:"error",className:"self-start",children:"Assignee cannot act"}):null]}),s.jsx(Jr,{label:"Updated",children:s.jsx("span",{className:"text-sm",children:Rc(c.updated_at)})})]})]}),s.jsx(YD,{update:e.update,issue:c,open:y==="edit",onOpenChange:w=>x(w?"edit":null),onReload:p,onDone:()=>{x(null),p()}}),s.jsx(XD,{redact:e.redact,issue:c,open:y==="redact",onOpenChange:w=>x(w?"redact":null),onReload:p,onDone:()=>{x(null),o.success("The text was redacted."),p()}}),s.jsx(KD,{transition:e.transition,issue:c,open:y==="resolve",onOpenChange:w=>x(w?"resolve":null),onDone:w=>{x(null),w||o.error("Someone else changed this issue; it is reloaded."),p()}})]})}function Jr({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 WD=10,JD=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Tv=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;function e3(e,t,n,a=""){const l=n!=null&&n.startsWith("task:")?n.slice(5):null;if(l&&JD.test(l))return{label:l,path:`/org/${e}/tasks/${l}`};const r=`/proj/${encodeURIComponent(t)}/releases`,i=n!=null&&n.startsWith("release:")?n.slice(8):null;if(i&&Tv.test(i))return{label:i==="candidate"?"Candidate":i,path:`${r}?release=${encodeURIComponent(i)}`};const o=n!=null&&n.startsWith("planned:")?n.slice(8):null;if(o&&Tv.test(o))return{label:o,path:`${r}?planned=${encodeURIComponent(o)}`};const c=Xl(Tc(a));return{label:"Issues",path:`/proj/${encodeURIComponent(t)}/issues${c?`?${c}`:""}`}}const t3=["Fixed in","Being fixed in","The release planned to fix it"];function n3(e){const t=e.filter(n=>n.kind==="release");for(const n of t3){const a=t.find(l=>l.relation===n);if(a)return a}return t[0]??null}function s3({org:e,project:t,issue_id:n,from:a,query:l=""}){var Oe;const r=jk(),{href:i,Link:o}=Ve(),c=e3(e,t,a,l),d=`/proj/${encodeURIComponent(t)}/issues`,f=K=>`${d}/${encodeURIComponent(K)}`,[h,m]=u.useState({state:"loading"}),[g,j]=u.useState(null),[v,y]=u.useState(null),[x,p]=u.useState({state:"loading"}),[b,_]=u.useState({state:"loading"}),N=u.useRef(null),C=Wn(),w=u.useRef(null),k=u.useRef(!1),A=u.useRef(0),$=u.useRef(0),X=u.useCallback(async()=>{if(!r.issueSections)return;p({state:"loading"});const K=await r.issueSections(n);p(K.ok?{state:"ok",data:K.data}:{state:"failed",refusal:K.refusal})},[r.issueSections,n]),Y=u.useCallback(async()=>{if(!r.issueRelated)return;_({state:"loading"});const K=await r.issueRelated(n);_(K.ok?{state:"ok",data:K.data}:{state:"failed",refusal:K.refusal})},[r.issueRelated,n]),L=u.useCallback(async()=>{const K=$.current+=1;if(y(null),!TD.test(n)){m({state:"missing"});return}X(),Y();const Ne=await r.issue(n);if(K!==$.current)return;if(Ne.ok){A.current=0,j(null),m({state:"ok",issue:Ne.data.issue,events:Ne.data.events,at:new Date().toISOString()});return}const ze=Ne.refusal.reason;if(Ne.refusal.status===404||ze==="not_found")return m({state:"missing"});if(ze==="engine_missing")return m({state:"engine_missing",refusal:Ne.refusal});if(ze==="view_outdated")return m({state:"view_outdated"});if(A.current+=1,A.current===1&&uk(Ne.refusal)){y(Ne.refusal.retry_after??WD);return}j(Ne.refusal)},[r.issue,n,X,Y]);u.useEffect(()=>{L()},[L]),u.useEffect(()=>{if(v===null)return;const K=setTimeout(()=>void L(),v*1e3);return()=>clearTimeout(K)},[v,L]),u.useEffect(()=>{var Ne;if(k.current||h.state!=="ok")return;k.current=!0;const K=(Ne=N.current)==null?void 0:Ne.querySelector("h1");K&&(K.tabIndex=-1,K.focus())},[h.state]);const H=u.useRef(null);u.useEffect(()=>{var ze;const K=H.current;if(K===null||(K==="sections"?x:b).state==="loading")return;H.current=null;const Ne=(K==="related"?w.current:null)??((ze=N.current)==null?void 0:ze.querySelector("h1"));Ne==null||Ne.focus()},[x,b]);const T=K=>{H.current=K,K==="sections"?X():Y()},R=()=>{A.current=0,L()},z=u.useRef(!1),S=()=>{z.current=!0,R()};if(u.useEffect(()=>{var Ne;if(!z.current||h.state==="loading"||v!==null)return;z.current=!1;const K=(Ne=N.current)==null?void 0:Ne.querySelector("h1");K&&(K.tabIndex=-1,K.focus())},[h,g,v]),h.state==="missing")return s.jsx(ya,{children:s.jsx(Ba,{icon:s.jsx(Wu,{"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(P,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(o,{href:i(c.path),children:[s.jsx(s0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(h.state==="engine_missing"||h.state==="view_outdated")return s.jsx(ya,{children:h.state==="engine_missing"?s.jsx(Js,{page:"Issue",header:s.jsx(Si,{back:O,id:null,title:n})}):s.jsxs(s.Fragment,{children:[s.jsx(Si,{back:O,id:null,title:n}),s.jsxs(me,{variant:"warning",className:"mt-4",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsx(pe,{children:C})]})]})});const Z=g?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This issue could not be loaded"}),s.jsxs(pe,{children:[s.jsxs("p",{children:[g.message,g.since?` Since ${Yn(g.since)}.`:"",h.state==="ok"?` This page was read at ${Yn(h.at)}.`:"",g.message.includes(ol)?"":` ${ol}`]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:S,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(gn,{"aria-hidden":"true"}),"This issue is busy. Reading it again…"]}):null});if(h.state==="loading")return s.jsxs(ya,{children:[s.jsx("div",{children:O}),E,Z,!g&&v===null?s.jsxs("div",{className:"mt-4 grid gap-3",role:"status","aria-label":"Loading issue",children:[s.jsx(pt,{className:"h-6 w-40"}),s.jsx(pt,{className:"h-9 w-2/3"}),s.jsx(pt,{className:"h-24 w-full"})]}):null]});const{issue:I,events:ne,at:ee}=h,ge=vk(I),G=x.state==="ok"?x.data:null,M=(G==null?void 0:G.reporter)??I.created_by_username??null,V=b.state==="ok"?n3(b.data):null,ae=I.status==="resolved"||I.group==="resolved",B=!!(G!=null&&G.duplicate_of),te=x.state==="loading"?"Loading…":(G==null?void 0:G.routing.owner)??I.owner_title??s.jsx("span",{className:"text-muted-foreground",children:"Unowned"}),J=K=>`${d}?${Xl({...lm,collection:K})}`,le=G==null?void 0:G.report,W=!!(le&&(le.actual||le.expected||le.steps.length||le.where)),Qe=[...ne].reverse(),oe=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 ",Yn(ee)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:R,children:[s.jsx(vl,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsx(ya,{children:s.jsxs("div",{ref:N,className:"contents",children:[s.jsx(Si,{back:O,id:I.id,badge:s.jsxs(s.Fragment,{children:[s.jsx(he,{variant:ge.tone,children:ge.label}),I.urgent&&!ae?s.jsx(he,{variant:"warning",children:"Urgent"}):null]}),title:I.title,created:`Reported${M?` by ${M}`:""} · ${Ci(I.created_at)}`,actions:oe}),G!=null&&G.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(G.duplicate_of)),children:G.duplicate_of})]}):null,E,Z,x.state==="loading"?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",role:"status",children:[s.jsx(gn,{"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(hs,{label:"Owner",value:te}),B?null:s.jsx(hs,{label:"Release",value:b.state==="loading"?"Loading…":V?s.jsx("span",{className:ie(V.label===V.id&&"font-mono"),children:V.label}):s.jsx("span",{className:"text-muted-foreground",children:"No release yet"})}),s.jsx(hs,{label:"Reported",value:[M,I.created_at?En(I.created_at):null].filter(Boolean).join(" · ")})]}),s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(go,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:yk}),s.jsx(pe,{children:bk})]}),x.state==="failed"?s.jsx("div",{className:"mt-6",children:s.jsx(ex,{what:"this issue's sections",again:"Read the issue again",refusal:x.refusal,on_retry:()=>T("sections")})}):null,G&&W&&le?s.jsxs(vt,{id:"issue-report",title:"What happens",children:[le.actual?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:le.actual}):null,le.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:le.expected})]}):null,le.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:le.steps.map((K,Ne)=>s.jsx("li",{children:K},Ne))})]}):null,(Oe=le.where)!=null&&Oe.env?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:["Seen on ",le.where.env,le.where.sha?s.jsxs(s.Fragment,{children:[" ","at ",s.jsx("span",{className:"font-mono",children:le.where.sha})]}):null]}):null]}):null,G&&(G.placement.placed||G.placement.unplaced_why)?s.jsx(vt,{id:"issue-placement",title:"Placement",children:G.placement.placed?s.jsxs("p",{className:"text-sm",children:["Placed in ",G.placement.placed]}):s.jsxs(me,{variant:"warning",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:["Not placed yet: ",G.placement.unplaced_why]})]})}):null,G&&(G.routing.route||G.routing.owner||G.routing.none)?s.jsxs(vt,{id:"issue-routing",title:"Routing",children:[G.routing.route?s.jsx("p",{className:"text-sm",children:G.routing.route}):null,G.routing.owner?s.jsxs("p",{className:"text-sm",children:["Owner: ",G.routing.owner]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"Owner: none yet"})]}):null,G&&(G.labels.length>0||G.collections.length>0)?s.jsxs(vt,{id:"issue-labels",title:"Labels and collections",children:[G.labels.length?s.jsx("div",{className:"flex flex-wrap gap-1",children:G.labels.map(K=>s.jsx(he,{variant:"neutral",size:"dense",children:K},K))}):null,G.collections.length?s.jsx("ul",{className:"mt-2 grid gap-1 text-sm",children:G.collections.map(K=>s.jsxs("li",{children:[s.jsx(o,{className:"text-primary hover:underline",href:i(J(K.collection)),children:K.title}),K.ref?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",K.ref]}):null,s.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",K.resolved," of ",K.total," resolved"]})]},K.collection))}):null]}):null,G&&G.anchors.length>0?s.jsx(vt,{id:"issue-anchors",title:"Anchors",children:s.jsx(Af,{label:"Anchors",heads:["Kind","Value","By"],rows:G.anchors.map(K=>[K.kind,s.jsx("span",{className:"font-mono text-xs break-all",children:K.value}),K.by??""])})}):null,G&&G.seen.length>0?s.jsx(vt,{id:"issue-seen",title:"Seen",aside:`${G.seen.length} of ${Math.max(I.occurrences??0,G.seen.length)} sightings`,children:s.jsx(Af,{label:"Seen",heads:["When","Where","Who","Note"],rows:G.seen.map(K=>[Ci(K.at),s.jsxs(s.Fragment,{children:[K.sha?s.jsx("div",{className:"font-mono text-xs",children:K.sha}):null,K.env?s.jsx("div",{className:"text-muted-foreground text-xs",children:K.env}):null]}),K.who??"",K.note??""])})}):null,Qe.length>0?s.jsx(vt,{id:"issue-history",title:"History",aside:"From the issue store, newest first",children:s.jsx(Af,{label:"History",heads:["When","Who","What"],rows:Qe.map(K=>[Ci(K.created_at),K.actor_username??"",zD(K.note,K.kind)])})}):null,s.jsx(dk,{id:"issue-related",related:b,heading_ref:w,on_retry:()=>T("related"),fixed:!0,link:K=>{const Ne=K.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(K.id)}`:K.kind==="task"?`/org/${e}/tasks/${encodeURIComponent(K.id)}?from=issue:${I.id}`:K.kind==="issue"?f(K.id):K.kind==="release"?`/proj/${encodeURIComponent(t)}/releases?${K.planned?"planned":"release"}=${encodeURIComponent(K.id)}`:null;if(K.kind==="task"&&Ne){const ze=LD(K.label);return s.jsxs("div",{className:"min-w-0",children:[s.jsx(o,{className:"text-primary font-mono text-xs hover:underline",href:i(Ne),children:K.id}),ze&&ze!==K.id?s.jsx("div",{className:"text-muted-foreground line-clamp-1 text-xs",title:ze,"data-testid":"related-task-title",children:ze}):null]})}return Ne?s.jsx(o,{className:ie("text-primary hover:underline",K.kind!=="thread"&&K.label===K.id&&"font-mono"),href:i(Ne),children:K.label}):K.label}})]})})}function Af({label:e,heads:t,rows:n}){return s.jsx(jt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:e,children:[s.jsx(Ge,{children:s.jsx(ue,{children:t.map(a=>s.jsx(F,{children:a},a))})}),s.jsx(He,{children:n.map((a,l)=>s.jsx(ue,{children:a.map((r,i)=>s.jsx(q,{className:"break-words",children:r},i))},l))})]})})}function a3({org:e,project:t,issue_id:n,from:a,query:l}){var r;return(r=en().issues)!=null&&r.issueSections?s.jsx(s3,{org:e,project:t,issue_id:n,from:a,query:l}):s.jsx(QD,{org:e,project:t,issue_id:n,query:l})}function wu(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 _k={integration:"Integration",deploy:"Deploy",publish:"Publish",accept:"Accept",custom:"Custom"},l3={self_service:"Self-service",managed:"Managed",manager_only:"Manager only"},r3={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"},i3={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 o3(e){return i3[e??"in_batch"]}function c3(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 u3(e,t,n,a=!0){return e.fixing_since!==void 0?{label:`Fixing forward since ${Hn(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 Hn(e){return new Date(e*1e3).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Al(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 d3(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 f3(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 h3(e,t){var o,c;const{policy:n,management:a}=e,l=(o=e.layer)==null?void 0:o.kind,r=d=>f3(d,t),i=[["Mode",r3[a.mode]],["Who can join",r(a.joiners)]];return l==="implement"&&i.push(["Managers",r(a.managers)],["Manager lease",Al(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 ${Al(n.freeze.max_seconds)}, ${Al(n.freeze.default_seconds)} by default`+(e.layer.freezers?` · ${r(e.layer.freezers)}`:""):"Off"],["Fix forward",n.fix_forward?"Yes: a failed turn keeps its turn until fixed":"No"],["Stalled turns",a.stall_takers.kind==="none"?"Nobody takes one":`${r(a.stall_takers)} may take one after ${Al(n.stall_seconds)}`])),i.push(["Reorder",r(a.reorderers)]),n.max_turns>1&&i.push(["Turns at once",`Up to ${n.max_turns} independent turns`]),i.push(["Turn lease",Al(n.lease_seconds)],["Time to start",`${Al(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 Nk="Where your organization's agents take turns at a shared branch, environment or proposal. One turn runs at a time in each queue.",kk="A task you cannot see",m3="A former member",p3="A member";function Sk(){const e=en().queues;if(!e)throw new Error("The Queues page rendered without the queues seam.");return e}function x3({org:e,open:t,path:n}){var h,m;const a=Sk(),{href:l,Link:r}=Ve(),i=a.availability,[o,c]=u.useState({state:"loading"}),d=u.useCallback(async g=>{i&&(g&&c({state:"loading"}),c(await i({fresh:g})))},[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(Ba,{title:"Page not found",description:"This page does not exist, or you do not have access to it.",backHref:l(`/org/${e}`),backLabel:"Back to the organization",link:r}):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(v3,{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(Js,{page:"Queues"}):s.jsxs(s.Fragment,{children:[s.jsx(Ft,{title:"Queues",description:a.description??Nk}),o.state==="loading"&&s.jsx(Ck,{}),(o.state==="error"||o.state==="off")&&s.jsx(rm,{refusal:o.refusal,on_retry:()=>void d(!0)}),o.state==="available"&&s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Tasks are not on for this organization"}),s.jsxs(pe,{children:["Queues hold turns for tasks, so they show once Tasks are on."," ",s.jsx(r,{className:"text-primary hover:underline",href:l(`/org/${e}/tasks`),children:"Go to Tasks"})]})]})]})})}function Ck(){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(pt,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function rm({refusal:e,on_retry:t}){const n=Wn();return(e==null?void 0:e.reason)==="store_locked"?s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"The local stores are busy"}),s.jsxs(pe,{children:[s.jsx("p",{children:e.message}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]}):(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsx(pe,{children:n})]}):s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Queues could not be loaded"}),s.jsxs(pe,{children:[s.jsx("p",{children:"The read did not answer. Try again in a moment."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}const Mf=e=>e.status===404||e.reason==="not_found"||e.code==="not_found";function g3(e,t,n,a){return t?e===null?`Not reading · trying again every ${n}s`:`Not reading since ${Hn(e)} · trying again every ${n}s`:e===null?"Connecting…":`Live · read ${Hn(e)} · refreshes every ${n}s${a?` · ${a}`:""}`}function v3({org:e,open:t,path:n}){var M;const{listQueues:a,queue:l,members:r,refresh_ms:i,settings_note:o,description:c,read_scope:d,subject_label:f="Task",thread_subjects:h=!1}=Sk(),{self_id:m}=Ku(),[g,j]=u.useState(null),[v,y]=u.useState(null),[x,p]=u.useState(null),[b,_]=u.useState(null),[N,C]=u.useState({state:"pending",members:[]});u.useEffect(()=>{let V=!0;return r().then(ae=>{V&&C(B=>ae.ok?{state:"answered",members:ae.data}:{state:"failed",members:B.members})}),()=>{V=!1}},[r]);const w=u.useMemo(()=>new Map(N.members.map(V=>[V.user_id,V])),[N.members]),k=N.state==="answered"?m3:p3,A=u.useCallback((V,ae)=>{var B;return(ae==null?void 0:ae.title)??(h?(ae==null?void 0:ae.id)??V:V===m?"You":((B=w.get(V))==null?void 0:B.label)??k)},[w,k,m,h]),$=u.useRef({list:{last:null,fresh:!1},detail:{last:null,fresh:!1}}),[X,Y]=u.useState(null),[L,H]=u.useState(!1),T=u.useCallback((V,ae)=>{$.current[V]={last:ae,fresh:!0};const{list:B,detail:te}=$.current;H(B.last==="failed"||te.last==="failed"),B.fresh&&te.fresh&&B.last==="ok"&&te.last==="ok"&&Y(Date.now()/1e3)},[]),R=t??((M=g==null?void 0:g.queues[0])==null?void 0:M.id)??null,z=u.useRef(R);u.useEffect(()=>{z.current=R},[R]);const S=u.useRef(0),O=u.useCallback(async()=>{var B;const V=S.current+=1;$.current.list.fresh=!1;const ae=await a();if(V===S.current)if(ae.ok){if(j(ae.data),y(null),!t){const te=((B=ae.data.queues[0])==null?void 0:B.id)??null;te===null?$.current.detail={last:"ok",fresh:!0}:te!==z.current&&($.current.detail.fresh=!1)}T("list","ok")}else y(ae.refusal),T("list","failed")},[a,t,T]),Z=u.useRef(0),E=u.useCallback(async()=>{const V=Z.current+=1;if(!R)return;$.current.detail.fresh=!1;const ae=await l(R);V===Z.current&&(ae.ok?(p(ae.data),_(null),T("detail","ok")):(_(ae.refusal),Mf(ae.refusal)&&p(null),T("detail",Mf(ae.refusal)?"ok":"failed")))},[R,l,T]);u.useEffect(()=>{O()},[O]),u.useEffect(()=>{p(null),_(null),E()},[E]);const I=u.useCallback(()=>{O(),E()},[O,E]),ne=!g&&(v==null?void 0:v.reason)==="engine_missing",ee=u.useCallback(()=>{ne||I()},[ne,I]);if(wu(ee,i),ne)return s.jsx(Js,{page:"Queues"});const ge=Math.round(i/1e3),G=b!==null&&Mf(b);return s.jsxs(s.Fragment,{children:[s.jsxs(Ft,{title:"Queues",description:c??Nk,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:g3(X,L,ge,d)}),s.jsx("span",{className:"sr-only",role:"status",children:L?"Not reading":X===null?"Connecting":"Live"})]}),!g&&!v&&s.jsx(Ck,{}),!g&&v&&s.jsx(rm,{refusal:v,on_retry:I}),g&&g.queues.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(o0,{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."})]}):g?s.jsxs(s.Fragment,{children:[s.jsx(b3,{path:n,queues:g.queues,open_id:R,name:A,held:h}),G?s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This queue is no longer available"}),s.jsx(pe,{children:"It was archived, or you can no longer read its Workspace. Pick another queue above."})]}):x&&x.queue.id===R?s.jsx(j3,{org:e,detail:x,name:A,settings_note:o,subject_label:f,thread_subjects:h}):b?s.jsx(rm,{refusal:b,on_retry:()=>void E()}):s.jsx(pt,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"})]}):null]})}function im({org:e,subject:t,link:n}){const{href:a,Link:l}=Ve();return!t||t.hidden?s.jsx("span",{className:"text-muted-foreground",children:kk}):t.kind==="task"&&n?s.jsx(l,{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 y3(e,t,n){const a=e.freeze?`frozen until ${Hn(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 ${Hn(e.batch.opened_at)}`,a].filter(Boolean).join(" · "),warn:!1};if(e.turn){const l=e.turn.subject,r=l.hidden?kk:l.title??l.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}${r}${o}`,secondary:Of(d.join(" · ")),warn:!1}:{primary:`${i}${r}${o}`,secondary:d.length?Of(d.join(" · ")):null,warn:d.length>0}}return{primary:"Nothing running",secondary:a?Of(a):null,warn:!!a}}const Of=e=>e.charAt(0).toUpperCase()+e.slice(1);function b3({path:e,queues:t,open_id:n,name:a,held:l}){const{href:r,Link:i}=Ve();return s.jsx(jt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Queues",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Queue"}),s.jsx(F,{className:"hidden md:table-cell",children:"Step"}),s.jsx(F,{children:"Running turn"}),s.jsx(F,{className:"hidden text-right md:table-cell",children:"Waiting"})]})}),s.jsx(He,{children:t.map(o=>{var m;const c=o.id===n,d=d3(o),f=y3(o,a,l),h=o.waiting-(((m=o.batch)==null?void 0:m.remaining)??0);return s.jsxs(ue,{"data-testid":"queues-row",className:ie(c&&"bg-accent"),children:[s.jsxs(q,{children:[s.jsx(i,{className:"text-primary hover:underline",href:r(`${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(q,{className:"hidden md:table-cell",children:s.jsx(he,{variant:"neutral",children:_k[o.policy.step]})}),s.jsxs(q,{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(q,{className:"hidden text-right md:table-cell",children:h})]},o.id)})})]})})}function oc({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 Ev({org:e,entries:t,landing:n,queue_name:a,subject_label:l,held:r,label:i}){return s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Be,{containerAriaLabel:i,children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:l}),s.jsx(F,{children:"State"})]})}),s.jsx(He,{children:t.map(o=>{const c=u3(o,n,a,r);return s.jsxs(ue,{"data-testid":"queues-running",children:[s.jsxs(q,{children:[s.jsx(im,{org:e,subject:o.subject,link:!r}),r&&o.hold&&o.note&&!o.subject.hidden?s.jsx("div",{className:"text-muted-foreground text-xs",children:o.note}):null]}),s.jsx(q,{children:s.jsx(he,{variant:c.tone,children:c.label})})]},o.ref)})})]})})}function j3({org:e,detail:t,name:n,settings_note:a,subject_label:l,thread_subjects:r}){var _;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,g=Math.max(1,f.filter(N=>N.batching!=="in_batch").length),j=m&&i.policy.independent_turns?f.filter(N=>N.batching!=="in_batch"&&N.ref!==m.holder):[],v=o.manager,y=o.freeze,x=((_=i.layer)==null?void 0:_.kind)==="release"?i.layer.stall_hold:void 0,p=x?{who:n(x.by),why:x.reason,until:x.until}:v!=null&&v.hold?{who:n(v.holder,v.holder_subject),why:v.hold.why,until:v.hold.until}:null,b=!m&&f.length===0&&h.length===0;return s.jsxs(jt,{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(he,{variant:"neutral",children:_k[i.policy.step]}),s.jsx(he,{variant:"neutral",children:l3[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(nT,{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 ",Hn(v.lease_until),v.serving_until!==void 0?" · serving now":""]})]}):null,y?s.jsxs(me,{variant:"warning",children:[s.jsx(QR,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:["Frozen until ",Hn(y.lease_until)]}),s.jsxs(pe,{children:[n(y.holder,y.holder_subject)," froze this queue at ",Hn(y.since),y.label?`: ${y.label}`:"",". Only ",n(y.holder,y.holder_subject),"'s entries start until it thaws."]})]}):null,p?s.jsxs(me,{variant:"info",children:[s.jsx(c0,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:["Stall hold until ",Hn(p.until)]}),s.jsxs(pe,{children:[p.who,p.why?`: ${p.why}`:"",". The first entry is not treated as stalled while it lasts."]})]}):null,b?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(oc,{id:"queue-running",title:"Running turn",side:`Batch opened by ${n(m.holder,m.holder_subject)} at ${Hn(m.opened_at)}`,children:[s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Be,{containerAriaLabel:"Batch members",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Landing order"}),s.jsx(F,{children:l}),s.jsx(F,{children:"Outcome"})]})}),s.jsx(He,{children:m.members.map((N,C)=>{const w=o3(N.outcome);return s.jsxs(ue,{"data-testid":"queues-member",children:[s.jsx(q,{children:C+1}),s.jsx(q,{children:s.jsx(im,{org:e,subject:N.subject??d.get(N.ref)??(r?{kind:"thread",id:N.ref}:void 0),link:!r})}),s.jsx(q,{children:s.jsx(he,{variant:w.tone,children:w.label})})]},N.ref)})})]})}),j.length>0?s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"text-muted-foreground text-xs font-medium",children:"Also running"}),s.jsx(Ev,{org:e,entries:j,landing:o.landing,queue_name:i.name,subject_label:l,held:r,label:"Turns running beside the batch"})]}):null]}):s.jsx(oc,{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(Ev,{org:e,entries:f,landing:o.landing,queue_name:i.name,subject_label:l,held:r,label:"Running turns"})}),s.jsx(oc,{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(Be,{containerAriaLabel:"Waiting entries",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Position"}),s.jsx(F,{children:l}),s.jsx(F,{className:"hidden md:table-cell",children:"Joined"}),s.jsx(F,{children:"Turn"}),s.jsx(F,{className:"hidden md:table-cell",children:"Note"})]})}),s.jsx(He,{children:h.map((N,C)=>{const w=c3(N);return s.jsxs(ue,{"data-testid":"queues-waiting",children:[s.jsx(q,{children:m?g+C+1:N.position}),s.jsx(q,{children:s.jsx(im,{org:e,subject:N.subject,link:!r})}),s.jsx(q,{className:"hidden md:table-cell",children:Hn(N.joined_at)}),s.jsx(q,{children:s.jsx(he,{variant:w.tone,children:w.label})}),s.jsx(q,{className:"hidden md:table-cell",children:N.subject.hidden?"":N.note??""})]},N.ref)})})]})})})]}),s.jsx(oc,{id:"queue-settings",title:"Settings",children:s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsx(Be,{containerAriaLabel:"Queue settings",children:s.jsx(He,{children:h3(i,c).map(([N,C])=>s.jsxs(ue,{children:[s.jsx(F,{scope:"row",className:"h-auto w-48 py-2 font-normal",children:N}),s.jsx(q,{children:C})]},N))})})})}),s.jsx("p",{className:"text-muted-foreground text-xs",children:a})]})}const us="__no_parent__";function Rk(e,t){const n=new Set([t]);for(let a=!0;a;){a=!1;for(const l of e)l.parent&&n.has(l.parent)&&!n.has(l.key)&&(n.add(l.key),a=!0)}return n}const Qi=(e,t)=>(e.label||e.key).localeCompare(t.label||t.key);function qn({id:e,label:t,help:n,error:a,children:l}){const r=[n?`${e}-help`:null,a?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:e,children:t}),l(r),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 Av({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 Mv({id:e,label:t,help:n,checked:a,on_change:l}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(zr,{id:e,className:"mt-0.5",checked:a,"aria-describedby":n?`${e}-help`:void 0,onCheckedChange:r=>l(r===!0)}),s.jsx(Me,{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 Tk({id:e,legend:t,help:n,error:a,options:l,checked:r,on_change:i,empty:o}){const c=[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":c,"aria-invalid":a?!0:void 0,children:[s.jsx("legend",{className:"mb-2 text-sm leading-none font-medium",children:t}),l.length===0&&o?s.jsx("p",{className:"text-muted-foreground text-sm",children:o}):null,s.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:l.map((d,f)=>s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(zr,{id:`${e}-${f}`,className:"mt-0.5",checked:r.has(d.value),onCheckedChange:h=>{const m=new Set(r);h===!0?m.add(d.value):m.delete(d.value),i(m)}}),s.jsx(Me,{htmlFor:`${e}-${f}`,className:"min-w-0 font-normal break-words",children:d.label})]},d.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 om({context:e,action:t,title:n="Two-factor sign-in needed"}){const a=e.two_factor==="enroll";return s.jsxs(me,{variant:"destructive",role:"alert",children:[s.jsx(XR,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:n}),s.jsxs(pe,{children:[s.jsx("p",{children:a?`Turn on two-factor sign-in in Account Settings, then come back here and ${t}.`:`Changing the org needs a two-factor sign-in. Sign in again with your authenticator in Account Settings, then come back here and ${t}.`}),s.jsx(P,{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 Ir=e=>e.two_factor==="ok";function Eo({refusal:e,context:t,subject:n,action:a}){if((e==null?void 0:e.kind)==="two_factor")return s.jsx(om,{context:t,action:a,title:`Could not save ${n}`});const l=Ir(t)?null:s.jsx(om,{context:t,action:a});if(!e)return l;const r=e.kind==="changed"?"The org changed since you opened this":e.kind==="authority"?`Could not save ${n}`:null;return s.jsxs(s.Fragment,{children:[l,s.jsxs(me,{variant:"destructive",role:"alert",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),r?s.jsx(ve,{children:r}):null,s.jsx(pe,{children:e.message})]})]})}function Ek({id:e,value:t,on_change:n,none:a,options:l,described_by:r}){return s.jsxs(dt,{value:t,onValueChange:n,children:[s.jsx(it,{id:e,"aria-describedby":r,children:s.jsx(ft,{placeholder:"Choose a team"})}),s.jsxs(ot,{children:[a?s.jsx(ke,{value:us,children:a}):null,l.map(i=>s.jsx(ke,{value:i.key,children:i.label||i.key},i.key))]})]})}function Ao(e){const[t,n]=u.useState(!1),[a,l]=u.useState(null);return{saving:t,refusal:a,set_refusal:l,run:async i=>{n(!0),l(null);try{const o=await i();o?l(o):e()}finally{n(!1)}}}}function Nd({saving:e,blocked:t,described_by:n,children:a}){return s.jsx(P,{type:"submit",disabled:e,"aria-disabled":t||void 0,"aria-describedby":t?n:void 0,children:a})}const Ak=(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 _3({open:e,chart:t,team:n,save:a,on_close:l,context:r=kd,scope:i="full",parents:o}){var S;const c=r.host==="hosted",[d,f]=u.useState(""),[h,m]=u.useState(""),[g,j]=u.useState(""),[v,y]=u.useState(us),[x,p]=u.useState({}),{saving:b,refusal:_,set_refusal:N,run:C}=Ao(l),w=((S=t.teams.find(O=>O.parent===null))==null?void 0:S.key)??null;u.useEffect(()=>{e&&(f(""),m((n==null?void 0:n.label)??""),j((n==null?void 0:n.description)??""),y((n==null?void 0:n.parent)??(c&&w&&(!o||o.includes(w))?w:us)),p({}),N(null))},[e,n,N,c,w,o]);const k=O=>{const Z=t.teams.find(E=>E.key===O);return Z?Z.label||Z.key:O??""},A=n?Rk(t.teams,n.key):new Set,$=[...t.teams].filter(O=>!A.has(O.key)&&(!o||o.includes(O.key))).sort((O,Z)=>O.key===w?-1:Z.key===w?1:Qi(O,Z)),X=n?n.label||n.key:"",Y=i==="description",L=!Ir(r),H=n?Y?"save the description":"save the team":"add the team",T=O=>{if(O.preventDefault(),L)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===us){p({parent:"Choose the parent team."});return}const ne=c?I:h.trim()||I;C(()=>a({action:"add",kind:"team",key:I,...h.trim()?{label:h.trim()}:{},...g.trim()?{description:g.trim()}:{},...v!==us?{parent:v}:{}},`Team ${ne} added.`));return}if(!Y&&!h.trim()){p({label:c?"Give the team a name.":"Give the team a label."});return}const Z=v===us?null:v,E={...!Y&&h.trim()!==n.label.trim()?{label:h.trim()}:{},...g.trim()!==(n.description??"").trim()?{description:g.trim()}:{},...!c&&Z!==n.parent?{parent:Z}:{}};if(Object.keys(E).length===0){l();return}C(()=>a({action:"edit",kind:"team",key:n.key,...E},Y?`Saved the description of ${X}.`:`Team ${h.trim()} saved.`))},R=n?Y?`Edit the description of ${X}`:`Edit team ${X}`:"Add team";let z;return Y?z="Say what the team works on. Only the description is yours to change here.":c?z=n?"Rename the team or say what it works on.":"Add a team to the organization.":n?z=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."]}):z="Add a team to this repository's local org.",s.jsx(es,{open:e,onOpenChange:O=>O||b?null:l(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:T,noValidate:!0,children:[s.jsxs(ns,{children:[s.jsx(as,{children:R}),s.jsx(ls,{children:z})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Eo,{refusal:_,context:r,subject:Y?"the description":"the team",action:H}),!n&&!c?s.jsx(qn,{id:"org-team-key",label:"Key",help:Ak("team",r.host),error:x.key,children:O=>s.jsx(Ot,{id:"org-team-key",className:"font-mono",value:d,autoComplete:"off","aria-invalid":x.key?!0:void 0,"aria-describedby":O,onChange:Z=>{f(Z.target.value),p({})}})}):null,Y&&n?s.jsx(Av,{label:"Name",children:n.parent?`${X} · under ${k(n.parent)}`:X}):s.jsx(qn,{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:x.label,children:O=>s.jsx(Ot,{id:"org-team-label",value:h,"aria-invalid":x.label?!0:void 0,"aria-describedby":O,onChange:Z=>{m(Z.target.value),p({})}})}),s.jsx(qn,{id:"org-team-description",label:Y?"Description":"Description (optional)",children:()=>s.jsx(ks,{id:"org-team-description",rows:3,placeholder:"What the team does",value:g,onChange:O=>j(O.target.value)})}),Y?null:c&&n?s.jsx(Av,{label:"Parent team",children:n.parent?k(n.parent):"None: the organization itself"}):s.jsx(qn,{id:"org-team-parent",label:"Parent team",help:"Where the team sits; its posts report up through the team above.",error:x.parent,children:O=>s.jsx(Ek,{id:"org-team-parent",value:v,on_change:Z=>{y(Z),p({})},none:c?void 0:"No parent (a root team)",options:$,described_by:O})})]}),s.jsxs(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:b,onClick:l,children:"Cancel"}),s.jsx(Nd,{saving:b,blocked:L,children:n?b?"Saving…":"Save":b?"Adding…":"Add team"})]})]})})})}const w3=(e,t)=>e.length===t.size&&e.every(n=>t.has(n));function N3({open:e,chart:t,job:n,save:a,on_close:l,context:r=kd}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,g]=u.useState(us),[j,v]=u.useState(new Set),[y,x]=u.useState(!1),[p,b]=u.useState(!0),[_,N]=u.useState({}),{saving:C,refusal:w,set_refusal:k,run:A}=Ao(l);u.useEffect(()=>{e&&(o(""),d((n==null?void 0:n.label)??""),h((n==null?void 0:n.description)??""),g((n==null?void 0:n.parent)??us),v(new Set((n==null?void 0:n.fills)??[])),x((n==null?void 0:n.requires_person)??!1),b((n==null?void 0:n.escalable)??!0),N({}),k(null))},[e,n,k]);const $=n?Rk(t.job_functions,n.key):new Set,X=[...t.job_functions].filter(R=>!$.has(R.key)).sort(Qi),Y=[...t.slots].sort(Qi).map(R=>({value:R.key,label:R.label||R.key})),L=!Ir(r),H=n?"save the job function":"add the job function",T=R=>{if(R.preventDefault(),L)return;if(!n){if(!i.trim()){N({key:"Give the job function a key."});return}A(()=>a({action:"add",kind:"job_function",key:i.trim(),...c.trim()?{label:c.trim()}:{},...f.trim()?{description:f.trim()}:{},...m!==us?{parent:m}:{},fills:[...j],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 z=m===us?null:m,S={...c.trim()!==n.label.trim()?{label:c.trim()}:{},...f.trim()!==(n.description??"").trim()?{description:f.trim()}:{},...z!==n.parent?{parent:z}:{},...w3(n.fills,j)?{}:{fills:[...j]},...y!==n.requires_person?{requires_person:y}:{},...p!==n.escalable?{escalable:p}:{}};if(Object.keys(S).length===0){l();return}A(()=>a({action:"edit",kind:"job_function",key:n.key,...S},`Job function ${c.trim()} saved.`))};return s.jsx(es,{open:e,onOpenChange:R=>R||C?null:l(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:T,noValidate:!0,children:[s.jsxs(ns,{children:[s.jsx(as,{children:n?`Edit job function ${n.label||n.key}`:"Add job function"}),s.jsxs(ls,{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(Eo,{refusal:w,context:r,subject:"the job function",action:H}),n?null:s.jsx(qn,{id:"org-function-key",label:"Key",help:Ak("job function",r.host),error:_.key,children:R=>s.jsx(Ot,{id:"org-function-key",className:"font-mono",value:i,autoComplete:"off","aria-invalid":_.key?!0:void 0,"aria-describedby":R,onChange:z=>{o(z.target.value),N({})}})}),s.jsx(qn,{id:"org-function-label",label:n?"Label":"Label (optional)",error:_.label,children:R=>s.jsx(Ot,{id:"org-function-label",value:c,"aria-invalid":_.label?!0:void 0,"aria-describedby":R,onChange:z=>{d(z.target.value),N({})}})}),s.jsx(qn,{id:"org-function-description",label:"Job description (optional)",children:()=>s.jsx(ks,{id:"org-function-description",rows:3,placeholder:"What this job function does",value:f,onChange:R=>h(R.target.value)})}),s.jsx(qn,{id:"org-function-parent",label:"Parent function",help:"Its posts report to the post of the parent function.",children:R=>s.jsx(Ek,{id:"org-function-parent",value:m,on_change:g,none:"No parent (a root function)",options:X,described_by:R})}),s.jsx(Tk,{id:"org-function-fills",legend:"Slots it fills",options:Y,checked:j,on_change:v,empty:r.host==="hosted"?"This organization has no slots yet.":"This org has no slots yet; add them with sdlc org add slot."}),s.jsx(Mv,{id:"org-function-requires-person",label:"Requires a person",help:"Only a person may hold its posts.",checked:y,on_change:x}),s.jsx(Mv,{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:b})]}),s.jsxs(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:C,onClick:l,children:"Cancel"}),s.jsx(Nd,{saving:C,blocked:L,children:n?C?"Saving…":"Save":C?"Adding…":"Add job function"})]})]})})})}function k3({open:e,chart:t,binding:n,names:a,save:l,confirm:r,on_close:i}){var k;const[o,c]=u.useState(new Set),[d,f]=u.useState(""),[h,m]=u.useState({}),{saving:g,refusal:j,set_refusal:v,run:y}=Ao(i);if(u.useEffect(()=>{!e||!n||(c(new Set(n.posts.map(A=>A.post))),f(n.source==="override"?n.reason??"":""),m({}),v(null))},[e,n,v]),!n)return null;const x=a.slot(n.slot),p=(k=t.project)!=null&&k.team?t.teams.find(A=>{var $;return A.key===(($=t.project)==null?void 0:$.team)}):void 0,b=p?p.label||p.key:"the owning team",_=new Set(t.job_functions.filter(A=>A.fills.includes(n.slot)).map(A=>A.key)),N=[...t.posts].map(A=>A.post).sort(a.byPost).map(A=>({value:A,label:_.has(A.split("/")[1]??"")?`${a.post(A)} (fills ${x})`:a.post(A)})),C=A=>{A.preventDefault();const $={...o.size===0?{posts:"Choose at least one post."}:{},...d.trim()?{}:{reason:"Give the reason for the override."}};m($),!($.posts||$.reason)&&y(()=>l({action:"bind",slot:n.slot,posts:[...o],reason:d.trim()},`Override of ${x} saved.`))},w=async()=>{await r({title:`Clear the override of ${x}?`,description:"It goes back to the posts its job descriptions name, and its reason is not kept.",action_label:"Clear",destructive:!0})&&y(()=>l({action:"unbind",slot:n.slot},`Override of ${x} cleared.`))};return s.jsx(es,{open:e,onOpenChange:A=>A||g?null:i(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:C,noValidate:!0,children:[s.jsxs(ns,{children:[s.jsxs(as,{children:["Override ",x]}),s.jsxs(ls,{children:["Bind ",x," in this project to the posts you choose instead of its 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:[s.jsx(Eo,{refusal:j,context:kd,subject:"the override",action:"save the override"}),s.jsx(Tk,{id:"org-override-posts",legend:"Posts",help:"A post outside its job description is marked on the chart.",error:h.posts,options:N,checked:o,on_change:A=>{c(A),m($=>({...$,posts:void 0}))}}),s.jsx(qn,{id:"org-override-reason",label:"Reason",error:h.reason,children:A=>s.jsx(ks,{id:"org-override-reason",rows:2,placeholder:"Why this slot needs other posts",value:d,"aria-invalid":h.reason?!0:void 0,"aria-describedby":A,onChange:$=>{f($.target.value),m(X=>({...X,reason:void 0}))}})}),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 ",b," or of a team above it."]})]}),s.jsxs(ss,{className:"mt-6",children:[n.source==="override"?s.jsx(P,{type:"button",variant:"ghost",className:"sm:mr-auto",disabled:g,onClick:()=>void w(),children:"Clear override"}):null,s.jsx(P,{type:"button",variant:"outline",disabled:g,onClick:i,children:"Cancel"}),s.jsx(P,{type:"submit",disabled:g,children:g?"Saving…":"Save override"})]})]})})})}function S3(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function C3({open:e,chart:t,names:n,save:a,on_close:l,context:r}){var L;const i=t.authority,o=u.useMemo(()=>new Set((i==null?void 0:i.post_pairs)??[]),[i]),c=((L=t.teams.find(H=>H.parent===null))==null?void 0:L.key)??null,d=[...t.teams].filter(H=>[...o].some(T=>T.startsWith(`${H.key}/`))).sort((H,T)=>H.key===c?-1:T.key===c?1:Qi(H,T)),[f,h]=u.useState(""),[m,g]=u.useState(""),[j,v]=u.useState({}),{saving:y,refusal:x,set_refusal:p,run:b}=Ao(l);u.useEffect(()=>{var H;e&&(h(((H=d[0])==null?void 0:H.key)??""),g(""),v({}),p(null))},[e,p]);const _=new Set(t.posts.filter(H=>H.post.startsWith(`${f}/`)).map(H=>H.post.split("/")[1])),N=[],C=H=>{for(const T of[...t.job_functions].filter(R=>R.parent===H).sort(Qi))N.push(T),C(T.key)};C(null);const w=N.filter(H=>o.has(`${f}/${H.key}`)&&!_.has(H.key)),k=f!==""&&w.length===0,A=!Ir(r)||k,$=H=>{if(H.preventDefault(),A)return;const T={...f?{}:{team:"Choose a team."},...m?{}:{job:"Choose a job function."}};v(T),!(T.team||T.job)&&b(()=>a({action:"add",kind:"post",key:`${f}/${m}`},`Added post ${n.job(m)} · ${n.team(f)}.`))},X=k?"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.",Y=(i==null?void 0:i.ask)??[];return s.jsx(es,{open:e,onOpenChange:H=>H||y?null:l(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:$,noValidate:!0,children:[s.jsxs(ns,{children:[s.jsx(as,{children:"Add post"}),s.jsx(ls,{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(Eo,{refusal:x,context:r,subject:"the post",action:"add the post"}),s.jsx(qn,{id:"org-post-team",label:"Team",help:"The team the post is in.",error:j.team,children:H=>s.jsxs(dt,{value:f,onValueChange:T=>{h(T),g(""),v({})},children:[s.jsx(it,{id:"org-post-team","aria-describedby":H,"aria-invalid":j.team?!0:void 0,children:s.jsx(ft,{placeholder:"Choose a team"})}),s.jsx(ot,{children:d.map(T=>s.jsx(ke,{value:T.key,children:T.label||T.key},T.key))})]})}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(qn,{id:"org-post-function",label:"Job function",help:X,error:j.job,children:H=>s.jsxs(dt,{value:m,disabled:k,onValueChange:T=>{g(T),v({})},children:[s.jsx(it,{id:"org-post-function","aria-describedby":H,"aria-invalid":j.job?!0:void 0,children:s.jsx(ft,{placeholder:k?"Every job function has a post here":"Choose a job function"})}),s.jsx(ot,{children:w.map(T=>s.jsx(ke,{value:T.key,children:T.label||T.key},T.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.",Y.length?` For others, ask ${S3(Y)}.`:""]}):null]})]}),s.jsxs(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:y,onClick:l,children:"Cancel"}),s.jsx(Nd,{saving:y,blocked:A,described_by:k?"org-post-function-help":void 0,children:y?"Adding…":"Add post"})]})]})})})}function R3({open:e,chart:t,post:n,names:a,members:l,save:r,on_close:i,context:o}){const[c,d]=u.useState({state:"loading"}),[f,h]=u.useState(""),[m,g]=u.useState(null),[j,v]=u.useState(-1),{saving:y,refusal:x,set_refusal:p,run:b}=Ao(i),_=u.useRef(0),N=u.useCallback(async()=>{const E=_.current+=1;d({state:"loading"});const I=await l();E===_.current&&d(I.ok?{state:"read",members:I.data}:{state:"failed"})},[l]);u.useEffect(()=>{e&&(h(""),g(null),v(-1),p(null),N())},[e,N,p]);const C=t.posts.find(E=>E.post===n);if(!n||!C)return null;const w=a.post(n),k=new Set(C.holders.map(E=>E.id)),$=t.posts.some(E=>E.reports_to===n)&&C.holders.length>0?C.holders[0]:null,X=f.trim().toLowerCase(),Y=c.state==="read"?c.members.filter(E=>!k.has(E.id)).filter(E=>!X||[E.label,E.detail,E.email].some(I=>I==null?void 0:I.toLowerCase().includes(X))):[],L=c.state==="read"&&c.members.every(E=>k.has(E.id)),H=c.state==="read"&&!L&&Y.length>0,T=H&&j>=0&&j<Y.length?Y[j]:null,R=E=>`org-holder-option-${E.id}`,z=!Ir(o)||!m||$!==null,S=E=>{if(!H)return;const I=Y.length-1,ne=ee=>{var ge,G;E.preventDefault(),v(ee),(G=(ge=document.getElementById(R(Y[ee])))==null?void 0:ge.scrollIntoView)==null||G.call(ge,{block:"nearest"})};E.key==="ArrowDown"?ne(Math.min(T?j+1:0,I)):E.key==="ArrowUp"?ne(T?Math.max(j-1,0):I):E.key==="Home"&&T?ne(0):E.key==="End"&&T?ne(I):E.key==="Enter"&&T&&(m==null?void 0:m.id)!==T.id&&(E.preventDefault(),g(T))},O=$?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.",Z=E=>{E.preventDefault(),!(z||!m)&&b(()=>r({action:"hold",post:n,member:m.id},`Added ${m.label} to ${w}.`))};return s.jsx(es,{open:e,onOpenChange:E=>E||y?null:i(),children:s.jsx(ts,{children:s.jsxs("form",{onSubmit:Z,noValidate:!0,children:[s.jsxs(ns,{children:[s.jsxs(as,{children:["Add holder to ",w]}),s.jsx(ls,{children:"The member holds this post and reports as it does."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Eo,{refusal:x,context:o,subject:"the holder",action:"add the holder"}),$?s.jsxs(me,{variant:"info",id:"org-holder-one",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsxs(pe,{children:["This post takes one holder. Remove ",a.member($)," first, then add the new holder."]})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Me,{htmlFor:"org-holder-member",children:"Member"}),s.jsx(Ot,{id:"org-holder-member",role:"combobox","aria-expanded":H,"aria-controls":H?"org-holder-members":void 0,"aria-activedescendant":T?R(T):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:$!==null,onChange:E=>{h(E.target.value),v(-1)},onKeyDown:S}),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(gn,{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(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void N(),children:"Retry"})]}):L?s.jsx("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"Every member already holds this post."}):Y.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:Y.map((E,I)=>{const ne=(m==null?void 0:m.id)===E.id,ee=(T==null?void 0:T.id)===E.id;return s.jsxs("li",{id:R(E),role:"option","aria-selected":ne,className:`cursor-pointer rounded-sm px-2 py-1.5 ${ne?"bg-accent text-accent-foreground":ee?"bg-muted":"hover:bg-muted"} ${ee?"ring-ring ring-2 ring-inset":""}`,onClick:()=>{$||(v(I),g(E))},children:[s.jsxs("div",{className:"text-sm font-medium break-words",children:[E.label,E.detail&&Y.filter(ge=>ge.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(ss,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:y,onClick:i,children:"Cancel"}),s.jsx(Nd,{saving:y,blocked:z,described_by:$?"org-holder-one":O?"org-holder-member-help":void 0,children:y?"Adding…":"Add holder"})]})]})})})}function T3(e){const[t,n]=u.useState(null),a=u.useRef(t);u.useEffect(()=>{a.current=t},[t]);const l=u.useCallback(c=>{var d;(d=a.current)==null||d.resolve(c),n(null)},[]),r=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=!Ir(e),o=s.jsx(l_,{open:t!==null,onOpenChange:c=>c?null:l(!1),children:s.jsxs(r_,{children:[s.jsxs(i_,{children:[s.jsx(c_,{children:t==null?void 0:t.title}),s.jsx(u_,{className:"whitespace-pre-line",children:t==null?void 0:t.description})]}),t&&i?s.jsx(om,{context:e,action:t.action}):null,s.jsxs(o_,{children:[s.jsx(f_,{children:"Cancel"}),s.jsx(d_,{variant:t!=null&&t.destructive?"destructive":"default","aria-disabled":i||void 0,onClick:c=>{if(i){c.preventDefault();return}l(!0)},children:t==null?void 0:t.action_label})]})]})});return{confirm:r,confirm_dialog:o}}function Nu({label:e,on_edit:t,on_remove:n,items:a}){const l=a??[...t?[{label:"Edit",on_select:t}]:[],...n?[{label:"Remove",on_select:n,destructive:!0}]:[]];return s.jsxs(xd,{children:[s.jsx(gd,{asChild:!0,children:s.jsx(P,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`More actions for ${e}`,children:s.jsx(fp,{className:"size-3.5","aria-hidden":"true"})})}),s.jsx(Co,{align:"end",children:l.map(r=>s.jsx(jr,{className:r.destructive?"text-destructive focus:text-destructive":void 0,onSelect:r.on_select,children:r.label},r.label))})]})}function E3({label:e,message:t,on_dismiss:n}){return s.jsxs(me,{variant:"destructive",role:"alert",className:"mb-3",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ve,{children:[e," was not removed"]}),s.jsxs(pe,{children:[s.jsx("p",{children:t}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Dismiss"})]})]})}const kd={host:"local",two_factor:"ok",settings_href:""},A3={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."},M3="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,ax=e=>({paddingLeft:16+24*Math.min(e,O3)}),ku={covered:{label:"Covered",tone:"success"},vacant:{label:"Vacant",tone:"warning"},uncovered:{label:"Uncovered",tone:"error"}};function $3(){const e=en().org;if(!e)throw new Error("The Org chart page rendered without the org seam.");return e}function D3({host:e="local",org:t=""}={}){const n=$3(),[a,l]=u.useState({state:"loading"}),[r,i]=u.useState(null),o=u.useRef(0),c=u.useRef(null),d=u.useCallback(j=>{const v=async y=>{const x=o.current+=1;c.current&&clearTimeout(c.current);const p=await n.chart();if(x!==o.current)return;if(p.ok){i({chart:p.data,at:new Date().toISOString()}),l({state:"read"});return}const{refusal:b}=p;if(b.reason==="no_local_org"){i(null),l({state:"none",seedable:b.seedable!==!1});return}if(e==="hosted"&&(b.reason==="not_found"||b.status===404)){i(null),l({state:"missing"});return}if(b.retry&&b.reason==="store_locked"&&y>0){const _=b.retry_after??10;l({state:"busy",retry_after:_}),c.current=setTimeout(()=>void v(y-1),_*1e3);return}l({state:"failed",refusal:b})};return v(j)},[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:r,{href:m}=Ve(),g=P3(n,()=>void d(1),(h==null?void 0:h.chart)??z3,e,m("/settings/account"));return a.state==="missing"?s.jsx(V3,{org:t}):s.jsx(WN,{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(Ft,{title:"Org chart",description:A3[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(q3,{quiet:a.state==="busy"}):null,a.state==="none"?s.jsx(G3,{edit:(g==null?void 0:g.actions)??null,seedable:a.seedable}):null,a.state==="failed"?s.jsx(F3,{host:e,kept_at:(h==null?void 0:h.at)??null,on_retry:f}):null,h?s.jsx(X3,{chart:h.chart,host:e,edit:(g==null?void 0:g.actions)??null}):null,(g==null?void 0:g.dialogs)??null]})})}const z3={org:"",workflow:!1,teams:[],job_functions:[],slots:[],posts:[],members:[],slot_resolution:[],project:{team:null,roots:[]}};function L3(e){var i;const t=e.authority;if(!t)return{functions:!0,team_add:!0,team:()=>"full",post_add:!1,post:()=>!1,override:!0};const n=((i=e.teams.find(o=>o.parent===null))==null?void 0:i.key)??null,a=new Set(t.teams),l=new Set(t.team_descriptions),r=new Set(t.posts);return{functions:t.administer,team_add:a.size>0,team:o=>o===n?t.administer?"root":l.has(o)?"description":null:a.has(o)?"full":l.has(o)?"description":null,post_add:t.post_pairs.length>0,post:o=>r.has(o),override:!1}}function U3(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 B3={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."},H3={mfa_challenge_required:"challenge",mfa_enrollment_required:"enroll"};function I3(e,t,n){var c;const a=t==="hosted"&&!!n.authority,l=((c=n.authority)==null?void 0:c.two_factor)??!0,[r,i]=u.useState("ok"),o=u.useCallback(async()=>{a&&i(e.twoFactor?await e.twoFactor():l?"ok":"challenge")},[e,a,l]);return u.useEffect(()=>{if(!a){i("ok");return}l?i("ok"):o();const d=()=>void o();return window.addEventListener("focus",d),()=>window.removeEventListener("focus",d)},[a,l,o]),{state:r,set_state:i,check:o}}function P3(e,t,n,a,l){const r=Ar(),i=Mk(n),o=I3(e,a,n),c=a==="hosted"?{host:a,two_factor:o.state,settings_href:l}:kd,{confirm:d,confirm_dialog:f}=T3(c),[h,m]=u.useState(null),[g,j]=u.useState({}),v=T=>j(R=>{if(!R[T])return R;const{[T]:z,...S}=R;return S}),y=e.members,x=u.useCallback(async()=>{if(!y)return{ok:!1};const T=await y();return T.ok?{ok:!0,data:T.data}:{ok:!1}},[y]),p=e.change;if(!p||a==="hosted"&&(!n.authority||!U3(n)))return null;const b=L3(n),_=T=>{const R=T.code?H3[T.code]:void 0;return R?(o.set_state(R),{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}},N=T=>T.action==="hold"||T.action==="release"?"posts":"kind"in T?T.kind==="team"?"teams":T.kind==="post"?"posts":"functions":null,C=(T,R)=>{const z=T==null?void 0:T.warning;z?r.error(z):r.success(R),t()},w=async(T,R)=>{const z=await p(T);if(!z.ok)return _(z.refusal);const S=N(T);return S&&v(S),C(z.data,R),null},k=T=>{o.check(),m(T)},A=async(T,R,z,S)=>{const O=await p(z);if(!O.ok){const Z=_(O.refusal);j(E=>({...E,[T]:{label:R,message:Z.message}}));return}v(T),C(O.data,S)},$=async(T,R,z)=>{const S=T==="team"?"team":"job function";o.check(),await d({title:`Remove ${S} ${z}?`,description:B3[a],action_label:"Remove",destructive:!0,action:`remove the ${S}`})&&await A(T==="team"?"teams":"functions",z,{action:"remove",kind:T,key:R},`${T==="team"?"Team":"Job function"} ${z} removed.`)},X=async T=>{const R=i.post(T);o.check(),await d({title:`Remove post ${R}?`,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 A("posts",R,{action:"remove",kind:"post",key:T},`Removed post ${R}.`)},Y=async(T,R)=>{const z=i.post(T),S=i.member(R),O=n.posts.find(ee=>ee.post===T),E=((O==null?void 0:O.holders.length)??0)<=1?O!=null&&O.escalates_to?` The post becomes vacant. Until someone holds it, its reports and the slots it fills go to ${i.manager(O.escalates_to)}.`:" The post becomes vacant.":"";if(o.check(),!await d({title:`Remove ${S} from ${z}?`,description:`They stop holding this post and no longer report through it.${E}`,action_label:"Remove",action:"remove the holder"}))return;const ne=await p({action:"release",post:T,member:R.id});if(!ne.ok){r.error(_(ne.refusal).message),t();return}v("posts"),C(ne.data,`Removed ${S} from ${z}.`)},L=()=>m(null),H=(h==null?void 0:h.kind)==="override"&&n.project&&n.project.team!==null?n.project.slots.find(T=>T.slot===h.slot)??null:null;return{actions:{can:b,host:a,team:(T,R="full")=>k({kind:"team",team:T,scope:R}),job:T=>k({kind:"function",job:T}),override:T=>k({kind:"override",slot:T}),remove:(T,R,z)=>void $(T,R,z),post_add:()=>k({kind:"post"}),post_remove:T=>void X(T),holder_add:T=>k({kind:"holder",post:T}),holder_remove:(T,R)=>void Y(T,R),refused:T=>{const R=g[T];return R?s.jsx(E3,{label:R.label,message:R.message,on_dismiss:()=>v(T)}):null}},dialogs:s.jsxs(s.Fragment,{children:[s.jsx(_3,{open:(h==null?void 0:h.kind)==="team",chart:n,team:(h==null?void 0:h.kind)==="team"?h.team:null,scope:(h==null?void 0:h.kind)==="team"?h.scope:"full",parents:n.authority?n.authority.teams:void 0,save:w,on_close:L,context:c}),s.jsx(N3,{open:(h==null?void 0:h.kind)==="function",chart:n,job:(h==null?void 0:h.kind)==="function"?h.job:null,save:w,on_close:L,context:c}),s.jsx(k3,{open:H!==null,chart:n,binding:H,names:i,save:w,confirm:T=>d({...T,action:"clear the override"}),on_close:L}),s.jsx(C3,{open:(h==null?void 0:h.kind)==="post",chart:n,names:i,save:w,on_close:L,context:c}),s.jsx(R3,{open:(h==null?void 0:h.kind)==="holder",chart:n,post:(h==null?void 0:h.kind)==="holder"?h.post:null,names:i,members:x,save:w,on_close:L,context:c}),f]})}}function q3({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(pt,{className:n===3?"h-10 w-2/3":"h-10 w-full"},n))})}function rr({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 G3({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(me,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"This repository has no local org yet"}),s.jsxs(pe,{children:[s.jsx("p",{children:n}),t||!e?s.jsxs("div",{className:"mt-2 grid w-full gap-2",children:[t?s.jsx(rr,{children:"sdlc org seed"}):null,e?null:s.jsx(rr,{children:"sdlc org add team <key>"})]}):null,e?s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>e.team(null),children:[s.jsx(yr,{className:"size-4","aria-hidden":"true"}),"Add team"]}):null]})]})}function V3({org:e}){const{href:t,Link:n}=Ve();return s.jsx(Ba,{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 Y3(e){return new Date(e).toDateString()===new Date().toDateString()?`today at ${Qn(e)}`:`on ${En(e)} at ${Qn(e)}`}function F3({host:e,kept_at:t,on_retry:n}){const a=t?`The chart read ${Y3(t)} is kept below. `:"";return s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:e==="hosted"?"Could not read the org chart":"Could not read the local org"}),s.jsxs(pe,{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(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function Mk(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])),l=new Map(e.posts.map(y=>[y.post,y.holders])),r=y=>y.label||y.id,i=new Map;for(const y of[...e.members,...e.posts.flatMap(x=>x.holders)]){const x=r(y);i.set(x,(i.get(x)??new Set).add(`${y.kind}:${y.id}`))}const o=y=>{var x;return(((x=i.get(r(y)))==null?void 0:x.size)??0)>1},c=y=>{const x=o(y)?y.detail??y.id:null;return x&&x!==r(y)?x:null},d=y=>{const x=c(y);return x&&x!==r(y)?`${r(y)} (${x})`:r(y)},f=y=>{const[x="",p=""]=y.split("/");return{team:t.get(x)??x,job:n.get(p)??p}},h=y=>{const{team:x,job:p}=f(y);return`${p} · ${x}`},m=y=>{if(y==="top")return"Top of the org";if(typeof y!="string")return`A vacant ${n.get(y.vacant)??y.vacant}`;const x=(l.get(y)??[]).map(d);return x.length?`${h(y)} (${x.join(", ")})`:h(y)},g=new Map(e.teams.map(y=>[y.key,y.parent])),j=y=>{let x=0;for(let p=g.get(y);p&&x<e.teams.length;p=g.get(p))x+=1;return x};return{parts:f,post:h,member:d,memberLabel:r,memberDetail:c,manager:m,byPost:(y,x)=>{const[p="",b=""]=[y.split("/")[0],x.split("/")[0]],[_,N]=[f(y),f(x)];return j(p)-j(b)||_.team.localeCompare(N.team)||_.job.localeCompare(N.job)},slot:y=>a.get(y)??y,job:y=>n.get(y)??y,team:y=>t.get(y)??y}},[e])}function Ka({id:e,title:t,description:n,actions:a,children:l}){return s.jsxs("section",{"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,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:l})]})}function $f({children:e,on_click:t}){return s.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(yr,{className:"size-4","aria-hidden":"true"}),e]})}const Ov={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 X3({chart:e,host:t,edit:n}){const a=Mk(e),l=e.members.some(r=>r.kind==="agent");return s.jsxs(s.Fragment,{children:[s.jsxs(Ka,{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($f,{on_click:n.post_add,children:"Add post"}):void 0,children:[n==null?void 0:n.refused("posts"),s.jsx(Z3,{chart:e,names:a,agents:l,host:t,edit:n})]}),s.jsx(Ka,{id:"org-chart-members",title:"Members",description:l?`${Ov[t]} Each agent answers to the nearest person in its reporting chain.`:Ov[t],children:s.jsx(nz,{chart:e,names:a,host:t,agents:l})}),n?s.jsxs(Ka,{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($f,{on_click:()=>n.team(null),children:"Add team"}):void 0,children:[n.refused("teams"),s.jsx(K3,{chart:e,edit:n})]}):null,s.jsxs("div",{className:"grid items-start gap-x-6 xl:grid-cols-2",children:[s.jsxs(Ka,{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($f,{on_click:()=>n.job(null),children:"Add job function"}):void 0,children:[n!=null&&n.can.functions?n.refused("functions"):null,s.jsx(sz,{chart:e,names:a,edit:n!=null&&n.can.functions?n:null})]}),s.jsxs(Ka,{id:"org-chart-slots",title:"Slots",description:M3,children:[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(lz,{chart:e,names:a})]})]}),e.project?s.jsx(iz,{project:e.project,chart:e,names:a,edit:n!=null&&n.can.override?n:null}):null]})}function K3({chart:e,edit:t}){var c;const n=lx([...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,l=t.host==="hosted",r=(d,f)=>{const h=t.can.team(d.key);return h==="full"?s.jsx(Nu,{label:f,on_edit:()=>t.team(d),on_remove:()=>t.remove("team",d.key,f)}):h==="root"?s.jsx(Nu,{label:f,on_edit:()=>t.team(d,"description")}):h==="description"?s.jsx(P,{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(Zu,{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})=>{const g=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:ax(f),"data-testid":"org-chart-team",children:[s.jsx("span",{className:"text-sm font-medium",children:g}),s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[l?null:s.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:h.key}),a===h.key?s.jsx(he,{variant:"neutral",children:"Owns this project"}):null,r(h,g)]})]}),m.length>0?i(m,f+1):null]},h.key)})}),o=l&&e.teams.length===1;return s.jsxs(s.Fragment,{children:[s.jsx(jt,{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 lx(e,t,n){const a=new Set(e.map(t)),l=new Map(e.map(i=>[t(i),{item:i,children:[]}])),r=[];for(const i of e){const o=n(i),c=l.get(t(i));o&&a.has(o)&&o!==t(i)?l.get(o).children.push(c):r.push(c)}return r}const Q3={local:"No posts yet.",hosted:"No posts yet. An org admin can add them."};function Z3({chart:e,names:t,agents:n,host:a,edit:l}){const r=lx([...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(r.length===0){const c=a==="hosted"&&(l==null?void 0:l.can.functions)&&!l.can.post_add;return s.jsx("p",{className:"text-muted-foreground text-sm",children:l!=null&&l.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.":Q3[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})=>{const{team:m}=t.parts(f.post),g=typeof f.reports_to=="object"?f.reports_to:null,j=!!(l!=null&&l.can.post(f.post));return s.jsxs("li",{children:[s.jsxs("div",{className:"border-b py-2 pr-4",style:ax(d),"data-testid":"org-chart-post",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(UC,{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:g?`${m} · Reports to a vacant ${t.job(g.vacant)}`:m}),j&&l?s.jsx("span",{className:"ml-auto",children:s.jsx(Nu,{label:t.post(f.post),items:[{label:"Add holder",on_select:()=>l.holder_add(f.post)},{label:"Remove post",on_select:()=>l.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(he,{variant:ku.vacant.tone,children:ku.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(v=>s.jsx(ez,{holder:v,post:f.post,member:i.get(`${v.kind}:${v.id}`),names:t,agents:n,host:a,on_remove:j&&l?()=>l.holder_remove(f.post,v):void 0},`${v.kind}:${v.id}`))})]}),h.length>0?o(h,d+1):null]},f.post)})});return s.jsx(jt,{className:"overflow-hidden",children:o(r,0)})}function W3(e){return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function J3(e){if(!e.held_since)return null;const t=W3(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 ez({holder:e,post:t,member:n,names:a,agents:l,host:r,on_remove:i}){const o=e.kind==="person"?hp:dp,c=n==null?void 0:n.posts.find(j=>j.post===t),d=n==null?void 0:n.posts.find(j=>j.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=r==="hosted"?J3(e):null,g=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:g}),i?s.jsxs(JN,{children:[s.jsx(ek,{asChild:!0,children:s.jsx(P,{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(Ju,{className:"size-3.5","aria-hidden":"true"})})}),s.jsxs(Kp,{children:["Remove ",g]})]}):null,f?s.jsx("span",{className:"text-muted-foreground text-xs break-all",children:f}):null,l?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 tz=["sdlc org hold <team>/<function> --person <id>","sdlc org hold <team>/<function> --agent <id>"];function nz({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:"}),tz.map(r=>s.jsx(rr,{children:r},r))]});const l=[...e.members].sort((r,i)=>r.kind===i.kind?t.memberLabel(r).localeCompare(t.memberLabel(i))||r.id.localeCompare(i.id):r.kind==="person"?-1:1);return s.jsx(jt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Members",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Member"}),s.jsx(F,{children:"Posts"}),s.jsx(F,{children:"Primary manager"}),s.jsx(F,{children:"Dotted lines"}),a?s.jsx(F,{children:"Accountable person"}):null]})}),s.jsx(He,{children:l.map(r=>{const i=r.posts.find(d=>d.primary),o=r.posts.filter(d=>d.dotted),c=t.memberDetail(r);return s.jsxs(ue,{"data-testid":"org-chart-member",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:t.memberLabel(r)}),c?s.jsx("div",{className:"text-muted-foreground text-xs",children:c}):null,a?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.kind==="person"?"Person":"Agent"}):null]}),s.jsx(q,{children:r.posts.map(d=>t.post(d.post)).join(", ")}),s.jsx(q,{children:i?t.manager(i.reports_to):"None"}),s.jsx(q,{children:o.length?o.map(d=>t.manager(d.reports_to)).join(", "):"None"}),a?s.jsx(q,{children:r.kind==="person"?"Not an agent":r.accountable_person?t.member(r.accountable_person):"None"}):null]},`${r.kind}:${r.id}`)})})]})})}function sz({chart:e,names:t,edit:n}){const a=lx([...e.job_functions].sort((r,i)=>(r.label||r.key).localeCompare(i.label||i.key)),r=>r.key,r=>r.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 l=(r,i)=>s.jsx("ul",{role:"list",className:i===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:r.map(({item:o,children:c})=>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:ax(i),"data-testid":"org-chart-function",children:[s.jsx("span",{className:"text-sm font-medium",children:o.label||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(he,{variant:"neutral",children:"Requires a person"}):null,n?s.jsx(Nu,{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?l(c,i+1):null]},o.key))});return s.jsx(jt,{className:"overflow-hidden",children:l(a,0)})}function az(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 Su={covered:0,vacant:1,uncovered:2};function Ok(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 lz({chart:e,names:t}){const n=Ok(e);return s.jsx(jt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Slots",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Slot"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Resolves to"})]})}),s.jsxs(He,{children:[[...e.slot_resolution].sort((a,l)=>Su[a.status]-Su[l.status]||t.slot(a.slot).localeCompare(t.slot(l.slot))).map(a=>{const l=ku[a.status];return s.jsxs(ue,{"data-testid":"org-chart-slot",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:t.slot(a.slot)}),n.has(a.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:n.get(a.slot)}):null]}),s.jsx(q,{children:s.jsx(he,{variant:l.tone,children:l.label})}),s.jsxs(q,{children:[az(a,t),a.status==="covered"&&a.needs_person?s.jsx("div",{className:"text-muted-foreground text-xs",children:"Needs a person"}):null]})]},a.slot)}),e.slot_resolution.length===0?s.jsx(ue,{children:s.jsx(q,{colSpan:3,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})})}const rz="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.",Df=["sdlc org own <team>","sdlc org bind <slot> <team>/<function>... --reason <text>","sdlc org unbind <slot>"];function iz({project:e,chart:t,names:n,edit:a}){if(e.team===null){const i=e.roots.map(n.team);return s.jsx(Ka,{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(rr,{children:i.length?Df[0]:"sdlc org add team <key>"})})})}const l=Ok(t),r=[...e.slots].sort((i,o)=>Su[i.status]-Su[o.status]||n.slot(i.slot).localeCompare(n.slot(o.slot)));return s.jsxs(Ka,{id:"org-chart-project",title:"This project",description:rz,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(jt,{className:"mt-3 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Slots in this project",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Slot"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Bound to"}),s.jsx(F,{children:"Source"}),a?s.jsx(F,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(He,{children:[r.map(i=>{const o=ku[i.status];return s.jsxs(ue,{"data-testid":"org-chart-project-slot",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:n.slot(i.slot)}),l.has(i.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:l.get(i.slot)}):null]}),s.jsx(q,{children:s.jsx(he,{variant:o.tone,children:o.label})}),s.jsx(q,{children:s.jsx(oz,{binding:i,names:n})}),s.jsx(q,{children:s.jsx(cz,{binding:i})}),a?s.jsx(q,{className:"text-right",children:s.jsx(P,{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(Zu,{className:"size-3.5","aria-hidden":"true"})})}):null]},i.slot)}),r.length===0?s.jsx(ue,{children:s.jsx(q,{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(rr,{children:Df[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:"}),Df.map(i=>s.jsx(rr,{children:i},i))]})]})}function oz({binding:e,names:t}){const n=[];e.status==="covered"&&e.needs_person&&n.push("Needs a person");for(const l of e.posts)l.off_description&&n.push(`${t.post(l.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(l=>t.post(l.post)).join(", ")} has no holder`:a=e.posts.map(l=>l.holders.length?`${t.post(l.post)}: ${l.holders.map(t.member).join(", ")}`:`${t.post(l.post)}: no holder`).join("; "),s.jsxs(s.Fragment,{children:[a,n.map(l=>s.jsx("div",{className:"text-muted-foreground text-xs",children:l},l))]})}function cz({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?En(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 uz={breaking:"Breaking",new:"New",improved:"Improved",other:"Other changes"},dz=["breaking","new","improved","other"],fz={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 $k(e){return fz[e]??e.replace(/_/g," ")}function hz(e){return e.bump==="major"?"breaking":e.change==="added"?"new":e.change==="changed"?"improved":"other"}function Zi(e){const t=new Map;let n=0,a=0;for(const r of e){if(r.modeling_only){a+=1;continue}if(!r.bump){n+=1;continue}const i=hz(r);t.set(i,[...t.get(i)??[],r])}return{sections:dz.filter(r=>t.has(r)).map(r=>({key:r,label:uz[r],lines:t.get(r)})),breaking:t.has("breaking"),unlisted_count:n,modeling_only_count:a}}function mz(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 l of a.lines){const r=l.why?`: ${l.why}`:"";n.push(`- ${l.label} (${$k(l.node_type)})${r}`)}}return`${n.join(`
386
386
  `)}
387
- `}const zs="candidate";function rx(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}const hz="Versioned records of this project's release branch, with notes from its graph changes.";function Ok({description:e=hz,actions:t}){return s.jsx(Ft,{title:"Releases",description:e,actions:t})}function $k(e){var r;if(!e)return"";const t=(r=e.previous_release)==null?void 0:r.version,n=Number(e.version.split("-rc.")[1]??0),a=e.commits_since??n,l=`${e.commits_since===null?"At least ":""}${a} commit${a===1?"":"s"}`;return t?`${l} since ${t}`:`${l} before the first Release`}function Ec({active:e,onClick:t,version:n,badges:a,caption:l,item_ref:r}){return s.jsxs("button",{ref:r,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:l})]})}function Tn({children:e}){return s.jsx("section",{className:"border-border flex flex-col gap-4 rounded-xl border p-4",children:e})}function An({title:e,error:t,onRetry:n}){return s.jsxs(me,{variant:"destructive",children:[s.jsx(xn,{}),e?s.jsx(ve,{children:e}):null,s.jsxs(pe,{className:"flex flex-col items-start gap-2",children:[t,n?s.jsx(P,{variant:"outline",size:"sm",onClick:n,children:"Try again"}):null]})]})}function mz({title:e,text:t}){return s.jsx(Tn,{children:s.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[s.jsx(Qu,{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 pz(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 Cu({changes:e}){const t=u.useMemo(()=>Zi(e),[e]),[n,a]=u.useState(!1),l=t.unlisted_count+t.modeling_only_count;return s.jsxs("div",{className:"flex flex-col gap-4",children:[t.sections.map(r=>{const i=s.jsx("ul",{className:"flex flex-col gap-2",children:r.lines.map(o=>s.jsx($v,{line:o},`${o.node_id}:${o.change}`))});return r.key==="breaking"?s.jsxs(me,{variant:"destructive",className:"border-destructive/40",children:[s.jsx(xn,{}),s.jsx(ve,{children:s.jsx("h3",{className:"text-destructive text-sm font-semibold",children:r.label})}),s.jsx(pe,{className:"text-foreground",children:i})]},r.key):s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:r.label}),i]},r.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,l>0?s.jsxs("p",{className:"text-muted-foreground text-sm",children:[l," more change",l===1?"":"s"," do",l===1?"es":""," not affect the version."]}):null,e.length>0?s.jsx(P,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":n,onClick:()=>a(r=>!r),children:n?"Hide all changes":"Show all changes"}):null,n?s.jsx("ul",{className:"flex flex-col gap-2",children:e.map(r=>s.jsx($v,{line:r,detail:!0},`all:${r.node_id}:${r.change}:${r.modeling_only}`))}):null]})}function $v({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(he,{variant:"outline",children:Mk(e.node_type)})]}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]})}const Dk="Releases of this checkout: the roadmap of open Planned Releases, the next candidate, and each production release with its notes.",Dv=5,cm="Not available",um="planned:";function zk(){const e=Wn();return s.jsx("p",{className:"text-muted-foreground text-sm",children:`${cm}. ${e}`})}const Fn=e=>`${um}${e}`,xz=e=>e!=null&&e.startsWith(um)?e.slice(um.length):null,ix=e=>e?e.slice(0,7):"";function gz(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 vz(){return s.jsxs(me,{variant:"info",children:[s.jsx(Ua,{}),s.jsx(ve,{children:"This page only reads Releases"}),s.jsx(pe,{className:"text-info",children:"A Release is written when production runs a release candidate, once its commit is merged into origin/main."})]})}function yz(e){if(e.state==="unreadable")return{badges:s.jsx(he,{variant:"error",children:"Could not be read"}),caption:""};if(e.state==="withdrawn")return{badges:s.jsx(he,{variant:"warning",children:"Withdrawn"}),caption:e.replaced_by?`Replaced by ${e.replaced_by}`:"Withdrawn"};const t=s.jsxs(s.Fragment,{children:[s.jsx(he,{variant:"neutral",children:e.app_changed===!1?"App unchanged":e.previous_release_id?e.bump??"patch":"First"}),e.breaking?s.jsx(he,{variant:"error",children:"Breaking"}):null]}),n=e.written_at?rx(e.written_at):"",a=e.tracks&&e.tracks.length>0?` · ${e.tracks.join(", ")}`:"";return{badges:t,caption:`${n}${a}`}}function sl({query:e,select:t,onSelect:n,children:a,inline:l=!1}){return s.jsx("a",{href:`?${e}`,className:l?"text-primary underline":"text-primary hover:underline",onClick:r=>{r.preventDefault(),n(t)},children:a})}function Sd({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 vs=({children:e})=>s.jsx("code",{className:"font-mono text-xs",children:e});function Lk(e,t){if(e.judged_commit&&t&&e.judged_commit!==t)return`Judged ${ix(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 Cd({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 bz={ready:"success",verifying:"info",fixing:"warning",abandoned:"warning",ready_older:"neutral",none:"neutral",unknown:"neutral"};function jz({batch:e}){if(e.state==="loading")return s.jsxs(me,{children:[s.jsx(uu,{}),s.jsxs(pe,{className:"flex flex-row items-center gap-2",role:"status",children:[s.jsx(gn,{"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(me,{children:[s.jsx(uu,{}),s.jsxs(ve,{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:t.text}),s.jsx(he,{variant:bz[t.state],children:t.chip})]}),t.help?s.jsx(pe,{children:t.help}):null]})}function _z(e,t,n){return`/org/${e}/issues/${encodeURIComponent(t)}?from=${encodeURIComponent(n)}`}function Uk({issues:e,error:t}){return t?s.jsx(An,{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(Cd,{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(vs,{children:n.file}):null]},n.key))})]})}function Bk({tracks:e,error:t}){return t?s.jsx(An,{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(Cd,{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(vs,{children:n.version}):null,n.bump?s.jsx(he,{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(vs,{children:a.name}),s.jsxs(vs,{children:[a.from??"—"," → ",a.to??"—"]})]}),a.changes.map((l,r)=>s.jsxs("span",{className:"text-muted-foreground text-xs",children:[l.feature,": ",l.entry]},r))]},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 Hk({delivery:e,candidate:t,onSelect:n}){if(!e||e.planned.length===0&&e.outside===0)return null;const a=l=>l.length===0?"—":l.map(r=>r.went?`${r.label} (${r.went})`:r.label).join(", ");return s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(Cd,{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(Be,{containerAriaLabel:"Planned Releases",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Planned Release"}),s.jsx(F,{children:"Delivered"}),s.jsx(F,{children:"Not delivered"})]})}),s.jsx(He,{children:e.planned.map(l=>s.jsxs(ue,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.open&&t?s.jsx(sl,{query:`planned=${encodeURIComponent(l.id)}`,select:Fn(l.id),onSelect:n,children:l.name}):s.jsx("span",{children:l.name}),s.jsx(vs,{children:l.id})]})}),s.jsx(q,{children:a(l.delivered)}),s.jsx(q,{children:a(l.not_delivered)})]},l.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 wz={thread:"Thread",task:"Task",issue:"Issue",test:"Test"};function Ik({rows:e,org:t,from:n,untasked:a}){const{href:l,Link:r}=Ve(),[i,o]=u.useState(!1),c=i?e:e.slice(0,Dv),d=f=>f.kind==="task"?s.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:l(`/org/${t}/tasks/${encodeURIComponent(f.id)}?from=${encodeURIComponent(n)}`),children:f.id}):f.kind==="issue"?s.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:l(_z(t,f.id,n)),children:f.id}):f.kind==="thread"?s.jsx(r,{className:"text-primary hover:underline",href:l(`${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(Be,{containerAriaLabel:"Related",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Kind"}),s.jsx(F,{children:"Item"}),s.jsx(F,{children:"How it relates"})]})}),s.jsx(He,{children:c.map(f=>s.jsxs(ue,{children:[s.jsx(q,{children:wz[f.kind]}),s.jsx(q,{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(q,{children:f.relation})]},`${f.kind}:${f.id}`))})]})}),e.length>Dv?s.jsx(P,{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 Pk=e=>(e==null?void 0:e.status)===409&&e.reason==="view_outdated";function qk(e){const t=ox(),[n,a]=u.useState(t!=null&&t.related?{state:"loading"}:null),l=u.useRef(0),r=u.useCallback(async(i=!1)=>{if(!(t!=null&&t.related))return;const o=++l.current;a({state:"loading"});const c=await t.related(e,i?{fresh:!0}:void 0);o===l.current&&a(c.ok?{state:"ready",value:c.data}:{state:"error",error:c.refusal.message,refusal:c.refusal})},[t,e]);return u.useEffect(()=>{r()},[r]),{related:n,read:r}}function Gk({related:e,org:t,from:n,onRetry:a}){const l=u.useRef(null),r=u.useRef(!1);if(u.useEffect(()=>{var o;r.current&&(e==null?void 0:e.state)!=="loading"&&(r.current=!1,(o=l.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:l,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(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-2/3"})]}):e.state==="error"?Pk(e.refusal)?s.jsx(zk,{}):s.jsx(An,{title:"Related work could not be read",error:e.error,onRetry:()=>{r.current=!0,a()}}):e.value.rows.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):s.jsx(Ik,{rows:e.value.rows,org:t,from:n,untasked:e.value.untasked})]})}function Nz(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 Vk({planned:e,onSelect:t}){return e?e.open?s.jsx(sl,{query:`planned=${encodeURIComponent(e.id)}`,select:Fn(e.id),onSelect:t,children:e.name}):s.jsxs("span",{children:[e.name," ",s.jsx(vs,{children:e.id})]}):null}function kz({candidate:e,org:t,onSelect:n,notes:a}){const l=ox(),{related:r,read:i}=qk("candidate"),[o,c]=u.useState(l!=null&&l.candidateBatch?{state:"loading"}:null);u.useEffect(()=>{if(!(l!=null&&l.candidateBatch))return;let f=!0;return l.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}},[l]);const d=e.readiness??((r==null?void 0:r.state)==="ready"?r.value.readiness:null)??null;return s.jsxs(s.Fragment,{children:[s.jsx(Sd,{pairs:[["Environment",e.environment??"staging"],["Commit",s.jsx(vs,{children:ix(e.head_commit_id)},"commit")],["Readiness",d?Lk(d,e.head_commit_id):null],["Planned",e.planned_release?s.jsx(Vk,{planned:e.planned_release,onSelect:n}):null]]}),o?s.jsx(jz,{batch:o}):null,a,s.jsx(Uk,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(Bk,{tracks:e.tracks,error:e.tracks_error}),s.jsx(Hk,{delivery:e.planned_delivery,candidate:!0,onSelect:n}),s.jsx(Gk,{related:r,org:t,from:"release:candidate",onRetry:()=>i(!0)})]})}function Sz({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(he,{variant:"warning",children:"Withdrawn"}):s.jsx(he,{variant:"neutral",children:e.app_changed===!1?"App unchanged":a?"First":e.bump}),e.breaking?s.jsx(he,{variant:"error",children:"Breaking"}):null]}),e.state==="withdrawn"&&e.replaced_by?s.jsxs("p",{className:"text-sm",children:["Replaced by"," ",s.jsx(sl,{query:`release=${encodeURIComponent(e.replaced_by)}`,select:e.replaced_by,onSelect:t,inline:!0,children:e.replaced_by})]}):null]})}function Cz({release:e,org:t,onSelect:n,notes:a}){const l=e.label??e.version,{related:r,read:i}=qk(l),o=(r==null?void 0:r.state)==="ready"?Nz(r.value.previews):null;return s.jsxs(s.Fragment,{children:[s.jsx(Sd,{pairs:[["Environment",e.environment??"production"],["Commit",e.commit?s.jsx(vs,{children:ix(e.commit)},"commit"):null],["Readiness",e.readiness?`${Lk(e.readiness)} on staging`:null],["Previews",o],["Planned",e.planned_release?s.jsx(Vk,{planned:e.planned_release,onSelect:n}):null]]}),a,s.jsx(Uk,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(Bk,{tracks:e.tracks,error:e.tracks_error}),s.jsx(Hk,{delivery:e.planned_delivery,candidate:!1,onSelect:n}),s.jsx(Gk,{related:r,org:t,from:`release:${l}`,onRetry:()=>i(!0)})]})}function Tz({id:e,summary:t,org:n,onNotFound:a,forecast:l}){var x,j;const r=ox(),[i,o]=u.useState({state:"loading"}),c=u.useRef(0),d=u.useCallback(async(v=!1)=>{const y=++c.current;if(!(r!=null&&r.plannedRelease)){o({state:"error",error:cm,refusal:{status:409,message:cm,reason:"view_outdated"}});return}o({state:"loading"});const g=await r.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})},[r,e]);u.useEffect(()=>{d()},[d]);const f=i.state==="error"&&(((x=i.refusal)==null?void 0:x.status)===404||((j=i.refusal)==null?void 0:j.reason)==="not_found");if(u.useEffect(()=>{f&&a()},[f,a]),i.state==="loading")return s.jsxs(Tn,{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(he,{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(Tn,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),Pk(i.refusal)?s.jsx(zk,{}):f?null:s.jsx(An,{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(Tn,{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(he,{variant:"neutral",children:"Planned"})]}),h.goal?s.jsx("p",{className:"text-muted-foreground text-sm",children:h.goal}):null]}),s.jsx(Sd,{pairs:[["Planned Release",s.jsx(vs,{children:h.id},"id")],["Date",h.date],["Order",m],["Members",String(h.members.length)]]}),l,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(Cd,{title:"Members",count:h.members.length}),h.members.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Members",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Member"}),s.jsx(F,{children:"Level"}),s.jsx(F,{children:"Tasks"}),s.jsx(F,{children:"State"})]})}),s.jsx(He,{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(ue,{children:[s.jsx(q,{children:v.label}),s.jsx(q,{children:v.level?s.jsx(he,{variant:"neutral",children:Rz(v.level)}):null}),s.jsx(q,{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(vs,{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(q,{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(Ik,{rows:h.related,org:n,from:`planned:${h.id}`})]})]})}const Rz=e=>e.charAt(0).toUpperCase()+e.slice(1);function ox(){return en().releases}const In={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"},zv=3,Ez=["in_progress","not_started","planned","blocked"],cx="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),yt=e=>e.charAt(0).toUpperCase()+e.slice(1);function zf(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(e??""));return t?`${Number(t[3])} ${cx[Number(t[2])-1]}`:String(e??"")}function Yk(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${cx[t.getMonth()]} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Az(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${cx[t.getMonth()]}`}function Ls(e){return e?e.from===e.to&&e.or_later?`${zf(e.from)} or later`:`${zf(e.from)} to ${zf(e.to)}${e.or_later?", or later":""}`:""}function Mz(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 Fk(e){var h;const t=e??{},n=t.source??{},l=[t.no_date==="no date: no rate"&&n.rate_why?n.rate_why:"",/members estimated$/.test(t.no_date??"")?"":Mz(t)].filter(Boolean).join(" · "),r=t.projected?Ls(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=[l,c,o&&i&&t.projected?`corrected for past estimates: raw ${Ls({...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:r?yt(r):"",caption:f}}function Oz(e){const t=e.kinds??[];return[t.includes("range")?"Not promised":"",e.goal??(t.includes("major")?"No goal yet":"")].filter(Boolean).join(" · ")}function $z(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,l=(e.needs_user??[]).length,r=!a&&!l?["none blocked · none waiting on you"]:[a?`${a} blocked`:"",l?`${l} waiting on you`:""],i=((f=e.tasks)==null?void 0:f.untracked_slices)??0;i&&r.push(`${i} slice${i===1?"":"s"} not tasks yet`);const o=((h=e.not_a_member)==null?void 0:h.count)??0;return o&&r.push(`${o} not a member yet`),{lead:n,rest:r.filter(Boolean).join(" · ")}}const Xk=e=>String(e??"").replace(/_/g," ");function Dz(e){const t=e??{},n=t.kinds??[],a=n.includes("slipped"),l=!a&&t.was&&t.now?Ls(t.was)===Ls(t.now)?`, range still ${Ls(t.now)}`:`, range was ${Ls(t.was)}, now ${Ls(t.now)}`:"",r=[a&&t.was?`was ${Ls(t.was)}`:"",n.includes("scope changed")?`scope changed${l}`:""].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:r.length?yt(r.join(" · ")):"",what:i}}const ir="roadmap",Lv={reading:!1,value:null,refusal:null};function zz(e){const[t,n]=u.useState({all:Lv,mine:Lv}),a=u.useRef({all:0,mine:0}),l=u.useCallback(async(r,i=!1)=>{if(!(e!=null&&e.roadmap))return;const o=++a.current[r];n(d=>({...d,[r]:{...d[r],reading:!0}}));const c=await e.roadmap({...i?{fresh:!0}:{},...r==="mine"?{mine:!0}:{}});o===a.current[r]&&n(d=>({...d,[r]:c.ok?{reading:!1,value:c.data,refusal:null}:{reading:!1,value:d[r].value,refusal:c.refusal}}))},[e]);return{reads:t,read:l,available:!!(e!=null&&e.roadmap)}}function Lz(e,t){return`${e} open${t.length?` · ${t.join(", ")} moved since you looked`:""}`}function Ti({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 Kk=({level:e})=>e?s.jsx(he,{variant:"neutral",children:yt(e)}):null;function Qk({state:e}){const t=yt(Xk(e));return Ez.includes(String(e))?s.jsx("span",{className:"font-medium",children:t}):s.jsx("span",{children:t})}function Uz({reads:e,scope:t,onScope:n,onRead:a,org:l,onSelect:r}){var x,j;const i=e[t],o=i.value,c=Wn(),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 ${Yk(o.as_of)}`:"",`${((x=o.source)==null?void 0:x.machine)||"this machine"}'s records`,((j=o.decider)==null?void 0:j.words)??""].filter(Boolean).join(" · "):"";return s.jsxs(Tn,{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(P,{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(gn,{"aria-hidden":!0,className:"size-4"})," ",yt(In.pending),"…"]}):null}),i.refusal&&!i.reading?i.refusal.reason==="no_roadmap"?s.jsx(An,{title:In.failedLead,error:`${yt(In.noEngineLead)}. ${c}`}):i.refusal.reason==="refused"?s.jsx(An,{title:In.failedLead,error:i.refusal.message}):s.jsx(An,{title:In.failedLead,error:i.refusal.message,onRetry:h}):null,o?t==="mine"?s.jsx(Vz,{mine:o.mine,org:l,onSelect:r}):s.jsx(Hz,{read:o,org:l,onSelect:r}):null]})}function Bz(e){if(!e||typeof e.seconds_per_day!="number")return"No rate";const t=Az(e.as_of);return`${Math.round(e.seconds_per_day/3600)} task hours a day over the ${e.days} days${t?` to ${t}`:""}`}function Hz({read:e,org:t,onSelect:n}){var l,r;const a=e.releases??[];if(!a.length){const[i,o]=In.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(Ti,{children:o})]})}return s.jsxs(s.Fragment,{children:[s.jsx(Sd,{pairs:[["Forecast from",yt(`${((l=e.source)==null?void 0:l.machine)||"this machine"}'s task records and rate`)],["Rate",Bz(e.rate)],["Not counted",yt(((r=e.source)==null?void 0:r.not_counted)||"other machines' work")]]}),a.map(i=>s.jsx(Iz,{row:i,org:t,onSelect:n},i.id))]})}function Iz({row:e,org:t,onSelect:n}){var h,m,x;const a=Fk(e.forecast),l=$z(e),r=Oz(e),i=`roadmap-${e.id}`,o=e.moved?Dz(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=[r,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(sl,{query:`planned=${encodeURIComponent(e.id)}`,select:Fn(e.id),onSelect:n,children:e.name})}),e.kinds.map(j=>s.jsx(he,{variant:"neutral",children:j},j))]}),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:yt(a.caption.join(" · "))}):null]}):null,f?s.jsx("p",{className:"text-muted-foreground text-sm",children:f}):null,o?s.jsxs(me,{variant:"info",children:[s.jsx(fT,{"aria-hidden":!0}),s.jsx(ve,{children:"Moved since you looked"}),s.jsxs(pe,{className:"text-info flex flex-col gap-0.5",children:[o.head?s.jsx("span",{children:o.head}):null,o.what.map((j,v)=>s.jsx("span",{className:"text-xs",children:j},v))]})]}):null,c?null:s.jsxs("p",{className:"text-sm",children:[l.lead,l.rest?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",l.rest]}):null]}),(x=e.stale_unchecked)!=null&&x.words?s.jsx("p",{className:"text-muted-foreground text-xs",children:yt(e.stale_unchecked.words)}):null,e.for_you&&e.kinds.includes("major")?s.jsx(Pz,{row:e}):null,s.jsx(Gz,{row:e,org:t})]})}function Pz({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 l=[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:[l?`${yt(l).replace(/\.$/,"")}. `:"","Accept or reject in the terminal:"]}),s.jsx(Ti,{children:a.accept}),s.jsx(Ti,{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(Ti,{children:t.set_goal})]}):null]})}function Zk({next:e,org:t}){const{href:n,Link:a}=Ve(),l=e.tasks[0],r=e.label||e.item;return l?s.jsx(a,{className:"text-primary hover:underline",href:n(`/org/${t}/tasks/${encodeURIComponent(l.id)}?from=roadmap`),children:r}):s.jsx("span",{children:r})}function qz(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?yt(e.nobody):""}function Gz({row:e,org:t}){const[n,a]=u.useState(!1),l=e.next??[];if(!l.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 r=n?l:l.slice(0,zv),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(Be,{containerAriaLabel:`Next in ${e.name}`,children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Member"}),s.jsx(F,{children:"Level"}),s.jsx(F,{children:"State"}),s.jsx(F,{children:"Who is on it"})]})}),s.jsx(He,{children:r.map(o=>{const c=i.get(o.item);return s.jsxs(ue,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(Zk,{next:o,org:t}),c?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[yt(c.words),c.estimate_as_of?` (estimated ${Yk(c.estimate_as_of)})`:""]}):null]})}),s.jsx(q,{children:s.jsx(Kk,{level:o.level})}),s.jsx(q,{children:s.jsx(Qk,{state:o.state})}),s.jsx(q,{children:qz(o,e)})]},o.item)})})]})}),l.length>zv&&!n?s.jsxs(P,{variant:"outline",size:"sm",className:"self-start",onClick:()=>a(!0),children:["Show all ",l.length]}):null,r.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 Vz({mine:e,org:t,onSelect:n}){const{href:a,Link:l}=Ve();if(!e)return null;const r=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:yt(In.noTask)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Your work",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Task"}),s.jsx(F,{children:"Release"}),s.jsx(F,{children:"Member"})]})}),s.jsx(He,{children:e.tasks.map(i=>{var o,c;return s.jsxs(ue,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(l,{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,yt(Xk(i.state))].filter(Boolean).join(" · ")})]})}),s.jsx(q,{children:(o=i.members)!=null&&o.length?i.members.map(d=>s.jsx("div",{children:s.jsx(sl,{query:`planned=${encodeURIComponent(d.planned_release)}`,select:Fn(d.planned_release),onSelect:n,children:d.name})},d.planned_release)):i.release?s.jsx(sl,{query:`planned=${encodeURIComponent(i.release.planned_release)}`,select:Fn(i.release.planned_release),onSelect:n,children:i.release.name}):s.jsx("span",{className:"text-muted-foreground",children:i.words?yt(i.words):"—"})}),s.jsx(q,{children:(c=i.members)!=null&&c.length?i.members.map(d=>s.jsx(Kk,{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)})})]})}),r.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(Ti,{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:yt(In.noNext)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Your next members",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Release"}),s.jsx(F,{children:"Member"}),s.jsx(F,{children:"State"})]})}),s.jsx(He,{children:e.next.map(i=>s.jsxs(ue,{children:[s.jsx(q,{children:s.jsx(sl,{query:`planned=${encodeURIComponent(i.release)}`,select:Fn(i.release),onSelect:n,children:i.name})}),s.jsx(q,{children:s.jsx(Zk,{next:i,org:t})}),s.jsx(q,{children:s.jsx(Qk,{state:i.state})})]},`${i.release}:${i.item}`))})]})})]})]})}function Yz({state:e,id:t}){var r;const n=Wn();if(!e)return null;const a=(r=e.value)==null?void 0:r.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(gn,{"aria-hidden":!0,className:"size-4"})," ",yt(In.pending),"…"]});if(e.refusal){const i=e.refusal.reason==="no_roadmap"?`${yt(In.noEngineLead)}. ${n}`:e.refusal.message;return s.jsx("p",{className:"text-muted-foreground text-xs",children:`${In.failedLead}: ${i}`})}return null}const l=Fk(a.forecast);return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.lead?s.jsx("p",{className:"text-sm",children:l.lead}):null,l.caption.length?s.jsx("p",{className:"text-muted-foreground text-xs",children:yt(l.caption.join(" · "))}):null]})}function Wk(){const e=en().releases;if(!e)throw new Error("The Releases page rendered without a Releases contract.");return e}function Fz({initial:e,environments:t,branch_options:n,chooseBranch:a,renderWrite:l,selection:r,org:i,onReadAgain:o,onNotFound:c,notice:d,focusOnMount:f}){var Rs,Dn,zn,Ct,nn,rs,Ln,ea,D,be;const h=Wk(),m=e.local??null,[x,j]=u.useState(e),[v,y]=u.useState(null),g=r?r.selected:v,p=r?r.onSelect:y,b=!!(m||x.release_branch),[_,N]=u.useState(m||e.release_branch?{state:"loading"}:{state:"ready",value:null}),[C,w]=u.useState({}),[k,A]=u.useState(null),[$,X]=u.useState(!1),[Y,L]=u.useState(null),[H,R]=u.useState(null),T=u.useRef(null),z=m?{fresh:!0}:void 0,S=u.useCallback(async se=>{const _e=await h.candidate(se);N(_e.ok?{state:"ready",value:_e.data.candidate}:{state:"error",error:_e.refusal.message,refusal:_e.refusal})},[h]),O=u.useCallback(async()=>{N({state:"loading"}),await S(z)},[S,m]),Z=u.useCallback(async()=>{const se=await h.list();se.ok&&j(se.data)},[h]),E=((Rs=x.release_branch)==null?void 0:Rs.id)??null;u.useEffect(()=>{if(!m&&!E)return;let se=!1;return h.candidate().then(_e=>{se||N(_e.ok?{state:"ready",value:_e.data.candidate}:{state:"error",error:_e.refusal.message,refusal:_e.refusal})}),()=>{se=!0}},[E,h,m]);const I=u.useRef(new Set),ne=u.useCallback((se,_e)=>w(Es=>({...Es,[se]:_e.ok?{state:"ready",value:_e.data.release}:{state:"error",error:_e.refusal.message,refusal:_e.refusal}})),[]),ee=async se=>{w(_e=>({..._e,[se]:{state:"loading"}})),I.current.add(se),ne(se,await h.release(se,z))},ge=_.state!=="ready"||_.value!==null,G=xz(g),M=zz(m?h:void 0),V=M.available&&g===ir,[ae,B]=u.useState("all"),te=x.release_branch||m?ge?zs:null:((Dn=x.releases[0])==null?void 0:Dn.version)??null,J=G!==null||V?null:g===zs?ge?zs:null:g??te,[le,W]=u.useState([]),Qe=u.useRef(0);u.useEffect(()=>{if(!m||!h.roadmapMoved)return;let se=!0;const _e=Qe.current;return h.roadmapMoved().then(Es=>{se&&Es.ok&&_e===Qe.current&&W(Es.data.moved.map(qa=>qa.name))}),()=>{se=!1}},[h,m]);const oe=M.reads.all,Oe=M.read;u.useEffect(()=>{G===null||!M.available||!oe.value&&!oe.reading&&!oe.refusal&&Oe("all")},[G,M.available,oe,Oe]);const[K,Ne]=u.useState(0),ze=u.useRef(0),xt=se=>{se===ir&&Ne(_e=>_e+1),p(se)};u.useEffect(()=>{if(K!==ze.current){if(!V){ze.current=K;return}ae!=="all"||oe.reading||!oe.value||!h.roadmapSeen||(ze.current=K,h.roadmapSeen(oe.value.as_of).then(se=>{se.ok&&(Qe.current+=1,W([]))}))}},[K,V,ae,oe,h]);const ye=new Map((((zn=oe.value)==null?void 0:zn.releases)??[]).map(se=>[se.id,[se.kinds.includes("range")?"range":"",se.forecast.projected?Ls(se.forecast.projected):"no date"].filter(Boolean).join(" · ")])),St=J===null||J===zs||x.releases.some(se=>se.version===J);u.useEffect(()=>{!m||!c||J!==null&&J!==zs&&!St&&c({kind:"release",id:J})},[m,c,J,St]),u.useEffect(()=>{!J||J===zs||I.current.has(J)||m&&!St||(I.current.add(J),h.release(J).then(se=>ne(J,se)))},[J,h,ne,St]);const Lt=u.useRef(g),yn=u.useRef(!1),Ss=u.useRef(!!f),bn=u.useRef(null);u.useEffect(()=>{var _e,Es;if(!m)return;if(Ss.current){const qa=(_e=bn.current)==null?void 0:_e.querySelector('[aria-current="true"]');if(qa){Ss.current=!1,Lt.current=g,qa.focus();return}}if(Lt.current!==g&&(Lt.current=g,yn.current=!0),!yn.current)return;const se=(Es=T.current)==null?void 0:Es.querySelector("h2");se&&(yn.current=!1,se.tabIndex=-1,se.focus())});const tn=async se=>{if(!a)return;A(null);const _e=await a(se);if(!_e.ok){A(_e.error);return}y(null),N({state:"loading"}),await Z()},Cs=async()=>{if(!x.next_before)return;R(null);const se=await h.list({before:x.next_before});if(!se.ok){R(se.refusal.message);return}j(_e=>({...se.data,releases:[..._e.releases,...se.data.releases]}))},Ts=x.release_branch?s.jsx(Kz,{value:x.release_branch.id,label:x.release_branch.name,options:n??[],can_write:x.can_write,onChange:tn}):null,re=m?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Read at ",Xz(m.read_at)]}),o?s.jsxs(P,{variant:"ghost",size:"sm",onClick:o,children:[s.jsx(vl,{className:"mr-1 size-4","aria-hidden":!0}),"Read again"]}):null]}):Ts,De=m?gz(((Ct=x.releases[0])==null?void 0:Ct.label)??((nn=x.releases[0])==null?void 0:nn.version)??null):pz(((rs=x.releases[0])==null?void 0:rs.version)??null,((Ln=x.release_branch)==null?void 0:Ln.name)??null),Ce={org:i??""};return s.jsxs(s.Fragment,{children:[s.jsx(Ok,{description:m?Dk:void 0,actions:re}),d,m?s.jsx(vz,{}):null,k?s.jsx(An,{error:k}):null,m?null:t,!m&&!x.release_branch?s.jsx(Qz,{can_write:x.can_write,options:n??[],onChoose:tn}):null,x.release_branch||x.releases.length>0||m?s.jsxs("div",{ref:bn,className:"flex flex-col gap-6 md:flex-row md:items-start",children:[s.jsx(Zz,{list:x,candidate:b?_:null,shown:V?ir:G!==null?Fn(G):J,onSelect:xt,roadmap:M.available?Lz(((ea=x.planned)==null?void 0:ea.length)??0,le):null,planned_ranges:ye,can_load_older:!!x.next_before,older_error:H,onLoadOlder:Cs}),s.jsx("div",{className:"min-w-0 flex-1",ref:T,children:V?s.jsx(Uz,{reads:M.reads,scope:ae,onScope:B,onRead:Oe,org:Ce.org,onSelect:p}):G!==null?s.jsx(Tz,{id:G,summary:((D=x.planned)==null?void 0:D.find(se=>se.id===G))??null,org:Ce.org,onNotFound:()=>c==null?void 0:c({kind:"planned",id:G}),forecast:M.available?s.jsx(Yz,{state:oe,id:G}):null}):J===zs?s.jsx(Jz,{candidate:_,branch_name:((be=x.release_branch)==null?void 0:be.name)??null,can_write:x.can_write&&!!l,local:!!m,org:Ce.org,onSelect:p,onRetry:O,onWrite:()=>X(!0)}):J?s.jsx(eL,{detail:C[J]??{state:"loading"},summary:x.releases.find(se=>se.version===J)??null,local:!!m,org:Ce.org,onSelect:p,onRetry:()=>ee(J)}):(x.release_branch||m)&&_.state==="ready"?s.jsx(mz,{title:De.title,text:De.text}):null})]}):null,l&&_.state==="ready"&&_.value?l({candidate:_.value,open:$,notice:Y,onOpenChange:se=>{se||L(null),X(se)},onStale:async se=>{L(se),await S()},onWritten:async se=>{X(!1),L(null),await Z(),y(se),await O()}}):null]})}function Xz(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function Kz({value:e,label:t,options:n,can_write:a,onChange:l}){const r=n.some(i=>i.id===e);return s.jsxs("div",{className:"grid w-56 gap-2",children:[s.jsx(Me,{htmlFor:"release-branch",children:"Release branch"}),s.jsxs(dt,{value:e,onValueChange:l,disabled:!a,children:[s.jsx(it,{id:"release-branch",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[r?null:s.jsx(ke,{value:e,children:t??"Unnamed branch"}),n.map(i=>s.jsx(ke,{value:i.id,children:i.label},i.id))]})]}),a?null:s.jsx(Jk,{})]})}function Jk(){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 Qz({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(uu,{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(Me,{htmlFor:"release-branch-first",children:"Release branch"}),s.jsxs(dt,{onValueChange:n,disabled:!e,children:[s.jsx(it,{id:"release-branch-first",children:s.jsx(ft,{placeholder:"Choose a branch"})}),s.jsx(ot,{children:t.map(a=>s.jsx(ke,{value:a.id,children:a.label},a.id))})]})]}),e?null:s.jsx(Jk,{})]})}function e1({children:e}){return s.jsx("p",{className:"text-muted-foreground px-3 pt-3 text-xs font-medium tracking-wide uppercase",children:e})}function Zz({list:e,candidate:t,shown:n,onSelect:a,roadmap:l,planned_ranges:r,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?Zi(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&&l?s.jsx(Ec,{active:n===ir,onClick:()=>a(ir),version:"Roadmap",badges:null,caption:l}):null,t&&(t.state!=="ready"||t.value)?s.jsx(Ec,{active:n===zs,onClick:()=>a(zs),version:t.state==="ready"&&t.value?t.value.version:"Next release",badges:s.jsxs(s.Fragment,{children:[s.jsx(he,{variant:"info",children:"Candidate"}),f!=null&&f.breaking?s.jsx(he,{variant:"error",children:"Breaking"}):t.state==="ready"&&((h=t.value)==null?void 0:h.app_changed)===!1?s.jsx(he,{variant:"neutral",children:"App unchanged"}):t.state==="ready"&&((m=t.value)!=null&&m.classification)?s.jsx(he,{variant:"neutral",children:t.value.classification.bump}):null]}),caption:t.state==="loading"?"Classifying…":t.state==="error"?"Could not be read":$k(t.value)}):null,d?s.jsx(Wz,{list:e,shown:n,onSelect:a,ranges:r}):null,d&&e.releases.length>0?s.jsx(e1,{children:"Released"}):null,e.releases.map(x=>{const j=d?yz(x):null;return s.jsx(Ec,{active:n===x.version,onClick:()=>a(x.version),version:x.label??x.version,badges:(j==null?void 0:j.badges)??s.jsxs(s.Fragment,{children:[s.jsx(he,{variant:"neutral",children:x.previous_release_id?x.bump??"patch":"First"}),x.breaking?s.jsx(he,{variant:"error",children:"Breaking"}):null]}),caption:(j==null?void 0:j.caption)??rx(x.written_at)},x.version)}),i?s.jsx(P,{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 Wz({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(e1,{children:"Planned"}),e.planned_error?s.jsx(An,{title:"Planned Releases could not be read",error:e.planned_error}):null,(e.planned??[]).map((l,r)=>s.jsx(Ec,{active:t===Fn(l.id),onClick:()=>n(Fn(l.id)),version:l.name,badges:s.jsx(he,{variant:"neutral",children:"Planned"}),caption:`${l.members===0?"no members":`${l.members} member${l.members===1?"":"s"}`}${r===0?" · next":""}${a!=null&&a.get(l.id)?` · ${a.get(l.id)}`:""}`},l.id))]})}function Jz({candidate:e,branch_name:t,can_write:n,local:a,org:l,onSelect:r,onRetry:i,onWrite:o}){var m;if(e.state==="loading")return s.jsx(Tn,{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(Tn,{children:s.jsx(An,{error:e.error,onRetry:i})});const c=e.value;if(!c)return null;const d=Zi(c.changes),f=!c.previous_release,h=t??"the release branch";return s.jsxs(Tn,{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(he,{variant:"info",children:"Candidate"}),d.breaking?s.jsx(he,{variant:"error",children:"Breaking"}):c.app_changed===!1?s.jsx(he,{variant:"neutral",children:"App unchanged"}):c.classification?s.jsx(he,{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: `,$k(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(P,{onClick:o,children:[s.jsx(uu,{className:"mr-2 size-4"}),"Write Release ",c.next_version]}):null]}),a?s.jsx(kz,{candidate:c,org:l,onSelect:r,notes:f?null:s.jsx(Cu,{changes:c.changes})}):f?null:s.jsx(Cu,{changes:c.changes})]})}function eL({detail:e,summary:t,local:n,org:a,onSelect:l,onRetry:r}){const[i,o]=u.useState(!1);if((t==null?void 0:t.state)==="unreadable")return s.jsxs(Tn,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:t.label??t.version}),s.jsx(An,{title:"This Release could not be read",error:t.error??"Its record cannot be read."})]});if(e.state==="loading")return s.jsx(Tn,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Release…"})});if(e.state==="error")return s.jsx(Tn,{children:s.jsx(An,{error:e.error,onRetry:r})});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(fz(h,Zi(c.changes))),o(!0)};return s.jsxs(Tn,{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(Sz,{release:c,onSelect:l}):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(he,{variant:"neutral",children:d?"First":c.bump}),Zi(c.changes).breaking?s.jsx(he,{variant:"error",children:"Breaking"}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Written ",rx(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(P,{variant:"outline",onClick:m,children:[s.jsx(JC,{className:"mr-2 size-4"}),i?"Copied":"Copy notes"]})]}),n?s.jsx(Cz,{release:c,org:a,onSelect:l,notes:d?null:s.jsx(Cu,{changes:c.changes})}):d?null:s.jsx(Cu,{changes:c.changes})]})}const tL=5,nL=e=>e.retry===!0||e.reason==="store_locked"||e.status===503;function sL({org:e,query:t,onSelect:n,home:a}){var H,R;const l=Wk(),{href:r,Link:i}=Ve(),[o,c]=u.useState({state:"loading"}),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,j]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(!1),b=u.useCallback(async T=>{const z=y.current+=1;m(null);const S=await l.list(T?{fresh:!0}:void 0);if(z===y.current){if(S.ok){v.current=0,f(null),c({state:"ok",list:S.data});return}if(S.refusal.reason==="engine_missing"){c({state:"engine_missing",refusal:S.refusal});return}if(v.current+=1,v.current===1&&nL(S.refusal)){m(S.refusal.retry_after??tL);return}f(S.refusal)}},[l]);u.useEffect(()=>{b(!1)},[b]),u.useEffect(()=>{if(h===null)return;const T=setTimeout(()=>void b(!1),h*1e3);return()=>clearTimeout(T)},[h,b]),u.useEffect(()=>{var z;if(!p.current||o.state==="loading"||d||h!==null)return;p.current=!1;const T=(z=g.current)==null?void 0:z.querySelector("h1");T&&(T.tabIndex=-1,T.focus())});const _=()=>{p.current=!0,v.current=0,f(null),b(!0)},N=o.state==="ok"?o.list:null,C=t.roadmap?ir:t.planned!==null?t.planned===""?(H=N==null?void 0:N.planned)!=null&&H[0]?Fn(N.planned[0].id):null:Fn(t.planned):t.release,w=`${t.release??""}|${t.planned??""}|${t.roadmap?"roadmap":""}`,k=u.useRef(w);u.useEffect(()=>{k.current!==w&&(k.current=w,j(null))},[w]);const A=u.useRef(!1),$=u.useCallback(T=>{A.current=!0,j(T)},[]),X=!x&&o.state==="ok"&&A.current;if(u.useEffect(()=>{X&&(A.current=!1)},[X]),x)return s.jsx(Ba,{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:r(a),backLabel:"All Releases",link:i});const Y=h!==null?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(gn,{"aria-hidden":!0})," The release records are busy; reading again in ",h," s…"]}):null,L=d?s.jsxs(me,{variant:"destructive",children:[s.jsx(xn,{}),s.jsx(ve,{children:"Releases could not be read"}),s.jsxs(pe,{className:"flex flex-col items-start gap-2",children:[s.jsxs("span",{children:[d.message,N?" The last Releases read stay below.":""]}),s.jsx(P,{variant:"outline",size:"sm",onClick:_,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(Fz,{initial:o.list,org:e,selection:{selected:C,onSelect:n},onReadAgain:_,onNotFound:$,notice:Y||L?s.jsxs(s.Fragment,{children:[Y,L]}):null,focusOnMount:X},((R=o.list.local)==null?void 0:R.read_at)??"list"):o.state==="engine_missing"?s.jsx(Js,{page:"Releases"}):s.jsxs(s.Fragment,{children:[s.jsx(Ok,{description:Dk}),L??Y??s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(gn,{"aria-hidden":!0})," Loading Releases…"]})]})})}const aL={threads:"Threads",tasks:"Tasks",queues:"Queues",worktrees:"Worktrees",workspaces:"Workspaces",chart:"Org chart"},lL={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Ac(e,t){return e.kind==="home"?"Home":e.kind==="org"?aL[e.page]:e.kind==="project"?e.page?lL[e.page]:t??e.project:"Not found"}const rL="(max-width: 767px)";function iL(){const e=typeof window<"u"&&window.matchMedia?window.matchMedia(rL):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 cc({className:e=""}){return s.jsx("span",{"aria-hidden":"true",className:`block animate-pulse rounded-md bg-sidebar-accent ${e}`})}function Uv({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 Bv({item:e,collapsed:t}){const{Link:n}=Ve(),a=e.icon,l=e.title??(t?e.label:void 0),r=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:l?s.jsxs(ZN,{children:[s.jsx(WN,{asChild:!0,children:r}),s.jsx(Kp,{side:"right",children:l})]}):r})}const Hv="m-0 flex list-none flex-col gap-1 p-0";function Iv({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 Pv({page:e,collapsed:t,sheet:n=!1}){var H;const{href:a}=Ve(),{worktrees:l}=en(),r=vn(),{org:i,projects:o,loading:c,none:d,about:f,aboutFailed:h,domains:m,engine:x}=r,j=x===null,v=i?`/org/${i.slug}`:"",y=o==null?void 0:o.find(R=>R.current),g=((H=i==null?void 0:i.source)==null?void 0:H.kind)==="folder"&&y!==void 0,p=R=>g&&y?`${R} · ${y.name}`:R,b=p("Workspaces"),_=p("Tasks"),N=p("Queues"),C=R=>g?R:void 0,w=[{label:"Home",href:a(v||"/"),icon:mT,current:e.kind==="home"},...j?[]:[{label:"Threads",href:a(`${v}/threads`),icon:RT,current:e.kind==="org"&&e.page==="threads"}],...m.includes("tasks")&&!j?[{label:_,title:C(_),href:a(`${v}/tasks`),icon:l0,current:e.kind==="org"&&e.page==="tasks"}]:[],...j?[]:[{label:N,title:C(N),href:a(`${v}/queues`),icon:r0,current:e.kind==="org"&&e.page==="queues"}],...l&&!j?[{label:"Worktrees",href:a(`${v}/worktrees`),icon:a0,current:e.kind==="org"&&e.page==="worktrees"}]:[],{label:b,title:C(b),href:a(`${v}/workspaces`),icon:oT,current:e.kind==="org"&&e.page==="workspaces"},{label:"Org chart",href:a(`${v}/chart`),icon:OT,current:e.kind==="org"&&e.page==="chart"}],k=c?null:d?"No organization":(i==null?void 0:i.name)??"Organization",A=i?oR(i):null,$=f==null?void 0:f.version,X=$?t?$:`sdlc ${$}`:h?du:ed,Y=h||(f==null?void 0:f.sync.state)==="unknown"?lR:f===void 0?aR:sR;let L;return c?L=s.jsx("div",{className:"px-2 py-1",children:s.jsxs(Uv,{label:"Loading projects",children:[s.jsx(cc,{className:"h-4 w-32"}),s.jsx(cc,{className:"h-4 w-24"})]})}):o?L=s.jsx("ul",{className:Hv,children:o.map(R=>s.jsx(Bv,{collapsed:t,item:{label:R.name,title:R.name,href:a(`/proj/${encodeURIComponent(R.id)}`),icon:rT,current:e.kind==="project"&&e.project===R.id}},R.id))}):L=s.jsx("p",{className:"m-0 px-2 text-sm text-sidebar-foreground/70",children:d?"No projects":du}),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(UC,{className:"size-4","aria-hidden":"true"})}),!t&&s.jsx("div",{className:"grid min-w-0 flex-1 text-left text-sm leading-tight",children:k===null?s.jsxs(Uv,{label:"Loading organization",children:[s.jsx(cc,{className:"h-4 w-28"}),s.jsx(cc,{className:"h-3 w-24"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-semibold",title:k,children:k}),A&&s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/70",children:A})]})})]}),s.jsxs("nav",{"aria-label":"App",className:"min-h-0 flex-1 overflow-y-auto",children:[s.jsx(Iv,{label:"Organization",collapsed:t,children:s.jsx("ul",{className:Hv,children:w.map(R=>s.jsx(Bv,{item:R,collapsed:t},R.label))})}),!t&&s.jsx(Iv,{label:"Projects",collapsed:t,children:L})]}),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:$?`sdlc ${$}`:void 0,children:X}),!t&&s.jsxs("p",{className:"m-0 flex items-start gap-2 px-2",children:[s.jsx(uT,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:Y})]})]})]})}const oL="outline-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring";function cL({page:e}){var c;const{href:t,Link:n}=Ve(),{org:a,projects:l,loading:r,none:i}=vn(),o=[];if(r)o.push({label:ed});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=l==null?void 0:l.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:Ac(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:Ac(e),href:t(f)}),o.push({label:e.item})}else e.kind!=="home"&&!(e.kind==="project"&&!e.page)&&o.push({label:Ac(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(n0,{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 ${oL}`,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 uL({page:e,children:t}){var g;const n=iL(),[a,l]=u.useState(!0),[r,i]=u.useState(!1),o=u.useRef(null),c=u.useRef(null),{org:d,projects:f,loading:h,none:m}=vn(),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?ed:m?"No organization":(d==null?void 0:d.name)??"Organization",b=(e.kind==="org"||e.kind==="project")&&e.item!==void 0?`${e.item} · `:"";document.title=`${b}${Ac(e,x)} · ${p} · sdlc viewer`},[e,x,d,h,m]);const j=()=>{var p;i(!1),(p=o.current)==null||p.focus()};u.useEffect(()=>{n||i(!1)},[n]);const v=n&&r;u.useEffect(()=>{var _;const p=c.current;if(!v||!p)return;(_=p.querySelector("a, button"))==null||_.focus();const b=N=>{var $;if(N.key==="Escape"){i(!1),($=o.current)==null||$.focus();return}if(N.key!=="Tab")return;const C=[...p.querySelectorAll("a[href], button:not([disabled])")];if(C.length===0)return;const w=C[0],k=C[C.length-1],A=p.contains(document.activeElement);N.shiftKey&&(document.activeElement===w||!A)?(N.preventDefault(),k.focus()):!N.shiftKey&&(document.activeElement===k||!A)&&(N.preventDefault(),w.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[v]);const y=!n&&!a;return s.jsx(QN,{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(Pv,{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(Pv,{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:j,children:s.jsx(Ju,{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:j})]}),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?r:a,onClick:()=>n?i(p=>!p):l(p=>!p),children:s.jsx(DT,{className:"size-4","aria-hidden":"true"})}),s.jsx("span",{"aria-hidden":"true",className:"mr-2 h-4 w-px bg-border"}),s.jsx(cL,{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 ux="m-0 text-2xl font-semibold tracking-tight",dx="outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",fx=`rounded-sm font-medium text-primary no-underline hover:underline ${dx}`;function Lf({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 dL({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(Lf,{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(Lf,{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(Lf,{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?ol:iR})]})}const qv=`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 ${dx}`;function fL(){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 Pr(){const{href:e,Link:t}=Ve(),{loading:n,projects:a,none:l,failure:r,readAt:i,refresh:o,reading:c}=vn(),[d,f]=u.useState(""),h=s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:ux,children:"Projects"}),!l&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:rR})]});if(l)return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[h,s.jsx(dL,{why:l==="not_in_git"?{kind:"not_in_git"}:fR(l)})]});const m=r!=null&&r.shown?r:null,x=(a??[]).filter(j=>j.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:o0(m.refusal,i)}),s.jsx("div",{children:s.jsx("button",{type:"button",className:qv,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:j=>f(j.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 ${dx}`}),!m&&s.jsx("button",{type:"button",className:`${qv} ml-auto`,onClick:o,disabled:c||n,children:"Refresh"})]}),r&&!r.shown&&i&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`Showing the list read at ${li(i)}; reading again in ${r.retryInSeconds??10} seconds.`})]}),n?s.jsx(fL,{}):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(j=>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(j.id)}`),className:fx,children:j.name})}),s.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:j.location??du}),s.jsx("td",{className:"px-3 py-2 text-right",children:j.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"})})]},j.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 t1({title:e,children:t}){const{href:n,Link:a}=Ve();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:ux,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 ${fx}`,children:"Back to the organization's Home"})})]})})}const hL={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Wi({project:e}){const{href:t,Link:n}=Ve(),{org:a,projects:l,loading:r,domains:i}=vn(),o=l==null?void 0:l.find(c=>c.id===e);return r?s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:ed}):l?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:ux,children:o.name}),s.jsx("p",{className:"m-0 font-mono text-sm text-muted-foreground",children:o.location??du})]}),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:fx,children:hL[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(t1,{title:"Project not found",children:`There is no project '${e}' in this organization.`}):s.jsx(Pr,{})}const Td=e=>e instanceof Error?e.message:String(e);async function n1(){try{const e=await fetch("api/threads",{cache:"no-store"});return e.status===404?{none:!0}:e.ok?{data:await e.json()}:{error:await e.text()||`HTTP ${e.status}`}}catch(e){return{error:Td(e)}}}async function mL(){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 l={};for(const[r,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&&(l[r]=o)}return l}catch{return null}}async function pL(){try{return(await fetch("api/pin",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function xL(){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 gL(){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:Td(e)}}}async function vL(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 l={};try{l=JSON.parse(a)??{}}catch{}return n.ok?{done:l}:{refused:{reason:typeof l.reason=="string"?l.reason:"failed",error:typeof l.error=="string"?l.error:a||`HTTP ${n.status}`,...typeof l.where=="string"&&l.where?{where:l.where}:{}}}}catch(n){return{refused:{reason:"failed",error:Td(n)}}}}async function yL(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 Td(n)}}const bL={probe:{source:async()=>{const e=await n1();if("error"in e)throw new Error(e.error);return{label:"Local workspace"}}}},s1={href:e=>e.replace(/^\/+/,"")||"./",Link:({href:e,className:t,children:n,...a})=>s.jsx("a",{href:e,className:t,...a,children:n})},jL={label:"Local viewer",can:()=>!1};function _L(){return u.useEffect(()=>{document.title="Shared app UI · SDLC Workspace Viewer"},[]),s.jsx("div",{className:"app-ui dark",children:s.jsx(Jj,{data:bL,router:s1,identity:jL,children:s.jsx(bC,{})})})}const wL="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.",NL=3e4,kL="Reading the workspaces. On a plan workspace this can take a few minutes.",SL="The read failed. Details are in the terminal running sdlc viewer.",CL={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"}},TL=e=>CL[e]??{label:e,tone:"neutral"},ba=e=>e.slice(0,8),a1={human:"Human",ai:"AI"},dm=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function RL(){const e=en().workspaces;if(!e)throw new Error("The Workspaces page rendered without the workspaces seam.");return e}function EL(e){const t=RL(),[n,a]=u.useState(null),[l,r]=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),r(null),o(!1)):(r(g.refusal),o(!0))})().finally(()=>{f.current=null});return f.current=y,y},[t]);u.useEffect(()=>{h()},[h]),wu(()=>void h(),NL),u.useEffect(()=>{var y;d.current&&(n||l)&&(d.current=!1,(y=c.current)==null||y.focus())},[n,l]);const m=()=>{d.current=!0,h()},x=n===null&&l===null,j=n===null&&l!==null,v=n?AL(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(Ft,{title:"Workspaces",description:wL,actions:s.jsxs(s.Fragment,{children:[v?s.jsx("p",{className:"text-muted-foreground text-xs",children:v}):null,s.jsxs(P,{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(vl,{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(ML,{}):null,j&&l?s.jsx(OL,{refusal:l,on_retry:m}):null,n?s.jsx($L,{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 AL(e,t){const n=`Read at ${Qn(new Date(e.read_at).toISOString())}`,a=l1(e,t);return a?`${n} · ${a}`:n}function ML(){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(pt,{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:kL})]})}function OL({refusal:e,on_retry:t}){const n=e.reason==="store_locked"?o0(e,null):SL;return s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Could not read workspaces"}),s.jsxs(pe,{children:[s.jsx("p",{children:n}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function $L({overview:e}){const{counts:t}=e,n=[dm(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(uc,{id:"workspaces-lineage",title:"Lineage",caption:"Each workspace under the one it forked from",children:s.jsx(DL,{rows:e.workspaces})}),s.jsx(uc,{id:"workspaces-authority",title:"Authority and resolver",caption:"What this checkout's workspace may change",children:s.jsx(zL,{authority:e.authority})})]}),s.jsx(uc,{id:"workspaces-activity",className:"mt-4",title:"Integration activity",caption:"Newest first",children:e.activity.length===0?s.jsx(Gv,{children:"No integration or reconciliation attempts yet."}):s.jsx(UL,{rows:e.activity})}),s.jsx(uc,{id:"workspaces-handoffs",className:"mt-4",title:"Handoffs",children:e.handoffs.length===0?s.jsx(Gv,{children:"No Handoffs prepared yet."}):s.jsx(BL,{rows:e.handoffs})})]})}function uc({id:e,title:t,caption:n,className:a,children:l}){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]}),l]})}const Gv=({children:e})=>s.jsx("p",{className:"text-muted-foreground text-sm",children:e}),Tu=({children:e,tone:t})=>s.jsx("div",{className:ie("text-xs",t==="error"?"text-destructive":"text-muted-foreground"),children:e});function Ji({status:e}){const t=TL(e);return s.jsx(he,{variant:t.tone,children:t.label})}function Rd({label:e,children:t}){return s.jsx(jt,{role:"group","aria-label":e,tabIndex:0,className:"overflow-x-auto outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:t})}function DL({rows:e}){return s.jsx(Rd,{label:"Workspaces",children:s.jsxs(Be,{containerClassName:"overflow-visible",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Workspace"}),s.jsx(F,{children:"Actor"}),s.jsx(F,{children:"Forked from"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Projection"})]})}),s.jsx(He,{children:e.map(t=>s.jsxs(ue,{"data-testid":"workspaces-row",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-mono font-medium",children:t.short_id}),s.jsx(Tu,{children:t.current?`${t.path} · This checkout`:t.path}),t.projection==="unreadable"&&t.projection_error&&s.jsx(Tu,{children:t.projection_error})]}),s.jsx(q,{children:a1[t.actor]}),s.jsx(q,{children:t.source_id?s.jsx("span",{className:"font-mono",children:ba(t.source_id)}):s.jsx("span",{className:"text-muted-foreground",children:"No source"})}),s.jsx(q,{children:s.jsx(Ji,{status:t.status})}),s.jsx(q,{children:s.jsx(Ji,{status:t.projection})})]},t.id))})]})})}function zL({authority:e}){const t=e.resolver,n=[["Workspace",s.jsx("span",{className:"font-mono",children:ba(e.workspace_id)},"id")],["Actor",a1[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(Ji,{status:t.state==="ready"?"ready":"needs_attention"},"resolver")]),t.state==="needs_attention"&&t.issue&&n.push(["Resolver issue",t.issue]),s.jsx(Rd,{label:"Authority and resolver",children:s.jsx(Be,{containerClassName:"overflow-visible",children:s.jsx(He,{children:n.map(([a,l])=>s.jsxs(ue,{children:[s.jsx(F,{scope:"row",className:"text-muted-foreground font-normal",children:a}),s.jsx(q,{children:l})]},a))})})})}function LL(e){const t=[e.merge_attempts?dm(e.merge_attempts,"merge attempt"):null,e.resolver_attempts?dm(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 UL({rows:e}){return s.jsx(Rd,{label:"Integration activity",children:s.jsxs(Be,{containerClassName:"overflow-visible",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Change"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Attempts"}),s.jsx(F,{children:"Updated"})]})}),s.jsx(He,{children:e.map((t,n)=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:t.kind==="integration"?`Integrate ${ba(t.child_id)} into ${ba(t.other_id)}`:`Reconcile ${ba(t.child_id)} from ${ba(t.other_id)}`}),s.jsx(Tu,{children:t.kind==="integration"?"Integration":"Source reconciliation"})]}),s.jsx(q,{children:s.jsx(Ji,{status:t.status})}),s.jsx(q,{children:LL(t)}),s.jsx(q,{children:tk(t.updated_at)})]},`${t.kind}-${t.child_id}-${t.other_id}-${t.updated_at}-${n}`))})]})})}function BL({rows:e}){return s.jsx(Rd,{label:"Handoffs",children:s.jsxs(Be,{containerClassName:"overflow-visible",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"From"}),s.jsx(F,{children:"To"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Pinned"})]})}),s.jsx(He,{children:e.map(t=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-mono font-medium",children:ba(t.child_id)}),t.error?s.jsx(Tu,{children:t.error}):null]}),s.jsx(q,{className:"font-mono",children:ba(t.source_id)}),s.jsx(q,{children:s.jsx(Ji,{status:t.status})}),s.jsx(q,{children:`${t.child_commit} onto ${t.source_commit}`})]},t.id))})]})})}const Vv="This machine's worktrees of this repository.",HL="Merge sends one whose thread is at rest to the main queue.",IL=3e4,PL=3e3,qL=6e5,Uf=[{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"}],ei={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"}},GL="no thread to land it",hx="its thread waits on you",r1="its thread is done",i1="its thread is retired",mx=e=>e.archivable&&e.cleanup==="user",VL=e=>e.queue!==null||e.merge.offered===!1&&e.merge.why==="already in a promotion queue",YL=e=>!e.merge.offered&&(e.merge.why===r1||e.merge.why.startsWith(i1)),px=e=>!e.merge.offered&&e.merge.why===GL||YL(e),Bf=(e,t)=>t==="all"?!0:t==="decide"?mx(e):(e.landed!==null?"landed":VL(e)?"queued":px(e)?"orphan":"needs")===t,FL=e=>e.landed!==null?e.threads.some(t=>t.phase!=="done"):e.threads.length>0&&!px(e);function Mc(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 o1(e){const t=e%100,n=t>=11&&t<=13?"th":{1:"st",2:"nd",3:"rd"}[e%10]??"th";return`${e}${n}`}function XL(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 Hf=e=>Qn(new Date(e*1e3).toISOString()),ci=e=>e.charAt(0).toUpperCase()+e.slice(1);function KL(e,t){var l;const n=t.phase?ci(t.phase):"No phase",a=e.merge;if(!a.offered&&a.why.startsWith(i1)){const r=(l=/; (.+) continues it$/.exec(a.why))==null?void 0:l[1];return r?`Retired · continued by ${r}`:"Retired"}return t.phase==="done"||!a.offered&&a.why===r1?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===hx?`${n} · waits on you`:a.why.startsWith("its session is not running")?`${n} · session not running`:n}function QL(){const e=en().worktrees;if(!e)throw new Error("The Worktrees page rendered without the worktrees seam.");return e}function ZL({org:e}){var O,Z;const t=QL(),[n,a]=u.useState(null),[l,r]=u.useState(null),[i,o]=u.useState(null),[c,d]=u.useState(!1),[f,h]=u.useState("all"),[m,x]=u.useState(""),[j,v]=u.useState({}),y=u.useRef({}),{confirm:g,confirm_dialog:p}=_o(),b=u.useRef(!1),_=u.useCallback(async()=>{if(b.current)return;b.current=!0;const E=await t.list();b.current=!1,E.ok?(a(E.data),r(null)):r(E.refusal)},[t]),N=u.useCallback(async()=>{const E=await t.sizes();d(!E.ok),E.ok&&o(E.data)},[t]);u.useEffect(()=>{_(),N()},[_,N]);const C=(n==null?void 0:n.rows.some(E=>{var I,ne;return((I=E.write)==null?void 0:I.state)==="waiting"||((ne=E.write)==null?void 0:ne.state)==="running"}))??!1;wu(()=>void _(),C?PL:IL),wu(()=>void N(),qL);const w=(n==null?void 0:n.rows)??[],k=E=>i==null?void 0:i.sizes[E.path],A=w.filter(mx),$=i?A.reduce((E,I)=>E+(k(I)??0),0):null,X=w.length===0?Vv:`${Vv} ${HL}${A.length?` ${A.length} ${A.length===1?"is":"are"} yours to decide${$!==null?`: removing them frees about ${Mc($)}`:""}.`:""}`,Y=m.trim().toLowerCase(),L=E=>!Y||[E.name,E.path,E.branch??"",...E.threads.map(I=>I.title??I.thread)].some(I=>I.toLowerCase().includes(Y)),H=w.filter(E=>Bf(E,f)&&L(E)).sort((E,I)=>{if(f==="decide")return(k(I)??0)-(k(E)??0);const ne=ee=>FL(ee)?ee.merge.offered?0:1:2;return ne(E)-ne(I)||(E.idle_days??1/0)-(I.idle_days??1/0)}),R=async(E,I)=>{const ne=await(E==="merge"?t.merge(I.path):t.remove(I.path));ne.ok?v(({[I.path]:ee,...ge})=>ge):v(ee=>({...ee,[I.path]:ne.refusal.message})),await _()},T=async E=>{if(!E.merge.offered)return;const I=E.threads.find(V=>V.thread===(E.merge.offered&&E.merge.thread)),ne=(I==null?void 0:I.title)??E.merge.thread,ee=I!=null&&I.holds.length?`has ${I.holds.length} open hold(s) (${I.holds.join(", ")})`:"has no open holds",ge=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",G=E.merge.caveat?`
387
+ `}const zs="candidate";function rx(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}const pz="Versioned records of this project's release branch, with notes from its graph changes.";function Dk({description:e=pz,actions:t}){return s.jsx(Ft,{title:"Releases",description:e,actions:t})}function zk(e){var r;if(!e)return"";const t=(r=e.previous_release)==null?void 0:r.version,n=Number(e.version.split("-rc.")[1]??0),a=e.commits_since??n,l=`${e.commits_since===null?"At least ":""}${a} commit${a===1?"":"s"}`;return t?`${l} since ${t}`:`${l} before the first Release`}function Ec({active:e,onClick:t,version:n,badges:a,caption:l,item_ref:r}){return s.jsxs("button",{ref:r,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:l})]})}function Rn({children:e}){return s.jsx("section",{className:"border-border flex flex-col gap-4 rounded-xl border p-4",children:e})}function An({title:e,error:t,onRetry:n}){return s.jsxs(me,{variant:"destructive",children:[s.jsx(xn,{}),e?s.jsx(ve,{children:e}):null,s.jsxs(pe,{className:"flex flex-col items-start gap-2",children:[t,n?s.jsx(P,{variant:"outline",size:"sm",onClick:n,children:"Try again"}):null]})]})}function xz({title:e,text:t}){return s.jsx(Rn,{children:s.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[s.jsx(Qu,{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 gz(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 Cu({changes:e}){const t=u.useMemo(()=>Zi(e),[e]),[n,a]=u.useState(!1),l=t.unlisted_count+t.modeling_only_count;return s.jsxs("div",{className:"flex flex-col gap-4",children:[t.sections.map(r=>{const i=s.jsx("ul",{className:"flex flex-col gap-2",children:r.lines.map(o=>s.jsx($v,{line:o},`${o.node_id}:${o.change}`))});return r.key==="breaking"?s.jsxs(me,{variant:"destructive",className:"border-destructive/40",children:[s.jsx(xn,{}),s.jsx(ve,{children:s.jsx("h3",{className:"text-destructive text-sm font-semibold",children:r.label})}),s.jsx(pe,{className:"text-foreground",children:i})]},r.key):s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:r.label}),i]},r.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,l>0?s.jsxs("p",{className:"text-muted-foreground text-sm",children:[l," more change",l===1?"":"s"," do",l===1?"es":""," not affect the version."]}):null,e.length>0?s.jsx(P,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":n,onClick:()=>a(r=>!r),children:n?"Hide all changes":"Show all changes"}):null,n?s.jsx("ul",{className:"flex flex-col gap-2",children:e.map(r=>s.jsx($v,{line:r,detail:!0},`all:${r.node_id}:${r.change}:${r.modeling_only}`))}):null]})}function $v({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(he,{variant:"outline",children:$k(e.node_type)})]}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]})}const Lk="Releases of this checkout: the roadmap of open Planned Releases, the next candidate, and each production release with its notes.",Dv=5,cm="Not available",um="planned:";function Uk(){const e=Wn();return s.jsx("p",{className:"text-muted-foreground text-sm",children:`${cm}. ${e}`})}const Fn=e=>`${um}${e}`,vz=e=>e!=null&&e.startsWith(um)?e.slice(um.length):null,ix=e=>e?e.slice(0,7):"";function yz(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 bz(){return s.jsxs(me,{variant:"info",children:[s.jsx(Ua,{}),s.jsx(ve,{children:"This page only reads Releases"}),s.jsx(pe,{className:"text-info",children:"A Release is written when production runs a release candidate, once its commit is merged into origin/main."})]})}function jz(e){if(e.state==="unreadable")return{badges:s.jsx(he,{variant:"error",children:"Could not be read"}),caption:""};if(e.state==="withdrawn")return{badges:s.jsx(he,{variant:"warning",children:"Withdrawn"}),caption:e.replaced_by?`Replaced by ${e.replaced_by}`:"Withdrawn"};const t=s.jsxs(s.Fragment,{children:[s.jsx(he,{variant:"neutral",children:e.app_changed===!1?"App unchanged":e.previous_release_id?e.bump??"patch":"First"}),e.breaking?s.jsx(he,{variant:"error",children:"Breaking"}):null]}),n=e.written_at?rx(e.written_at):"",a=e.tracks&&e.tracks.length>0?` · ${e.tracks.join(", ")}`:"";return{badges:t,caption:`${n}${a}`}}function sl({query:e,select:t,onSelect:n,children:a,inline:l=!1}){return s.jsx("a",{href:`?${e}`,className:l?"text-primary underline":"text-primary hover:underline",onClick:r=>{r.preventDefault(),n(t)},children:a})}function Sd({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 vs=({children:e})=>s.jsx("code",{className:"font-mono text-xs",children:e});function Bk(e,t){if(e.judged_commit&&t&&e.judged_commit!==t)return`Judged ${ix(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 Cd({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 _z={ready:"success",verifying:"info",fixing:"warning",abandoned:"warning",ready_older:"neutral",none:"neutral",unknown:"neutral"};function wz({batch:e}){if(e.state==="loading")return s.jsxs(me,{children:[s.jsx(uu,{}),s.jsxs(pe,{className:"flex flex-row items-center gap-2",role:"status",children:[s.jsx(gn,{"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(me,{children:[s.jsx(uu,{}),s.jsxs(ve,{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:t.text}),s.jsx(he,{variant:_z[t.state],children:t.chip})]}),t.help?s.jsx(pe,{children:t.help}):null]})}function Nz(e,t,n){return`/org/${e}/issues/${encodeURIComponent(t)}?from=${encodeURIComponent(n)}`}function Hk({issues:e,error:t}){return t?s.jsx(An,{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(Cd,{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(vs,{children:n.file}):null]},n.key))})]})}function Ik({tracks:e,error:t}){return t?s.jsx(An,{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(Cd,{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(vs,{children:n.version}):null,n.bump?s.jsx(he,{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(vs,{children:a.name}),s.jsxs(vs,{children:[a.from??"—"," → ",a.to??"—"]})]}),a.changes.map((l,r)=>s.jsxs("span",{className:"text-muted-foreground text-xs",children:[l.feature,": ",l.entry]},r))]},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 Pk({delivery:e,candidate:t,onSelect:n}){if(!e||e.planned.length===0&&e.outside===0)return null;const a=l=>l.length===0?"—":l.map(r=>r.went?`${r.label} (${r.went})`:r.label).join(", ");return s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(Cd,{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(Be,{containerAriaLabel:"Planned Releases",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Planned Release"}),s.jsx(F,{children:"Delivered"}),s.jsx(F,{children:"Not delivered"})]})}),s.jsx(He,{children:e.planned.map(l=>s.jsxs(ue,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.open&&t?s.jsx(sl,{query:`planned=${encodeURIComponent(l.id)}`,select:Fn(l.id),onSelect:n,children:l.name}):s.jsx("span",{children:l.name}),s.jsx(vs,{children:l.id})]})}),s.jsx(q,{children:a(l.delivered)}),s.jsx(q,{children:a(l.not_delivered)})]},l.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 kz={thread:"Thread",task:"Task",issue:"Issue",test:"Test"};function qk({rows:e,org:t,from:n,untasked:a}){const{href:l,Link:r}=Ve(),[i,o]=u.useState(!1),c=i?e:e.slice(0,Dv),d=f=>f.kind==="task"?s.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:l(`/org/${t}/tasks/${encodeURIComponent(f.id)}?from=${encodeURIComponent(n)}`),children:f.id}):f.kind==="issue"?s.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:l(Nz(t,f.id,n)),children:f.id}):f.kind==="thread"?s.jsx(r,{className:"text-primary hover:underline",href:l(`${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(Be,{containerAriaLabel:"Related",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Kind"}),s.jsx(F,{children:"Item"}),s.jsx(F,{children:"How it relates"})]})}),s.jsx(He,{children:c.map(f=>s.jsxs(ue,{children:[s.jsx(q,{children:kz[f.kind]}),s.jsx(q,{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(q,{children:f.relation})]},`${f.kind}:${f.id}`))})]})}),e.length>Dv?s.jsx(P,{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 Gk=e=>(e==null?void 0:e.status)===409&&e.reason==="view_outdated";function Vk(e){const t=ox(),[n,a]=u.useState(t!=null&&t.related?{state:"loading"}:null),l=u.useRef(0),r=u.useCallback(async(i=!1)=>{if(!(t!=null&&t.related))return;const o=++l.current;a({state:"loading"});const c=await t.related(e,i?{fresh:!0}:void 0);o===l.current&&a(c.ok?{state:"ready",value:c.data}:{state:"error",error:c.refusal.message,refusal:c.refusal})},[t,e]);return u.useEffect(()=>{r()},[r]),{related:n,read:r}}function Yk({related:e,org:t,from:n,onRetry:a}){const l=u.useRef(null),r=u.useRef(!1);if(u.useEffect(()=>{var o;r.current&&(e==null?void 0:e.state)!=="loading"&&(r.current=!1,(o=l.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:l,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(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-full"}),s.jsx(pt,{className:"h-8 w-2/3"})]}):e.state==="error"?Gk(e.refusal)?s.jsx(Uk,{}):s.jsx(An,{title:"Related work could not be read",error:e.error,onRetry:()=>{r.current=!0,a()}}):e.value.rows.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):s.jsx(qk,{rows:e.value.rows,org:t,from:n,untasked:e.value.untasked})]})}function Sz(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 Fk({planned:e,onSelect:t}){return e?e.open?s.jsx(sl,{query:`planned=${encodeURIComponent(e.id)}`,select:Fn(e.id),onSelect:t,children:e.name}):s.jsxs("span",{children:[e.name," ",s.jsx(vs,{children:e.id})]}):null}function Cz({candidate:e,org:t,onSelect:n,notes:a}){const l=ox(),{related:r,read:i}=Vk("candidate"),[o,c]=u.useState(l!=null&&l.candidateBatch?{state:"loading"}:null);u.useEffect(()=>{if(!(l!=null&&l.candidateBatch))return;let f=!0;return l.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}},[l]);const d=e.readiness??((r==null?void 0:r.state)==="ready"?r.value.readiness:null)??null;return s.jsxs(s.Fragment,{children:[s.jsx(Sd,{pairs:[["Environment",e.environment??"staging"],["Commit",s.jsx(vs,{children:ix(e.head_commit_id)},"commit")],["Readiness",d?Bk(d,e.head_commit_id):null],["Planned",e.planned_release?s.jsx(Fk,{planned:e.planned_release,onSelect:n}):null]]}),o?s.jsx(wz,{batch:o}):null,a,s.jsx(Hk,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(Ik,{tracks:e.tracks,error:e.tracks_error}),s.jsx(Pk,{delivery:e.planned_delivery,candidate:!0,onSelect:n}),s.jsx(Yk,{related:r,org:t,from:"release:candidate",onRetry:()=>i(!0)})]})}function Rz({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(he,{variant:"warning",children:"Withdrawn"}):s.jsx(he,{variant:"neutral",children:e.app_changed===!1?"App unchanged":a?"First":e.bump}),e.breaking?s.jsx(he,{variant:"error",children:"Breaking"}):null]}),e.state==="withdrawn"&&e.replaced_by?s.jsxs("p",{className:"text-sm",children:["Replaced by"," ",s.jsx(sl,{query:`release=${encodeURIComponent(e.replaced_by)}`,select:e.replaced_by,onSelect:t,inline:!0,children:e.replaced_by})]}):null]})}function Tz({release:e,org:t,onSelect:n,notes:a}){const l=e.label??e.version,{related:r,read:i}=Vk(l),o=(r==null?void 0:r.state)==="ready"?Sz(r.value.previews):null;return s.jsxs(s.Fragment,{children:[s.jsx(Sd,{pairs:[["Environment",e.environment??"production"],["Commit",e.commit?s.jsx(vs,{children:ix(e.commit)},"commit"):null],["Readiness",e.readiness?`${Bk(e.readiness)} on staging`:null],["Previews",o],["Planned",e.planned_release?s.jsx(Fk,{planned:e.planned_release,onSelect:n}):null]]}),a,s.jsx(Hk,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(Ik,{tracks:e.tracks,error:e.tracks_error}),s.jsx(Pk,{delivery:e.planned_delivery,candidate:!1,onSelect:n}),s.jsx(Yk,{related:r,org:t,from:`release:${l}`,onRetry:()=>i(!0)})]})}function Ez({id:e,summary:t,org:n,onNotFound:a,forecast:l}){var g,j;const r=ox(),[i,o]=u.useState({state:"loading"}),c=u.useRef(0),d=u.useCallback(async(v=!1)=>{const y=++c.current;if(!(r!=null&&r.plannedRelease)){o({state:"error",error:cm,refusal:{status:409,message:cm,reason:"view_outdated"}});return}o({state:"loading"});const x=await r.plannedRelease(e,v?{fresh:!0}:void 0);y===c.current&&o(x.ok?{state:"ready",value:x.data}:{state:"error",error:x.refusal.message,refusal:x.refusal})},[r,e]);u.useEffect(()=>{d()},[d]);const f=i.state==="error"&&(((g=i.refusal)==null?void 0:g.status)===404||((j=i.refusal)==null?void 0:j.reason)==="not_found");if(u.useEffect(()=>{f&&a()},[f,a]),i.state==="loading")return s.jsxs(Rn,{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(he,{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(Rn,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),Gk(i.refusal)?s.jsx(Uk,{}):f?null:s.jsx(An,{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(Rn,{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(he,{variant:"neutral",children:"Planned"})]}),h.goal?s.jsx("p",{className:"text-muted-foreground text-sm",children:h.goal}):null]}),s.jsx(Sd,{pairs:[["Planned Release",s.jsx(vs,{children:h.id},"id")],["Date",h.date],["Order",m],["Members",String(h.members.length)]]}),l,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(Cd,{title:"Members",count:h.members.length}),h.members.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Members",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Member"}),s.jsx(F,{children:"Level"}),s.jsx(F,{children:"Tasks"}),s.jsx(F,{children:"State"})]})}),s.jsx(He,{children:h.members.map(v=>{const y=v.tasks.filter(p=>p.state==="done").length,x=v.tasks.filter(p=>p.state!=="done").map(p=>p.id);return s.jsxs(ue,{children:[s.jsx(q,{children:v.label}),s.jsx(q,{children:v.level?s.jsx(he,{variant:"neutral",children:Az(v.level)}):null}),s.jsx(q,{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,x.length>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Open: ",s.jsx(vs,{children:x.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(q,{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(qk,{rows:h.related,org:n,from:`planned:${h.id}`})]})]})}const Az=e=>e.charAt(0).toUpperCase()+e.slice(1);function ox(){return en().releases}const In={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"},zv=3,Mz=["in_progress","not_started","planned","blocked"],cx="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),yt=e=>e.charAt(0).toUpperCase()+e.slice(1);function zf(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(e??""));return t?`${Number(t[3])} ${cx[Number(t[2])-1]}`:String(e??"")}function Xk(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${cx[t.getMonth()]} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Oz(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${cx[t.getMonth()]}`}function Ls(e){return e?e.from===e.to&&e.or_later?`${zf(e.from)} or later`:`${zf(e.from)} to ${zf(e.to)}${e.or_later?", or later":""}`:""}function $z(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 Kk(e){var h;const t=e??{},n=t.source??{},l=[t.no_date==="no date: no rate"&&n.rate_why?n.rate_why:"",/members estimated$/.test(t.no_date??"")?"":$z(t)].filter(Boolean).join(" · "),r=t.projected?Ls(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=[l,c,o&&i&&t.projected?`corrected for past estimates: raw ${Ls({...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:r?yt(r):"",caption:f}}function Dz(e){const t=e.kinds??[];return[t.includes("range")?"Not promised":"",e.goal??(t.includes("major")?"No goal yet":"")].filter(Boolean).join(" · ")}function zz(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,l=(e.needs_user??[]).length,r=!a&&!l?["none blocked · none waiting on you"]:[a?`${a} blocked`:"",l?`${l} waiting on you`:""],i=((f=e.tasks)==null?void 0:f.untracked_slices)??0;i&&r.push(`${i} slice${i===1?"":"s"} not tasks yet`);const o=((h=e.not_a_member)==null?void 0:h.count)??0;return o&&r.push(`${o} not a member yet`),{lead:n,rest:r.filter(Boolean).join(" · ")}}const Qk=e=>String(e??"").replace(/_/g," ");function Lz(e){const t=e??{},n=t.kinds??[],a=n.includes("slipped"),l=!a&&t.was&&t.now?Ls(t.was)===Ls(t.now)?`, range still ${Ls(t.now)}`:`, range was ${Ls(t.was)}, now ${Ls(t.now)}`:"",r=[a&&t.was?`was ${Ls(t.was)}`:"",n.includes("scope changed")?`scope changed${l}`:""].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:r.length?yt(r.join(" · ")):"",what:i}}const ir="roadmap",Lv={reading:!1,value:null,refusal:null};function Uz(e){const[t,n]=u.useState({all:Lv,mine:Lv}),a=u.useRef({all:0,mine:0}),l=u.useCallback(async(r,i=!1)=>{if(!(e!=null&&e.roadmap))return;const o=++a.current[r];n(d=>({...d,[r]:{...d[r],reading:!0}}));const c=await e.roadmap({...i?{fresh:!0}:{},...r==="mine"?{mine:!0}:{}});o===a.current[r]&&n(d=>({...d,[r]:c.ok?{reading:!1,value:c.data,refusal:null}:{reading:!1,value:d[r].value,refusal:c.refusal}}))},[e]);return{reads:t,read:l,available:!!(e!=null&&e.roadmap)}}function Bz(e,t){return`${e} open${t.length?` · ${t.join(", ")} moved since you looked`:""}`}function Ri({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 Zk=({level:e})=>e?s.jsx(he,{variant:"neutral",children:yt(e)}):null;function Wk({state:e}){const t=yt(Qk(e));return Mz.includes(String(e))?s.jsx("span",{className:"font-medium",children:t}):s.jsx("span",{children:t})}function Hz({reads:e,scope:t,onScope:n,onRead:a,org:l,onSelect:r}){var g,j;const i=e[t],o=i.value,c=Wn(),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 ${Xk(o.as_of)}`:"",`${((g=o.source)==null?void 0:g.machine)||"this machine"}'s records`,((j=o.decider)==null?void 0:j.words)??""].filter(Boolean).join(" · "):"";return s.jsxs(Rn,{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(P,{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(gn,{"aria-hidden":!0,className:"size-4"})," ",yt(In.pending),"…"]}):null}),i.refusal&&!i.reading?i.refusal.reason==="no_roadmap"?s.jsx(An,{title:In.failedLead,error:`${yt(In.noEngineLead)}. ${c}`}):i.refusal.reason==="refused"?s.jsx(An,{title:In.failedLead,error:i.refusal.message}):s.jsx(An,{title:In.failedLead,error:i.refusal.message,onRetry:h}):null,o?t==="mine"?s.jsx(Fz,{mine:o.mine,org:l,onSelect:r}):s.jsx(Pz,{read:o,org:l,onSelect:r}):null]})}function Iz(e){if(!e||typeof e.seconds_per_day!="number")return"No rate";const t=Oz(e.as_of);return`${Math.round(e.seconds_per_day/3600)} task hours a day over the ${e.days} days${t?` to ${t}`:""}`}function Pz({read:e,org:t,onSelect:n}){var l,r;const a=e.releases??[];if(!a.length){const[i,o]=In.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(Ri,{children:o})]})}return s.jsxs(s.Fragment,{children:[s.jsx(Sd,{pairs:[["Forecast from",yt(`${((l=e.source)==null?void 0:l.machine)||"this machine"}'s task records and rate`)],["Rate",Iz(e.rate)],["Not counted",yt(((r=e.source)==null?void 0:r.not_counted)||"other machines' work")]]}),a.map(i=>s.jsx(qz,{row:i,org:t,onSelect:n},i.id))]})}function qz({row:e,org:t,onSelect:n}){var h,m,g;const a=Kk(e.forecast),l=zz(e),r=Dz(e),i=`roadmap-${e.id}`,o=e.moved?Lz(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=[r,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(sl,{query:`planned=${encodeURIComponent(e.id)}`,select:Fn(e.id),onSelect:n,children:e.name})}),e.kinds.map(j=>s.jsx(he,{variant:"neutral",children:j},j))]}),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:yt(a.caption.join(" · "))}):null]}):null,f?s.jsx("p",{className:"text-muted-foreground text-sm",children:f}):null,o?s.jsxs(me,{variant:"info",children:[s.jsx(mR,{"aria-hidden":!0}),s.jsx(ve,{children:"Moved since you looked"}),s.jsxs(pe,{className:"text-info flex flex-col gap-0.5",children:[o.head?s.jsx("span",{children:o.head}):null,o.what.map((j,v)=>s.jsx("span",{className:"text-xs",children:j},v))]})]}):null,c?null:s.jsxs("p",{className:"text-sm",children:[l.lead,l.rest?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",l.rest]}):null]}),(g=e.stale_unchecked)!=null&&g.words?s.jsx("p",{className:"text-muted-foreground text-xs",children:yt(e.stale_unchecked.words)}):null,e.for_you&&e.kinds.includes("major")?s.jsx(Gz,{row:e}):null,s.jsx(Yz,{row:e,org:t})]})}function Gz({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 l=[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:[l?`${yt(l).replace(/\.$/,"")}. `:"","Accept or reject in the terminal:"]}),s.jsx(Ri,{children:a.accept}),s.jsx(Ri,{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(Ri,{children:t.set_goal})]}):null]})}function Jk({next:e,org:t}){const{href:n,Link:a}=Ve(),l=e.tasks[0],r=e.label||e.item;return l?s.jsx(a,{className:"text-primary hover:underline",href:n(`/org/${t}/tasks/${encodeURIComponent(l.id)}?from=roadmap`),children:r}):s.jsx("span",{children:r})}function Vz(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?yt(e.nobody):""}function Yz({row:e,org:t}){const[n,a]=u.useState(!1),l=e.next??[];if(!l.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 r=n?l:l.slice(0,zv),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(Be,{containerAriaLabel:`Next in ${e.name}`,children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Member"}),s.jsx(F,{children:"Level"}),s.jsx(F,{children:"State"}),s.jsx(F,{children:"Who is on it"})]})}),s.jsx(He,{children:r.map(o=>{const c=i.get(o.item);return s.jsxs(ue,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(Jk,{next:o,org:t}),c?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[yt(c.words),c.estimate_as_of?` (estimated ${Xk(c.estimate_as_of)})`:""]}):null]})}),s.jsx(q,{children:s.jsx(Zk,{level:o.level})}),s.jsx(q,{children:s.jsx(Wk,{state:o.state})}),s.jsx(q,{children:Vz(o,e)})]},o.item)})})]})}),l.length>zv&&!n?s.jsxs(P,{variant:"outline",size:"sm",className:"self-start",onClick:()=>a(!0),children:["Show all ",l.length]}):null,r.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 Fz({mine:e,org:t,onSelect:n}){const{href:a,Link:l}=Ve();if(!e)return null;const r=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:yt(In.noTask)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Your work",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Task"}),s.jsx(F,{children:"Release"}),s.jsx(F,{children:"Member"})]})}),s.jsx(He,{children:e.tasks.map(i=>{var o,c;return s.jsxs(ue,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(l,{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,yt(Qk(i.state))].filter(Boolean).join(" · ")})]})}),s.jsx(q,{children:(o=i.members)!=null&&o.length?i.members.map(d=>s.jsx("div",{children:s.jsx(sl,{query:`planned=${encodeURIComponent(d.planned_release)}`,select:Fn(d.planned_release),onSelect:n,children:d.name})},d.planned_release)):i.release?s.jsx(sl,{query:`planned=${encodeURIComponent(i.release.planned_release)}`,select:Fn(i.release.planned_release),onSelect:n,children:i.release.name}):s.jsx("span",{className:"text-muted-foreground",children:i.words?yt(i.words):"—"})}),s.jsx(q,{children:(c=i.members)!=null&&c.length?i.members.map(d=>s.jsx(Zk,{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)})})]})}),r.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(Ri,{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:yt(In.noNext)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Your next members",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Release"}),s.jsx(F,{children:"Member"}),s.jsx(F,{children:"State"})]})}),s.jsx(He,{children:e.next.map(i=>s.jsxs(ue,{children:[s.jsx(q,{children:s.jsx(sl,{query:`planned=${encodeURIComponent(i.release)}`,select:Fn(i.release),onSelect:n,children:i.name})}),s.jsx(q,{children:s.jsx(Jk,{next:i,org:t})}),s.jsx(q,{children:s.jsx(Wk,{state:i.state})})]},`${i.release}:${i.item}`))})]})})]})]})}function Xz({state:e,id:t}){var r;const n=Wn();if(!e)return null;const a=(r=e.value)==null?void 0:r.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(gn,{"aria-hidden":!0,className:"size-4"})," ",yt(In.pending),"…"]});if(e.refusal){const i=e.refusal.reason==="no_roadmap"?`${yt(In.noEngineLead)}. ${n}`:e.refusal.message;return s.jsx("p",{className:"text-muted-foreground text-xs",children:`${In.failedLead}: ${i}`})}return null}const l=Kk(a.forecast);return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.lead?s.jsx("p",{className:"text-sm",children:l.lead}):null,l.caption.length?s.jsx("p",{className:"text-muted-foreground text-xs",children:yt(l.caption.join(" · "))}):null]})}function e1(){const e=en().releases;if(!e)throw new Error("The Releases page rendered without a Releases contract.");return e}function Kz({initial:e,environments:t,branch_options:n,chooseBranch:a,renderWrite:l,selection:r,org:i,onReadAgain:o,onNotFound:c,notice:d,focusOnMount:f}){var Ts,Dn,zn,Ct,nn,rs,Ln,ea,D,be;const h=e1(),m=e.local??null,[g,j]=u.useState(e),[v,y]=u.useState(null),x=r?r.selected:v,p=r?r.onSelect:y,b=!!(m||g.release_branch),[_,N]=u.useState(m||e.release_branch?{state:"loading"}:{state:"ready",value:null}),[C,w]=u.useState({}),[k,A]=u.useState(null),[$,X]=u.useState(!1),[Y,L]=u.useState(null),[H,T]=u.useState(null),R=u.useRef(null),z=m?{fresh:!0}:void 0,S=u.useCallback(async se=>{const _e=await h.candidate(se);N(_e.ok?{state:"ready",value:_e.data.candidate}:{state:"error",error:_e.refusal.message,refusal:_e.refusal})},[h]),O=u.useCallback(async()=>{N({state:"loading"}),await S(z)},[S,m]),Z=u.useCallback(async()=>{const se=await h.list();se.ok&&j(se.data)},[h]),E=((Ts=g.release_branch)==null?void 0:Ts.id)??null;u.useEffect(()=>{if(!m&&!E)return;let se=!1;return h.candidate().then(_e=>{se||N(_e.ok?{state:"ready",value:_e.data.candidate}:{state:"error",error:_e.refusal.message,refusal:_e.refusal})}),()=>{se=!0}},[E,h,m]);const I=u.useRef(new Set),ne=u.useCallback((se,_e)=>w(Es=>({...Es,[se]:_e.ok?{state:"ready",value:_e.data.release}:{state:"error",error:_e.refusal.message,refusal:_e.refusal}})),[]),ee=async se=>{w(_e=>({..._e,[se]:{state:"loading"}})),I.current.add(se),ne(se,await h.release(se,z))},ge=_.state!=="ready"||_.value!==null,G=vz(x),M=Uz(m?h:void 0),V=M.available&&x===ir,[ae,B]=u.useState("all"),te=g.release_branch||m?ge?zs:null:((Dn=g.releases[0])==null?void 0:Dn.version)??null,J=G!==null||V?null:x===zs?ge?zs:null:x??te,[le,W]=u.useState([]),Qe=u.useRef(0);u.useEffect(()=>{if(!m||!h.roadmapMoved)return;let se=!0;const _e=Qe.current;return h.roadmapMoved().then(Es=>{se&&Es.ok&&_e===Qe.current&&W(Es.data.moved.map(qa=>qa.name))}),()=>{se=!1}},[h,m]);const oe=M.reads.all,Oe=M.read;u.useEffect(()=>{G===null||!M.available||!oe.value&&!oe.reading&&!oe.refusal&&Oe("all")},[G,M.available,oe,Oe]);const[K,Ne]=u.useState(0),ze=u.useRef(0),xt=se=>{se===ir&&Ne(_e=>_e+1),p(se)};u.useEffect(()=>{if(K!==ze.current){if(!V){ze.current=K;return}ae!=="all"||oe.reading||!oe.value||!h.roadmapSeen||(ze.current=K,h.roadmapSeen(oe.value.as_of).then(se=>{se.ok&&(Qe.current+=1,W([]))}))}},[K,V,ae,oe,h]);const ye=new Map((((zn=oe.value)==null?void 0:zn.releases)??[]).map(se=>[se.id,[se.kinds.includes("range")?"range":"",se.forecast.projected?Ls(se.forecast.projected):"no date"].filter(Boolean).join(" · ")])),St=J===null||J===zs||g.releases.some(se=>se.version===J);u.useEffect(()=>{!m||!c||J!==null&&J!==zs&&!St&&c({kind:"release",id:J})},[m,c,J,St]),u.useEffect(()=>{!J||J===zs||I.current.has(J)||m&&!St||(I.current.add(J),h.release(J).then(se=>ne(J,se)))},[J,h,ne,St]);const Lt=u.useRef(x),yn=u.useRef(!1),Ss=u.useRef(!!f),bn=u.useRef(null);u.useEffect(()=>{var _e,Es;if(!m)return;if(Ss.current){const qa=(_e=bn.current)==null?void 0:_e.querySelector('[aria-current="true"]');if(qa){Ss.current=!1,Lt.current=x,qa.focus();return}}if(Lt.current!==x&&(Lt.current=x,yn.current=!0),!yn.current)return;const se=(Es=R.current)==null?void 0:Es.querySelector("h2");se&&(yn.current=!1,se.tabIndex=-1,se.focus())});const tn=async se=>{if(!a)return;A(null);const _e=await a(se);if(!_e.ok){A(_e.error);return}y(null),N({state:"loading"}),await Z()},Cs=async()=>{if(!g.next_before)return;T(null);const se=await h.list({before:g.next_before});if(!se.ok){T(se.refusal.message);return}j(_e=>({...se.data,releases:[..._e.releases,...se.data.releases]}))},Rs=g.release_branch?s.jsx(Zz,{value:g.release_branch.id,label:g.release_branch.name,options:n??[],can_write:g.can_write,onChange:tn}):null,re=m?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Read at ",Qz(m.read_at)]}),o?s.jsxs(P,{variant:"ghost",size:"sm",onClick:o,children:[s.jsx(vl,{className:"mr-1 size-4","aria-hidden":!0}),"Read again"]}):null]}):Rs,De=m?yz(((Ct=g.releases[0])==null?void 0:Ct.label)??((nn=g.releases[0])==null?void 0:nn.version)??null):gz(((rs=g.releases[0])==null?void 0:rs.version)??null,((Ln=g.release_branch)==null?void 0:Ln.name)??null),Ce={org:i??""};return s.jsxs(s.Fragment,{children:[s.jsx(Dk,{description:m?Lk:void 0,actions:re}),d,m?s.jsx(bz,{}):null,k?s.jsx(An,{error:k}):null,m?null:t,!m&&!g.release_branch?s.jsx(Wz,{can_write:g.can_write,options:n??[],onChoose:tn}):null,g.release_branch||g.releases.length>0||m?s.jsxs("div",{ref:bn,className:"flex flex-col gap-6 md:flex-row md:items-start",children:[s.jsx(Jz,{list:g,candidate:b?_:null,shown:V?ir:G!==null?Fn(G):J,onSelect:xt,roadmap:M.available?Bz(((ea=g.planned)==null?void 0:ea.length)??0,le):null,planned_ranges:ye,can_load_older:!!g.next_before,older_error:H,onLoadOlder:Cs}),s.jsx("div",{className:"min-w-0 flex-1",ref:R,children:V?s.jsx(Hz,{reads:M.reads,scope:ae,onScope:B,onRead:Oe,org:Ce.org,onSelect:p}):G!==null?s.jsx(Ez,{id:G,summary:((D=g.planned)==null?void 0:D.find(se=>se.id===G))??null,org:Ce.org,onNotFound:()=>c==null?void 0:c({kind:"planned",id:G}),forecast:M.available?s.jsx(Xz,{state:oe,id:G}):null}):J===zs?s.jsx(tL,{candidate:_,branch_name:((be=g.release_branch)==null?void 0:be.name)??null,can_write:g.can_write&&!!l,local:!!m,org:Ce.org,onSelect:p,onRetry:O,onWrite:()=>X(!0)}):J?s.jsx(nL,{detail:C[J]??{state:"loading"},summary:g.releases.find(se=>se.version===J)??null,local:!!m,org:Ce.org,onSelect:p,onRetry:()=>ee(J)}):(g.release_branch||m)&&_.state==="ready"?s.jsx(xz,{title:De.title,text:De.text}):null})]}):null,l&&_.state==="ready"&&_.value?l({candidate:_.value,open:$,notice:Y,onOpenChange:se=>{se||L(null),X(se)},onStale:async se=>{L(se),await S()},onWritten:async se=>{X(!1),L(null),await Z(),y(se),await O()}}):null]})}function Qz(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function Zz({value:e,label:t,options:n,can_write:a,onChange:l}){const r=n.some(i=>i.id===e);return s.jsxs("div",{className:"grid w-56 gap-2",children:[s.jsx(Me,{htmlFor:"release-branch",children:"Release branch"}),s.jsxs(dt,{value:e,onValueChange:l,disabled:!a,children:[s.jsx(it,{id:"release-branch",children:s.jsx(ft,{})}),s.jsxs(ot,{children:[r?null:s.jsx(ke,{value:e,children:t??"Unnamed branch"}),n.map(i=>s.jsx(ke,{value:i.id,children:i.label},i.id))]})]}),a?null:s.jsx(t1,{})]})}function t1(){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 Wz({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(uu,{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(Me,{htmlFor:"release-branch-first",children:"Release branch"}),s.jsxs(dt,{onValueChange:n,disabled:!e,children:[s.jsx(it,{id:"release-branch-first",children:s.jsx(ft,{placeholder:"Choose a branch"})}),s.jsx(ot,{children:t.map(a=>s.jsx(ke,{value:a.id,children:a.label},a.id))})]})]}),e?null:s.jsx(t1,{})]})}function n1({children:e}){return s.jsx("p",{className:"text-muted-foreground px-3 pt-3 text-xs font-medium tracking-wide uppercase",children:e})}function Jz({list:e,candidate:t,shown:n,onSelect:a,roadmap:l,planned_ranges:r,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?Zi(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&&l?s.jsx(Ec,{active:n===ir,onClick:()=>a(ir),version:"Roadmap",badges:null,caption:l}):null,t&&(t.state!=="ready"||t.value)?s.jsx(Ec,{active:n===zs,onClick:()=>a(zs),version:t.state==="ready"&&t.value?t.value.version:"Next release",badges:s.jsxs(s.Fragment,{children:[s.jsx(he,{variant:"info",children:"Candidate"}),f!=null&&f.breaking?s.jsx(he,{variant:"error",children:"Breaking"}):t.state==="ready"&&((h=t.value)==null?void 0:h.app_changed)===!1?s.jsx(he,{variant:"neutral",children:"App unchanged"}):t.state==="ready"&&((m=t.value)!=null&&m.classification)?s.jsx(he,{variant:"neutral",children:t.value.classification.bump}):null]}),caption:t.state==="loading"?"Classifying…":t.state==="error"?"Could not be read":zk(t.value)}):null,d?s.jsx(eL,{list:e,shown:n,onSelect:a,ranges:r}):null,d&&e.releases.length>0?s.jsx(n1,{children:"Released"}):null,e.releases.map(g=>{const j=d?jz(g):null;return s.jsx(Ec,{active:n===g.version,onClick:()=>a(g.version),version:g.label??g.version,badges:(j==null?void 0:j.badges)??s.jsxs(s.Fragment,{children:[s.jsx(he,{variant:"neutral",children:g.previous_release_id?g.bump??"patch":"First"}),g.breaking?s.jsx(he,{variant:"error",children:"Breaking"}):null]}),caption:(j==null?void 0:j.caption)??rx(g.written_at)},g.version)}),i?s.jsx(P,{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 eL({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(n1,{children:"Planned"}),e.planned_error?s.jsx(An,{title:"Planned Releases could not be read",error:e.planned_error}):null,(e.planned??[]).map((l,r)=>s.jsx(Ec,{active:t===Fn(l.id),onClick:()=>n(Fn(l.id)),version:l.name,badges:s.jsx(he,{variant:"neutral",children:"Planned"}),caption:`${l.members===0?"no members":`${l.members} member${l.members===1?"":"s"}`}${r===0?" · next":""}${a!=null&&a.get(l.id)?` · ${a.get(l.id)}`:""}`},l.id))]})}function tL({candidate:e,branch_name:t,can_write:n,local:a,org:l,onSelect:r,onRetry:i,onWrite:o}){var m;if(e.state==="loading")return s.jsx(Rn,{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(Rn,{children:s.jsx(An,{error:e.error,onRetry:i})});const c=e.value;if(!c)return null;const d=Zi(c.changes),f=!c.previous_release,h=t??"the release branch";return s.jsxs(Rn,{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(he,{variant:"info",children:"Candidate"}),d.breaking?s.jsx(he,{variant:"error",children:"Breaking"}):c.app_changed===!1?s.jsx(he,{variant:"neutral",children:"App unchanged"}):c.classification?s.jsx(he,{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: `,zk(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(P,{onClick:o,children:[s.jsx(uu,{className:"mr-2 size-4"}),"Write Release ",c.next_version]}):null]}),a?s.jsx(Cz,{candidate:c,org:l,onSelect:r,notes:f?null:s.jsx(Cu,{changes:c.changes})}):f?null:s.jsx(Cu,{changes:c.changes})]})}function nL({detail:e,summary:t,local:n,org:a,onSelect:l,onRetry:r}){const[i,o]=u.useState(!1);if((t==null?void 0:t.state)==="unreadable")return s.jsxs(Rn,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:t.label??t.version}),s.jsx(An,{title:"This Release could not be read",error:t.error??"Its record cannot be read."})]});if(e.state==="loading")return s.jsx(Rn,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Release…"})});if(e.state==="error")return s.jsx(Rn,{children:s.jsx(An,{error:e.error,onRetry:r})});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(mz(h,Zi(c.changes))),o(!0)};return s.jsxs(Rn,{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(Rz,{release:c,onSelect:l}):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(he,{variant:"neutral",children:d?"First":c.bump}),Zi(c.changes).breaking?s.jsx(he,{variant:"error",children:"Breaking"}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Written ",rx(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(P,{variant:"outline",onClick:m,children:[s.jsx(tR,{className:"mr-2 size-4"}),i?"Copied":"Copy notes"]})]}),n?s.jsx(Tz,{release:c,org:a,onSelect:l,notes:d?null:s.jsx(Cu,{changes:c.changes})}):d?null:s.jsx(Cu,{changes:c.changes})]})}const sL=5,aL=e=>e.retry===!0||e.reason==="store_locked"||e.status===503;function lL({org:e,query:t,onSelect:n,home:a}){var H,T;const l=e1(),{href:r,Link:i}=Ve(),[o,c]=u.useState({state:"loading"}),[d,f]=u.useState(null),[h,m]=u.useState(null),[g,j]=u.useState(null),v=u.useRef(0),y=u.useRef(0),x=u.useRef(null),p=u.useRef(!1),b=u.useCallback(async R=>{const z=y.current+=1;m(null);const S=await l.list(R?{fresh:!0}:void 0);if(z===y.current){if(S.ok){v.current=0,f(null),c({state:"ok",list:S.data});return}if(S.refusal.reason==="engine_missing"){c({state:"engine_missing",refusal:S.refusal});return}if(v.current+=1,v.current===1&&aL(S.refusal)){m(S.refusal.retry_after??sL);return}f(S.refusal)}},[l]);u.useEffect(()=>{b(!1)},[b]),u.useEffect(()=>{if(h===null)return;const R=setTimeout(()=>void b(!1),h*1e3);return()=>clearTimeout(R)},[h,b]),u.useEffect(()=>{var z;if(!p.current||o.state==="loading"||d||h!==null)return;p.current=!1;const R=(z=x.current)==null?void 0:z.querySelector("h1");R&&(R.tabIndex=-1,R.focus())});const _=()=>{p.current=!0,v.current=0,f(null),b(!0)},N=o.state==="ok"?o.list:null,C=t.roadmap?ir:t.planned!==null?t.planned===""?(H=N==null?void 0:N.planned)!=null&&H[0]?Fn(N.planned[0].id):null:Fn(t.planned):t.release,w=`${t.release??""}|${t.planned??""}|${t.roadmap?"roadmap":""}`,k=u.useRef(w);u.useEffect(()=>{k.current!==w&&(k.current=w,j(null))},[w]);const A=u.useRef(!1),$=u.useCallback(R=>{A.current=!0,j(R)},[]),X=!g&&o.state==="ok"&&A.current;if(u.useEffect(()=>{X&&(A.current=!1)},[X]),g)return s.jsx(Ba,{title:g.kind==="release"?`No Release ${g.id}`:`No open Planned Release ${g.id}`,description:"This project has no Release, candidate or open Planned Release by that name.",backHref:r(a),backLabel:"All Releases",link:i});const Y=h!==null?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(gn,{"aria-hidden":!0})," The release records are busy; reading again in ",h," s…"]}):null,L=d?s.jsxs(me,{variant:"destructive",children:[s.jsx(xn,{}),s.jsx(ve,{children:"Releases could not be read"}),s.jsxs(pe,{className:"flex flex-col items-start gap-2",children:[s.jsxs("span",{children:[d.message,N?" The last Releases read stay below.":""]}),s.jsx(P,{variant:"outline",size:"sm",onClick:_,children:"Try again"})]})]}):null;return s.jsx("div",{ref:x,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(Kz,{initial:o.list,org:e,selection:{selected:C,onSelect:n},onReadAgain:_,onNotFound:$,notice:Y||L?s.jsxs(s.Fragment,{children:[Y,L]}):null,focusOnMount:X},((T=o.list.local)==null?void 0:T.read_at)??"list"):o.state==="engine_missing"?s.jsx(Js,{page:"Releases"}):s.jsxs(s.Fragment,{children:[s.jsx(Dk,{description:Lk}),L??Y??s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(gn,{"aria-hidden":!0})," Loading Releases…"]})]})})}const rL={threads:"Threads",tasks:"Tasks",queues:"Queues",worktrees:"Worktrees",workspaces:"Workspaces",chart:"Org chart"},iL={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Ac(e,t){return e.kind==="home"?"Home":e.kind==="org"?rL[e.page]:e.kind==="project"?e.page?iL[e.page]:t??e.project:"Not found"}const oL="(max-width: 767px)";function cL(){const e=typeof window<"u"&&window.matchMedia?window.matchMedia(oL):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 cc({className:e=""}){return s.jsx("span",{"aria-hidden":"true",className:`block animate-pulse rounded-md bg-sidebar-accent ${e}`})}function Uv({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 Bv({item:e,collapsed:t}){const{Link:n}=Ve(),a=e.icon,l=e.title??(t?e.label:void 0),r=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:l?s.jsxs(JN,{children:[s.jsx(ek,{asChild:!0,children:r}),s.jsx(Kp,{side:"right",children:l})]}):r})}const Hv="m-0 flex list-none flex-col gap-1 p-0";function Iv({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 Pv({page:e,collapsed:t,sheet:n=!1}){var H;const{href:a}=Ve(),{worktrees:l}=en(),r=vn(),{org:i,projects:o,loading:c,none:d,about:f,aboutFailed:h,domains:m,engine:g}=r,j=g===null,v=i?`/org/${i.slug}`:"",y=o==null?void 0:o.find(T=>T.current),x=((H=i==null?void 0:i.source)==null?void 0:H.kind)==="folder"&&y!==void 0,p=T=>x&&y?`${T} · ${y.name}`:T,b=p("Workspaces"),_=p("Tasks"),N=p("Queues"),C=T=>x?T:void 0,w=[{label:"Home",href:a(v||"/"),icon:xR,current:e.kind==="home"},...j?[]:[{label:"Threads",href:a(`${v}/threads`),icon:AR,current:e.kind==="org"&&e.page==="threads"}],...m.includes("tasks")&&!j?[{label:_,title:C(_),href:a(`${v}/tasks`),icon:i0,current:e.kind==="org"&&e.page==="tasks"}]:[],...j?[]:[{label:N,title:C(N),href:a(`${v}/queues`),icon:o0,current:e.kind==="org"&&e.page==="queues"}],...l&&!j?[{label:"Worktrees",href:a(`${v}/worktrees`),icon:r0,current:e.kind==="org"&&e.page==="worktrees"}]:[],{label:b,title:C(b),href:a(`${v}/workspaces`),icon:uR,current:e.kind==="org"&&e.page==="workspaces"},{label:"Org chart",href:a(`${v}/chart`),icon:DR,current:e.kind==="org"&&e.page==="chart"}],k=c?null:d?"No organization":(i==null?void 0:i.name)??"Organization",A=i?uT(i):null,$=f==null?void 0:f.version,X=$?t?$:`sdlc ${$}`:h?du:ed,Y=h||(f==null?void 0:f.sync.state)==="unknown"?iT:f===void 0?rT:lT;let L;return c?L=s.jsx("div",{className:"px-2 py-1",children:s.jsxs(Uv,{label:"Loading projects",children:[s.jsx(cc,{className:"h-4 w-32"}),s.jsx(cc,{className:"h-4 w-24"})]})}):o?L=s.jsx("ul",{className:Hv,children:o.map(T=>s.jsx(Bv,{collapsed:t,item:{label:T.name,title:T.name,href:a(`/proj/${encodeURIComponent(T.id)}`),icon:oR,current:e.kind==="project"&&e.project===T.id}},T.id))}):L=s.jsx("p",{className:"m-0 px-2 text-sm text-sidebar-foreground/70",children:d?"No projects":du}),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(HC,{className:"size-4","aria-hidden":"true"})}),!t&&s.jsx("div",{className:"grid min-w-0 flex-1 text-left text-sm leading-tight",children:k===null?s.jsxs(Uv,{label:"Loading organization",children:[s.jsx(cc,{className:"h-4 w-28"}),s.jsx(cc,{className:"h-3 w-24"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-semibold",title:k,children:k}),A&&s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/70",children:A})]})})]}),s.jsxs("nav",{"aria-label":"App",className:"min-h-0 flex-1 overflow-y-auto",children:[s.jsx(Iv,{label:"Organization",collapsed:t,children:s.jsx("ul",{className:Hv,children:w.map(T=>s.jsx(Bv,{item:T,collapsed:t},T.label))})}),!t&&s.jsx(Iv,{label:"Projects",collapsed:t,children:L})]}),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:$?`sdlc ${$}`:void 0,children:X}),!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:Y})]})]})]})}const uL="outline-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring";function dL({page:e}){var c;const{href:t,Link:n}=Ve(),{org:a,projects:l,loading:r,none:i}=vn(),o=[];if(r)o.push({label:ed});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=l==null?void 0:l.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:Ac(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:Ac(e),href:t(f)}),o.push({label:e.item})}else e.kind!=="home"&&!(e.kind==="project"&&!e.page)&&o.push({label:Ac(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(a0,{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 ${uL}`,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 fL({page:e,children:t}){var x;const n=cL(),[a,l]=u.useState(!0),[r,i]=u.useState(!1),o=u.useRef(null),c=u.useRef(null),{org:d,projects:f,loading:h,none:m}=vn(),g=e.kind==="project"?(x=f==null?void 0:f.find(p=>p.id===e.project))==null?void 0:x.name:void 0;u.useEffect(()=>{const p=h?ed:m?"No organization":(d==null?void 0:d.name)??"Organization",b=(e.kind==="org"||e.kind==="project")&&e.item!==void 0?`${e.item} · `:"";document.title=`${b}${Ac(e,g)} · ${p} · sdlc viewer`},[e,g,d,h,m]);const j=()=>{var p;i(!1),(p=o.current)==null||p.focus()};u.useEffect(()=>{n||i(!1)},[n]);const v=n&&r;u.useEffect(()=>{var _;const p=c.current;if(!v||!p)return;(_=p.querySelector("a, button"))==null||_.focus();const b=N=>{var $;if(N.key==="Escape"){i(!1),($=o.current)==null||$.focus();return}if(N.key!=="Tab")return;const C=[...p.querySelectorAll("a[href], button:not([disabled])")];if(C.length===0)return;const w=C[0],k=C[C.length-1],A=p.contains(document.activeElement);N.shiftKey&&(document.activeElement===w||!A)?(N.preventDefault(),k.focus()):!N.shiftKey&&(document.activeElement===k||!A)&&(N.preventDefault(),w.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[v]);const y=!n&&!a;return s.jsx(WN,{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(Pv,{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(Pv,{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:j,children:s.jsx(Ju,{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:j})]}),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?r:a,onClick:()=>n?i(p=>!p):l(p=>!p),children:s.jsx(LR,{className:"size-4","aria-hidden":"true"})}),s.jsx("span",{"aria-hidden":"true",className:"mr-2 h-4 w-px bg-border"}),s.jsx(dL,{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 ux="m-0 text-2xl font-semibold tracking-tight",dx="outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",fx=`rounded-sm font-medium text-primary no-underline hover:underline ${dx}`;function Lf({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 hL({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(Lf,{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(Lf,{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(Lf,{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?ol:cT})]})}const qv=`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 ${dx}`;function mL(){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 Pr(){const{href:e,Link:t}=Ve(),{loading:n,projects:a,none:l,failure:r,readAt:i,refresh:o,reading:c}=vn(),[d,f]=u.useState(""),h=s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:ux,children:"Projects"}),!l&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:oT})]});if(l)return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[h,s.jsx(hL,{why:l==="not_in_git"?{kind:"not_in_git"}:mT(l)})]});const m=r!=null&&r.shown?r:null,g=(a??[]).filter(j=>j.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:u0(m.refusal,i)}),s.jsx("div",{children:s.jsx("button",{type:"button",className:qv,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:j=>f(j.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 ${dx}`}),!m&&s.jsx("button",{type:"button",className:`${qv} ml-auto`,onClick:o,disabled:c||n,children:"Refresh"})]}),r&&!r.shown&&i&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`Showing the list read at ${li(i)}; reading again in ${r.retryInSeconds??10} seconds.`})]}),n?s.jsx(mL,{}):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:[g.map(j=>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(j.id)}`),className:fx,children:j.name})}),s.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:j.location??du}),s.jsx("td",{className:"px-3 py-2 text-right",children:j.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"})})]},j.id)),g.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 s1({title:e,children:t}){const{href:n,Link:a}=Ve();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:ux,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 ${fx}`,children:"Back to the organization's Home"})})]})})}const pL={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Wi({project:e}){const{href:t,Link:n}=Ve(),{org:a,projects:l,loading:r,domains:i}=vn(),o=l==null?void 0:l.find(c=>c.id===e);return r?s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:ed}):l?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:ux,children:o.name}),s.jsx("p",{className:"m-0 font-mono text-sm text-muted-foreground",children:o.location??du})]}),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:fx,children:pL[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(s1,{title:"Project not found",children:`There is no project '${e}' in this organization.`}):s.jsx(Pr,{})}const Rd=e=>e instanceof Error?e.message:String(e);async function a1(){try{const e=await fetch("api/threads",{cache:"no-store"});return e.status===404?{none:!0}:e.ok?{data:await e.json()}:{error:await e.text()||`HTTP ${e.status}`}}catch(e){return{error:Rd(e)}}}async function xL(){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 l={};for(const[r,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&&(l[r]=o)}return l}catch{return null}}async function gL(){try{return(await fetch("api/pin",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function vL(){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 yL(){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:Rd(e)}}}async function bL(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 l={};try{l=JSON.parse(a)??{}}catch{}return n.ok?{done:l}:{refused:{reason:typeof l.reason=="string"?l.reason:"failed",error:typeof l.error=="string"?l.error:a||`HTTP ${n.status}`,...typeof l.where=="string"&&l.where?{where:l.where}:{}}}}catch(n){return{refused:{reason:"failed",error:Rd(n)}}}}async function jL(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 Rd(n)}}const _L={probe:{source:async()=>{const e=await a1();if("error"in e)throw new Error(e.error);return{label:"Local workspace"}}}},l1={href:e=>e.replace(/^\/+/,"")||"./",Link:({href:e,className:t,children:n,...a})=>s.jsx("a",{href:e,className:t,...a,children:n})},wL={label:"Local viewer",can:()=>!1};function NL(){return u.useEffect(()=>{document.title="Shared app UI · SDLC Workspace Viewer"},[]),s.jsx("div",{className:"app-ui dark",children:s.jsx(t0,{data:_L,router:l1,identity:wL,children:s.jsx(_C,{})})})}const kL="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.",SL=3e4,CL="Reading the workspaces. On a plan workspace this can take a few minutes.",RL="The read failed. Details are in the terminal running sdlc viewer.",TL={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"}},EL=e=>TL[e]??{label:e,tone:"neutral"},ba=e=>e.slice(0,8),r1={human:"Human",ai:"AI"},dm=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function AL(){const e=en().workspaces;if(!e)throw new Error("The Workspaces page rendered without the workspaces seam.");return e}function ML(e){const t=AL(),[n,a]=u.useState(null),[l,r]=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 x=await t.overview();x.ok?(a(x.data),r(null),o(!1)):(r(x.refusal),o(!0))})().finally(()=>{f.current=null});return f.current=y,y},[t]);u.useEffect(()=>{h()},[h]),wu(()=>void h(),SL),u.useEffect(()=>{var y;d.current&&(n||l)&&(d.current=!1,(y=c.current)==null||y.focus())},[n,l]);const m=()=>{d.current=!0,h()},g=n===null&&l===null,j=n===null&&l!==null,v=n?OL(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(Ft,{title:"Workspaces",description:kL,actions:s.jsxs(s.Fragment,{children:[v?s.jsx("p",{className:"text-muted-foreground text-xs",children:v}):null,s.jsxs(P,{type:"button",variant:"outline",size:"sm","aria-disabled":g||void 0,"aria-describedby":g?"workspaces-reading":void 0,className:"gap-2",onClick:g?void 0:()=>void h(),children:[s.jsx(vl,{className:"size-4","aria-hidden":"true"}),"Read again"]}),g?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?i1(n,i):""})]})}),s.jsxs("div",{ref:c,tabIndex:-1,className:"outline-none",children:[g?s.jsx($L,{}):null,j&&l?s.jsx(DL,{refusal:l,on_retry:m}):null,n?s.jsx(zL,{overview:n}):null]})]})}function i1(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 OL(e,t){const n=`Read at ${Qn(new Date(e.read_at).toISOString())}`,a=i1(e,t);return a?`${n} · ${a}`:n}function $L(){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(pt,{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:CL})]})}function DL({refusal:e,on_retry:t}){const n=e.reason==="store_locked"?u0(e,null):RL;return s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Could not read workspaces"}),s.jsxs(pe,{children:[s.jsx("p",{children:n}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function zL({overview:e}){const{counts:t}=e,n=[dm(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(uc,{id:"workspaces-lineage",title:"Lineage",caption:"Each workspace under the one it forked from",children:s.jsx(LL,{rows:e.workspaces})}),s.jsx(uc,{id:"workspaces-authority",title:"Authority and resolver",caption:"What this checkout's workspace may change",children:s.jsx(UL,{authority:e.authority})})]}),s.jsx(uc,{id:"workspaces-activity",className:"mt-4",title:"Integration activity",caption:"Newest first",children:e.activity.length===0?s.jsx(Gv,{children:"No integration or reconciliation attempts yet."}):s.jsx(HL,{rows:e.activity})}),s.jsx(uc,{id:"workspaces-handoffs",className:"mt-4",title:"Handoffs",children:e.handoffs.length===0?s.jsx(Gv,{children:"No Handoffs prepared yet."}):s.jsx(IL,{rows:e.handoffs})})]})}function uc({id:e,title:t,caption:n,className:a,children:l}){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]}),l]})}const Gv=({children:e})=>s.jsx("p",{className:"text-muted-foreground text-sm",children:e}),Ru=({children:e,tone:t})=>s.jsx("div",{className:ie("text-xs",t==="error"?"text-destructive":"text-muted-foreground"),children:e});function Ji({status:e}){const t=EL(e);return s.jsx(he,{variant:t.tone,children:t.label})}function Td({label:e,children:t}){return s.jsx(jt,{role:"group","aria-label":e,tabIndex:0,className:"overflow-x-auto outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:t})}function LL({rows:e}){return s.jsx(Td,{label:"Workspaces",children:s.jsxs(Be,{containerClassName:"overflow-visible",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Workspace"}),s.jsx(F,{children:"Actor"}),s.jsx(F,{children:"Forked from"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Projection"})]})}),s.jsx(He,{children:e.map(t=>s.jsxs(ue,{"data-testid":"workspaces-row",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-mono font-medium",children:t.short_id}),s.jsx(Ru,{children:t.current?`${t.path} · This checkout`:t.path}),t.projection==="unreadable"&&t.projection_error&&s.jsx(Ru,{children:t.projection_error})]}),s.jsx(q,{children:r1[t.actor]}),s.jsx(q,{children:t.source_id?s.jsx("span",{className:"font-mono",children:ba(t.source_id)}):s.jsx("span",{className:"text-muted-foreground",children:"No source"})}),s.jsx(q,{children:s.jsx(Ji,{status:t.status})}),s.jsx(q,{children:s.jsx(Ji,{status:t.projection})})]},t.id))})]})})}function UL({authority:e}){const t=e.resolver,n=[["Workspace",s.jsx("span",{className:"font-mono",children:ba(e.workspace_id)},"id")],["Actor",r1[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(Ji,{status:t.state==="ready"?"ready":"needs_attention"},"resolver")]),t.state==="needs_attention"&&t.issue&&n.push(["Resolver issue",t.issue]),s.jsx(Td,{label:"Authority and resolver",children:s.jsx(Be,{containerClassName:"overflow-visible",children:s.jsx(He,{children:n.map(([a,l])=>s.jsxs(ue,{children:[s.jsx(F,{scope:"row",className:"text-muted-foreground font-normal",children:a}),s.jsx(q,{children:l})]},a))})})})}function BL(e){const t=[e.merge_attempts?dm(e.merge_attempts,"merge attempt"):null,e.resolver_attempts?dm(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 HL({rows:e}){return s.jsx(Td,{label:"Integration activity",children:s.jsxs(Be,{containerClassName:"overflow-visible",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Change"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Attempts"}),s.jsx(F,{children:"Updated"})]})}),s.jsx(He,{children:e.map((t,n)=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:t.kind==="integration"?`Integrate ${ba(t.child_id)} into ${ba(t.other_id)}`:`Reconcile ${ba(t.child_id)} from ${ba(t.other_id)}`}),s.jsx(Ru,{children:t.kind==="integration"?"Integration":"Source reconciliation"})]}),s.jsx(q,{children:s.jsx(Ji,{status:t.status})}),s.jsx(q,{children:BL(t)}),s.jsx(q,{children:sk(t.updated_at)})]},`${t.kind}-${t.child_id}-${t.other_id}-${t.updated_at}-${n}`))})]})})}function IL({rows:e}){return s.jsx(Td,{label:"Handoffs",children:s.jsxs(Be,{containerClassName:"overflow-visible",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"From"}),s.jsx(F,{children:"To"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Pinned"})]})}),s.jsx(He,{children:e.map(t=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-mono font-medium",children:ba(t.child_id)}),t.error?s.jsx(Ru,{children:t.error}):null]}),s.jsx(q,{className:"font-mono",children:ba(t.source_id)}),s.jsx(q,{children:s.jsx(Ji,{status:t.status})}),s.jsx(q,{children:`${t.child_commit} onto ${t.source_commit}`})]},t.id))})]})})}const Vv="This machine's worktrees of this repository.",PL="Merge sends one whose thread is at rest to the main queue.",qL=3e4,GL=3e3,VL=6e5,Uf=[{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"}],ei={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"}},YL="no thread to land it",hx="its thread waits on you",o1="its thread is done",c1="its thread is retired",mx=e=>e.archivable&&e.cleanup==="user",FL=e=>e.queue!==null||e.merge.offered===!1&&e.merge.why==="already in a promotion queue",XL=e=>!e.merge.offered&&(e.merge.why===o1||e.merge.why.startsWith(c1)),px=e=>!e.merge.offered&&e.merge.why===YL||XL(e),Bf=(e,t)=>t==="all"?!0:t==="decide"?mx(e):(e.landed!==null?"landed":FL(e)?"queued":px(e)?"orphan":"needs")===t,KL=e=>e.landed!==null?e.threads.some(t=>t.phase!=="done"):e.threads.length>0&&!px(e);function Mc(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 u1(e){const t=e%100,n=t>=11&&t<=13?"th":{1:"st",2:"nd",3:"rd"}[e%10]??"th";return`${e}${n}`}function QL(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 Hf=e=>Qn(new Date(e*1e3).toISOString()),ci=e=>e.charAt(0).toUpperCase()+e.slice(1);function ZL(e,t){var l;const n=t.phase?ci(t.phase):"No phase",a=e.merge;if(!a.offered&&a.why.startsWith(c1)){const r=(l=/; (.+) continues it$/.exec(a.why))==null?void 0:l[1];return r?`Retired · continued by ${r}`:"Retired"}return t.phase==="done"||!a.offered&&a.why===o1?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===hx?`${n} · waits on you`:a.why.startsWith("its session is not running")?`${n} · session not running`:n}function WL(){const e=en().worktrees;if(!e)throw new Error("The Worktrees page rendered without the worktrees seam.");return e}function JL({org:e}){var O,Z;const t=WL(),[n,a]=u.useState(null),[l,r]=u.useState(null),[i,o]=u.useState(null),[c,d]=u.useState(!1),[f,h]=u.useState("all"),[m,g]=u.useState(""),[j,v]=u.useState({}),y=u.useRef({}),{confirm:x,confirm_dialog:p}=_o(),b=u.useRef(!1),_=u.useCallback(async()=>{if(b.current)return;b.current=!0;const E=await t.list();b.current=!1,E.ok?(a(E.data),r(null)):r(E.refusal)},[t]),N=u.useCallback(async()=>{const E=await t.sizes();d(!E.ok),E.ok&&o(E.data)},[t]);u.useEffect(()=>{_(),N()},[_,N]);const C=(n==null?void 0:n.rows.some(E=>{var I,ne;return((I=E.write)==null?void 0:I.state)==="waiting"||((ne=E.write)==null?void 0:ne.state)==="running"}))??!1;wu(()=>void _(),C?GL:qL),wu(()=>void N(),VL);const w=(n==null?void 0:n.rows)??[],k=E=>i==null?void 0:i.sizes[E.path],A=w.filter(mx),$=i?A.reduce((E,I)=>E+(k(I)??0),0):null,X=w.length===0?Vv:`${Vv} ${PL}${A.length?` ${A.length} ${A.length===1?"is":"are"} yours to decide${$!==null?`: removing them frees about ${Mc($)}`:""}.`:""}`,Y=m.trim().toLowerCase(),L=E=>!Y||[E.name,E.path,E.branch??"",...E.threads.map(I=>I.title??I.thread)].some(I=>I.toLowerCase().includes(Y)),H=w.filter(E=>Bf(E,f)&&L(E)).sort((E,I)=>{if(f==="decide")return(k(I)??0)-(k(E)??0);const ne=ee=>KL(ee)?ee.merge.offered?0:1:2;return ne(E)-ne(I)||(E.idle_days??1/0)-(I.idle_days??1/0)}),T=async(E,I)=>{const ne=await(E==="merge"?t.merge(I.path):t.remove(I.path));ne.ok?v(({[I.path]:ee,...ge})=>ge):v(ee=>({...ee,[I.path]:ne.refusal.message})),await _()},R=async E=>{if(!E.merge.offered)return;const I=E.threads.find(V=>V.thread===(E.merge.offered&&E.merge.thread)),ne=(I==null?void 0:I.title)??E.merge.thread,ee=I!=null&&I.holds.length?`has ${I.holds.length} open hold(s) (${I.holds.join(", ")})`:"has no open holds",ge=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",G=E.merge.caveat?`
388
388
 
389
- 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, ${ne}, which ${ee} and is told of the join. The queue checks the branch first, and ${ge}. Nothing reaches main before then.${G}`,action_label:"Join the main queue"})&&await R("merge",E)},z=async E=>{const I=k(E);await g({title:`Remove ${E.name}?`,description:`This deletes the folder ${E.path}${I!==void 0?` and frees about ${Mc(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 R("remove",E))},S=async E=>{await t.dismiss(E),await _()};return(l==null?void 0:l.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(Js,{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(Ft,{title:"Worktrees",description:X}),!n&&!l&&s.jsx(WL,{}),l?s.jsx(JL,{refusal:l,read_at:n==null?void 0:n.read_at,on_retry:()=>void _()}):null,n!=null&&n.stale?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Could not read worktrees"}),s.jsxs(pe,{children:[s.jsxs("p",{children:[n.stale.message," This list was read at ",Qn(new Date(n.read_at).toISOString()),"."]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void _(),children:"Retry"})]})]}):null,n==null?void 0:n.removals.map(E=>s.jsxs(me,{variant:"success",className:"mt-4",role:"status",children:[s.jsx(ve,{children:y.current[E.path]!==void 0?`Removed ${E.name} and freed ${Mc(y.current[E.path])}`:`Removed ${E.name}`}),s.jsxs(pe,{children:[s.jsx("p",{children:E.branch?`Its branch ${E.branch} stays, and its records were saved.`:"Its records were saved."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void S({removal:E.path}),children:"Dismiss"})]})]},E.path)),n&&w.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(a0,{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(Ot,{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 ",Qn(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:Uf.map(E=>s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":f===E.id,onClick:()=>h(E.id),children:[E.label," ",w.filter(I=>Bf(I,E.id)).length]},E.id))}),H.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(Wu,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No worktrees match"}),Y?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(O=Uf.find(E=>E.id===f))==null?void 0:O.empty," matches “",m,"”. Clear the search to see all"," ",w.filter(E=>Bf(E,f)).length,"."]}),s.jsx(P,{type:"button",variant:"outline",onClick:()=>x(""),children:"Clear search"})]}):s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(Z=Uf.find(E=>E.id===f))==null?void 0:Z.empty," right now."]})]}):s.jsx(jt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Worktrees",className:"table-fixed",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{className:"w-[24%]",children:"Worktree"}),s.jsx(F,{className:"w-[24%]",children:"Threads"}),s.jsx(F,{className:"w-[12%]",children:"Landed"}),s.jsx(F,{className:"w-[18%]",children:"Cleanup"}),s.jsx(F,{className:"hidden w-[10%] md:table-cell",children:"Last commit"}),s.jsx(F,{className:"w-[12%] text-right",children:"Actions"})]})}),s.jsx(He,{children:H.map(E=>s.jsx(e6,{org:e,row:E,size:k(E),sizes:i!==null?"read":c?"failed":"measuring",can_write:n.can_write,sent:j[E.path],on_merge:()=>void T(E),on_remove:()=>void z(E),on_dismiss:I=>void S(I),on_clear_sent:()=>v(({[E.path]:I,...ne})=>ne)},E.path))})]})})]}):null,p]})}function WL(){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(pt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function JL({refusal:e,read_at:t,on_retry:n}){const a=Wn();return e.reason==="view_outdated"?s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsx(pe,{children:a})]}):s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Could not read worktrees"}),s.jsxs(pe,{children:[s.jsxs("p",{children:[e.message,t?` This list was read at ${Qn(new Date(t).toISOString())}.`:""]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function dc({children:e,muted:t=!0}){return s.jsx("div",{className:ie("truncate text-xs",t&&"text-muted-foreground"),title:e,children:e})}function e6({org:e,row:t,size:n,sizes:a,can_write:l,sent:r,on_merge:i,on_remove:o,on_dismiss:c,on_clear_sent:d}){const{href:f,Link:h}=Ve(),m=e?`/org/${encodeURIComponent(e)}`:"",x=f(`${m}/threads`),j=f(`${m}/tasks`),v=ei[t.landed??"not_landed"],y=mx(t),g=t.write,p=(g==null?void 0:g.state)==="waiting"||(g==null?void 0:g.state)==="running",b=t.threads.find(X=>"thread"in t.merge&&X.thread===t.merge.thread)??t.threads[0],_=t.merge,N=!_.offered&&_.why===hx,C=l&&t.landed===null&&!t.queue&&!N&&!px(t),w=n!==void 0?Mc(n):a==="measuring"?"Measuring size…":a==="failed"?"Size could not be read":null,k=y?{label:"Yours to decide",muted:!1,second:[w,t.cleanup_why[0]]}:t.archivable?{label:"The manager removes it",muted:!1,second:[w]}:{label:"Stays",muted:!0,second:[w,t.why[0]??null]},A=k.second.filter(Boolean).join(" · "),$=t.path.slice(0,t.path.length-t.name.length-1)||".";return s.jsxs(s.Fragment,{children:[s.jsxs(ue,{"data-testid":"worktrees-row",children:[s.jsxs(q,{children:[s.jsx("div",{className:"truncate font-medium",title:t.name,children:t.name}),s.jsx(dc,{children:t.branch??"Detached"}),$!==".sdlc-worktrees"?s.jsx(dc,{children:`in ${$}`}):null]}),s.jsx(q,{children:b?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"truncate",title:b.title??b.thread,children:b.title??b.thread}),s.jsx(dc,{children:`${KL(t,b)}${t.threads.length>1?` · ${t.threads.length-1} more`:""}`})]}):s.jsx("span",{className:"text-muted-foreground",children:"No thread"})}),s.jsx(q,{children:s.jsx(he,{variant:v.tone,children:v.label})}),s.jsxs(q,{children:[s.jsx("div",{className:ie("truncate",k.muted&&"text-muted-foreground"),children:k.label}),A?s.jsx("div",{className:"hidden md:block",children:s.jsx(dc,{children:A})}):null]}),s.jsx(q,{className:"hidden md:table-cell",children:XL(t.idle_days)}),s.jsx(q,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[p?s.jsx(P,{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(he,{variant:ei.queued.tone,children:`${ei.queued.label} · ${o1(t.queue.position)}`}):N?s.jsx(h,{href:j,"aria-label":`${t.name}: its thread waits on you, in Waiting on you`,children:s.jsx(he,{variant:ei.needs_you.tone,children:ei.needs_you.label})}):C?s.jsx(P,{type:"button",variant:"outline",size:"sm",title:_.offered?void 0:_.why,"aria-disabled":!_.offered||void 0,className:ie(!_.offered&&"cursor-not-allowed opacity-50"),"aria-label":`Send ${t.name} to the main queue`,"aria-describedby":_.offered?void 0:`why-${t.name}`,onClick:_.offered?i:void 0,children:"Merge"}):null,y&&l&&!p?s.jsx(P,{type:"button",variant:"outline",size:"sm","aria-label":`Remove ${t.name}`,onClick:o,children:"Remove"}):null]})})]}),s.jsx(t6,{row:t,threads:x,tasks:j,merge_shown:C,sent:r,on_dismiss:c,on_clear_sent:d})]})}function t6({row:e,threads:t,tasks:n,merge_shown:a,sent:l,on_dismiss:r,on_clear_sent:i}){var j,v,y,g;const{Link:o}=Ve(),c=(p="Open in Threads")=>s.jsx(o,{className:"text-primary text-sm hover:underline",href:t,children:p}),d=p=>s.jsx(P,{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(l)x=s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"It was not sent"}),s.jsxs(pe,{children:[s.jsx("p",{children:l}),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=((j=f.lands)==null?void 0:j.by)==="manager"?`the merge manager, ${f.lands.manager}, lands it`:"it lands it on its turn";x=s.jsxs(me,{variant:f.told?"success":"warning",role:"status",children:[s.jsx(ve,{children:`${e.name} joined the main queue, ${o1(f.position)}`}),s.jsxs(pe,{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 ${Hf(e.queue.passes_at)}.`}):null,s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>r({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(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:f.kind==="merge"&&f.state==="failed"?`${e.name} did not join`:p}),s.jsxs(pe,{children:[s.jsx("p",{children:`${ci(f.message)}${f.kind==="merge"?" Nothing was queued.":" Nothing was deleted."}`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>r({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(me,{variant:"warning",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:`${e.name}'s turn ${p.outcome==="failed"?"failed":"passed on"} at ${Hf(p.left_at)}`}),s.jsxs(pe,{children:[s.jsx("p",{children:`${ci(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(()=>r({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 ${Hf(e.queue.passes_at)}. `,c()]}):!e.merge.offered&&e.merge.why===hx?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:[`${ci(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:`${ci(e.merge.caveat)}.`}));return x?s.jsx(ue,{className:"hover:bg-transparent",children:s.jsx(q,{colSpan:6,className:"pt-0",children:x})}):null}const n6=["reason","since","store","repository","folder","home","member_path"];function c1(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 n6){const l=t==null?void 0:t[a];typeof l=="string"&&(n[a]=l)}return n}function jl({base:e="",fetcher:t=fetch}){return async(n,a={})=>{const l=new URLSearchParams;for(const[c,d]of Object.entries(a))if(Array.isArray(d))for(const f of d)l.append(c,f);else d!==void 0&&d!==!1&&d!==""&&l.set(c,String(d));const r=l.size>0?`?${l.toString()}`:"";let i;try{i=await t(`${e}api/app/${n}${r}`,{cache:"no-store"})}catch{return{ok:!1,refusal:{status:0,message:"The viewer did not answer. Is sdlc viewer still running?"}}}const o=await i.json().catch(()=>null);return i.ok?{ok:!0,data:o}:{ok:!1,refusal:c1(i.status,o)}}}function s6(e={}){const t=jl(e),n=l=>async()=>{const r=await t("access");return r.ok?{ok:!0,data:r.data[l]}:r},a=encodeURIComponent;return{tasks:{access:n("tasks"),configuration:()=>t("tasks/configuration"),listTasks:l=>t(`tasks/lists/${a(l)}/tasks`),task:l=>t(`tasks/tasks/${a(l)}`)},issues:{access:n("issues"),list:(l={})=>t("issues",l),issue:l=>t(`issues/${a(l)}`),issueSections:l=>t(`issues/${a(l)}/sections`),issueRelated:l=>t(`issues/${a(l)}/related`)},releases:{access:n("releases"),list:()=>t("releases"),release:l=>t(`releases/${a(l)}`),candidate:()=>t("releases/candidate")},organizations:{access:n("organizations"),list:()=>t("orgs")},projects:{access:n("projects"),list:()=>t("projects")},about:{about:()=>t("about")}}}function a6(e={}){const t=jl(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 ui=e=>({ok:!1,refusal:{status:0,message:e}});function xx({base:e="",fetcher:t=fetch}){return async(n,a)=>{let l;try{l=await t(`${e}api/${n}`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch{return ui("The viewer did not answer. Is sdlc viewer still running?")}const r=await l.json().catch(()=>null);return l.ok?{ok:!0,data:r}:{ok:!1,refusal:c1(l.status,r)}}}function l6(e={}){const t=jl(e),n=xx(e);return{chart:()=>t("org"),change:a=>n("org-change",a)}}function r6(e={}){const t=jl(e),n=o=>`tasks/tasks/${encodeURIComponent(o)}`,{base:a="",fetcher:l=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={})=>c.state==="archived"?Promise.resolve(ui("This checkout keeps no archived tasks.")):c.assigned_to_me?Promise.resolve(ui("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}),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()=>ui("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 l(`${a}api/task-done`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})}catch{return ui("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 i6(e={}){const t=jl(e),n=xx(e),a=encodeURIComponent,l=r=>r!=null&&r.fresh?{fresh:1}:{};return{access:async()=>{const r=await t("access");return r.ok?{ok:!0,data:r.data.releases}:r},list:(r={})=>t("releases",l(r)),release:(r,i)=>t(`releases/${a(r)}`,l(i)),candidate:r=>t("releases/candidate",l(r)),candidateBatch:r=>t("releases/candidate/batch",l(r)),related:(r,i)=>t(`releases/${a(r)}/related`,l(i)),plannedRelease:(r,i)=>t(`releases/planned/${a(r)}`,l(i)),roadmap:r=>t("releases/roadmap",{...l(r),...r!=null&&r.mine?{mine:1}:{}}),roadmapMoved:r=>t("releases/roadmap/moved",l(r)),roadmapSeen:r=>n("roadmap/seen",{at:r})}}function o6(e={}){const t=jl(e),n=xx(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 c6(e={}){const t=jl(e);return{overview:()=>t("workspaces")}}const u6=15e3,d6=10,Yv="idle-sessions-list",Fv="idle-sessions-heading",Xv="idle-sessions-confirm-text";function u1(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const f6=e=>`${Number.isInteger(e)?e:e.toFixed(1)} h`,d1=e=>e===1?"1 session":`${e} sessions`;function h6(e){const t=e.released.length?`Closed ${d1(e.released.length)}.`:"Closed no sessions.";return e.kept.length?`${t} Kept ${e.kept.length}:`:t}function m6({row:e}){const t=[e.name,e.retired?"continued in another session":"",`idle ${f6(e.idle_hours)}`,u1(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 p6(){const[e,t]=u.useState(null),[n,a]=u.useState(!1),[l,r]=u.useState(!1),[i,o]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(""),m=u.useRef(""),x=u.useRef(null),j=u.useRef(null),v=u.useRef(null),y=u.useRef(null),g=u.useRef(0),p=u.useRef(0),b=u.useCallback(async()=>{const L=++g.current,H=await xL();if(!H||L<p.current)return;p.current=L,h("");const R=JSON.stringify(H);R!==m.current&&(m.current=R,t(H))},[]);u.useEffect(()=>{const L=setTimeout(b,0),H=setInterval(b,u6);return()=>{clearTimeout(L),clearInterval(H)}},[b]),u.useEffect(()=>{var H;const L=y.current;L&&(y.current=null,(H={cancel:j,close:x,dismiss:v}[L].current)==null||H.focus())});const _=(e==null?void 0:e.sessions.length)??0;if(u.useEffect(()=>{l&&!_&&i===null&&r(!1)},[l,_,i]),!_&&!c&&!f&&i===null)return null;const N=()=>{i===null&&(r(!0),y.current="cancel")},C=()=>{i===null&&(r(!1),y.current="close")},w=async()=>{if(i!==null)return;o(_),d(null),h("");const L=await gL();p.current=g.current+1,await b(),o(null),r(!1),a(!1),"error"in L?(h(`The sessions were not closed: ${L.error.replace(/\.+$/,"")}.`),y.current="close"):(d(L.done),y.current="dismiss")},k=()=>{d(null),y.current="close"},A=L=>{L.key==="Escape"&&(L.preventDefault(),C())},$=i!==null?`Closing ${d1(i)}…`:c?h6(c):"",X=(e==null?void 0:e.sessions.slice(0,d6))??[],Y=_-X.length;return s.jsxs("div",{className:"idle",role:"group",..._?{"aria-labelledby":Fv}:{"aria-label":"Idle sessions"},children:[f&&s.jsx("div",{className:"alert",role:"alert",children:f}),_>0&&e&&s.jsxs("div",{className:"idle-head",children:[s.jsxs("div",{className:"idle-title",children:[s.jsxs("h2",{className:"group",id:Fv,"aria-label":`Idle sessions, ${_}`,children:["Idle sessions",s.jsx("span",{className:"count",children:_})]}),s.jsxs("p",{className:"caption muted",children:["over ",e.idle_over," h · ",u1(e.memory_mb)]})]}),s.jsxs("div",{className:"tools",children:[s.jsx("button",{type:"button",className:"pin","aria-expanded":n,"aria-controls":Yv,"aria-label":n?"Hide the idle sessions list":"Show the idle sessions list",onClick:()=>a(L=>!L),children:n?"Hide":"Show"}),s.jsx("button",{type:"button",className:"pin",ref:x,"aria-expanded":l,"aria-label":"Close idle sessions…",onClick:N,children:"Close idle…"})]})]}),_>0&&s.jsxs("ul",{className:"idle-list",id:Yv,hidden:!n,"aria-label":`Sessions idle over ${e==null?void 0:e.idle_over} hours, longest idle first`,children:[X.map(L=>s.jsx(m6,{row:L},L.session)),Y>0&&s.jsx("li",{children:s.jsxs("p",{className:"caption muted",children:["…and ",Y," more"]})})]}),l&&_>0&&s.jsxs("div",{className:"idle-confirm",role:"group","aria-label":"Close idle sessions","aria-describedby":Xv,onKeyDown:A,children:[s.jsxs("p",{id:Xv,children:[_===1?"Close this session?":`Close these ${_} sessions?`," Each transcript stays, so reopening a conversation resumes it, and a thread with unfinished work goes on with Continue on its card. A session that is busy or has background work running is kept."]}),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:w,children:i!==null?`Closing ${i}…`:`Close ${_}`}),s.jsx("button",{type:"button",className:"pin",ref:j,"aria-disabled":i!==null?!0:void 0,onClick:C,children:"Cancel"})]})]}),s.jsx("p",{className:"idle-status",role:"status",children:$}),c&&s.jsxs(s.Fragment,{children:[c.kept.length>0&&s.jsx("ul",{className:"idle-list","aria-label":"Kept sessions",children:c.kept.map(L=>s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:L.title}),s.jsx("p",{className:"caption muted",children:L.why})]},L.session))}),s.jsx("div",{className:"tools start",children:s.jsx("button",{type:"button",className:"pin",ref:v,"aria-label":"Dismiss the close result",onClick:k,children:"Dismiss"})})]})]})}const Kv={ok:"lime",you:"amber",alert:"red",waiting:"blue",blocked:"purple",muted:"grey",plain:"grey"};function Oc(e){return e&&Object.hasOwn(Kv,e)?Kv[e]:"grey"}const x6=1e4,g6=6e4,v6=2,If="#thread-",y6=c0("Threads"),b6={working:"▶",prod:"↑",planned:"○"},j6={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 _6(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 w6=new Set(["not_terminal","another_process","continued","no_open","pending"]);function Qv({label:e,count:t,hint:n}){const a=n?`hint-${e.toLowerCase().replace(/\W+/g,"-")}`:void 0;return s.jsxs(s.Fragment,{children:[s.jsxs("h2",{className:"group","aria-label":`${e}, ${t}`,"aria-describedby":a,children:[e,s.jsx("span",{className:"count",children:t})]}),n&&s.jsx("span",{className:"sr-only",id:a,children:n})]})}function Pf({text:e,role:t}){return s.jsx("span",{className:`badge tone-${Oc(t)}`,children:e})}function N6({serves:e}){const t=e.slice(0,v6),n=e.length-t.length;return s.jsxs("p",{className:"caption muted serves",children:[t.map((a,l)=>s.jsxs("span",{children:[l>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"]})]})]})}function Zv({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 k6({onConnection:e,org:t=null,project:n=null}){const[a,l]=u.useState(null),[r,i]=u.useState(!1),[o,c]=u.useState(""),[d,f]=u.useState(!1),[h,m]=u.useState(null),[x,j]=u.useState(""),[v,y]=u.useState(null),[g,p]=u.useState(null),[b,_]=u.useState(null),N=u.useRef(""),C=u.useRef(""),w=u.useRef(null),k=u.useRef(null),A=u.useRef(null),$=B=>{var te;return B instanceof HTMLButtonElement&&B.classList.contains("pin")&&((te=w.current)!=null&&te.contains(B))?B.dataset.key??null:null},X=B=>{A.current=$(B.target)},Y=()=>{setTimeout(()=>{$(document.activeElement)||(A.current=null)},0)},L=u.useCallback(async()=>{const B=await n1();if("none"in B){i(!0),c(""),e("live");return}if("error"in B){c(B.error),e("disconnected");return}i(!1),c(""),j(""),e("live");const te=JSON.stringify(B.data);te!==N.current&&(N.current=te,l(B.data))},[e]);u.useEffect(()=>{let B=!0;pL().then(le=>B&&f(le));const te=setTimeout(L,0),J=setInterval(L,x6);return()=>{B=!1,clearTimeout(te),clearInterval(J)}},[L]),u.useEffect(()=>{let B=!0;const te=()=>mL().then(le=>{B&&le&&y(W=>JSON.stringify(W)===JSON.stringify(le)?W:le)});te();const J=setInterval(te,g6);return()=>{B=!1,clearInterval(J)}},[]),u.useEffect(()=>{const B=()=>{var Qe,oe,Oe;const J=window.location.hash;if(!J.startsWith(If)){_(null);return}if(J===C.current)return;let le;try{le=decodeURIComponent(J.slice(If.length))}catch{le=J.slice(If.length)}const W=document.getElementById(`thread-${le}`);if(!W||!((Qe=w.current)!=null&&Qe.contains(W))){a&&_(le);return}C.current=J,_(null),p(le),(oe=W.querySelector(".thread-title"))==null||oe.focus({preventScroll:!0}),(Oe=W.scrollIntoView)==null||Oe.call(W,{block:"center"})},te=()=>{C.current="",B()};return B(),window.addEventListener("hashchange",te),()=>window.removeEventListener("hashchange",te)},[a]),u.useEffect(()=>{if(!g)return;const B=()=>p(null);return document.addEventListener("pointerdown",B,!0),document.addEventListener("keydown",B,!0),()=>{document.removeEventListener("pointerdown",B,!0),document.removeEventListener("keydown",B,!0)}},[g]),u.useLayoutEffect(()=>{const B=A.current??k.current;if(!B||!w.current)return;const te=document.activeElement;if(te&&te!==document.body&&!w.current.contains(te)){A.current=null;return}const J=[...w.current.querySelectorAll("button.pin")].find(le=>le.dataset.key===B);J?te!==J&&J.focus({preventScroll:B!==k.current}):A.current=null});const H=async B=>{if(h)return;const te=!B.pinned;k.current=B.key,m(B.key);const J=await yL(B.key,te);m(null),J||l(le=>le&&{...le,threads:le.threads.map(W=>W.key===B.key?{...W,pinned:te}:W)}),await L(),j(J?`The pin was not saved: ${J}`:""),k.current===B.key&&(k.current=null)},[R,T]=u.useState(()=>new Set),[z,S]=u.useState({}),O=Wn(),{confirm:Z,confirm_dialog:E}=_o(),I=(B,te)=>S(J=>{const{[B]:le,...W}=J;return te?{...W,[B]:te}:W}),ne=(B,te)=>T(J=>{const le=new Set(J);return te?le.add(B):le.delete(B),le}),ee=Object.keys(z).some(B=>!R.has(B));u.useEffect(()=>{if(!ee)return;const B=()=>S(te=>Object.fromEntries(Object.entries(te).filter(([J])=>R.has(J))));return document.addEventListener("pointerdown",B,!0),document.addEventListener("click",B,!0),()=>{document.removeEventListener("pointerdown",B,!0),document.removeEventListener("click",B,!0)}},[ee,R]);const ge=B=>setTimeout(()=>{var te,J;return(J=[...((te=w.current)==null?void 0:te.querySelectorAll("button.open-thread"))??[]].find(le=>le.dataset.key===B))==null?void 0:J.focus()},0),G=async(B,te)=>{const J=await Z({title:`Reopen ${B.title} in Terminal?`,description:`Its session is closed. It opens in a new Terminal window in ${te??"the thread's folder"}, running claude --resume.`,action_label:"Reopen"});return ge(B.key),J},M=async B=>{if(R.has(B.key))return;let te=!1;for(;;){ne(B.key,!0),I(B.key,{key:B.key,text:j6[B.where??""]??"Opening.",role:"waiting"});const J=await vL(B.key,te);if(ne(B.key,!1),"done"in J){I(B.key,null);return}const{reason:le,error:W,where:Qe}=J.refused;if(le==="closed"&&!te){if(I(B.key,null),!await G(B,Qe))return;te=!0;continue}const oe=le==="outdated"?`${W.replace(/\.*$/,".")} ${O}`:W.replace(/\.*$/,"."),Oe=le==="terminal_denied"?"you":w6.has(le)?"muted":"alert";I(B.key,{key:B.key,text:oe,role:Oe});return}},V=(a==null?void 0:a.pinnedCount)??0,ae=(a==null?void 0:a.threads)??[];return s.jsxs(s.Fragment,{children:[E,s.jsxs("header",{className:"main-head",children:[s.jsx("h1",{children:"Threads"}),a&&!r&&s.jsx("p",{className:"muted",children:a.line})]}),s.jsxs("section",{className:"card threads","aria-label":"Threads",children:[s.jsx(p6,{}),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:b!==null&&!r?s.jsxs(s.Fragment,{children:["Thread ",b," is not in this list. ",s.jsx("code",{children:"sdlc view --all"})," lists older threads."]}):null}),r?s.jsx("p",{className:"muted",children:y6}):s.jsxs("div",{className:"thread-list",ref:w,onFocus:X,onBlur:Y,children:[ae.map((B,te)=>s.jsxs("div",{children:[V>0&&te===0&&s.jsx(Qv,{label:"Pinned",count:V,hint:"Threads you pinned; they stay first in every order"}),V>0&&te===V&&s.jsx(Qv,{label:"Other threads",count:ae.length-V}),s.jsx(S6,{row:v!=null&&v[B.key]?{...B,serves:v[B.key]}:B,arrived:g===B.key,pinnable:d&&typeof B.pinned=="boolean",pinning:h,onPin:()=>H(B),opening:R.has(B.key),note:z[B.key]??null,onOpen:()=>M(B),org:t,project:n})]},B.key)),a&&!ae.length&&s.jsx("p",{className:"muted empty",children:"No threads at work or waiting."}),a&&a.hidden>0&&s.jsxs("p",{className:"caption muted",children:[a.hidden," older thread(s) not shown; sdlc view --all lists them."]})]})]})]})}function S6({row:e,arrived:t,pinnable:n,pinning:a,onPin:l,opening:r,note:i,onOpen:o,org:c,project:d}){const f=v=>c?`org/${encodeURIComponent(c)}/tasks/${encodeURIComponent(v)}`:null,h=v=>d?`proj/${encodeURIComponent(d)}/issues/${encodeURIComponent(v)}`:null,m=[e.where||e.agent,e.phase,e.age,e.waitsOn?`waits on ${e.waitsOn}`:""].filter(Boolean).join(" · "),x=_6(e),j=`open-note-${e.key}`;return s.jsxs("article",{className:t?"thread arrived":"thread",id:`thread-${e.key}`,style:{marginLeft:Math.min(e.depth*22,110)},children:[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(Pf,{text:e.carried,role:"waiting"}),e.carriedBatch&&s.jsx(Pf,{text:e.carriedBatch.text,role:e.carriedBatch.role})]}):s.jsx(Pf,{text:e.status,role:e.role}),x&&s.jsx("button",{type:"button",className:"open-thread","data-key":e.key,"aria-label":`${x}: ${e.title}`,"aria-describedby":j,"aria-disabled":r?!0:void 0,"aria-busy":r?!0:void 0,onClick:()=>{r||o()},children:r?"Opening…":x}),n&&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":a?!0:void 0,"aria-busy":a===e.key?!0:void 0,onClick:()=>{a||l()},children:e.pinned?"Unpin":"Pin"})]})]}),s.jsx("p",{className:"caption muted",children:m}),x&&s.jsx("p",{id:j,className:`caption open-note tone-${Oc((i==null?void 0:i.role)??"muted")}`,role:(i==null?void 0:i.role)==="alert"||(i==null?void 0:i.role)==="you"?"alert":"status",children:(i==null?void 0:i.text)??null}),e.serves&&e.serves.length>0&&s.jsx(N6,{serves:e.serves}),e.summary&&s.jsx("p",{className:"caption muted",children:e.summary}),e.carriedDetail&&s.jsx("p",{className:"line",children:e.carriedDetail}),e.step&&s.jsxs("p",{className:"caption muted",children:["step: ",e.step]}),e.lines.map((v,y)=>s.jsxs("p",{className:`line tone-${Oc(v.role)}`,children:[s.jsxs("span",{"aria-hidden":"true",children:[b6[v.state]??"•"," "]}),v.state==="working"&&s.jsx("span",{className:"sr-only",children:"Working: "}),v.task!==void 0&&s.jsx(Zv,{id:v.task,href:f(v.task)}),v.task!==void 0&&v.text?" ":null,v.text]},`l${y}`)),(e.routed??[]).map(v=>s.jsxs("p",{className:"line",children:["routed ",s.jsx(Zv,{id:v.issue,href:h(v.issue)}),v.title?` ${v.title}`:null]},`r${v.issue}`)),e.holds.map((v,y)=>s.jsx("p",{className:`line tone-${Oc(v.role)}`,children:v.text},`h${y}`)),e.plan&&s.jsx("p",{className:"caption muted",children:e.plan})]})}const C6=5e3;function T6(){const[e,t]=u.useState([]),n=u.useRef(0),a=u.useRef(new Map),l=u.useCallback(c=>{const d=a.current.get(c);d&&clearTimeout(d),a.current.delete(c),t(f=>f.filter(h=>h.id!==c))},[]),r=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(()=>l(f),C6))},[l]);u.useEffect(()=>{const c=a.current;return()=>{for(const d of c.values())clearTimeout(d)}},[]);const i=u.useMemo(()=>({success:c=>r("success",c),error:c=>r("error",c)}),[r]),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(P,{type:"button",variant:"ghost",size:"control",className:"shrink-0",onClick:()=>l(c.id),children:"Dismiss"})]},c.id))});return{notify:i,toasts:o}}const f1=/^#(?:(releases)|release=(.+)|planned(?:=(.+))?)$/,R6=/^#task=(.+)$/,E6=/^#issue=(.+)$/,A6=/^iss-\d{1,9}$/;function h1(e){return e.split("/").filter(Boolean).slice(1).join("/")}function M6(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,l,r,i]=n;if(a==="org"&&r==="tasks"&&i==="queues"&&n.length===4)return{forward:`org/${l}/queues${t}`};if(a==="org"&&r==="chat"&&n.length<=4)return{forward:`org/${l}/threads${i===void 0?"":`#thread-${i}`}`};if(a==="org"&&r==="tasks"&&n.length===4){const o=decodeURIComponent(i);return{page:{kind:"org",page:"tasks",item:o},org:decodeURIComponent(l),task:o}}if(a==="org"&&r==="issues"&&n.length<=4){const o=decodeURIComponent(l);return i===void 0?{page:{kind:"home"},org:o,issues:!0}:{page:{kind:"home"},org:o,issues:!0,issue:decodeURIComponent(i)}}if(a==="proj"&&r==="issues"&&n.length<=4){const o=decodeURIComponent(l),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(l);if(r===void 0)return{page:{kind:"home"},org:o};if(r==="threads")return{page:{kind:"org",page:"threads"},org:o,threads:!0};if(r==="tasks")return{page:{kind:"org",page:"tasks"},org:o,tasks:!0};if(r==="chart")return{page:{kind:"org",page:"chart"},org:o,chart:!0};if(r==="worktrees")return{page:{kind:"org",page:"worktrees"},org:o,worktrees:!0};if(r==="workspaces")return{page:{kind:"org",page:"workspaces"},org:o,workspaces:!0};if(r==="queues")return{page:{kind:"org",page:"queues"},org:o,queues:!0};if(r==="releases")return{page:{kind:"home"},org:o,releasesForward:!0}}if(a==="proj"&&n.length<=3){const o=decodeURIComponent(l);if(r===void 0)return{page:{kind:"project",project:o}};if(r==="tasks")return{page:{kind:"project",project:o,page:"tasks"},tasks:!0};if(r==="releases")return{page:{kind:"project",project:o,page:"releases"},releases:!0}}return{page:{kind:"not_found"}}}const O6={label:"Local viewer",can:()=>!1},$6={connecting:"Connecting…",live:"Live · refreshes every 10s",disconnected:"Disconnected"},Wv=()=>s.jsx(t1,{title:"Page not found",children:"There is no page at this address in this viewer."});function D6({routeOrg:e}){const{org:t,engine:n}=vn(),{project:a}=Mo(),[l,r]=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(Js,{page:"Threads"})}):s.jsxs("div",{className:"main viewer-panel",children:[s.jsxs("p",{className:"connection",role:"status",children:[s.jsx("span",{className:`dot ${l}`,"aria-hidden":"true"}),$6[l]]}),s.jsx(k6,{onConnection:r,org:(t==null?void 0:t.slug)??e??null,project:a})]})}const Pa=()=>s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"});function z6({route:e,navigate:t}){var f;const{org:n,projects:a,loading:l,none:r}=vn(),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&&!l&&n!==null?`org/${encodeURIComponent(n.slug)}/tasks`:null;if(u.useEffect(()=>{c&&t(c)},[c,t]),i!==null&&o)return s.jsx(Wi,{project:i});if(c||e.org===void 0&&l)return s.jsx(Pa,{});const d=(n==null?void 0:n.slug)??e.org;return d===void 0&&i!==null?s.jsx(Wi,{project:i}):d===void 0&&r?s.jsx(Pr,{}):d===void 0?s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Tasks open once the organization reads."}):s.jsx(U$,{org:d})}function L6({route:e,navigate:t}){const{org:n,loading:a,none:l}=vn(),r=e.org===void 0&&!a&&n!==null?`org/${encodeURIComponent(n.slug)}/queues${window.location.search}`:null;if(u.useEffect(()=>{r&&t(r)},[r,t]),r||e.org===void 0&&a)return s.jsx(Pa,{});const i=(n==null?void 0:n.slug)??e.org;if(i===void 0&&l)return s.jsx(Pr,{});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(m3,{org:i,open:o,path:`/org/${encodeURIComponent(i)}/queues`})}function U6({route:e,navigate:t}){var j;const{org:n,projects:a}=vn(),{project:l,settled:r}=Mo(),i=e.project??null,o=i!==null&&a!==null&&!((j=a.find(v=>v.id===i))!=null&&j.current),c=window.location.search,d=i===null&&l!==null?`proj/${encodeURIComponent(l)}/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(Wi,{project:i});if(d||i===null&&!r)return s.jsx(Pa,{});if(i===null)return s.jsx(Pr,{});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(n3,{org:x,project:i,issue_id:e.issue,from:v,query:f})}return s.jsx(qD,{org:x,project:i,query:f,onQuery:m})}function B6({issue:e,navigate:t,home:n}){const{project:a,settled:l}=Mo(),r=a!==null?`proj/${encodeURIComponent(a)}/issues/${encodeURIComponent(e)}`:null;return u.useEffect(()=>{r&&t(r)},[r,t]),r||!l?s.jsx(Pa,{}):n}function Mo(){var r;const{projects:e,loading:t,none:n,failure:a}=vn();return{project:((r=e==null?void 0:e.find(i=>i.current))==null?void 0:r.id)??null,settled:!t&&(e!==null||n!==null||!!(a!=null&&a.shown))}}function H6({navigate:e}){const{project:t,settled:n}=Mo(),a=t!==null?`proj/${encodeURIComponent(t)}/releases${window.location.search}`:null;return u.useEffect(()=>{a&&e(a)},[a,e]),a||!n?s.jsx(Pa,{}):s.jsx(Pr,{})}function Jv(e){const t=new URLSearchParams(e);return{release:t.get("release"),planned:t.has("planned")?t.get("planned")??"":null}}function I6({route:e}){var f;const{org:t,projects:n,loading:a}=vn(),l=e.page.kind==="project"?e.page.project:"",[r,i]=u.useState(()=>Jv(window.location.search));if(a)return s.jsx(Pa,{});if(n!==null&&!((f=n.find(h=>h.id===l))!=null&&f.current))return s.jsx(Wi,{project:l});const c=`/proj/${encodeURIComponent(l)}/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(Jv(x))};return s.jsx(sL,{org:(t==null?void 0:t.slug)??"",query:r,onSelect:d,home:c})}function P6({hash:e,navigate:t,home:n}){const{project:a,settled:l}=Mo(),r=f1.exec(e),i=r!=null&&r[2]?Ru(r[2]):null,o=r!=null&&r[3]?Ru(r[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||!l?s.jsx(Pa,{}):n}function qf({route:e,navigate:t}){const{org:n}=vn();let a=e.page;const l=e.org!==void 0&&n!==null&&e.org!==n.slug;l&&(a={kind:"not_found"});let r;if(l)r=s.jsx(Wv,{});else if("threads"in e)r=s.jsx(D6,{routeOrg:e.org});else if("task"in e){const i=new URLSearchParams(window.location.search).get("from");r=s.jsx(uD,{org:encodeURIComponent(e.org),task_id:e.task,from:i})}else"tasks"in e?r=s.jsx(z6,{route:e,navigate:t}):"issues"in e?r=s.jsx(U6,{route:e,navigate:t}):"chart"in e?r=s.jsx(O3,{}):"worktrees"in e?r=s.jsx(ZL,{org:(n==null?void 0:n.slug)??e.org}):"workspaces"in e?r=s.jsx(EL,{org:(n==null?void 0:n.slug)??e.org}):"queues"in e?r=s.jsx(L6,{route:e,navigate:t}):"releasesForward"in e?r=s.jsx(H6,{navigate:t}):"releases"in e?r=s.jsx(I6,{route:e}):a.kind==="home"?r=s.jsx(Pr,{}):a.kind==="project"?r=s.jsx(Wi,{project:a.project}):r=s.jsx(Wv,{});return s.jsx(uL,{page:a,children:r})}function q6({task:e,navigate:t,home:n}){const{org:a,loading:l,none:r,failure:i}=vn(),o=a!==null?`org/${encodeURIComponent(a.slug)}/tasks/${encodeURIComponent(e)}`:null,c=!l&&(r!==null||!!(i!=null&&i.shown));return u.useEffect(()=>{o&&t(o)},[o,t]),o||!c?s.jsx(Pa,{}):n}const G6=e=>window.location.replace(e);function Ru(e){try{return decodeURIComponent(e)}catch{return null}}function V6({navigate:e=G6,data:t}){const n=M6(h1(window.location.pathname),window.location.search),[a,l]=u.useState(null),{notify:r,toasts:i}=T6(),o=R6.exec(window.location.hash),c=o?Ru(o[1]):null,d=E6.exec(window.location.hash),f=d?Ru(d[1]):null,h=f!==null&&A6.test(f)?f:null,m=f1.test(window.location.hash)?window.location.hash:null,x=o!==null&&c===null||d!==null&&h===null,j="forward"in n?n.forward:null;u.useEffect(()=>{j&&e(j)},[j,e]);const v=u.useMemo(()=>{if(t)return t;const g=s6();return{probe:{source:async()=>({label:"Local workspace"})},shell:g,issues:g.issues,tasks:r6(),org:l6(),worktrees:o6(),workspaces:c6(),queues:a6(),releases:i6()}},[t]);if(j||"forward"in n||!v.shell)return null;const y=s.jsx(qf,{route:{page:{kind:"home"}},navigate:e});return s.jsx("div",{className:"app-ui dark",ref:l,children:s.jsxs(TA,{container:a,children:[s.jsx(Jj,{data:v,router:s1,identity:O6,notify:r,children:s.jsx(xR,{shell:v.shell,children:x?s.jsx(qf,{route:{page:{kind:"not_found"}},navigate:e}):c!==null?s.jsx(q6,{task:c,navigate:e,home:y}):h!==null?s.jsx(B6,{issue:h,navigate:e,home:y}):m!==null?s.jsx(P6,{hash:m,navigate:e,home:y}):s.jsx(qf,{route:n,navigate:e})})}),i]})})}vC.createRoot(document.getElementById("root")).render(s.jsx(u.StrictMode,{children:h1(window.location.pathname)==="app-ui-probe"?s.jsx(_L,{}):s.jsx(V6,{})}));
389
+ Its session could not be read: ${E.merge.caveat}. A turn it does not start passes on.`:"";await x({title:`Send ${E.name} to the main queue`,description:`This joins the main promotion queue for its thread, ${ne}, which ${ee} and is told of the join. The queue checks the branch first, and ${ge}. Nothing reaches main before then.${G}`,action_label:"Join the main queue"})&&await T("merge",E)},z=async E=>{const I=k(E);await x({title:`Remove ${E.name}?`,description:`This deletes the folder ${E.path}${I!==void 0?` and frees about ${Mc(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 T("remove",E))},S=async E=>{await t.dismiss(E),await _()};return(l==null?void 0:l.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(Js,{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(Ft,{title:"Worktrees",description:X}),!n&&!l&&s.jsx(e6,{}),l?s.jsx(t6,{refusal:l,read_at:n==null?void 0:n.read_at,on_retry:()=>void _()}):null,n!=null&&n.stale?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Could not read worktrees"}),s.jsxs(pe,{children:[s.jsxs("p",{children:[n.stale.message," This list was read at ",Qn(new Date(n.read_at).toISOString()),"."]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void _(),children:"Retry"})]})]}):null,n==null?void 0:n.removals.map(E=>s.jsxs(me,{variant:"success",className:"mt-4",role:"status",children:[s.jsx(ve,{children:y.current[E.path]!==void 0?`Removed ${E.name} and freed ${Mc(y.current[E.path])}`:`Removed ${E.name}`}),s.jsxs(pe,{children:[s.jsx("p",{children:E.branch?`Its branch ${E.branch} stays, and its records were saved.`:"Its records were saved."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void S({removal:E.path}),children:"Dismiss"})]})]},E.path)),n&&w.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(r0,{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(Ot,{type:"search",className:"w-64","aria-label":"Search worktrees",placeholder:"Search worktrees",value:m,onChange:E=>g(E.target.value)}),s.jsxs("p",{className:"text-muted-foreground ml-auto text-xs",children:["Read at ",Qn(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:Uf.map(E=>s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ar,"aria-pressed":f===E.id,onClick:()=>h(E.id),children:[E.label," ",w.filter(I=>Bf(I,E.id)).length]},E.id))}),H.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(Wu,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No worktrees match"}),Y?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(O=Uf.find(E=>E.id===f))==null?void 0:O.empty," matches “",m,"”. Clear the search to see all"," ",w.filter(E=>Bf(E,f)).length,"."]}),s.jsx(P,{type:"button",variant:"outline",onClick:()=>g(""),children:"Clear search"})]}):s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(Z=Uf.find(E=>E.id===f))==null?void 0:Z.empty," right now."]})]}):s.jsx(jt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Worktrees",className:"table-fixed",children:[s.jsx(Ge,{children:s.jsxs(ue,{children:[s.jsx(F,{className:"w-[24%]",children:"Worktree"}),s.jsx(F,{className:"w-[24%]",children:"Threads"}),s.jsx(F,{className:"w-[12%]",children:"Landed"}),s.jsx(F,{className:"w-[18%]",children:"Cleanup"}),s.jsx(F,{className:"hidden w-[10%] md:table-cell",children:"Last commit"}),s.jsx(F,{className:"w-[12%] text-right",children:"Actions"})]})}),s.jsx(He,{children:H.map(E=>s.jsx(n6,{org:e,row:E,size:k(E),sizes:i!==null?"read":c?"failed":"measuring",can_write:n.can_write,sent:j[E.path],on_merge:()=>void R(E),on_remove:()=>void z(E),on_dismiss:I=>void S(I),on_clear_sent:()=>v(({[E.path]:I,...ne})=>ne)},E.path))})]})})]}):null,p]})}function e6(){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(pt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function t6({refusal:e,read_at:t,on_retry:n}){const a=Wn();return e.reason==="view_outdated"?s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(xn,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:Or}),s.jsx(pe,{children:a})]}):s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"Could not read worktrees"}),s.jsxs(pe,{children:[s.jsxs("p",{children:[e.message,t?` This list was read at ${Qn(new Date(t).toISOString())}.`:""]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function dc({children:e,muted:t=!0}){return s.jsx("div",{className:ie("truncate text-xs",t&&"text-muted-foreground"),title:e,children:e})}function n6({org:e,row:t,size:n,sizes:a,can_write:l,sent:r,on_merge:i,on_remove:o,on_dismiss:c,on_clear_sent:d}){const{href:f,Link:h}=Ve(),m=e?`/org/${encodeURIComponent(e)}`:"",g=f(`${m}/threads`),j=f(`${m}/tasks`),v=ei[t.landed??"not_landed"],y=mx(t),x=t.write,p=(x==null?void 0:x.state)==="waiting"||(x==null?void 0:x.state)==="running",b=t.threads.find(X=>"thread"in t.merge&&X.thread===t.merge.thread)??t.threads[0],_=t.merge,N=!_.offered&&_.why===hx,C=l&&t.landed===null&&!t.queue&&!N&&!px(t),w=n!==void 0?Mc(n):a==="measuring"?"Measuring size…":a==="failed"?"Size could not be read":null,k=y?{label:"Yours to decide",muted:!1,second:[w,t.cleanup_why[0]]}:t.archivable?{label:"The manager removes it",muted:!1,second:[w]}:{label:"Stays",muted:!0,second:[w,t.why[0]??null]},A=k.second.filter(Boolean).join(" · "),$=t.path.slice(0,t.path.length-t.name.length-1)||".";return s.jsxs(s.Fragment,{children:[s.jsxs(ue,{"data-testid":"worktrees-row",children:[s.jsxs(q,{children:[s.jsx("div",{className:"truncate font-medium",title:t.name,children:t.name}),s.jsx(dc,{children:t.branch??"Detached"}),$!==".sdlc-worktrees"?s.jsx(dc,{children:`in ${$}`}):null]}),s.jsx(q,{children:b?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"truncate",title:b.title??b.thread,children:b.title??b.thread}),s.jsx(dc,{children:`${ZL(t,b)}${t.threads.length>1?` · ${t.threads.length-1} more`:""}`})]}):s.jsx("span",{className:"text-muted-foreground",children:"No thread"})}),s.jsx(q,{children:s.jsx(he,{variant:v.tone,children:v.label})}),s.jsxs(q,{children:[s.jsx("div",{className:ie("truncate",k.muted&&"text-muted-foreground"),children:k.label}),A?s.jsx("div",{className:"hidden md:block",children:s.jsx(dc,{children:A})}):null]}),s.jsx(q,{className:"hidden md:table-cell",children:QL(t.idle_days)}),s.jsx(q,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[p?s.jsx(P,{type:"button",variant:"outline",size:"sm",loading:!0,disabled:!0,children:(x==null?void 0:x.kind)==="merge"?x.state==="waiting"?"Waiting to join…":"Joining main…":(x==null?void 0:x.state)==="waiting"?"Waiting to remove…":"Removing…"}):t.queue?s.jsx(he,{variant:ei.queued.tone,children:`${ei.queued.label} · ${u1(t.queue.position)}`}):N?s.jsx(h,{href:j,"aria-label":`${t.name}: its thread waits on you, in Waiting on you`,children:s.jsx(he,{variant:ei.needs_you.tone,children:ei.needs_you.label})}):C?s.jsx(P,{type:"button",variant:"outline",size:"sm",title:_.offered?void 0:_.why,"aria-disabled":!_.offered||void 0,className:ie(!_.offered&&"cursor-not-allowed opacity-50"),"aria-label":`Send ${t.name} to the main queue`,"aria-describedby":_.offered?void 0:`why-${t.name}`,onClick:_.offered?i:void 0,children:"Merge"}):null,y&&l&&!p?s.jsx(P,{type:"button",variant:"outline",size:"sm","aria-label":`Remove ${t.name}`,onClick:o,children:"Remove"}):null]})})]}),s.jsx(s6,{row:t,threads:g,tasks:j,merge_shown:C,sent:r,on_dismiss:c,on_clear_sent:d})]})}function s6({row:e,threads:t,tasks:n,merge_shown:a,sent:l,on_dismiss:r,on_clear_sent:i}){var j,v,y,x;const{Link:o}=Ve(),c=(p="Open in Threads")=>s.jsx(o,{className:"text-primary text-sm hover:underline",href:t,children:p}),d=p=>s.jsx(P,{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 g=null;if(l)g=s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:"It was not sent"}),s.jsxs(pe,{children:[s.jsx("p",{children:l}),d(i)]})]});else if((f==null?void 0:f.state)==="waiting")g=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")g=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=((j=f.lands)==null?void 0:j.by)==="manager"?`the merge manager, ${f.lands.manager}, lands it`:"it lands it on its turn";g=s.jsxs(me,{variant:f.told?"success":"warning",role:"status",children:[s.jsx(ve,{children:`${e.name} joined the main queue, ${u1(f.position)}`}),s.jsxs(pe,{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 ${Hf(e.queue.passes_at)}.`}):null,s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>r({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`;g=s.jsxs(me,{variant:"destructive",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:f.kind==="merge"&&f.state==="failed"?`${e.name} did not join`:p}),s.jsxs(pe,{children:[s.jsx("p",{children:`${ci(f.message)}${f.kind==="merge"?" Nothing was queued.":" Nothing was deleted."}`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>r({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;g=s.jsxs(me,{variant:"warning",children:[s.jsx(rt,{className:"size-4","aria-hidden":"true"}),s.jsx(ve,{children:`${e.name}'s turn ${p.outcome==="failed"?"failed":"passed on"} at ${Hf(p.left_at)}`}),s.jsxs(pe,{children:[s.jsx("p",{children:`${ci(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(()=>r({turn:{execution:p.execution,left_at:p.left_at}})),s.jsx("span",{className:"mt-2",children:c()})]})]})]})}else((x=e.queue)==null?void 0:x.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?g=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 ${Hf(e.queue.passes_at)}. `,c()]}):!e.merge.offered&&e.merge.why===hx?g=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?g=s.jsx("p",{className:"text-sm",children:c("Open its successor in Threads")}):a&&!e.merge.offered?g=s.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:[`${ci(e.merge.why)}. `,e.merge.thread&&!e.merge.why.startsWith("its thread is at work")?c():null]}):e.merge.offered&&e.merge.caveat&&(g=s.jsx("p",{className:"text-muted-foreground text-sm",children:`${ci(e.merge.caveat)}.`}));return g?s.jsx(ue,{className:"hover:bg-transparent",children:s.jsx(q,{colSpan:6,className:"pt-0",children:g})}):null}const a6=["reason","since","store","repository","folder","home","member_path"];function d1(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 a6){const l=t==null?void 0:t[a];typeof l=="string"&&(n[a]=l)}return n}function jl({base:e="",fetcher:t=fetch}){return async(n,a={})=>{const l=new URLSearchParams;for(const[c,d]of Object.entries(a))if(Array.isArray(d))for(const f of d)l.append(c,f);else d!==void 0&&d!==!1&&d!==""&&l.set(c,String(d));const r=l.size>0?`?${l.toString()}`:"";let i;try{i=await t(`${e}api/app/${n}${r}`,{cache:"no-store"})}catch{return{ok:!1,refusal:{status:0,message:"The viewer did not answer. Is sdlc viewer still running?"}}}const o=await i.json().catch(()=>null);return i.ok?{ok:!0,data:o}:{ok:!1,refusal:d1(i.status,o)}}}function l6(e={}){const t=jl(e),n=l=>async()=>{const r=await t("access");return r.ok?{ok:!0,data:r.data[l]}:r},a=encodeURIComponent;return{tasks:{access:n("tasks"),configuration:()=>t("tasks/configuration"),listTasks:l=>t(`tasks/lists/${a(l)}/tasks`),task:l=>t(`tasks/tasks/${a(l)}`)},issues:{access:n("issues"),list:(l={})=>t("issues",l),issue:l=>t(`issues/${a(l)}`),issueSections:l=>t(`issues/${a(l)}/sections`),issueRelated:l=>t(`issues/${a(l)}/related`)},releases:{access:n("releases"),list:()=>t("releases"),release:l=>t(`releases/${a(l)}`),candidate:()=>t("releases/candidate")},organizations:{access:n("organizations"),list:()=>t("orgs")},projects:{access:n("projects"),list:()=>t("projects")},about:{about:()=>t("about")}}}function r6(e={}){const t=jl(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 ui=e=>({ok:!1,refusal:{status:0,message:e}});function xx({base:e="",fetcher:t=fetch}){return async(n,a)=>{let l;try{l=await t(`${e}api/${n}`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch{return ui("The viewer did not answer. Is sdlc viewer still running?")}const r=await l.json().catch(()=>null);return l.ok?{ok:!0,data:r}:{ok:!1,refusal:d1(l.status,r)}}}function i6(e={}){const t=jl(e),n=xx(e);return{chart:()=>t("org"),change:a=>n("org-change",a)}}function o6(e={}){const t=jl(e),n=o=>`tasks/tasks/${encodeURIComponent(o)}`,{base:a="",fetcher:l=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={})=>c.state==="archived"?Promise.resolve(ui("This checkout keeps no archived tasks.")):c.assigned_to_me?Promise.resolve(ui("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}),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()=>ui("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 l(`${a}api/task-done`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})}catch{return ui("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 c6(e={}){const t=jl(e),n=xx(e),a=encodeURIComponent,l=r=>r!=null&&r.fresh?{fresh:1}:{};return{access:async()=>{const r=await t("access");return r.ok?{ok:!0,data:r.data.releases}:r},list:(r={})=>t("releases",l(r)),release:(r,i)=>t(`releases/${a(r)}`,l(i)),candidate:r=>t("releases/candidate",l(r)),candidateBatch:r=>t("releases/candidate/batch",l(r)),related:(r,i)=>t(`releases/${a(r)}/related`,l(i)),plannedRelease:(r,i)=>t(`releases/planned/${a(r)}`,l(i)),roadmap:r=>t("releases/roadmap",{...l(r),...r!=null&&r.mine?{mine:1}:{}}),roadmapMoved:r=>t("releases/roadmap/moved",l(r)),roadmapSeen:r=>n("roadmap/seen",{at:r})}}function u6(e={}){const t=jl(e),n=xx(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 d6(e={}){const t=jl(e);return{overview:()=>t("workspaces")}}const f6=15e3,h6=10,Yv="idle-sessions-list",Fv="idle-sessions-heading",Xv="idle-sessions-confirm-text";function f1(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const m6=e=>`${Number.isInteger(e)?e:e.toFixed(1)} h`,h1=e=>e===1?"1 session":`${e} sessions`;function p6(e){const t=e.released.length?`Closed ${h1(e.released.length)}.`:"Closed no sessions.";return e.kept.length?`${t} Kept ${e.kept.length}:`:t}function x6({row:e}){const t=[e.name,e.retired?"continued in another session":"",`idle ${m6(e.idle_hours)}`,f1(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 g6(){const[e,t]=u.useState(null),[n,a]=u.useState(!1),[l,r]=u.useState(!1),[i,o]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(""),m=u.useRef(""),g=u.useRef(null),j=u.useRef(null),v=u.useRef(null),y=u.useRef(null),x=u.useRef(0),p=u.useRef(0),b=u.useCallback(async()=>{const L=++x.current,H=await vL();if(!H||L<p.current)return;p.current=L,h("");const T=JSON.stringify(H);T!==m.current&&(m.current=T,t(H))},[]);u.useEffect(()=>{const L=setTimeout(b,0),H=setInterval(b,f6);return()=>{clearTimeout(L),clearInterval(H)}},[b]),u.useEffect(()=>{var H;const L=y.current;L&&(y.current=null,(H={cancel:j,close:g,dismiss:v}[L].current)==null||H.focus())});const _=(e==null?void 0:e.sessions.length)??0;if(u.useEffect(()=>{l&&!_&&i===null&&r(!1)},[l,_,i]),!_&&!c&&!f&&i===null)return null;const N=()=>{i===null&&(r(!0),y.current="cancel")},C=()=>{i===null&&(r(!1),y.current="close")},w=async()=>{if(i!==null)return;o(_),d(null),h("");const L=await yL();p.current=x.current+1,await b(),o(null),r(!1),a(!1),"error"in L?(h(`The sessions were not closed: ${L.error.replace(/\.+$/,"")}.`),y.current="close"):(d(L.done),y.current="dismiss")},k=()=>{d(null),y.current="close"},A=L=>{L.key==="Escape"&&(L.preventDefault(),C())},$=i!==null?`Closing ${h1(i)}…`:c?p6(c):"",X=(e==null?void 0:e.sessions.slice(0,h6))??[],Y=_-X.length;return s.jsxs("div",{className:"idle",role:"group",..._?{"aria-labelledby":Fv}:{"aria-label":"Idle sessions"},children:[f&&s.jsx("div",{className:"alert",role:"alert",children:f}),_>0&&e&&s.jsxs("div",{className:"idle-head",children:[s.jsxs("div",{className:"idle-title",children:[s.jsxs("h2",{className:"group",id:Fv,"aria-label":`Idle sessions, ${_}`,children:["Idle sessions",s.jsx("span",{className:"count",children:_})]}),s.jsxs("p",{className:"caption muted",children:["over ",e.idle_over," h · ",f1(e.memory_mb)]})]}),s.jsxs("div",{className:"tools",children:[s.jsx("button",{type:"button",className:"pin","aria-expanded":n,"aria-controls":Yv,"aria-label":n?"Hide the idle sessions list":"Show the idle sessions list",onClick:()=>a(L=>!L),children:n?"Hide":"Show"}),s.jsx("button",{type:"button",className:"pin",ref:g,"aria-expanded":l,"aria-label":"Close idle sessions…",onClick:N,children:"Close idle…"})]})]}),_>0&&s.jsxs("ul",{className:"idle-list",id:Yv,hidden:!n,"aria-label":`Sessions idle over ${e==null?void 0:e.idle_over} hours, longest idle first`,children:[X.map(L=>s.jsx(x6,{row:L},L.session)),Y>0&&s.jsx("li",{children:s.jsxs("p",{className:"caption muted",children:["…and ",Y," more"]})})]}),l&&_>0&&s.jsxs("div",{className:"idle-confirm",role:"group","aria-label":"Close idle sessions","aria-describedby":Xv,onKeyDown:A,children:[s.jsxs("p",{id:Xv,children:[_===1?"Close this session?":`Close these ${_} sessions?`," Each transcript stays, so reopening a conversation resumes it, and a thread with unfinished work goes on with Continue on its card. A session that is busy or has background work running is kept."]}),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:w,children:i!==null?`Closing ${i}…`:`Close ${_}`}),s.jsx("button",{type:"button",className:"pin",ref:j,"aria-disabled":i!==null?!0:void 0,onClick:C,children:"Cancel"})]})]}),s.jsx("p",{className:"idle-status",role:"status",children:$}),c&&s.jsxs(s.Fragment,{children:[c.kept.length>0&&s.jsx("ul",{className:"idle-list","aria-label":"Kept sessions",children:c.kept.map(L=>s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:L.title}),s.jsx("p",{className:"caption muted",children:L.why})]},L.session))}),s.jsx("div",{className:"tools start",children:s.jsx("button",{type:"button",className:"pin",ref:v,"aria-label":"Dismiss the close result",onClick:k,children:"Dismiss"})})]})]})}const Kv={ok:"lime",you:"amber",alert:"red",waiting:"blue",blocked:"purple",muted:"grey",plain:"grey"};function Oc(e){return e&&Object.hasOwn(Kv,e)?Kv[e]:"grey"}const v6=1e4,y6=6e4,b6=2,If="#thread-",j6=d0("Threads"),_6={working:"▶",prod:"↑",planned:"○"},Qv=3,Zv=["working","ready","prod","waiting","blocked","paused","planned"],w6={ready:"results ready",prod:"ready for prod"};function N6(e){const t=Zv.map(a=>[a,e.filter(l=>l.state===a).length]),n=[...new Set(e.map(a=>a.state).filter(a=>!Zv.includes(a)))].map(a=>[a,e.filter(l=>l.state===a).length]);return[...t,...n].filter(([,a])=>a>0).map(([a,l])=>`${l} ${w6[a]??a}`).join(" · ")}const k6={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 S6(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 C6=new Set(["not_terminal","another_process","continued","no_open","pending"]);function Wv({label:e,count:t,hint:n}){const a=n?`hint-${e.toLowerCase().replace(/\W+/g,"-")}`:void 0;return s.jsxs(s.Fragment,{children:[s.jsxs("h2",{className:"group","aria-label":`${e}, ${t}`,"aria-describedby":a,children:[e,s.jsx("span",{className:"count",children:t})]}),n&&s.jsx("span",{className:"sr-only",id:a,children:n})]})}function Pf({text:e,role:t}){return s.jsx("span",{className:`badge tone-${Oc(t)}`,children:e})}function R6({serves:e}){const t=e.slice(0,b6),n=e.length-t.length;return s.jsxs("p",{className:"caption muted serves",children:[t.map((a,l)=>s.jsxs("span",{children:[l>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"]})]})]})}function Jv({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 T6({onConnection:e,org:t=null,project:n=null}){const[a,l]=u.useState(null),[r,i]=u.useState(!1),[o,c]=u.useState(""),[d,f]=u.useState(!1),[h,m]=u.useState(null),[g,j]=u.useState(""),[v,y]=u.useState(null),[x,p]=u.useState(null),[b,_]=u.useState(null),N=u.useRef(""),C=u.useRef(""),w=u.useRef(null),k=u.useRef(null),A=u.useRef(null),$=B=>{var te;return B instanceof HTMLButtonElement&&B.classList.contains("pin")&&((te=w.current)!=null&&te.contains(B))?B.dataset.key??null:null},X=B=>{A.current=$(B.target)},Y=()=>{setTimeout(()=>{$(document.activeElement)||(A.current=null)},0)},L=u.useCallback(async()=>{const B=await a1();if("none"in B){i(!0),c(""),e("live");return}if("error"in B){c(B.error),e("disconnected");return}i(!1),c(""),j(""),e("live");const te=JSON.stringify(B.data);te!==N.current&&(N.current=te,l(B.data))},[e]);u.useEffect(()=>{let B=!0;gL().then(le=>B&&f(le));const te=setTimeout(L,0),J=setInterval(L,v6);return()=>{B=!1,clearTimeout(te),clearInterval(J)}},[L]),u.useEffect(()=>{let B=!0;const te=()=>xL().then(le=>{B&&le&&y(W=>JSON.stringify(W)===JSON.stringify(le)?W:le)});te();const J=setInterval(te,y6);return()=>{B=!1,clearInterval(J)}},[]),u.useEffect(()=>{const B=()=>{var Qe,oe,Oe;const J=window.location.hash;if(!J.startsWith(If)){_(null);return}if(J===C.current)return;let le;try{le=decodeURIComponent(J.slice(If.length))}catch{le=J.slice(If.length)}const W=document.getElementById(`thread-${le}`);if(!W||!((Qe=w.current)!=null&&Qe.contains(W))){a&&_(le);return}C.current=J,_(null),p(le),(oe=W.querySelector(".thread-title"))==null||oe.focus({preventScroll:!0}),(Oe=W.scrollIntoView)==null||Oe.call(W,{block:"center"})},te=()=>{C.current="",B()};return B(),window.addEventListener("hashchange",te),()=>window.removeEventListener("hashchange",te)},[a]),u.useEffect(()=>{if(!x)return;const B=()=>p(null);return document.addEventListener("pointerdown",B,!0),document.addEventListener("keydown",B,!0),()=>{document.removeEventListener("pointerdown",B,!0),document.removeEventListener("keydown",B,!0)}},[x]),u.useLayoutEffect(()=>{const B=A.current??k.current;if(!B||!w.current)return;const te=document.activeElement;if(te&&te!==document.body&&!w.current.contains(te)){A.current=null;return}const J=[...w.current.querySelectorAll("button.pin")].find(le=>le.dataset.key===B);J?te!==J&&J.focus({preventScroll:B!==k.current}):A.current=null});const H=async B=>{if(h)return;const te=!B.pinned;k.current=B.key,m(B.key);const J=await jL(B.key,te);m(null),J||l(le=>le&&{...le,threads:le.threads.map(W=>W.key===B.key?{...W,pinned:te}:W)}),await L(),j(J?`The pin was not saved: ${J}`:""),k.current===B.key&&(k.current=null)},[T,R]=u.useState(()=>new Set),[z,S]=u.useState({}),O=Wn(),{confirm:Z,confirm_dialog:E}=_o(),I=(B,te)=>S(J=>{const{[B]:le,...W}=J;return te?{...W,[B]:te}:W}),ne=(B,te)=>R(J=>{const le=new Set(J);return te?le.add(B):le.delete(B),le}),ee=Object.keys(z).some(B=>!T.has(B));u.useEffect(()=>{if(!ee)return;const B=()=>S(te=>Object.fromEntries(Object.entries(te).filter(([J])=>T.has(J))));return document.addEventListener("pointerdown",B,!0),document.addEventListener("click",B,!0),()=>{document.removeEventListener("pointerdown",B,!0),document.removeEventListener("click",B,!0)}},[ee,T]);const ge=B=>setTimeout(()=>{var te,J;return(J=[...((te=w.current)==null?void 0:te.querySelectorAll("button.open-thread"))??[]].find(le=>le.dataset.key===B))==null?void 0:J.focus()},0),G=async(B,te)=>{const J=await Z({title:`Reopen ${B.title} in Terminal?`,description:`Its session is closed. It opens in a new Terminal window in ${te??"the thread's folder"}, running claude --resume.`,action_label:"Reopen"});return ge(B.key),J},M=async B=>{if(T.has(B.key))return;let te=!1;for(;;){ne(B.key,!0),I(B.key,{key:B.key,text:k6[B.where??""]??"Opening.",role:"waiting"});const J=await bL(B.key,te);if(ne(B.key,!1),"done"in J){I(B.key,null);return}const{reason:le,error:W,where:Qe}=J.refused;if(le==="closed"&&!te){if(I(B.key,null),!await G(B,Qe))return;te=!0;continue}const oe=le==="outdated"?`${W.replace(/\.*$/,".")} ${O}`:W.replace(/\.*$/,"."),Oe=le==="terminal_denied"?"you":C6.has(le)?"muted":"alert";I(B.key,{key:B.key,text:oe,role:Oe});return}},V=(a==null?void 0:a.pinnedCount)??0,ae=(a==null?void 0:a.threads)??[];return s.jsxs(s.Fragment,{children:[E,s.jsxs("header",{className:"main-head",children:[s.jsx("h1",{children:"Threads"}),a&&!r&&s.jsx("p",{className:"muted",children:a.line})]}),s.jsxs("section",{className:"card threads","aria-label":"Threads",children:[s.jsx(g6,{}),o&&s.jsxs("div",{className:"alert",role:"alert",children:["Threads unavailable: ",o.replace(/\.+$/,""),". Retrying every 10 s."]}),g&&s.jsx("div",{className:"alert",role:"alert",children:g}),s.jsx("p",{className:"caption muted not-listed",role:"status",children:b!==null&&!r?s.jsxs(s.Fragment,{children:["Thread ",b," is not in this list. ",s.jsx("code",{children:"sdlc view --all"})," lists older threads."]}):null}),r?s.jsx("p",{className:"muted",children:j6}):s.jsxs("div",{className:"thread-list",ref:w,onFocus:X,onBlur:Y,children:[ae.map((B,te)=>s.jsxs("div",{children:[V>0&&te===0&&s.jsx(Wv,{label:"Pinned",count:V,hint:"Threads you pinned; they stay first in every order"}),V>0&&te===V&&s.jsx(Wv,{label:"Other threads",count:ae.length-V}),s.jsx(E6,{row:v!=null&&v[B.key]?{...B,serves:v[B.key]}:B,arrived:x===B.key,pinnable:d&&typeof B.pinned=="boolean",pinning:h,onPin:()=>H(B),opening:T.has(B.key),note:z[B.key]??null,onOpen:()=>M(B),org:t,project:n})]},B.key)),a&&!ae.length&&s.jsx("p",{className:"muted empty",children:"No threads at work or waiting."}),a&&a.hidden>0&&s.jsxs("p",{className:"caption muted",children:[a.hidden," older thread(s) not shown; sdlc view --all lists them."]})]})]})]})}function E6({row:e,arrived:t,pinnable:n,pinning:a,onPin:l,opening:r,note:i,onOpen:o,org:c,project:d}){const f=x=>c?`org/${encodeURIComponent(c)}/tasks/${encodeURIComponent(x)}`:null,h=x=>d?`proj/${encodeURIComponent(d)}/issues/${encodeURIComponent(x)}`:null,m=[e.where||e.agent,e.phase,e.age,e.waitsOn?`waits on ${e.waitsOn}`:""].filter(Boolean).join(" · "),g=S6(e),j=`open-note-${e.key}`,[v,y]=u.useState(!1);return s.jsxs("article",{className:t?"thread arrived":"thread",id:`thread-${e.key}`,style:{marginLeft:Math.min(e.depth*22,110)},children:[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(Pf,{text:e.carried,role:"waiting"}),e.carriedBatch&&s.jsx(Pf,{text:e.carriedBatch.text,role:e.carriedBatch.role})]}):s.jsx(Pf,{text:e.status,role:e.role}),g&&s.jsx("button",{type:"button",className:"open-thread","data-key":e.key,"aria-label":`${g}: ${e.title}`,"aria-describedby":j,"aria-disabled":r?!0:void 0,"aria-busy":r?!0:void 0,onClick:()=>{r||o()},children:r?"Opening…":g}),n&&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":a?!0:void 0,"aria-busy":a===e.key?!0:void 0,onClick:()=>{a||l()},children:e.pinned?"Unpin":"Pin"})]})]}),s.jsx("p",{className:"caption muted",children:m}),g&&s.jsx("p",{id:j,className:`caption open-note tone-${Oc((i==null?void 0:i.role)??"muted")}`,role:(i==null?void 0:i.role)==="alert"||(i==null?void 0:i.role)==="you"?"alert":"status",children:(i==null?void 0:i.text)??null}),e.serves&&e.serves.length>0&&s.jsx(R6,{serves:e.serves}),e.summary&&s.jsx("p",{className:"caption muted",children:e.summary}),e.carriedDetail&&s.jsx("p",{className:"line",children:e.carriedDetail}),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:N6(e.lines)}),(v?e.lines:e.lines.slice(0,Qv)).map((x,p)=>s.jsxs("p",{className:`line tone-${Oc(x.role)}`,children:[s.jsxs("span",{"aria-hidden":"true",children:[_6[x.state]??"•"," "]}),x.state==="working"&&s.jsx("span",{className:"sr-only",children:"Working: "}),x.task!==void 0&&s.jsx(Jv,{id:x.task,href:f(x.task)}),x.task!==void 0&&x.text?" ":null,x.text]},`l${p}`)),e.lines.length>Qv&&s.jsx("button",{type:"button",className:"lines-more","aria-expanded":v,"aria-label":v?`Show fewer lines of work of ${e.title}`:`Show all ${e.lines.length} lines of work of ${e.title}`,onClick:()=>y(x=>!x),children:v?"Show fewer":`Show all ${e.lines.length}`}),(e.routed??[]).map(x=>s.jsxs("p",{className:"line",children:["routed ",s.jsx(Jv,{id:x.issue,href:h(x.issue)}),x.title?` ${x.title}`:null]},`r${x.issue}`)),e.holds.map((x,p)=>s.jsx("p",{className:`line tone-${Oc(x.role)}`,children:x.text},`h${p}`)),e.plan&&s.jsx("p",{className:"caption muted",children:e.plan})]})}const A6=5e3;function M6(){const[e,t]=u.useState([]),n=u.useRef(0),a=u.useRef(new Map),l=u.useCallback(c=>{const d=a.current.get(c);d&&clearTimeout(d),a.current.delete(c),t(f=>f.filter(h=>h.id!==c))},[]),r=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(()=>l(f),A6))},[l]);u.useEffect(()=>{const c=a.current;return()=>{for(const d of c.values())clearTimeout(d)}},[]);const i=u.useMemo(()=>({success:c=>r("success",c),error:c=>r("error",c)}),[r]),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(P,{type:"button",variant:"ghost",size:"control",className:"shrink-0",onClick:()=>l(c.id),children:"Dismiss"})]},c.id))});return{notify:i,toasts:o}}const m1=/^#(?:(releases)|release=(.+)|planned(?:=(.+))?)$/,O6=/^#task=(.+)$/,$6=/^#issue=(.+)$/,D6=/^iss-\d{1,9}$/;function p1(e){return e.split("/").filter(Boolean).slice(1).join("/")}function z6(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,l,r,i]=n;if(a==="org"&&r==="tasks"&&i==="queues"&&n.length===4)return{forward:`org/${l}/queues${t}`};if(a==="org"&&r==="chat"&&n.length<=4)return{forward:`org/${l}/threads${i===void 0?"":`#thread-${i}`}`};if(a==="org"&&r==="tasks"&&n.length===4){const o=decodeURIComponent(i);return{page:{kind:"org",page:"tasks",item:o},org:decodeURIComponent(l),task:o}}if(a==="org"&&r==="issues"&&n.length<=4){const o=decodeURIComponent(l);return i===void 0?{page:{kind:"home"},org:o,issues:!0}:{page:{kind:"home"},org:o,issues:!0,issue:decodeURIComponent(i)}}if(a==="proj"&&r==="issues"&&n.length<=4){const o=decodeURIComponent(l),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(l);if(r===void 0)return{page:{kind:"home"},org:o};if(r==="threads")return{page:{kind:"org",page:"threads"},org:o,threads:!0};if(r==="tasks")return{page:{kind:"org",page:"tasks"},org:o,tasks:!0};if(r==="chart")return{page:{kind:"org",page:"chart"},org:o,chart:!0};if(r==="worktrees")return{page:{kind:"org",page:"worktrees"},org:o,worktrees:!0};if(r==="workspaces")return{page:{kind:"org",page:"workspaces"},org:o,workspaces:!0};if(r==="queues")return{page:{kind:"org",page:"queues"},org:o,queues:!0};if(r==="releases")return{page:{kind:"home"},org:o,releasesForward:!0}}if(a==="proj"&&n.length<=3){const o=decodeURIComponent(l);if(r===void 0)return{page:{kind:"project",project:o}};if(r==="tasks")return{page:{kind:"project",project:o,page:"tasks"},tasks:!0};if(r==="releases")return{page:{kind:"project",project:o,page:"releases"},releases:!0}}return{page:{kind:"not_found"}}}const L6={label:"Local viewer",can:()=>!1},U6={connecting:"Connecting…",live:"Live · refreshes every 10s",disconnected:"Disconnected"},ey=()=>s.jsx(s1,{title:"Page not found",children:"There is no page at this address in this viewer."});function B6({routeOrg:e}){const{org:t,engine:n}=vn(),{project:a}=Mo(),[l,r]=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(Js,{page:"Threads"})}):s.jsxs("div",{className:"main viewer-panel",children:[s.jsxs("p",{className:"connection",role:"status",children:[s.jsx("span",{className:`dot ${l}`,"aria-hidden":"true"}),U6[l]]}),s.jsx(T6,{onConnection:r,org:(t==null?void 0:t.slug)??e??null,project:a})]})}const Pa=()=>s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"});function H6({route:e,navigate:t}){var f;const{org:n,projects:a,loading:l,none:r}=vn(),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&&!l&&n!==null?`org/${encodeURIComponent(n.slug)}/tasks`:null;if(u.useEffect(()=>{c&&t(c)},[c,t]),i!==null&&o)return s.jsx(Wi,{project:i});if(c||e.org===void 0&&l)return s.jsx(Pa,{});const d=(n==null?void 0:n.slug)??e.org;return d===void 0&&i!==null?s.jsx(Wi,{project:i}):d===void 0&&r?s.jsx(Pr,{}):d===void 0?s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Tasks open once the organization reads."}):s.jsx(H$,{org:d})}function I6({route:e,navigate:t}){const{org:n,loading:a,none:l}=vn(),r=e.org===void 0&&!a&&n!==null?`org/${encodeURIComponent(n.slug)}/queues${window.location.search}`:null;if(u.useEffect(()=>{r&&t(r)},[r,t]),r||e.org===void 0&&a)return s.jsx(Pa,{});const i=(n==null?void 0:n.slug)??e.org;if(i===void 0&&l)return s.jsx(Pr,{});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(x3,{org:i,open:o,path:`/org/${encodeURIComponent(i)}/queues`})}function P6({route:e,navigate:t}){var j;const{org:n,projects:a}=vn(),{project:l,settled:r}=Mo(),i=e.project??null,o=i!==null&&a!==null&&!((j=a.find(v=>v.id===i))!=null&&j.current),c=window.location.search,d=i===null&&l!==null?`proj/${encodeURIComponent(l)}/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(Wi,{project:i});if(d||i===null&&!r)return s.jsx(Pa,{});if(i===null)return s.jsx(Pr,{});const g=encodeURIComponent((n==null?void 0:n.slug)??e.org??"");if(e.issue!==void 0){const v=new URLSearchParams(f).get("from");return s.jsx(a3,{org:g,project:i,issue_id:e.issue,from:v,query:f})}return s.jsx(VD,{org:g,project:i,query:f,onQuery:m})}function q6({issue:e,navigate:t,home:n}){const{project:a,settled:l}=Mo(),r=a!==null?`proj/${encodeURIComponent(a)}/issues/${encodeURIComponent(e)}`:null;return u.useEffect(()=>{r&&t(r)},[r,t]),r||!l?s.jsx(Pa,{}):n}function Mo(){var r;const{projects:e,loading:t,none:n,failure:a}=vn();return{project:((r=e==null?void 0:e.find(i=>i.current))==null?void 0:r.id)??null,settled:!t&&(e!==null||n!==null||!!(a!=null&&a.shown))}}function G6({navigate:e}){const{project:t,settled:n}=Mo(),a=t!==null?`proj/${encodeURIComponent(t)}/releases${window.location.search}`:null;return u.useEffect(()=>{a&&e(a)},[a,e]),a||!n?s.jsx(Pa,{}):s.jsx(Pr,{})}function ty(e){const t=new URLSearchParams(e);return{release:t.get("release"),planned:t.has("planned")?t.get("planned")??"":null}}function V6({route:e}){var f;const{org:t,projects:n,loading:a}=vn(),l=e.page.kind==="project"?e.page.project:"",[r,i]=u.useState(()=>ty(window.location.search));if(a)return s.jsx(Pa,{});if(n!==null&&!((f=n.find(h=>h.id===l))!=null&&f.current))return s.jsx(Wi,{project:l});const c=`/proj/${encodeURIComponent(l)}/releases`,d=h=>{const m=new URLSearchParams;h!=null&&h.startsWith("planned:")?m.set("planned",h.slice(8)):h&&m.set("release",h);const g=m.size>0?`?${m.toString()}`:"";window.history.replaceState(window.history.state,"",`${window.location.pathname}${g}`),i(ty(g))};return s.jsx(lL,{org:(t==null?void 0:t.slug)??"",query:r,onSelect:d,home:c})}function Y6({hash:e,navigate:t,home:n}){const{project:a,settled:l}=Mo(),r=m1.exec(e),i=r!=null&&r[2]?Tu(r[2]):null,o=r!=null&&r[3]?Tu(r[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||!l?s.jsx(Pa,{}):n}function qf({route:e,navigate:t}){const{org:n}=vn();let a=e.page;const l=e.org!==void 0&&n!==null&&e.org!==n.slug;l&&(a={kind:"not_found"});let r;if(l)r=s.jsx(ey,{});else if("threads"in e)r=s.jsx(B6,{routeOrg:e.org});else if("task"in e){const i=new URLSearchParams(window.location.search).get("from");r=s.jsx(fD,{org:encodeURIComponent(e.org),task_id:e.task,from:i})}else"tasks"in e?r=s.jsx(H6,{route:e,navigate:t}):"issues"in e?r=s.jsx(P6,{route:e,navigate:t}):"chart"in e?r=s.jsx(D3,{}):"worktrees"in e?r=s.jsx(JL,{org:(n==null?void 0:n.slug)??e.org}):"workspaces"in e?r=s.jsx(ML,{org:(n==null?void 0:n.slug)??e.org}):"queues"in e?r=s.jsx(I6,{route:e,navigate:t}):"releasesForward"in e?r=s.jsx(G6,{navigate:t}):"releases"in e?r=s.jsx(V6,{route:e}):a.kind==="home"?r=s.jsx(Pr,{}):a.kind==="project"?r=s.jsx(Wi,{project:a.project}):r=s.jsx(ey,{});return s.jsx(fL,{page:a,children:r})}function F6({task:e,navigate:t,home:n}){const{org:a,loading:l,none:r,failure:i}=vn(),o=a!==null?`org/${encodeURIComponent(a.slug)}/tasks/${encodeURIComponent(e)}`:null,c=!l&&(r!==null||!!(i!=null&&i.shown));return u.useEffect(()=>{o&&t(o)},[o,t]),o||!c?s.jsx(Pa,{}):n}const X6=e=>window.location.replace(e);function Tu(e){try{return decodeURIComponent(e)}catch{return null}}function K6({navigate:e=X6,data:t}){const n=z6(p1(window.location.pathname),window.location.search),[a,l]=u.useState(null),{notify:r,toasts:i}=M6(),o=O6.exec(window.location.hash),c=o?Tu(o[1]):null,d=$6.exec(window.location.hash),f=d?Tu(d[1]):null,h=f!==null&&D6.test(f)?f:null,m=m1.test(window.location.hash)?window.location.hash:null,g=o!==null&&c===null||d!==null&&h===null,j="forward"in n?n.forward:null;u.useEffect(()=>{j&&e(j)},[j,e]);const v=u.useMemo(()=>{if(t)return t;const x=l6();return{probe:{source:async()=>({label:"Local workspace"})},shell:x,issues:x.issues,tasks:o6(),org:i6(),worktrees:u6(),workspaces:d6(),queues:r6(),releases:c6()}},[t]);if(j||"forward"in n||!v.shell)return null;const y=s.jsx(qf,{route:{page:{kind:"home"}},navigate:e});return s.jsx("div",{className:"app-ui dark",ref:l,children:s.jsxs(EA,{container:a,children:[s.jsx(t0,{data:v,router:l1,identity:L6,notify:r,children:s.jsx(vT,{shell:v.shell,children:g?s.jsx(qf,{route:{page:{kind:"not_found"}},navigate:e}):c!==null?s.jsx(F6,{task:c,navigate:e,home:y}):h!==null?s.jsx(q6,{issue:h,navigate:e,home:y}):m!==null?s.jsx(Y6,{hash:m,navigate:e,home:y}):s.jsx(qf,{route:n,navigate:e})})}),i]})})}bC.createRoot(document.getElementById("root")).render(s.jsx(u.StrictMode,{children:p1(window.location.pathname)==="app-ui-probe"?s.jsx(NL,{}):s.jsx(K6,{})}));