syntaur 0.75.0 → 0.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dashboard/dist/assets/{_basePickBy-Cj5wouIO.js → _basePickBy-CmtR3VlC.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-uoD3r5Lh.js → _baseUniq-d5yVqkuO.js} +1 -1
- package/dashboard/dist/assets/{arc-Bsl9iLIF.js → arc-BTfvlUzk.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-ChAY3fon.js → architectureDiagram-2XIMDMQ5-ComKmfQn.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-CiALbCXV.js → blockDiagram-WCTKOSBZ-69xtTOqC.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-B9ykJE5a.js → c4Diagram-IC4MRINW-B5MsrIyR.js} +1 -1
- package/dashboard/dist/assets/channel-B55sx3Pw.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-DPNMTYz8.js → chunk-4BX2VUAB-BV-rQx2S.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-UFkoEp3B.js → chunk-55IACEB6-BHoZ0_2C.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-BN4UsRVp.js → chunk-FMBD7UC4-BZppz6s9.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-H_f-EJCZ.js → chunk-JSJVCQXG-BKJIycjQ.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-BPjizgwa.js → chunk-KX2RTZJC-Drv6rL3f.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-DgeG5isU.js → chunk-NQ4KR5QH-u1ws00gN.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-CJXZCDFY.js → chunk-QZHKN3VN-zCyNaZcO.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-DXPbG5r8.js → chunk-WL4C6EOR-Dz0hDBUx.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-Kgg-J05j.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-Kgg-J05j.js +1 -0
- package/dashboard/dist/assets/clone-DXxPBQmb.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-B0S22TLu.js → cose-bilkent-S5V4N54A-CO0Ms-ys.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-iW797T4v.js → dagre-KLK3FWXG-BDBGlQ5i.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-zXYLlqYa.js → diagram-E7M64L7V-C1jhhA3a.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-BDdMdE2u.js → diagram-IFDJBPK2-DYA2G930.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-CwqwK1lQ.js → diagram-P4PSJMXO-iox20fhC.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-CmlGISPx.js → erDiagram-INFDFZHY-CdrG4ZUW.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-BAxunYoQ.js → flowDiagram-PKNHOUZH-CMuagI-6.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-Cn4q3HyV.js → ganttDiagram-A5KZAMGK-C8jgdfRO.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-Dazu58q1.js → gitGraphDiagram-K3NZZRJ6-Chu0FgBt.js} +1 -1
- package/dashboard/dist/assets/{graph-BBx_Y0Dm.js → graph-RWP7g4cL.js} +1 -1
- package/dashboard/dist/assets/index-BFpKR1Z0.js +690 -0
- package/dashboard/dist/assets/{index-BetqH_3H.css → index-C6KBRx3q.css} +1 -1
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-C27nHoRd.js → infoDiagram-LFFYTUFH-bIlmxe7x.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-DYxpNPld.js → ishikawaDiagram-PHBUUO56-CvvXAmzr.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-Dm0g2SlP.js → journeyDiagram-4ABVD52K-BlSVnlQk.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-DFMR1cb5.js → kanban-definition-K7BYSVSG-D6kAus7L.js} +1 -1
- package/dashboard/dist/assets/{layout-lF_n-m9p.js → layout-BIoVL4m2.js} +1 -1
- package/dashboard/dist/assets/{linear-D3fOfDjk.js → linear-B4ySyXON.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-BQxxvCJY.js → mermaid.core-B_8IjgQO.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-BD31M5_l.js → mindmap-definition-YRQLILUH-B6RTS8xi.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-C2RHC4j8.js → pieDiagram-SKSYHLDU-EntB8Xmg.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-BuzGUAFP.js → quadrantDiagram-337W2JSQ-UTEbe4g6.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-BfbKujmv.js → requirementDiagram-Z7DCOOCP-qG2oV68i.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-BeHTatTO.js → sankeyDiagram-WA2Y5GQK-C-EzJpn8.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-D0iiDmN4.js → sequenceDiagram-2WXFIKYE-rCjfcAr5.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-DT9Q9hP4.js → stateDiagram-RAJIS63D-C3hoQmLC.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-rHFeeHzp.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-DJiIMZoa.js → timeline-definition-YZTLITO2-2gGWKHHW.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-DmEMf93k.js → treemap-KZPCXAKY-BV6TTFvC.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-Curdpkhp.js → vennDiagram-LZ73GAT5-C1aeXQ29.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-BXin4AvW.js → xychartDiagram-JWTSCODW-BDbba6Mg.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/dashboard/server.js +845 -147
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +1290 -547
- package/dist/index.js.map +1 -1
- package/dist/launch/index.d.ts +41 -0
- package/dist/launch/index.js +200 -21
- package/dist/launch/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
- package/platforms/codex/.codex-plugin/plugin.json +1 -1
- package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
- package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
- package/dashboard/dist/assets/channel-DGGrKtvR.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-O5pXkiFS.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-O5pXkiFS.js +0 -1
- package/dashboard/dist/assets/clone-DjMP6PdW.js +0 -1
- package/dashboard/dist/assets/index-D9z0k09w.js +0 -675
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-dTCQtscr.js +0 -1
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
var wM=Object.defineProperty;var jM=(e,t,n)=>t in e?wM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Yx=(e,t,n)=>jM(e,typeof t!="symbol"?t+"":t,n);function kM(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function Dd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function vce(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Xx={exports:{}},bu={},Qx={exports:{}},Et={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var S1;function NM(){if(S1)return Et;S1=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.iterator;function g(F){return F===null||typeof F!="object"?null:(F=h&&F[h]||F["@@iterator"],typeof F=="function"?F:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,v={};function b(F,Y,H){this.props=F,this.context=Y,this.refs=v,this.updater=H||y}b.prototype.isReactComponent={},b.prototype.setState=function(F,Y){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,Y,"setState")},b.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function w(){}w.prototype=b.prototype;function S(F,Y,H){this.props=F,this.context=Y,this.refs=v,this.updater=H||y}var N=S.prototype=new w;N.constructor=S,k(N,b.prototype),N.isPureReactComponent=!0;var C=Array.isArray,R=Object.prototype.hasOwnProperty,T={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function I(F,Y,H){var Q,J={},Z=null,oe=null;if(Y!=null)for(Q in Y.ref!==void 0&&(oe=Y.ref),Y.key!==void 0&&(Z=""+Y.key),Y)R.call(Y,Q)&&!A.hasOwnProperty(Q)&&(J[Q]=Y[Q]);var te=arguments.length-2;if(te===1)J.children=H;else if(1<te){for(var ue=Array(te),ge=0;ge<te;ge++)ue[ge]=arguments[ge+2];J.children=ue}if(F&&F.defaultProps)for(Q in te=F.defaultProps,te)J[Q]===void 0&&(J[Q]=te[Q]);return{$$typeof:e,type:F,key:Z,ref:oe,props:J,_owner:T.current}}function _(F,Y){return{$$typeof:e,type:F.type,key:Y,ref:F.ref,props:F.props,_owner:F._owner}}function z(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function O(F){var Y={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(H){return Y[H]})}var B=/\/+/g;function V(F,Y){return typeof F=="object"&&F!==null&&F.key!=null?O(""+F.key):Y.toString(36)}function $(F,Y,H,Q,J){var Z=typeof F;(Z==="undefined"||Z==="boolean")&&(F=null);var oe=!1;if(F===null)oe=!0;else switch(Z){case"string":case"number":oe=!0;break;case"object":switch(F.$$typeof){case e:case t:oe=!0}}if(oe)return oe=F,J=J(oe),F=Q===""?"."+V(oe,0):Q,C(J)?(H="",F!=null&&(H=F.replace(B,"$&/")+"/"),$(J,Y,H,"",function(ge){return ge})):J!=null&&(z(J)&&(J=_(J,H+(!J.key||oe&&oe.key===J.key?"":(""+J.key).replace(B,"$&/")+"/")+F)),Y.push(J)),1;if(oe=0,Q=Q===""?".":Q+":",C(F))for(var te=0;te<F.length;te++){Z=F[te];var ue=Q+V(Z,te);oe+=$(Z,Y,H,ue,J)}else if(ue=g(F),typeof ue=="function")for(F=ue.call(F),te=0;!(Z=F.next()).done;)Z=Z.value,ue=Q+V(Z,te++),oe+=$(Z,Y,H,ue,J);else if(Z==="object")throw Y=String(F),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return oe}function L(F,Y,H){if(F==null)return F;var Q=[],J=0;return $(F,Q,"","",function(Z){return Y.call(H,Z,J++)}),Q}function U(F){if(F._status===-1){var Y=F._result;Y=Y(),Y.then(function(H){(F._status===0||F._status===-1)&&(F._status=1,F._result=H)},function(H){(F._status===0||F._status===-1)&&(F._status=2,F._result=H)}),F._status===-1&&(F._status=0,F._result=Y)}if(F._status===1)return F._result.default;throw F._result}var K={current:null},D={transition:null},W={ReactCurrentDispatcher:K,ReactCurrentBatchConfig:D,ReactCurrentOwner:T};function M(){throw Error("act(...) is not supported in production builds of React.")}return Et.Children={map:L,forEach:function(F,Y,H){L(F,function(){Y.apply(this,arguments)},H)},count:function(F){var Y=0;return L(F,function(){Y++}),Y},toArray:function(F){return L(F,function(Y){return Y})||[]},only:function(F){if(!z(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},Et.Component=b,Et.Fragment=n,Et.Profiler=o,Et.PureComponent=S,Et.StrictMode=r,Et.Suspense=u,Et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,Et.act=M,Et.cloneElement=function(F,Y,H){if(F==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+F+".");var Q=k({},F.props),J=F.key,Z=F.ref,oe=F._owner;if(Y!=null){if(Y.ref!==void 0&&(Z=Y.ref,oe=T.current),Y.key!==void 0&&(J=""+Y.key),F.type&&F.type.defaultProps)var te=F.type.defaultProps;for(ue in Y)R.call(Y,ue)&&!A.hasOwnProperty(ue)&&(Q[ue]=Y[ue]===void 0&&te!==void 0?te[ue]:Y[ue])}var ue=arguments.length-2;if(ue===1)Q.children=H;else if(1<ue){te=Array(ue);for(var ge=0;ge<ue;ge++)te[ge]=arguments[ge+2];Q.children=te}return{$$typeof:e,type:F.type,key:J,ref:Z,props:Q,_owner:oe}},Et.createContext=function(F){return F={$$typeof:a,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},F.Provider={$$typeof:i,_context:F},F.Consumer=F},Et.createElement=I,Et.createFactory=function(F){var Y=I.bind(null,F);return Y.type=F,Y},Et.createRef=function(){return{current:null}},Et.forwardRef=function(F){return{$$typeof:l,render:F}},Et.isValidElement=z,Et.lazy=function(F){return{$$typeof:p,_payload:{_status:-1,_result:F},_init:U}},Et.memo=function(F,Y){return{$$typeof:f,type:F,compare:Y===void 0?null:Y}},Et.startTransition=function(F){var Y=D.transition;D.transition={};try{F()}finally{D.transition=Y}},Et.unstable_act=M,Et.useCallback=function(F,Y){return K.current.useCallback(F,Y)},Et.useContext=function(F){return K.current.useContext(F)},Et.useDebugValue=function(){},Et.useDeferredValue=function(F){return K.current.useDeferredValue(F)},Et.useEffect=function(F,Y){return K.current.useEffect(F,Y)},Et.useId=function(){return K.current.useId()},Et.useImperativeHandle=function(F,Y,H){return K.current.useImperativeHandle(F,Y,H)},Et.useInsertionEffect=function(F,Y){return K.current.useInsertionEffect(F,Y)},Et.useLayoutEffect=function(F,Y){return K.current.useLayoutEffect(F,Y)},Et.useMemo=function(F,Y){return K.current.useMemo(F,Y)},Et.useReducer=function(F,Y,H){return K.current.useReducer(F,Y,H)},Et.useRef=function(F){return K.current.useRef(F)},Et.useState=function(F){return K.current.useState(F)},Et.useSyncExternalStore=function(F,Y,H){return K.current.useSyncExternalStore(F,Y,H)},Et.useTransition=function(){return K.current.useTransition()},Et.version="18.3.1",Et}var C1;function $d(){return C1||(C1=1,Qx.exports=NM()),Qx.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var E1;function SM(){if(E1)return bu;E1=1;var e=$d(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(l,u,f){var p,h={},g=null,y=null;f!==void 0&&(g=""+f),u.key!==void 0&&(g=""+u.key),u.ref!==void 0&&(y=u.ref);for(p in u)r.call(u,p)&&!i.hasOwnProperty(p)&&(h[p]=u[p]);if(l&&l.defaultProps)for(p in u=l.defaultProps,u)h[p]===void 0&&(h[p]=u[p]);return{$$typeof:t,type:l,key:g,ref:y,props:h,_owner:o.current}}return bu.Fragment=n,bu.jsx=a,bu.jsxs=a,bu}var T1;function CM(){return T1||(T1=1,Xx.exports=SM()),Xx.exports}var s=CM(),m=$d();const Ot=Dd(m),s2=kM({__proto__:null,default:Ot},[m]);var ap={},Jx={exports:{}},gr={},Zx={exports:{}},ey={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var R1;function EM(){return R1||(R1=1,(function(e){function t(D,W){var M=D.length;D.push(W);e:for(;0<M;){var F=M-1>>>1,Y=D[F];if(0<o(Y,W))D[F]=W,D[M]=Y,M=F;else break e}}function n(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var W=D[0],M=D.pop();if(M!==W){D[0]=M;e:for(var F=0,Y=D.length,H=Y>>>1;F<H;){var Q=2*(F+1)-1,J=D[Q],Z=Q+1,oe=D[Z];if(0>o(J,M))Z<Y&&0>o(oe,J)?(D[F]=oe,D[Z]=M,F=Z):(D[F]=J,D[Q]=M,F=Q);else if(Z<Y&&0>o(oe,M))D[F]=oe,D[Z]=M,F=Z;else break e}}return W}function o(D,W){var M=D.sortIndex-W.sortIndex;return M!==0?M:D.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var u=[],f=[],p=1,h=null,g=3,y=!1,k=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(D){for(var W=n(f);W!==null;){if(W.callback===null)r(f);else if(W.startTime<=D)r(f),W.sortIndex=W.expirationTime,t(u,W);else break;W=n(f)}}function C(D){if(v=!1,N(D),!k)if(n(u)!==null)k=!0,U(R);else{var W=n(f);W!==null&&K(C,W.startTime-D)}}function R(D,W){k=!1,v&&(v=!1,w(I),I=-1),y=!0;var M=g;try{for(N(W),h=n(u);h!==null&&(!(h.expirationTime>W)||D&&!O());){var F=h.callback;if(typeof F=="function"){h.callback=null,g=h.priorityLevel;var Y=F(h.expirationTime<=W);W=e.unstable_now(),typeof Y=="function"?h.callback=Y:h===n(u)&&r(u),N(W)}else r(u);h=n(u)}if(h!==null)var H=!0;else{var Q=n(f);Q!==null&&K(C,Q.startTime-W),H=!1}return H}finally{h=null,g=M,y=!1}}var T=!1,A=null,I=-1,_=5,z=-1;function O(){return!(e.unstable_now()-z<_)}function B(){if(A!==null){var D=e.unstable_now();z=D;var W=!0;try{W=A(!0,D)}finally{W?V():(T=!1,A=null)}}else T=!1}var V;if(typeof S=="function")V=function(){S(B)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,L=$.port2;$.port1.onmessage=B,V=function(){L.postMessage(null)}}else V=function(){b(B,0)};function U(D){A=D,T||(T=!0,V())}function K(D,W){I=b(function(){D(e.unstable_now())},W)}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(D){D.callback=null},e.unstable_continueExecution=function(){k||y||(k=!0,U(R))},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(D){switch(g){case 1:case 2:case 3:var W=3;break;default:W=g}var M=g;g=W;try{return D()}finally{g=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(D,W){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var M=g;g=D;try{return W()}finally{g=M}},e.unstable_scheduleCallback=function(D,W,M){var F=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?F+M:F):M=F,D){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=M+Y,D={id:p++,callback:W,priorityLevel:D,startTime:M,expirationTime:Y,sortIndex:-1},M>F?(D.sortIndex=M,t(f,D),n(u)===null&&D===n(f)&&(v?(w(I),I=-1):v=!0,K(C,M-F))):(D.sortIndex=Y,t(u,D),k||y||(k=!0,U(R))),D},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(D){var W=g;return function(){var M=g;g=W;try{return D.apply(this,arguments)}finally{g=M}}}})(ey)),ey}var A1;function TM(){return A1||(A1=1,Zx.exports=EM()),Zx.exports}/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var P1;function RM(){if(P1)return gr;P1=1;var e=$d(),t=TM();function n(c){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+c,x=1;x<arguments.length;x++)d+="&args[]="+encodeURIComponent(arguments[x]);return"Minified React error #"+c+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,o={};function i(c,d){a(c,d),a(c+"Capture",d)}function a(c,d){for(o[c]=d,c=0;c<d.length;c++)r.add(d[c])}var l=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,f=/^[: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]*$/,p={},h={};function g(c){return u.call(h,c)?!0:u.call(p,c)?!1:f.test(c)?h[c]=!0:(p[c]=!0,!1)}function y(c,d,x,j){if(x!==null&&x.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return j?!1:x!==null?!x.acceptsBooleans:(c=c.toLowerCase().slice(0,5),c!=="data-"&&c!=="aria-");default:return!1}}function k(c,d,x,j){if(d===null||typeof d>"u"||y(c,d,x,j))return!0;if(j)return!1;if(x!==null)switch(x.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function v(c,d,x,j,E,P,G){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=j,this.attributeNamespace=E,this.mustUseProperty=x,this.propertyName=c,this.type=d,this.sanitizeURL=P,this.removeEmptyString=G}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(c){b[c]=new v(c,0,!1,c,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(c){var d=c[0];b[d]=new v(d,1,!1,c[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(c){b[c]=new v(c,2,!1,c.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(c){b[c]=new v(c,2,!1,c,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(c){b[c]=new v(c,3,!1,c.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(c){b[c]=new v(c,3,!0,c,null,!1,!1)}),["capture","download"].forEach(function(c){b[c]=new v(c,4,!1,c,null,!1,!1)}),["cols","rows","size","span"].forEach(function(c){b[c]=new v(c,6,!1,c,null,!1,!1)}),["rowSpan","start"].forEach(function(c){b[c]=new v(c,5,!1,c.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function S(c){return c[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(c){var d=c.replace(w,S);b[d]=new v(d,1,!1,c,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(c){var d=c.replace(w,S);b[d]=new v(d,1,!1,c,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(c){var d=c.replace(w,S);b[d]=new v(d,1,!1,c,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(c){b[c]=new v(c,1,!1,c.toLowerCase(),null,!1,!1)}),b.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(c){b[c]=new v(c,1,!1,c.toLowerCase(),null,!0,!0)});function N(c,d,x,j){var E=b.hasOwnProperty(d)?b[d]:null;(E!==null?E.type!==0:j||!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(k(d,x,E,j)&&(x=null),j||E===null?g(d)&&(x===null?c.removeAttribute(d):c.setAttribute(d,""+x)):E.mustUseProperty?c[E.propertyName]=x===null?E.type===3?!1:"":x:(d=E.attributeName,j=E.attributeNamespace,x===null?c.removeAttribute(d):(E=E.type,x=E===3||E===4&&x===!0?"":""+x,j?c.setAttributeNS(j,d,x):c.setAttribute(d,x))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,R=Symbol.for("react.element"),T=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),O=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),K=Symbol.for("react.offscreen"),D=Symbol.iterator;function W(c){return c===null||typeof c!="object"?null:(c=D&&c[D]||c["@@iterator"],typeof c=="function"?c:null)}var M=Object.assign,F;function Y(c){if(F===void 0)try{throw Error()}catch(x){var d=x.stack.trim().match(/\n( *(at )?)/);F=d&&d[1]||""}return`
|
|
34
|
+
`+F+c}var H=!1;function Q(c,d){if(!c||H)return"";H=!0;var x=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(d)if(d=function(){throw Error()},Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(he){var j=he}Reflect.construct(c,[],d)}else{try{d.call()}catch(he){j=he}c.call(d.prototype)}else{try{throw Error()}catch(he){j=he}c()}}catch(he){if(he&&j&&typeof he.stack=="string"){for(var E=he.stack.split(`
|
|
35
|
+
`),P=j.stack.split(`
|
|
36
|
+
`),G=E.length-1,ee=P.length-1;1<=G&&0<=ee&&E[G]!==P[ee];)ee--;for(;1<=G&&0<=ee;G--,ee--)if(E[G]!==P[ee]){if(G!==1||ee!==1)do if(G--,ee--,0>ee||E[G]!==P[ee]){var se=`
|
|
37
|
+
`+E[G].replace(" at new "," at ");return c.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",c.displayName)),se}while(1<=G&&0<=ee);break}}}finally{H=!1,Error.prepareStackTrace=x}return(c=c?c.displayName||c.name:"")?Y(c):""}function J(c){switch(c.tag){case 5:return Y(c.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return c=Q(c.type,!1),c;case 11:return c=Q(c.type.render,!1),c;case 1:return c=Q(c.type,!0),c;default:return""}}function Z(c){if(c==null)return null;if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case A:return"Fragment";case T:return"Portal";case _:return"Profiler";case I:return"StrictMode";case V:return"Suspense";case $:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case O:return(c.displayName||"Context")+".Consumer";case z:return(c._context.displayName||"Context")+".Provider";case B:var d=c.render;return c=c.displayName,c||(c=d.displayName||d.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case L:return d=c.displayName||null,d!==null?d:Z(c.type)||"Memo";case U:d=c._payload,c=c._init;try{return Z(c(d))}catch{}}return null}function oe(c){var d=c.type;switch(c.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return c=d.render,c=c.displayName||c.name||"",d.displayName||(c!==""?"ForwardRef("+c+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Z(d);case 8:return d===I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function te(c){switch(typeof c){case"boolean":case"number":case"string":case"undefined":return c;case"object":return c;default:return""}}function ue(c){var d=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function ge(c){var d=ue(c)?"checked":"value",x=Object.getOwnPropertyDescriptor(c.constructor.prototype,d),j=""+c[d];if(!c.hasOwnProperty(d)&&typeof x<"u"&&typeof x.get=="function"&&typeof x.set=="function"){var E=x.get,P=x.set;return Object.defineProperty(c,d,{configurable:!0,get:function(){return E.call(this)},set:function(G){j=""+G,P.call(this,G)}}),Object.defineProperty(c,d,{enumerable:x.enumerable}),{getValue:function(){return j},setValue:function(G){j=""+G},stopTracking:function(){c._valueTracker=null,delete c[d]}}}}function Ce(c){c._valueTracker||(c._valueTracker=ge(c))}function Se(c){if(!c)return!1;var d=c._valueTracker;if(!d)return!0;var x=d.getValue(),j="";return c&&(j=ue(c)?c.checked?"true":"false":c.value),c=j,c!==x?(d.setValue(c),!0):!1}function ke(c){if(c=c||(typeof document<"u"?document:void 0),typeof c>"u")return null;try{return c.activeElement||c.body}catch{return c.body}}function Be(c,d){var x=d.checked;return M({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:x??c._wrapperState.initialChecked})}function ie(c,d){var x=d.defaultValue==null?"":d.defaultValue,j=d.checked!=null?d.checked:d.defaultChecked;x=te(d.value!=null?d.value:x),c._wrapperState={initialChecked:j,initialValue:x,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function ve(c,d){d=d.checked,d!=null&&N(c,"checked",d,!1)}function ye(c,d){ve(c,d);var x=te(d.value),j=d.type;if(x!=null)j==="number"?(x===0&&c.value===""||c.value!=x)&&(c.value=""+x):c.value!==""+x&&(c.value=""+x);else if(j==="submit"||j==="reset"){c.removeAttribute("value");return}d.hasOwnProperty("value")?Ue(c,d.type,x):d.hasOwnProperty("defaultValue")&&Ue(c,d.type,te(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(c.defaultChecked=!!d.defaultChecked)}function Ae(c,d,x){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var j=d.type;if(!(j!=="submit"&&j!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+c._wrapperState.initialValue,x||d===c.value||(c.value=d),c.defaultValue=d}x=c.name,x!==""&&(c.name=""),c.defaultChecked=!!c._wrapperState.initialChecked,x!==""&&(c.name=x)}function Ue(c,d,x){(d!=="number"||ke(c.ownerDocument)!==c)&&(x==null?c.defaultValue=""+c._wrapperState.initialValue:c.defaultValue!==""+x&&(c.defaultValue=""+x))}var rt=Array.isArray;function Oe(c,d,x,j){if(c=c.options,d){d={};for(var E=0;E<x.length;E++)d["$"+x[E]]=!0;for(x=0;x<c.length;x++)E=d.hasOwnProperty("$"+c[x].value),c[x].selected!==E&&(c[x].selected=E),E&&j&&(c[x].defaultSelected=!0)}else{for(x=""+te(x),d=null,E=0;E<c.length;E++){if(c[E].value===x){c[E].selected=!0,j&&(c[E].defaultSelected=!0);return}d!==null||c[E].disabled||(d=c[E])}d!==null&&(d.selected=!0)}}function ot(c,d){if(d.dangerouslySetInnerHTML!=null)throw Error(n(91));return M({},d,{value:void 0,defaultValue:void 0,children:""+c._wrapperState.initialValue})}function St(c,d){var x=d.value;if(x==null){if(x=d.children,d=d.defaultValue,x!=null){if(d!=null)throw Error(n(92));if(rt(x)){if(1<x.length)throw Error(n(93));x=x[0]}d=x}d==null&&(d=""),x=d}c._wrapperState={initialValue:te(x)}}function ht(c,d){var x=te(d.value),j=te(d.defaultValue);x!=null&&(x=""+x,x!==c.value&&(c.value=x),d.defaultValue==null&&c.defaultValue!==x&&(c.defaultValue=x)),j!=null&&(c.defaultValue=""+j)}function it(c){var d=c.textContent;d===c._wrapperState.initialValue&&d!==""&&d!==null&&(c.value=d)}function ce(c){switch(c){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function me(c,d){return c==null||c==="http://www.w3.org/1999/xhtml"?ce(d):c==="http://www.w3.org/2000/svg"&&d==="foreignObject"?"http://www.w3.org/1999/xhtml":c}var Ie,Pe=(function(c){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(d,x,j,E){MSApp.execUnsafeLocalFunction(function(){return c(d,x,j,E)})}:c})(function(c,d){if(c.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in c)c.innerHTML=d;else{for(Ie=Ie||document.createElement("div"),Ie.innerHTML="<svg>"+d.valueOf().toString()+"</svg>",d=Ie.firstChild;c.firstChild;)c.removeChild(c.firstChild);for(;d.firstChild;)c.appendChild(d.firstChild)}});function We(c,d){if(d){var x=c.firstChild;if(x&&x===c.lastChild&&x.nodeType===3){x.nodeValue=d;return}}c.textContent=d}var pt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},De=["Webkit","ms","Moz","O"];Object.keys(pt).forEach(function(c){De.forEach(function(d){d=d+c.charAt(0).toUpperCase()+c.substring(1),pt[d]=pt[c]})});function Qe(c,d,x){return d==null||typeof d=="boolean"||d===""?"":x||typeof d!="number"||d===0||pt.hasOwnProperty(c)&&pt[c]?(""+d).trim():d+"px"}function Je(c,d){c=c.style;for(var x in d)if(d.hasOwnProperty(x)){var j=x.indexOf("--")===0,E=Qe(x,d[x],j);x==="float"&&(x="cssFloat"),j?c.setProperty(x,E):c[x]=E}}var ut=M({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fe(c,d){if(d){if(ut[c]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,c));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function q(c,d){if(c.indexOf("-")===-1)return typeof d.is=="string";switch(c){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 ne=null;function xe(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var qe=null,Fe=null,lt=null;function mt(c){if(c=su(c)){if(typeof qe!="function")throw Error(n(280));var d=c.stateNode;d&&(d=jf(d),qe(c.stateNode,c.type,d))}}function vt(c){Fe?lt?lt.push(c):lt=[c]:Fe=c}function nt(){if(Fe){var c=Fe,d=lt;if(lt=Fe=null,mt(c),d)for(c=0;c<d.length;c++)mt(d[c])}}function _t(c,d){return c(d)}function Bt(){}var Ut=!1;function An(c,d,x){if(Ut)return c(d,x);Ut=!0;try{return _t(c,d,x)}finally{Ut=!1,(Fe!==null||lt!==null)&&(Bt(),nt())}}function Ct(c,d){var x=c.stateNode;if(x===null)return null;var j=jf(x);if(j===null)return null;x=j[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(j=!j.disabled)||(c=c.type,j=!(c==="button"||c==="input"||c==="select"||c==="textarea")),c=!j;break e;default:c=!1}if(c)return null;if(x&&typeof x!="function")throw Error(n(231,d,typeof x));return x}var je=!1;if(l)try{var Ye={};Object.defineProperty(Ye,"passive",{get:function(){je=!0}}),window.addEventListener("test",Ye,Ye),window.removeEventListener("test",Ye,Ye)}catch{je=!1}function at(c,d,x,j,E,P,G,ee,se){var he=Array.prototype.slice.call(arguments,3);try{d.apply(x,he)}catch(Te){this.onError(Te)}}var Mt=!1,le=null,Ne=!1,et=null,Pn={onError:function(c){Mt=!0,le=c}};function Er(c,d,x,j,E,P,G,ee,se){Mt=!1,le=null,at.apply(Pn,arguments)}function lo(c,d,x,j,E,P,G,ee,se){if(Er.apply(this,arguments),Mt){if(Mt){var he=le;Mt=!1,le=null}else throw Error(n(198));Ne||(Ne=!0,et=he)}}function wt(c){var d=c,x=c;if(c.alternate)for(;d.return;)d=d.return;else{c=d;do d=c,(d.flags&4098)!==0&&(x=d.return),c=d.return;while(c)}return d.tag===3?x:null}function _i(c){if(c.tag===13){var d=c.memoizedState;if(d===null&&(c=c.alternate,c!==null&&(d=c.memoizedState)),d!==null)return d.dehydrated}return null}function Oo(c){if(wt(c)!==c)throw Error(n(188))}function Ma(c){var d=c.alternate;if(!d){if(d=wt(c),d===null)throw Error(n(188));return d!==c?null:c}for(var x=c,j=d;;){var E=x.return;if(E===null)break;var P=E.alternate;if(P===null){if(j=E.return,j!==null){x=j;continue}break}if(E.child===P.child){for(P=E.child;P;){if(P===x)return Oo(E),c;if(P===j)return Oo(E),d;P=P.sibling}throw Error(n(188))}if(x.return!==j.return)x=E,j=P;else{for(var G=!1,ee=E.child;ee;){if(ee===x){G=!0,x=E,j=P;break}if(ee===j){G=!0,j=E,x=P;break}ee=ee.sibling}if(!G){for(ee=P.child;ee;){if(ee===x){G=!0,x=P,j=E;break}if(ee===j){G=!0,j=P,x=E;break}ee=ee.sibling}if(!G)throw Error(n(189))}}if(x.alternate!==j)throw Error(n(190))}if(x.tag!==3)throw Error(n(188));return x.stateNode.current===x?c:d}function nn(c){return c=Ma(c),c!==null?Fo(c):null}function Fo(c){if(c.tag===5||c.tag===6)return c;for(c=c.child;c!==null;){var d=Fo(c);if(d!==null)return d;c=c.sibling}return null}var La=t.unstable_scheduleCallback,Oa=t.unstable_cancelCallback,Bc=t.unstable_shouldYield,Fa=t.unstable_requestPaint,Ht=t.unstable_now,Di=t.unstable_getCurrentPriorityLevel,co=t.unstable_ImmediatePriority,zo=t.unstable_UserBlockingPriority,Ds=t.unstable_NormalPriority,Bo=t.unstable_LowPriority,za=t.unstable_IdlePriority,Uo=null,ir=null;function ur(c){if(ir&&typeof ir.onCommitFiberRoot=="function")try{ir.onCommitFiberRoot(Uo,c,void 0,(c.current.flags&128)===128)}catch{}}var Fn=Math.clz32?Math.clz32:Hc,Ho=Math.log,Uc=Math.LN2;function Hc(c){return c>>>=0,c===0?32:31-(Ho(c)/Uc|0)|0}var Vo=64,Kn=4194304;function uo(c){switch(c&-c){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: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 c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function Vr(c,d){var x=c.pendingLanes;if(x===0)return 0;var j=0,E=c.suspendedLanes,P=c.pingedLanes,G=x&268435455;if(G!==0){var ee=G&~E;ee!==0?j=uo(ee):(P&=G,P!==0&&(j=uo(P)))}else G=x&~E,G!==0?j=uo(G):P!==0&&(j=uo(P));if(j===0)return 0;if(d!==0&&d!==j&&(d&E)===0&&(E=j&-j,P=d&-d,E>=P||E===16&&(P&4194240)!==0))return d;if((j&4)!==0&&(j|=x&16),d=c.entangledLanes,d!==0)for(c=c.entanglements,d&=j;0<d;)x=31-Fn(d),E=1<<x,j|=c[x],d&=~E;return j}function Ba(c,d){switch(c){case 1:case 2:case 4:return d+250;case 8:case 16:case 32:case 64: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 d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function $i(c,d){for(var x=c.suspendedLanes,j=c.pingedLanes,E=c.expirationTimes,P=c.pendingLanes;0<P;){var G=31-Fn(P),ee=1<<G,se=E[G];se===-1?((ee&x)===0||(ee&j)!==0)&&(E[G]=Ba(ee,d)):se<=d&&(c.expiredLanes|=ee),P&=~ee}}function Wo(c){return c=c.pendingLanes&-1073741825,c!==0?c:c&1073741824?1073741824:0}function Ko(){var c=Vo;return Vo<<=1,(Vo&4194240)===0&&(Vo=64),c}function $s(c){for(var d=[],x=0;31>x;x++)d.push(c);return d}function zn(c,d,x){c.pendingLanes|=d,d!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,d=31-Fn(d),c[d]=x}function _n(c,d){var x=c.pendingLanes&~d;c.pendingLanes=d,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=d,c.mutableReadLanes&=d,c.entangledLanes&=d,d=c.entanglements;var j=c.eventTimes;for(c=c.expirationTimes;0<x;){var E=31-Fn(x),P=1<<E;d[E]=0,j[E]=-1,c[E]=-1,x&=~P}}function Is(c,d){var x=c.entangledLanes|=d;for(c=c.entanglements;x;){var j=31-Fn(x),E=1<<j;E&d|c[j]&d&&(c[j]|=d),x&=~E}}var Ft=0;function uf(c){return c&=-c,1<c?4<c?(c&268435455)!==0?16:536870912:4:1}var Vc,Ii,Wc,fo,Kc,Mi=!1,Ua=[],Ms=null,pn=null,Ls=null,po=new Map,Li=new Map,Os=[],jg="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 submit".split(" ");function Fs(c,d){switch(c){case"focusin":case"focusout":Ms=null;break;case"dragenter":case"dragleave":pn=null;break;case"mouseover":case"mouseout":Ls=null;break;case"pointerover":case"pointerout":po.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":Li.delete(d.pointerId)}}function X(c,d,x,j,E,P){return c===null||c.nativeEvent!==P?(c={blockedOn:d,domEventName:x,eventSystemFlags:j,nativeEvent:P,targetContainers:[E]},d!==null&&(d=su(d),d!==null&&Ii(d)),c):(c.eventSystemFlags|=j,d=c.targetContainers,E!==null&&d.indexOf(E)===-1&&d.push(E),c)}function re(c,d,x,j,E){switch(d){case"focusin":return Ms=X(Ms,c,d,x,j,E),!0;case"dragenter":return pn=X(pn,c,d,x,j,E),!0;case"mouseover":return Ls=X(Ls,c,d,x,j,E),!0;case"pointerover":var P=E.pointerId;return po.set(P,X(po.get(P)||null,c,d,x,j,E)),!0;case"gotpointercapture":return P=E.pointerId,Li.set(P,X(Li.get(P)||null,c,d,x,j,E)),!0}return!1}function we(c){var d=Oi(c.target);if(d!==null){var x=wt(d);if(x!==null){if(d=x.tag,d===13){if(d=_i(x),d!==null){c.blockedOn=d,Kc(c.priority,function(){Wc(x)});return}}else if(d===3&&x.stateNode.current.memoizedState.isDehydrated){c.blockedOn=x.tag===3?x.stateNode.containerInfo:null;return}}}c.blockedOn=null}function ze(c){if(c.blockedOn!==null)return!1;for(var d=c.targetContainers;0<d.length;){var x=Wr(c.domEventName,c.eventSystemFlags,d[0],c.nativeEvent);if(x===null){x=c.nativeEvent;var j=new x.constructor(x.type,x);ne=j,x.target.dispatchEvent(j),ne=null}else return d=su(x),d!==null&&Ii(d),c.blockedOn=x,!1;d.shift()}return!0}function yt(c,d,x){ze(c)&&x.delete(d)}function Dt(){Mi=!1,Ms!==null&&ze(Ms)&&(Ms=null),pn!==null&&ze(pn)&&(pn=null),Ls!==null&&ze(Ls)&&(Ls=null),po.forEach(yt),Li.forEach(yt)}function $t(c,d){c.blockedOn===d&&(c.blockedOn=null,Mi||(Mi=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Dt)))}function Bn(c){function d(E){return $t(E,c)}if(0<Ua.length){$t(Ua[0],c);for(var x=1;x<Ua.length;x++){var j=Ua[x];j.blockedOn===c&&(j.blockedOn=null)}}for(Ms!==null&&$t(Ms,c),pn!==null&&$t(pn,c),Ls!==null&&$t(Ls,c),po.forEach(d),Li.forEach(d),x=0;x<Os.length;x++)j=Os[x],j.blockedOn===c&&(j.blockedOn=null);for(;0<Os.length&&(x=Os[0],x.blockedOn===null);)we(x),x.blockedOn===null&&Os.shift()}var yn=C.ReactCurrentBatchConfig,hn=!0;function Tr(c,d,x,j){var E=Ft,P=yn.transition;yn.transition=null;try{Ft=1,Va(c,d,x,j)}finally{Ft=E,yn.transition=P}}function Ha(c,d,x,j){var E=Ft,P=yn.transition;yn.transition=null;try{Ft=4,Va(c,d,x,j)}finally{Ft=E,yn.transition=P}}function Va(c,d,x,j){if(hn){var E=Wr(c,d,x,j);if(E===null)Fg(c,d,j,ho,x),Fs(c,j);else if(re(E,c,d,x,j))j.stopPropagation();else if(Fs(c,j),d&4&&-1<jg.indexOf(c)){for(;E!==null;){var P=su(E);if(P!==null&&Vc(P),P=Wr(c,d,x,j),P===null&&Fg(c,d,j,ho,x),P===E)break;E=P}E!==null&&j.stopPropagation()}else Fg(c,d,j,null,x)}}var ho=null;function Wr(c,d,x,j){if(ho=null,c=xe(j),c=Oi(c),c!==null)if(d=wt(c),d===null)c=null;else if(x=d.tag,x===13){if(c=_i(d),c!==null)return c;c=null}else if(x===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;c=null}else d!==c&&(c=null);return ho=c,null}function dj(c){switch(c){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Di()){case co:return 1;case zo:return 4;case Ds:case Bo:return 16;case za:return 536870912;default:return 16}default:return 16}}var qo=null,kg=null,df=null;function fj(){if(df)return df;var c,d=kg,x=d.length,j,E="value"in qo?qo.value:qo.textContent,P=E.length;for(c=0;c<x&&d[c]===E[c];c++);var G=x-c;for(j=1;j<=G&&d[x-j]===E[P-j];j++);return df=E.slice(c,1<j?1-j:void 0)}function ff(c){var d=c.keyCode;return"charCode"in c?(c=c.charCode,c===0&&d===13&&(c=13)):c=d,c===10&&(c=13),32<=c||c===13?c:0}function pf(){return!0}function pj(){return!1}function Rr(c){function d(x,j,E,P,G){this._reactName=x,this._targetInst=E,this.type=j,this.nativeEvent=P,this.target=G,this.currentTarget=null;for(var ee in c)c.hasOwnProperty(ee)&&(x=c[ee],this[ee]=x?x(P):P[ee]);return this.isDefaultPrevented=(P.defaultPrevented!=null?P.defaultPrevented:P.returnValue===!1)?pf:pj,this.isPropagationStopped=pj,this}return M(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var x=this.nativeEvent;x&&(x.preventDefault?x.preventDefault():typeof x.returnValue!="unknown"&&(x.returnValue=!1),this.isDefaultPrevented=pf)},stopPropagation:function(){var x=this.nativeEvent;x&&(x.stopPropagation?x.stopPropagation():typeof x.cancelBubble!="unknown"&&(x.cancelBubble=!0),this.isPropagationStopped=pf)},persist:function(){},isPersistent:pf}),d}var Wa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ng=Rr(Wa),qc=M({},Wa,{view:0,detail:0}),G$=Rr(qc),Sg,Cg,Gc,hf=M({},qc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tg,button:0,buttons:0,relatedTarget:function(c){return c.relatedTarget===void 0?c.fromElement===c.srcElement?c.toElement:c.fromElement:c.relatedTarget},movementX:function(c){return"movementX"in c?c.movementX:(c!==Gc&&(Gc&&c.type==="mousemove"?(Sg=c.screenX-Gc.screenX,Cg=c.screenY-Gc.screenY):Cg=Sg=0,Gc=c),Sg)},movementY:function(c){return"movementY"in c?c.movementY:Cg}}),hj=Rr(hf),Y$=M({},hf,{dataTransfer:0}),X$=Rr(Y$),Q$=M({},qc,{relatedTarget:0}),Eg=Rr(Q$),J$=M({},Wa,{animationName:0,elapsedTime:0,pseudoElement:0}),Z$=Rr(J$),eI=M({},Wa,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),tI=Rr(eI),nI=M({},Wa,{data:0}),mj=Rr(nI),rI={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sI={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"},oI={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function iI(c){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(c):(c=oI[c])?!!d[c]:!1}function Tg(){return iI}var aI=M({},qc,{key:function(c){if(c.key){var d=rI[c.key]||c.key;if(d!=="Unidentified")return d}return c.type==="keypress"?(c=ff(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?sI[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tg,charCode:function(c){return c.type==="keypress"?ff(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?ff(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),lI=Rr(aI),cI=M({},hf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gj=Rr(cI),uI=M({},qc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tg}),dI=Rr(uI),fI=M({},Wa,{propertyName:0,elapsedTime:0,pseudoElement:0}),pI=Rr(fI),hI=M({},hf,{deltaX:function(c){return"deltaX"in c?c.deltaX:"wheelDeltaX"in c?-c.wheelDeltaX:0},deltaY:function(c){return"deltaY"in c?c.deltaY:"wheelDeltaY"in c?-c.wheelDeltaY:"wheelDelta"in c?-c.wheelDelta:0},deltaZ:0,deltaMode:0}),mI=Rr(hI),gI=[9,13,27,32],Rg=l&&"CompositionEvent"in window,Yc=null;l&&"documentMode"in document&&(Yc=document.documentMode);var xI=l&&"TextEvent"in window&&!Yc,xj=l&&(!Rg||Yc&&8<Yc&&11>=Yc),yj=" ",bj=!1;function vj(c,d){switch(c){case"keyup":return gI.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wj(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var Ka=!1;function yI(c,d){switch(c){case"compositionend":return wj(d);case"keypress":return d.which!==32?null:(bj=!0,yj);case"textInput":return c=d.data,c===yj&&bj?null:c;default:return null}}function bI(c,d){if(Ka)return c==="compositionend"||!Rg&&vj(c,d)?(c=fj(),df=kg=qo=null,Ka=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return xj&&d.locale!=="ko"?null:d.data;default:return null}}var vI={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 jj(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d==="input"?!!vI[c.type]:d==="textarea"}function kj(c,d,x,j){vt(j),d=bf(d,"onChange"),0<d.length&&(x=new Ng("onChange","change",null,x,j),c.push({event:x,listeners:d}))}var Xc=null,Qc=null;function wI(c){Bj(c,0)}function mf(c){var d=Qa(c);if(Se(d))return c}function jI(c,d){if(c==="change")return d}var Nj=!1;if(l){var Ag;if(l){var Pg="oninput"in document;if(!Pg){var Sj=document.createElement("div");Sj.setAttribute("oninput","return;"),Pg=typeof Sj.oninput=="function"}Ag=Pg}else Ag=!1;Nj=Ag&&(!document.documentMode||9<document.documentMode)}function Cj(){Xc&&(Xc.detachEvent("onpropertychange",Ej),Qc=Xc=null)}function Ej(c){if(c.propertyName==="value"&&mf(Qc)){var d=[];kj(d,Qc,c,xe(c)),An(wI,d)}}function kI(c,d,x){c==="focusin"?(Cj(),Xc=d,Qc=x,Xc.attachEvent("onpropertychange",Ej)):c==="focusout"&&Cj()}function NI(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return mf(Qc)}function SI(c,d){if(c==="click")return mf(d)}function CI(c,d){if(c==="input"||c==="change")return mf(d)}function EI(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var as=typeof Object.is=="function"?Object.is:EI;function Jc(c,d){if(as(c,d))return!0;if(typeof c!="object"||c===null||typeof d!="object"||d===null)return!1;var x=Object.keys(c),j=Object.keys(d);if(x.length!==j.length)return!1;for(j=0;j<x.length;j++){var E=x[j];if(!u.call(d,E)||!as(c[E],d[E]))return!1}return!0}function Tj(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function Rj(c,d){var x=Tj(c);c=0;for(var j;x;){if(x.nodeType===3){if(j=c+x.textContent.length,c<=d&&j>=d)return{node:x,offset:d-c};c=j}e:{for(;x;){if(x.nextSibling){x=x.nextSibling;break e}x=x.parentNode}x=void 0}x=Tj(x)}}function Aj(c,d){return c&&d?c===d?!0:c&&c.nodeType===3?!1:d&&d.nodeType===3?Aj(c,d.parentNode):"contains"in c?c.contains(d):c.compareDocumentPosition?!!(c.compareDocumentPosition(d)&16):!1:!1}function Pj(){for(var c=window,d=ke();d instanceof c.HTMLIFrameElement;){try{var x=typeof d.contentWindow.location.href=="string"}catch{x=!1}if(x)c=d.contentWindow;else break;d=ke(c.document)}return d}function _g(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d&&(d==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||d==="textarea"||c.contentEditable==="true")}function TI(c){var d=Pj(),x=c.focusedElem,j=c.selectionRange;if(d!==x&&x&&x.ownerDocument&&Aj(x.ownerDocument.documentElement,x)){if(j!==null&&_g(x)){if(d=j.start,c=j.end,c===void 0&&(c=d),"selectionStart"in x)x.selectionStart=d,x.selectionEnd=Math.min(c,x.value.length);else if(c=(d=x.ownerDocument||document)&&d.defaultView||window,c.getSelection){c=c.getSelection();var E=x.textContent.length,P=Math.min(j.start,E);j=j.end===void 0?P:Math.min(j.end,E),!c.extend&&P>j&&(E=j,j=P,P=E),E=Rj(x,P);var G=Rj(x,j);E&&G&&(c.rangeCount!==1||c.anchorNode!==E.node||c.anchorOffset!==E.offset||c.focusNode!==G.node||c.focusOffset!==G.offset)&&(d=d.createRange(),d.setStart(E.node,E.offset),c.removeAllRanges(),P>j?(c.addRange(d),c.extend(G.node,G.offset)):(d.setEnd(G.node,G.offset),c.addRange(d)))}}for(d=[],c=x;c=c.parentNode;)c.nodeType===1&&d.push({element:c,left:c.scrollLeft,top:c.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<d.length;x++)c=d[x],c.element.scrollLeft=c.left,c.element.scrollTop=c.top}}var RI=l&&"documentMode"in document&&11>=document.documentMode,qa=null,Dg=null,Zc=null,$g=!1;function _j(c,d,x){var j=x.window===x?x.document:x.nodeType===9?x:x.ownerDocument;$g||qa==null||qa!==ke(j)||(j=qa,"selectionStart"in j&&_g(j)?j={start:j.selectionStart,end:j.selectionEnd}:(j=(j.ownerDocument&&j.ownerDocument.defaultView||window).getSelection(),j={anchorNode:j.anchorNode,anchorOffset:j.anchorOffset,focusNode:j.focusNode,focusOffset:j.focusOffset}),Zc&&Jc(Zc,j)||(Zc=j,j=bf(Dg,"onSelect"),0<j.length&&(d=new Ng("onSelect","select",null,d,x),c.push({event:d,listeners:j}),d.target=qa)))}function gf(c,d){var x={};return x[c.toLowerCase()]=d.toLowerCase(),x["Webkit"+c]="webkit"+d,x["Moz"+c]="moz"+d,x}var Ga={animationend:gf("Animation","AnimationEnd"),animationiteration:gf("Animation","AnimationIteration"),animationstart:gf("Animation","AnimationStart"),transitionend:gf("Transition","TransitionEnd")},Ig={},Dj={};l&&(Dj=document.createElement("div").style,"AnimationEvent"in window||(delete Ga.animationend.animation,delete Ga.animationiteration.animation,delete Ga.animationstart.animation),"TransitionEvent"in window||delete Ga.transitionend.transition);function xf(c){if(Ig[c])return Ig[c];if(!Ga[c])return c;var d=Ga[c],x;for(x in d)if(d.hasOwnProperty(x)&&x in Dj)return Ig[c]=d[x];return c}var $j=xf("animationend"),Ij=xf("animationiteration"),Mj=xf("animationstart"),Lj=xf("transitionend"),Oj=new Map,Fj="abort auxClick 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(" ");function Go(c,d){Oj.set(c,d),i(d,[c])}for(var Mg=0;Mg<Fj.length;Mg++){var Lg=Fj[Mg],AI=Lg.toLowerCase(),PI=Lg[0].toUpperCase()+Lg.slice(1);Go(AI,"on"+PI)}Go($j,"onAnimationEnd"),Go(Ij,"onAnimationIteration"),Go(Mj,"onAnimationStart"),Go("dblclick","onDoubleClick"),Go("focusin","onFocus"),Go("focusout","onBlur"),Go(Lj,"onTransitionEnd"),a("onMouseEnter",["mouseout","mouseover"]),a("onMouseLeave",["mouseout","mouseover"]),a("onPointerEnter",["pointerout","pointerover"]),a("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var eu="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(" "),_I=new Set("cancel close invalid load scroll toggle".split(" ").concat(eu));function zj(c,d,x){var j=c.type||"unknown-event";c.currentTarget=x,lo(j,d,void 0,c),c.currentTarget=null}function Bj(c,d){d=(d&4)!==0;for(var x=0;x<c.length;x++){var j=c[x],E=j.event;j=j.listeners;e:{var P=void 0;if(d)for(var G=j.length-1;0<=G;G--){var ee=j[G],se=ee.instance,he=ee.currentTarget;if(ee=ee.listener,se!==P&&E.isPropagationStopped())break e;zj(E,ee,he),P=se}else for(G=0;G<j.length;G++){if(ee=j[G],se=ee.instance,he=ee.currentTarget,ee=ee.listener,se!==P&&E.isPropagationStopped())break e;zj(E,ee,he),P=se}}}if(Ne)throw c=et,Ne=!1,et=null,c}function Xt(c,d){var x=d[Wg];x===void 0&&(x=d[Wg]=new Set);var j=c+"__bubble";x.has(j)||(Uj(d,c,2,!1),x.add(j))}function Og(c,d,x){var j=0;d&&(j|=4),Uj(x,c,j,d)}var yf="_reactListening"+Math.random().toString(36).slice(2);function tu(c){if(!c[yf]){c[yf]=!0,r.forEach(function(x){x!=="selectionchange"&&(_I.has(x)||Og(x,!1,c),Og(x,!0,c))});var d=c.nodeType===9?c:c.ownerDocument;d===null||d[yf]||(d[yf]=!0,Og("selectionchange",!1,d))}}function Uj(c,d,x,j){switch(dj(d)){case 1:var E=Tr;break;case 4:E=Ha;break;default:E=Va}x=E.bind(null,d,x,c),E=void 0,!je||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(E=!0),j?E!==void 0?c.addEventListener(d,x,{capture:!0,passive:E}):c.addEventListener(d,x,!0):E!==void 0?c.addEventListener(d,x,{passive:E}):c.addEventListener(d,x,!1)}function Fg(c,d,x,j,E){var P=j;if((d&1)===0&&(d&2)===0&&j!==null)e:for(;;){if(j===null)return;var G=j.tag;if(G===3||G===4){var ee=j.stateNode.containerInfo;if(ee===E||ee.nodeType===8&&ee.parentNode===E)break;if(G===4)for(G=j.return;G!==null;){var se=G.tag;if((se===3||se===4)&&(se=G.stateNode.containerInfo,se===E||se.nodeType===8&&se.parentNode===E))return;G=G.return}for(;ee!==null;){if(G=Oi(ee),G===null)return;if(se=G.tag,se===5||se===6){j=P=G;continue e}ee=ee.parentNode}}j=j.return}An(function(){var he=P,Te=xe(x),$e=[];e:{var Ee=Oj.get(c);if(Ee!==void 0){var Ke=Ng,Ze=c;switch(c){case"keypress":if(ff(x)===0)break e;case"keydown":case"keyup":Ke=lI;break;case"focusin":Ze="focus",Ke=Eg;break;case"focusout":Ze="blur",Ke=Eg;break;case"beforeblur":case"afterblur":Ke=Eg;break;case"click":if(x.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ke=hj;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ke=X$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ke=dI;break;case $j:case Ij:case Mj:Ke=Z$;break;case Lj:Ke=pI;break;case"scroll":Ke=G$;break;case"wheel":Ke=mI;break;case"copy":case"cut":case"paste":Ke=tI;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ke=gj}var tt=(d&4)!==0,mn=!tt&&c==="scroll",de=tt?Ee!==null?Ee+"Capture":null:Ee;tt=[];for(var ae=he,pe;ae!==null;){pe=ae;var Le=pe.stateNode;if(pe.tag===5&&Le!==null&&(pe=Le,de!==null&&(Le=Ct(ae,de),Le!=null&&tt.push(nu(ae,Le,pe)))),mn)break;ae=ae.return}0<tt.length&&(Ee=new Ke(Ee,Ze,null,x,Te),$e.push({event:Ee,listeners:tt}))}}if((d&7)===0){e:{if(Ee=c==="mouseover"||c==="pointerover",Ke=c==="mouseout"||c==="pointerout",Ee&&x!==ne&&(Ze=x.relatedTarget||x.fromElement)&&(Oi(Ze)||Ze[mo]))break e;if((Ke||Ee)&&(Ee=Te.window===Te?Te:(Ee=Te.ownerDocument)?Ee.defaultView||Ee.parentWindow:window,Ke?(Ze=x.relatedTarget||x.toElement,Ke=he,Ze=Ze?Oi(Ze):null,Ze!==null&&(mn=wt(Ze),Ze!==mn||Ze.tag!==5&&Ze.tag!==6)&&(Ze=null)):(Ke=null,Ze=he),Ke!==Ze)){if(tt=hj,Le="onMouseLeave",de="onMouseEnter",ae="mouse",(c==="pointerout"||c==="pointerover")&&(tt=gj,Le="onPointerLeave",de="onPointerEnter",ae="pointer"),mn=Ke==null?Ee:Qa(Ke),pe=Ze==null?Ee:Qa(Ze),Ee=new tt(Le,ae+"leave",Ke,x,Te),Ee.target=mn,Ee.relatedTarget=pe,Le=null,Oi(Te)===he&&(tt=new tt(de,ae+"enter",Ze,x,Te),tt.target=pe,tt.relatedTarget=mn,Le=tt),mn=Le,Ke&&Ze)t:{for(tt=Ke,de=Ze,ae=0,pe=tt;pe;pe=Ya(pe))ae++;for(pe=0,Le=de;Le;Le=Ya(Le))pe++;for(;0<ae-pe;)tt=Ya(tt),ae--;for(;0<pe-ae;)de=Ya(de),pe--;for(;ae--;){if(tt===de||de!==null&&tt===de.alternate)break t;tt=Ya(tt),de=Ya(de)}tt=null}else tt=null;Ke!==null&&Hj($e,Ee,Ke,tt,!1),Ze!==null&&mn!==null&&Hj($e,mn,Ze,tt,!0)}}e:{if(Ee=he?Qa(he):window,Ke=Ee.nodeName&&Ee.nodeName.toLowerCase(),Ke==="select"||Ke==="input"&&Ee.type==="file")var st=jI;else if(jj(Ee))if(Nj)st=CI;else{st=NI;var dt=kI}else(Ke=Ee.nodeName)&&Ke.toLowerCase()==="input"&&(Ee.type==="checkbox"||Ee.type==="radio")&&(st=SI);if(st&&(st=st(c,he))){kj($e,st,x,Te);break e}dt&&dt(c,Ee,he),c==="focusout"&&(dt=Ee._wrapperState)&&dt.controlled&&Ee.type==="number"&&Ue(Ee,"number",Ee.value)}switch(dt=he?Qa(he):window,c){case"focusin":(jj(dt)||dt.contentEditable==="true")&&(qa=dt,Dg=he,Zc=null);break;case"focusout":Zc=Dg=qa=null;break;case"mousedown":$g=!0;break;case"contextmenu":case"mouseup":case"dragend":$g=!1,_j($e,x,Te);break;case"selectionchange":if(RI)break;case"keydown":case"keyup":_j($e,x,Te)}var ft;if(Rg)e:{switch(c){case"compositionstart":var gt="onCompositionStart";break e;case"compositionend":gt="onCompositionEnd";break e;case"compositionupdate":gt="onCompositionUpdate";break e}gt=void 0}else Ka?vj(c,x)&&(gt="onCompositionEnd"):c==="keydown"&&x.keyCode===229&&(gt="onCompositionStart");gt&&(xj&&x.locale!=="ko"&&(Ka||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&Ka&&(ft=fj()):(qo=Te,kg="value"in qo?qo.value:qo.textContent,Ka=!0)),dt=bf(he,gt),0<dt.length&&(gt=new mj(gt,c,null,x,Te),$e.push({event:gt,listeners:dt}),ft?gt.data=ft:(ft=wj(x),ft!==null&&(gt.data=ft)))),(ft=xI?yI(c,x):bI(c,x))&&(he=bf(he,"onBeforeInput"),0<he.length&&(Te=new mj("onBeforeInput","beforeinput",null,x,Te),$e.push({event:Te,listeners:he}),Te.data=ft))}Bj($e,d)})}function nu(c,d,x){return{instance:c,listener:d,currentTarget:x}}function bf(c,d){for(var x=d+"Capture",j=[];c!==null;){var E=c,P=E.stateNode;E.tag===5&&P!==null&&(E=P,P=Ct(c,x),P!=null&&j.unshift(nu(c,P,E)),P=Ct(c,d),P!=null&&j.push(nu(c,P,E))),c=c.return}return j}function Ya(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5);return c||null}function Hj(c,d,x,j,E){for(var P=d._reactName,G=[];x!==null&&x!==j;){var ee=x,se=ee.alternate,he=ee.stateNode;if(se!==null&&se===j)break;ee.tag===5&&he!==null&&(ee=he,E?(se=Ct(x,P),se!=null&&G.unshift(nu(x,se,ee))):E||(se=Ct(x,P),se!=null&&G.push(nu(x,se,ee)))),x=x.return}G.length!==0&&c.push({event:d,listeners:G})}var DI=/\r\n?/g,$I=/\u0000|\uFFFD/g;function Vj(c){return(typeof c=="string"?c:""+c).replace(DI,`
|
|
38
|
+
`).replace($I,"")}function vf(c,d,x){if(d=Vj(d),Vj(c)!==d&&x)throw Error(n(425))}function wf(){}var zg=null,Bg=null;function Ug(c,d){return c==="textarea"||c==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.__html!=null}var Hg=typeof setTimeout=="function"?setTimeout:void 0,II=typeof clearTimeout=="function"?clearTimeout:void 0,Wj=typeof Promise=="function"?Promise:void 0,MI=typeof queueMicrotask=="function"?queueMicrotask:typeof Wj<"u"?function(c){return Wj.resolve(null).then(c).catch(LI)}:Hg;function LI(c){setTimeout(function(){throw c})}function Vg(c,d){var x=d,j=0;do{var E=x.nextSibling;if(c.removeChild(x),E&&E.nodeType===8)if(x=E.data,x==="/$"){if(j===0){c.removeChild(E),Bn(d);return}j--}else x!=="$"&&x!=="$?"&&x!=="$!"||j++;x=E}while(x);Bn(d)}function Yo(c){for(;c!=null;c=c.nextSibling){var d=c.nodeType;if(d===1||d===3)break;if(d===8){if(d=c.data,d==="$"||d==="$!"||d==="$?")break;if(d==="/$")return null}}return c}function Kj(c){c=c.previousSibling;for(var d=0;c;){if(c.nodeType===8){var x=c.data;if(x==="$"||x==="$!"||x==="$?"){if(d===0)return c;d--}else x==="/$"&&d++}c=c.previousSibling}return null}var Xa=Math.random().toString(36).slice(2),zs="__reactFiber$"+Xa,ru="__reactProps$"+Xa,mo="__reactContainer$"+Xa,Wg="__reactEvents$"+Xa,OI="__reactListeners$"+Xa,FI="__reactHandles$"+Xa;function Oi(c){var d=c[zs];if(d)return d;for(var x=c.parentNode;x;){if(d=x[mo]||x[zs]){if(x=d.alternate,d.child!==null||x!==null&&x.child!==null)for(c=Kj(c);c!==null;){if(x=c[zs])return x;c=Kj(c)}return d}c=x,x=c.parentNode}return null}function su(c){return c=c[zs]||c[mo],!c||c.tag!==5&&c.tag!==6&&c.tag!==13&&c.tag!==3?null:c}function Qa(c){if(c.tag===5||c.tag===6)return c.stateNode;throw Error(n(33))}function jf(c){return c[ru]||null}var Kg=[],Ja=-1;function Xo(c){return{current:c}}function Qt(c){0>Ja||(c.current=Kg[Ja],Kg[Ja]=null,Ja--)}function qt(c,d){Ja++,Kg[Ja]=c.current,c.current=d}var Qo={},Qn=Xo(Qo),dr=Xo(!1),Fi=Qo;function Za(c,d){var x=c.type.contextTypes;if(!x)return Qo;var j=c.stateNode;if(j&&j.__reactInternalMemoizedUnmaskedChildContext===d)return j.__reactInternalMemoizedMaskedChildContext;var E={},P;for(P in x)E[P]=d[P];return j&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=d,c.__reactInternalMemoizedMaskedChildContext=E),E}function fr(c){return c=c.childContextTypes,c!=null}function kf(){Qt(dr),Qt(Qn)}function qj(c,d,x){if(Qn.current!==Qo)throw Error(n(168));qt(Qn,d),qt(dr,x)}function Gj(c,d,x){var j=c.stateNode;if(d=d.childContextTypes,typeof j.getChildContext!="function")return x;j=j.getChildContext();for(var E in j)if(!(E in d))throw Error(n(108,oe(c)||"Unknown",E));return M({},x,j)}function Nf(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Qo,Fi=Qn.current,qt(Qn,c),qt(dr,dr.current),!0}function Yj(c,d,x){var j=c.stateNode;if(!j)throw Error(n(169));x?(c=Gj(c,d,Fi),j.__reactInternalMemoizedMergedChildContext=c,Qt(dr),Qt(Qn),qt(Qn,c)):Qt(dr),qt(dr,x)}var go=null,Sf=!1,qg=!1;function Xj(c){go===null?go=[c]:go.push(c)}function zI(c){Sf=!0,Xj(c)}function Jo(){if(!qg&&go!==null){qg=!0;var c=0,d=Ft;try{var x=go;for(Ft=1;c<x.length;c++){var j=x[c];do j=j(!0);while(j!==null)}go=null,Sf=!1}catch(E){throw go!==null&&(go=go.slice(c+1)),La(co,Jo),E}finally{Ft=d,qg=!1}}return null}var el=[],tl=0,Cf=null,Ef=0,Kr=[],qr=0,zi=null,xo=1,yo="";function Bi(c,d){el[tl++]=Ef,el[tl++]=Cf,Cf=c,Ef=d}function Qj(c,d,x){Kr[qr++]=xo,Kr[qr++]=yo,Kr[qr++]=zi,zi=c;var j=xo;c=yo;var E=32-Fn(j)-1;j&=~(1<<E),x+=1;var P=32-Fn(d)+E;if(30<P){var G=E-E%5;P=(j&(1<<G)-1).toString(32),j>>=G,E-=G,xo=1<<32-Fn(d)+E|x<<E|j,yo=P+c}else xo=1<<P|x<<E|j,yo=c}function Gg(c){c.return!==null&&(Bi(c,1),Qj(c,1,0))}function Yg(c){for(;c===Cf;)Cf=el[--tl],el[tl]=null,Ef=el[--tl],el[tl]=null;for(;c===zi;)zi=Kr[--qr],Kr[qr]=null,yo=Kr[--qr],Kr[qr]=null,xo=Kr[--qr],Kr[qr]=null}var Ar=null,Pr=null,rn=!1,ls=null;function Jj(c,d){var x=Qr(5,null,null,0);x.elementType="DELETED",x.stateNode=d,x.return=c,d=c.deletions,d===null?(c.deletions=[x],c.flags|=16):d.push(x)}function Zj(c,d){switch(c.tag){case 5:var x=c.type;return d=d.nodeType!==1||x.toLowerCase()!==d.nodeName.toLowerCase()?null:d,d!==null?(c.stateNode=d,Ar=c,Pr=Yo(d.firstChild),!0):!1;case 6:return d=c.pendingProps===""||d.nodeType!==3?null:d,d!==null?(c.stateNode=d,Ar=c,Pr=null,!0):!1;case 13:return d=d.nodeType!==8?null:d,d!==null?(x=zi!==null?{id:xo,overflow:yo}:null,c.memoizedState={dehydrated:d,treeContext:x,retryLane:1073741824},x=Qr(18,null,null,0),x.stateNode=d,x.return=c,c.child=x,Ar=c,Pr=null,!0):!1;default:return!1}}function Xg(c){return(c.mode&1)!==0&&(c.flags&128)===0}function Qg(c){if(rn){var d=Pr;if(d){var x=d;if(!Zj(c,d)){if(Xg(c))throw Error(n(418));d=Yo(x.nextSibling);var j=Ar;d&&Zj(c,d)?Jj(j,x):(c.flags=c.flags&-4097|2,rn=!1,Ar=c)}}else{if(Xg(c))throw Error(n(418));c.flags=c.flags&-4097|2,rn=!1,Ar=c}}}function ek(c){for(c=c.return;c!==null&&c.tag!==5&&c.tag!==3&&c.tag!==13;)c=c.return;Ar=c}function Tf(c){if(c!==Ar)return!1;if(!rn)return ek(c),rn=!0,!1;var d;if((d=c.tag!==3)&&!(d=c.tag!==5)&&(d=c.type,d=d!=="head"&&d!=="body"&&!Ug(c.type,c.memoizedProps)),d&&(d=Pr)){if(Xg(c))throw tk(),Error(n(418));for(;d;)Jj(c,d),d=Yo(d.nextSibling)}if(ek(c),c.tag===13){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(317));e:{for(c=c.nextSibling,d=0;c;){if(c.nodeType===8){var x=c.data;if(x==="/$"){if(d===0){Pr=Yo(c.nextSibling);break e}d--}else x!=="$"&&x!=="$!"&&x!=="$?"||d++}c=c.nextSibling}Pr=null}}else Pr=Ar?Yo(c.stateNode.nextSibling):null;return!0}function tk(){for(var c=Pr;c;)c=Yo(c.nextSibling)}function nl(){Pr=Ar=null,rn=!1}function Jg(c){ls===null?ls=[c]:ls.push(c)}var BI=C.ReactCurrentBatchConfig;function ou(c,d,x){if(c=x.ref,c!==null&&typeof c!="function"&&typeof c!="object"){if(x._owner){if(x=x._owner,x){if(x.tag!==1)throw Error(n(309));var j=x.stateNode}if(!j)throw Error(n(147,c));var E=j,P=""+c;return d!==null&&d.ref!==null&&typeof d.ref=="function"&&d.ref._stringRef===P?d.ref:(d=function(G){var ee=E.refs;G===null?delete ee[P]:ee[P]=G},d._stringRef=P,d)}if(typeof c!="string")throw Error(n(284));if(!x._owner)throw Error(n(290,c))}return c}function Rf(c,d){throw c=Object.prototype.toString.call(d),Error(n(31,c==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":c))}function nk(c){var d=c._init;return d(c._payload)}function rk(c){function d(de,ae){if(c){var pe=de.deletions;pe===null?(de.deletions=[ae],de.flags|=16):pe.push(ae)}}function x(de,ae){if(!c)return null;for(;ae!==null;)d(de,ae),ae=ae.sibling;return null}function j(de,ae){for(de=new Map;ae!==null;)ae.key!==null?de.set(ae.key,ae):de.set(ae.index,ae),ae=ae.sibling;return de}function E(de,ae){return de=ii(de,ae),de.index=0,de.sibling=null,de}function P(de,ae,pe){return de.index=pe,c?(pe=de.alternate,pe!==null?(pe=pe.index,pe<ae?(de.flags|=2,ae):pe):(de.flags|=2,ae)):(de.flags|=1048576,ae)}function G(de){return c&&de.alternate===null&&(de.flags|=2),de}function ee(de,ae,pe,Le){return ae===null||ae.tag!==6?(ae=Hx(pe,de.mode,Le),ae.return=de,ae):(ae=E(ae,pe),ae.return=de,ae)}function se(de,ae,pe,Le){var st=pe.type;return st===A?Te(de,ae,pe.props.children,Le,pe.key):ae!==null&&(ae.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===U&&nk(st)===ae.type)?(Le=E(ae,pe.props),Le.ref=ou(de,ae,pe),Le.return=de,Le):(Le=Zf(pe.type,pe.key,pe.props,null,de.mode,Le),Le.ref=ou(de,ae,pe),Le.return=de,Le)}function he(de,ae,pe,Le){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==pe.containerInfo||ae.stateNode.implementation!==pe.implementation?(ae=Vx(pe,de.mode,Le),ae.return=de,ae):(ae=E(ae,pe.children||[]),ae.return=de,ae)}function Te(de,ae,pe,Le,st){return ae===null||ae.tag!==7?(ae=Yi(pe,de.mode,Le,st),ae.return=de,ae):(ae=E(ae,pe),ae.return=de,ae)}function $e(de,ae,pe){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return ae=Hx(""+ae,de.mode,pe),ae.return=de,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case R:return pe=Zf(ae.type,ae.key,ae.props,null,de.mode,pe),pe.ref=ou(de,null,ae),pe.return=de,pe;case T:return ae=Vx(ae,de.mode,pe),ae.return=de,ae;case U:var Le=ae._init;return $e(de,Le(ae._payload),pe)}if(rt(ae)||W(ae))return ae=Yi(ae,de.mode,pe,null),ae.return=de,ae;Rf(de,ae)}return null}function Ee(de,ae,pe,Le){var st=ae!==null?ae.key:null;if(typeof pe=="string"&&pe!==""||typeof pe=="number")return st!==null?null:ee(de,ae,""+pe,Le);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case R:return pe.key===st?se(de,ae,pe,Le):null;case T:return pe.key===st?he(de,ae,pe,Le):null;case U:return st=pe._init,Ee(de,ae,st(pe._payload),Le)}if(rt(pe)||W(pe))return st!==null?null:Te(de,ae,pe,Le,null);Rf(de,pe)}return null}function Ke(de,ae,pe,Le,st){if(typeof Le=="string"&&Le!==""||typeof Le=="number")return de=de.get(pe)||null,ee(ae,de,""+Le,st);if(typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case R:return de=de.get(Le.key===null?pe:Le.key)||null,se(ae,de,Le,st);case T:return de=de.get(Le.key===null?pe:Le.key)||null,he(ae,de,Le,st);case U:var dt=Le._init;return Ke(de,ae,pe,dt(Le._payload),st)}if(rt(Le)||W(Le))return de=de.get(pe)||null,Te(ae,de,Le,st,null);Rf(ae,Le)}return null}function Ze(de,ae,pe,Le){for(var st=null,dt=null,ft=ae,gt=ae=0,Vn=null;ft!==null&><pe.length;gt++){ft.index>gt?(Vn=ft,ft=null):Vn=ft.sibling;var Lt=Ee(de,ft,pe[gt],Le);if(Lt===null){ft===null&&(ft=Vn);break}c&&ft&&Lt.alternate===null&&d(de,ft),ae=P(Lt,ae,gt),dt===null?st=Lt:dt.sibling=Lt,dt=Lt,ft=Vn}if(gt===pe.length)return x(de,ft),rn&&Bi(de,gt),st;if(ft===null){for(;gt<pe.length;gt++)ft=$e(de,pe[gt],Le),ft!==null&&(ae=P(ft,ae,gt),dt===null?st=ft:dt.sibling=ft,dt=ft);return rn&&Bi(de,gt),st}for(ft=j(de,ft);gt<pe.length;gt++)Vn=Ke(ft,de,gt,pe[gt],Le),Vn!==null&&(c&&Vn.alternate!==null&&ft.delete(Vn.key===null?gt:Vn.key),ae=P(Vn,ae,gt),dt===null?st=Vn:dt.sibling=Vn,dt=Vn);return c&&ft.forEach(function(ai){return d(de,ai)}),rn&&Bi(de,gt),st}function tt(de,ae,pe,Le){var st=W(pe);if(typeof st!="function")throw Error(n(150));if(pe=st.call(pe),pe==null)throw Error(n(151));for(var dt=st=null,ft=ae,gt=ae=0,Vn=null,Lt=pe.next();ft!==null&&!Lt.done;gt++,Lt=pe.next()){ft.index>gt?(Vn=ft,ft=null):Vn=ft.sibling;var ai=Ee(de,ft,Lt.value,Le);if(ai===null){ft===null&&(ft=Vn);break}c&&ft&&ai.alternate===null&&d(de,ft),ae=P(ai,ae,gt),dt===null?st=ai:dt.sibling=ai,dt=ai,ft=Vn}if(Lt.done)return x(de,ft),rn&&Bi(de,gt),st;if(ft===null){for(;!Lt.done;gt++,Lt=pe.next())Lt=$e(de,Lt.value,Le),Lt!==null&&(ae=P(Lt,ae,gt),dt===null?st=Lt:dt.sibling=Lt,dt=Lt);return rn&&Bi(de,gt),st}for(ft=j(de,ft);!Lt.done;gt++,Lt=pe.next())Lt=Ke(ft,de,gt,Lt.value,Le),Lt!==null&&(c&&Lt.alternate!==null&&ft.delete(Lt.key===null?gt:Lt.key),ae=P(Lt,ae,gt),dt===null?st=Lt:dt.sibling=Lt,dt=Lt);return c&&ft.forEach(function(vM){return d(de,vM)}),rn&&Bi(de,gt),st}function mn(de,ae,pe,Le){if(typeof pe=="object"&&pe!==null&&pe.type===A&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case R:e:{for(var st=pe.key,dt=ae;dt!==null;){if(dt.key===st){if(st=pe.type,st===A){if(dt.tag===7){x(de,dt.sibling),ae=E(dt,pe.props.children),ae.return=de,de=ae;break e}}else if(dt.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===U&&nk(st)===dt.type){x(de,dt.sibling),ae=E(dt,pe.props),ae.ref=ou(de,dt,pe),ae.return=de,de=ae;break e}x(de,dt);break}else d(de,dt);dt=dt.sibling}pe.type===A?(ae=Yi(pe.props.children,de.mode,Le,pe.key),ae.return=de,de=ae):(Le=Zf(pe.type,pe.key,pe.props,null,de.mode,Le),Le.ref=ou(de,ae,pe),Le.return=de,de=Le)}return G(de);case T:e:{for(dt=pe.key;ae!==null;){if(ae.key===dt)if(ae.tag===4&&ae.stateNode.containerInfo===pe.containerInfo&&ae.stateNode.implementation===pe.implementation){x(de,ae.sibling),ae=E(ae,pe.children||[]),ae.return=de,de=ae;break e}else{x(de,ae);break}else d(de,ae);ae=ae.sibling}ae=Vx(pe,de.mode,Le),ae.return=de,de=ae}return G(de);case U:return dt=pe._init,mn(de,ae,dt(pe._payload),Le)}if(rt(pe))return Ze(de,ae,pe,Le);if(W(pe))return tt(de,ae,pe,Le);Rf(de,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"?(pe=""+pe,ae!==null&&ae.tag===6?(x(de,ae.sibling),ae=E(ae,pe),ae.return=de,de=ae):(x(de,ae),ae=Hx(pe,de.mode,Le),ae.return=de,de=ae),G(de)):x(de,ae)}return mn}var rl=rk(!0),sk=rk(!1),Af=Xo(null),Pf=null,sl=null,Zg=null;function ex(){Zg=sl=Pf=null}function tx(c){var d=Af.current;Qt(Af),c._currentValue=d}function nx(c,d,x){for(;c!==null;){var j=c.alternate;if((c.childLanes&d)!==d?(c.childLanes|=d,j!==null&&(j.childLanes|=d)):j!==null&&(j.childLanes&d)!==d&&(j.childLanes|=d),c===x)break;c=c.return}}function ol(c,d){Pf=c,Zg=sl=null,c=c.dependencies,c!==null&&c.firstContext!==null&&((c.lanes&d)!==0&&(pr=!0),c.firstContext=null)}function Gr(c){var d=c._currentValue;if(Zg!==c)if(c={context:c,memoizedValue:d,next:null},sl===null){if(Pf===null)throw Error(n(308));sl=c,Pf.dependencies={lanes:0,firstContext:c}}else sl=sl.next=c;return d}var Ui=null;function rx(c){Ui===null?Ui=[c]:Ui.push(c)}function ok(c,d,x,j){var E=d.interleaved;return E===null?(x.next=x,rx(d)):(x.next=E.next,E.next=x),d.interleaved=x,bo(c,j)}function bo(c,d){c.lanes|=d;var x=c.alternate;for(x!==null&&(x.lanes|=d),x=c,c=c.return;c!==null;)c.childLanes|=d,x=c.alternate,x!==null&&(x.childLanes|=d),x=c,c=c.return;return x.tag===3?x.stateNode:null}var Zo=!1;function sx(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ik(c,d){c=c.updateQueue,d.updateQueue===c&&(d.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,effects:c.effects})}function vo(c,d){return{eventTime:c,lane:d,tag:0,payload:null,callback:null,next:null}}function ei(c,d,x){var j=c.updateQueue;if(j===null)return null;if(j=j.shared,(It&2)!==0){var E=j.pending;return E===null?d.next=d:(d.next=E.next,E.next=d),j.pending=d,bo(c,x)}return E=j.interleaved,E===null?(d.next=d,rx(j)):(d.next=E.next,E.next=d),j.interleaved=d,bo(c,x)}function _f(c,d,x){if(d=d.updateQueue,d!==null&&(d=d.shared,(x&4194240)!==0)){var j=d.lanes;j&=c.pendingLanes,x|=j,d.lanes=x,Is(c,x)}}function ak(c,d){var x=c.updateQueue,j=c.alternate;if(j!==null&&(j=j.updateQueue,x===j)){var E=null,P=null;if(x=x.firstBaseUpdate,x!==null){do{var G={eventTime:x.eventTime,lane:x.lane,tag:x.tag,payload:x.payload,callback:x.callback,next:null};P===null?E=P=G:P=P.next=G,x=x.next}while(x!==null);P===null?E=P=d:P=P.next=d}else E=P=d;x={baseState:j.baseState,firstBaseUpdate:E,lastBaseUpdate:P,shared:j.shared,effects:j.effects},c.updateQueue=x;return}c=x.lastBaseUpdate,c===null?x.firstBaseUpdate=d:c.next=d,x.lastBaseUpdate=d}function Df(c,d,x,j){var E=c.updateQueue;Zo=!1;var P=E.firstBaseUpdate,G=E.lastBaseUpdate,ee=E.shared.pending;if(ee!==null){E.shared.pending=null;var se=ee,he=se.next;se.next=null,G===null?P=he:G.next=he,G=se;var Te=c.alternate;Te!==null&&(Te=Te.updateQueue,ee=Te.lastBaseUpdate,ee!==G&&(ee===null?Te.firstBaseUpdate=he:ee.next=he,Te.lastBaseUpdate=se))}if(P!==null){var $e=E.baseState;G=0,Te=he=se=null,ee=P;do{var Ee=ee.lane,Ke=ee.eventTime;if((j&Ee)===Ee){Te!==null&&(Te=Te.next={eventTime:Ke,lane:0,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null});e:{var Ze=c,tt=ee;switch(Ee=d,Ke=x,tt.tag){case 1:if(Ze=tt.payload,typeof Ze=="function"){$e=Ze.call(Ke,$e,Ee);break e}$e=Ze;break e;case 3:Ze.flags=Ze.flags&-65537|128;case 0:if(Ze=tt.payload,Ee=typeof Ze=="function"?Ze.call(Ke,$e,Ee):Ze,Ee==null)break e;$e=M({},$e,Ee);break e;case 2:Zo=!0}}ee.callback!==null&&ee.lane!==0&&(c.flags|=64,Ee=E.effects,Ee===null?E.effects=[ee]:Ee.push(ee))}else Ke={eventTime:Ke,lane:Ee,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null},Te===null?(he=Te=Ke,se=$e):Te=Te.next=Ke,G|=Ee;if(ee=ee.next,ee===null){if(ee=E.shared.pending,ee===null)break;Ee=ee,ee=Ee.next,Ee.next=null,E.lastBaseUpdate=Ee,E.shared.pending=null}}while(!0);if(Te===null&&(se=$e),E.baseState=se,E.firstBaseUpdate=he,E.lastBaseUpdate=Te,d=E.shared.interleaved,d!==null){E=d;do G|=E.lane,E=E.next;while(E!==d)}else P===null&&(E.shared.lanes=0);Wi|=G,c.lanes=G,c.memoizedState=$e}}function lk(c,d,x){if(c=d.effects,d.effects=null,c!==null)for(d=0;d<c.length;d++){var j=c[d],E=j.callback;if(E!==null){if(j.callback=null,j=x,typeof E!="function")throw Error(n(191,E));E.call(j)}}}var iu={},Bs=Xo(iu),au=Xo(iu),lu=Xo(iu);function Hi(c){if(c===iu)throw Error(n(174));return c}function ox(c,d){switch(qt(lu,d),qt(au,c),qt(Bs,iu),c=d.nodeType,c){case 9:case 11:d=(d=d.documentElement)?d.namespaceURI:me(null,"");break;default:c=c===8?d.parentNode:d,d=c.namespaceURI||null,c=c.tagName,d=me(d,c)}Qt(Bs),qt(Bs,d)}function il(){Qt(Bs),Qt(au),Qt(lu)}function ck(c){Hi(lu.current);var d=Hi(Bs.current),x=me(d,c.type);d!==x&&(qt(au,c),qt(Bs,x))}function ix(c){au.current===c&&(Qt(Bs),Qt(au))}var ln=Xo(0);function $f(c){for(var d=c;d!==null;){if(d.tag===13){var x=d.memoizedState;if(x!==null&&(x=x.dehydrated,x===null||x.data==="$?"||x.data==="$!"))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===c)break;for(;d.sibling===null;){if(d.return===null||d.return===c)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var ax=[];function lx(){for(var c=0;c<ax.length;c++)ax[c]._workInProgressVersionPrimary=null;ax.length=0}var If=C.ReactCurrentDispatcher,cx=C.ReactCurrentBatchConfig,Vi=0,cn=null,Dn=null,Un=null,Mf=!1,cu=!1,uu=0,UI=0;function Jn(){throw Error(n(321))}function ux(c,d){if(d===null)return!1;for(var x=0;x<d.length&&x<c.length;x++)if(!as(c[x],d[x]))return!1;return!0}function dx(c,d,x,j,E,P){if(Vi=P,cn=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,If.current=c===null||c.memoizedState===null?KI:qI,c=x(j,E),cu){P=0;do{if(cu=!1,uu=0,25<=P)throw Error(n(301));P+=1,Un=Dn=null,d.updateQueue=null,If.current=GI,c=x(j,E)}while(cu)}if(If.current=Ff,d=Dn!==null&&Dn.next!==null,Vi=0,Un=Dn=cn=null,Mf=!1,d)throw Error(n(300));return c}function fx(){var c=uu!==0;return uu=0,c}function Us(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Un===null?cn.memoizedState=Un=c:Un=Un.next=c,Un}function Yr(){if(Dn===null){var c=cn.alternate;c=c!==null?c.memoizedState:null}else c=Dn.next;var d=Un===null?cn.memoizedState:Un.next;if(d!==null)Un=d,Dn=c;else{if(c===null)throw Error(n(310));Dn=c,c={memoizedState:Dn.memoizedState,baseState:Dn.baseState,baseQueue:Dn.baseQueue,queue:Dn.queue,next:null},Un===null?cn.memoizedState=Un=c:Un=Un.next=c}return Un}function du(c,d){return typeof d=="function"?d(c):d}function px(c){var d=Yr(),x=d.queue;if(x===null)throw Error(n(311));x.lastRenderedReducer=c;var j=Dn,E=j.baseQueue,P=x.pending;if(P!==null){if(E!==null){var G=E.next;E.next=P.next,P.next=G}j.baseQueue=E=P,x.pending=null}if(E!==null){P=E.next,j=j.baseState;var ee=G=null,se=null,he=P;do{var Te=he.lane;if((Vi&Te)===Te)se!==null&&(se=se.next={lane:0,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),j=he.hasEagerState?he.eagerState:c(j,he.action);else{var $e={lane:Te,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null};se===null?(ee=se=$e,G=j):se=se.next=$e,cn.lanes|=Te,Wi|=Te}he=he.next}while(he!==null&&he!==P);se===null?G=j:se.next=ee,as(j,d.memoizedState)||(pr=!0),d.memoizedState=j,d.baseState=G,d.baseQueue=se,x.lastRenderedState=j}if(c=x.interleaved,c!==null){E=c;do P=E.lane,cn.lanes|=P,Wi|=P,E=E.next;while(E!==c)}else E===null&&(x.lanes=0);return[d.memoizedState,x.dispatch]}function hx(c){var d=Yr(),x=d.queue;if(x===null)throw Error(n(311));x.lastRenderedReducer=c;var j=x.dispatch,E=x.pending,P=d.memoizedState;if(E!==null){x.pending=null;var G=E=E.next;do P=c(P,G.action),G=G.next;while(G!==E);as(P,d.memoizedState)||(pr=!0),d.memoizedState=P,d.baseQueue===null&&(d.baseState=P),x.lastRenderedState=P}return[P,j]}function uk(){}function dk(c,d){var x=cn,j=Yr(),E=d(),P=!as(j.memoizedState,E);if(P&&(j.memoizedState=E,pr=!0),j=j.queue,mx(hk.bind(null,x,j,c),[c]),j.getSnapshot!==d||P||Un!==null&&Un.memoizedState.tag&1){if(x.flags|=2048,fu(9,pk.bind(null,x,j,E,d),void 0,null),Hn===null)throw Error(n(349));(Vi&30)!==0||fk(x,d,E)}return E}function fk(c,d,x){c.flags|=16384,c={getSnapshot:d,value:x},d=cn.updateQueue,d===null?(d={lastEffect:null,stores:null},cn.updateQueue=d,d.stores=[c]):(x=d.stores,x===null?d.stores=[c]:x.push(c))}function pk(c,d,x,j){d.value=x,d.getSnapshot=j,mk(d)&&gk(c)}function hk(c,d,x){return x(function(){mk(d)&&gk(c)})}function mk(c){var d=c.getSnapshot;c=c.value;try{var x=d();return!as(c,x)}catch{return!0}}function gk(c){var d=bo(c,1);d!==null&&fs(d,c,1,-1)}function xk(c){var d=Us();return typeof c=="function"&&(c=c()),d.memoizedState=d.baseState=c,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:du,lastRenderedState:c},d.queue=c,c=c.dispatch=WI.bind(null,cn,c),[d.memoizedState,c]}function fu(c,d,x,j){return c={tag:c,create:d,destroy:x,deps:j,next:null},d=cn.updateQueue,d===null?(d={lastEffect:null,stores:null},cn.updateQueue=d,d.lastEffect=c.next=c):(x=d.lastEffect,x===null?d.lastEffect=c.next=c:(j=x.next,x.next=c,c.next=j,d.lastEffect=c)),c}function yk(){return Yr().memoizedState}function Lf(c,d,x,j){var E=Us();cn.flags|=c,E.memoizedState=fu(1|d,x,void 0,j===void 0?null:j)}function Of(c,d,x,j){var E=Yr();j=j===void 0?null:j;var P=void 0;if(Dn!==null){var G=Dn.memoizedState;if(P=G.destroy,j!==null&&ux(j,G.deps)){E.memoizedState=fu(d,x,P,j);return}}cn.flags|=c,E.memoizedState=fu(1|d,x,P,j)}function bk(c,d){return Lf(8390656,8,c,d)}function mx(c,d){return Of(2048,8,c,d)}function vk(c,d){return Of(4,2,c,d)}function wk(c,d){return Of(4,4,c,d)}function jk(c,d){if(typeof d=="function")return c=c(),d(c),function(){d(null)};if(d!=null)return c=c(),d.current=c,function(){d.current=null}}function kk(c,d,x){return x=x!=null?x.concat([c]):null,Of(4,4,jk.bind(null,d,c),x)}function gx(){}function Nk(c,d){var x=Yr();d=d===void 0?null:d;var j=x.memoizedState;return j!==null&&d!==null&&ux(d,j[1])?j[0]:(x.memoizedState=[c,d],c)}function Sk(c,d){var x=Yr();d=d===void 0?null:d;var j=x.memoizedState;return j!==null&&d!==null&&ux(d,j[1])?j[0]:(c=c(),x.memoizedState=[c,d],c)}function Ck(c,d,x){return(Vi&21)===0?(c.baseState&&(c.baseState=!1,pr=!0),c.memoizedState=x):(as(x,d)||(x=Ko(),cn.lanes|=x,Wi|=x,c.baseState=!0),d)}function HI(c,d){var x=Ft;Ft=x!==0&&4>x?x:4,c(!0);var j=cx.transition;cx.transition={};try{c(!1),d()}finally{Ft=x,cx.transition=j}}function Ek(){return Yr().memoizedState}function VI(c,d,x){var j=si(c);if(x={lane:j,action:x,hasEagerState:!1,eagerState:null,next:null},Tk(c))Rk(d,x);else if(x=ok(c,d,x,j),x!==null){var E=lr();fs(x,c,j,E),Ak(x,d,j)}}function WI(c,d,x){var j=si(c),E={lane:j,action:x,hasEagerState:!1,eagerState:null,next:null};if(Tk(c))Rk(d,E);else{var P=c.alternate;if(c.lanes===0&&(P===null||P.lanes===0)&&(P=d.lastRenderedReducer,P!==null))try{var G=d.lastRenderedState,ee=P(G,x);if(E.hasEagerState=!0,E.eagerState=ee,as(ee,G)){var se=d.interleaved;se===null?(E.next=E,rx(d)):(E.next=se.next,se.next=E),d.interleaved=E;return}}catch{}finally{}x=ok(c,d,E,j),x!==null&&(E=lr(),fs(x,c,j,E),Ak(x,d,j))}}function Tk(c){var d=c.alternate;return c===cn||d!==null&&d===cn}function Rk(c,d){cu=Mf=!0;var x=c.pending;x===null?d.next=d:(d.next=x.next,x.next=d),c.pending=d}function Ak(c,d,x){if((x&4194240)!==0){var j=d.lanes;j&=c.pendingLanes,x|=j,d.lanes=x,Is(c,x)}}var Ff={readContext:Gr,useCallback:Jn,useContext:Jn,useEffect:Jn,useImperativeHandle:Jn,useInsertionEffect:Jn,useLayoutEffect:Jn,useMemo:Jn,useReducer:Jn,useRef:Jn,useState:Jn,useDebugValue:Jn,useDeferredValue:Jn,useTransition:Jn,useMutableSource:Jn,useSyncExternalStore:Jn,useId:Jn,unstable_isNewReconciler:!1},KI={readContext:Gr,useCallback:function(c,d){return Us().memoizedState=[c,d===void 0?null:d],c},useContext:Gr,useEffect:bk,useImperativeHandle:function(c,d,x){return x=x!=null?x.concat([c]):null,Lf(4194308,4,jk.bind(null,d,c),x)},useLayoutEffect:function(c,d){return Lf(4194308,4,c,d)},useInsertionEffect:function(c,d){return Lf(4,2,c,d)},useMemo:function(c,d){var x=Us();return d=d===void 0?null:d,c=c(),x.memoizedState=[c,d],c},useReducer:function(c,d,x){var j=Us();return d=x!==void 0?x(d):d,j.memoizedState=j.baseState=d,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:d},j.queue=c,c=c.dispatch=VI.bind(null,cn,c),[j.memoizedState,c]},useRef:function(c){var d=Us();return c={current:c},d.memoizedState=c},useState:xk,useDebugValue:gx,useDeferredValue:function(c){return Us().memoizedState=c},useTransition:function(){var c=xk(!1),d=c[0];return c=HI.bind(null,c[1]),Us().memoizedState=c,[d,c]},useMutableSource:function(){},useSyncExternalStore:function(c,d,x){var j=cn,E=Us();if(rn){if(x===void 0)throw Error(n(407));x=x()}else{if(x=d(),Hn===null)throw Error(n(349));(Vi&30)!==0||fk(j,d,x)}E.memoizedState=x;var P={value:x,getSnapshot:d};return E.queue=P,bk(hk.bind(null,j,P,c),[c]),j.flags|=2048,fu(9,pk.bind(null,j,P,x,d),void 0,null),x},useId:function(){var c=Us(),d=Hn.identifierPrefix;if(rn){var x=yo,j=xo;x=(j&~(1<<32-Fn(j)-1)).toString(32)+x,d=":"+d+"R"+x,x=uu++,0<x&&(d+="H"+x.toString(32)),d+=":"}else x=UI++,d=":"+d+"r"+x.toString(32)+":";return c.memoizedState=d},unstable_isNewReconciler:!1},qI={readContext:Gr,useCallback:Nk,useContext:Gr,useEffect:mx,useImperativeHandle:kk,useInsertionEffect:vk,useLayoutEffect:wk,useMemo:Sk,useReducer:px,useRef:yk,useState:function(){return px(du)},useDebugValue:gx,useDeferredValue:function(c){var d=Yr();return Ck(d,Dn.memoizedState,c)},useTransition:function(){var c=px(du)[0],d=Yr().memoizedState;return[c,d]},useMutableSource:uk,useSyncExternalStore:dk,useId:Ek,unstable_isNewReconciler:!1},GI={readContext:Gr,useCallback:Nk,useContext:Gr,useEffect:mx,useImperativeHandle:kk,useInsertionEffect:vk,useLayoutEffect:wk,useMemo:Sk,useReducer:hx,useRef:yk,useState:function(){return hx(du)},useDebugValue:gx,useDeferredValue:function(c){var d=Yr();return Dn===null?d.memoizedState=c:Ck(d,Dn.memoizedState,c)},useTransition:function(){var c=hx(du)[0],d=Yr().memoizedState;return[c,d]},useMutableSource:uk,useSyncExternalStore:dk,useId:Ek,unstable_isNewReconciler:!1};function cs(c,d){if(c&&c.defaultProps){d=M({},d),c=c.defaultProps;for(var x in c)d[x]===void 0&&(d[x]=c[x]);return d}return d}function xx(c,d,x,j){d=c.memoizedState,x=x(j,d),x=x==null?d:M({},d,x),c.memoizedState=x,c.lanes===0&&(c.updateQueue.baseState=x)}var zf={isMounted:function(c){return(c=c._reactInternals)?wt(c)===c:!1},enqueueSetState:function(c,d,x){c=c._reactInternals;var j=lr(),E=si(c),P=vo(j,E);P.payload=d,x!=null&&(P.callback=x),d=ei(c,P,E),d!==null&&(fs(d,c,E,j),_f(d,c,E))},enqueueReplaceState:function(c,d,x){c=c._reactInternals;var j=lr(),E=si(c),P=vo(j,E);P.tag=1,P.payload=d,x!=null&&(P.callback=x),d=ei(c,P,E),d!==null&&(fs(d,c,E,j),_f(d,c,E))},enqueueForceUpdate:function(c,d){c=c._reactInternals;var x=lr(),j=si(c),E=vo(x,j);E.tag=2,d!=null&&(E.callback=d),d=ei(c,E,j),d!==null&&(fs(d,c,j,x),_f(d,c,j))}};function Pk(c,d,x,j,E,P,G){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(j,P,G):d.prototype&&d.prototype.isPureReactComponent?!Jc(x,j)||!Jc(E,P):!0}function _k(c,d,x){var j=!1,E=Qo,P=d.contextType;return typeof P=="object"&&P!==null?P=Gr(P):(E=fr(d)?Fi:Qn.current,j=d.contextTypes,P=(j=j!=null)?Za(c,E):Qo),d=new d(x,P),c.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=zf,c.stateNode=d,d._reactInternals=c,j&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=E,c.__reactInternalMemoizedMaskedChildContext=P),d}function Dk(c,d,x,j){c=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(x,j),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(x,j),d.state!==c&&zf.enqueueReplaceState(d,d.state,null)}function yx(c,d,x,j){var E=c.stateNode;E.props=x,E.state=c.memoizedState,E.refs={},sx(c);var P=d.contextType;typeof P=="object"&&P!==null?E.context=Gr(P):(P=fr(d)?Fi:Qn.current,E.context=Za(c,P)),E.state=c.memoizedState,P=d.getDerivedStateFromProps,typeof P=="function"&&(xx(c,d,P,x),E.state=c.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(d=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),d!==E.state&&zf.enqueueReplaceState(E,E.state,null),Df(c,x,E,j),E.state=c.memoizedState),typeof E.componentDidMount=="function"&&(c.flags|=4194308)}function al(c,d){try{var x="",j=d;do x+=J(j),j=j.return;while(j);var E=x}catch(P){E=`
|
|
39
|
+
Error generating stack: `+P.message+`
|
|
40
|
+
`+P.stack}return{value:c,source:d,stack:E,digest:null}}function bx(c,d,x){return{value:c,source:null,stack:x??null,digest:d??null}}function vx(c,d){try{console.error(d.value)}catch(x){setTimeout(function(){throw x})}}var YI=typeof WeakMap=="function"?WeakMap:Map;function $k(c,d,x){x=vo(-1,x),x.tag=3,x.payload={element:null};var j=d.value;return x.callback=function(){qf||(qf=!0,Ix=j),vx(c,d)},x}function Ik(c,d,x){x=vo(-1,x),x.tag=3;var j=c.type.getDerivedStateFromError;if(typeof j=="function"){var E=d.value;x.payload=function(){return j(E)},x.callback=function(){vx(c,d)}}var P=c.stateNode;return P!==null&&typeof P.componentDidCatch=="function"&&(x.callback=function(){vx(c,d),typeof j!="function"&&(ni===null?ni=new Set([this]):ni.add(this));var G=d.stack;this.componentDidCatch(d.value,{componentStack:G!==null?G:""})}),x}function Mk(c,d,x){var j=c.pingCache;if(j===null){j=c.pingCache=new YI;var E=new Set;j.set(d,E)}else E=j.get(d),E===void 0&&(E=new Set,j.set(d,E));E.has(x)||(E.add(x),c=cM.bind(null,c,d,x),d.then(c,c))}function Lk(c){do{var d;if((d=c.tag===13)&&(d=c.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return c;c=c.return}while(c!==null);return null}function Ok(c,d,x,j,E){return(c.mode&1)===0?(c===d?c.flags|=65536:(c.flags|=128,x.flags|=131072,x.flags&=-52805,x.tag===1&&(x.alternate===null?x.tag=17:(d=vo(-1,1),d.tag=2,ei(x,d,1))),x.lanes|=1),c):(c.flags|=65536,c.lanes=E,c)}var XI=C.ReactCurrentOwner,pr=!1;function ar(c,d,x,j){d.child=c===null?sk(d,null,x,j):rl(d,c.child,x,j)}function Fk(c,d,x,j,E){x=x.render;var P=d.ref;return ol(d,E),j=dx(c,d,x,j,P,E),x=fx(),c!==null&&!pr?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~E,wo(c,d,E)):(rn&&x&&Gg(d),d.flags|=1,ar(c,d,j,E),d.child)}function zk(c,d,x,j,E){if(c===null){var P=x.type;return typeof P=="function"&&!Ux(P)&&P.defaultProps===void 0&&x.compare===null&&x.defaultProps===void 0?(d.tag=15,d.type=P,Bk(c,d,P,j,E)):(c=Zf(x.type,null,j,d,d.mode,E),c.ref=d.ref,c.return=d,d.child=c)}if(P=c.child,(c.lanes&E)===0){var G=P.memoizedProps;if(x=x.compare,x=x!==null?x:Jc,x(G,j)&&c.ref===d.ref)return wo(c,d,E)}return d.flags|=1,c=ii(P,j),c.ref=d.ref,c.return=d,d.child=c}function Bk(c,d,x,j,E){if(c!==null){var P=c.memoizedProps;if(Jc(P,j)&&c.ref===d.ref)if(pr=!1,d.pendingProps=j=P,(c.lanes&E)!==0)(c.flags&131072)!==0&&(pr=!0);else return d.lanes=c.lanes,wo(c,d,E)}return wx(c,d,x,j,E)}function Uk(c,d,x){var j=d.pendingProps,E=j.children,P=c!==null?c.memoizedState:null;if(j.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},qt(cl,_r),_r|=x;else{if((x&1073741824)===0)return c=P!==null?P.baseLanes|x:x,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:c,cachePool:null,transitions:null},d.updateQueue=null,qt(cl,_r),_r|=c,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},j=P!==null?P.baseLanes:x,qt(cl,_r),_r|=j}else P!==null?(j=P.baseLanes|x,d.memoizedState=null):j=x,qt(cl,_r),_r|=j;return ar(c,d,E,x),d.child}function Hk(c,d){var x=d.ref;(c===null&&x!==null||c!==null&&c.ref!==x)&&(d.flags|=512,d.flags|=2097152)}function wx(c,d,x,j,E){var P=fr(x)?Fi:Qn.current;return P=Za(d,P),ol(d,E),x=dx(c,d,x,j,P,E),j=fx(),c!==null&&!pr?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~E,wo(c,d,E)):(rn&&j&&Gg(d),d.flags|=1,ar(c,d,x,E),d.child)}function Vk(c,d,x,j,E){if(fr(x)){var P=!0;Nf(d)}else P=!1;if(ol(d,E),d.stateNode===null)Uf(c,d),_k(d,x,j),yx(d,x,j,E),j=!0;else if(c===null){var G=d.stateNode,ee=d.memoizedProps;G.props=ee;var se=G.context,he=x.contextType;typeof he=="object"&&he!==null?he=Gr(he):(he=fr(x)?Fi:Qn.current,he=Za(d,he));var Te=x.getDerivedStateFromProps,$e=typeof Te=="function"||typeof G.getSnapshotBeforeUpdate=="function";$e||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(ee!==j||se!==he)&&Dk(d,G,j,he),Zo=!1;var Ee=d.memoizedState;G.state=Ee,Df(d,j,G,E),se=d.memoizedState,ee!==j||Ee!==se||dr.current||Zo?(typeof Te=="function"&&(xx(d,x,Te,j),se=d.memoizedState),(ee=Zo||Pk(d,x,ee,j,Ee,se,he))?($e||typeof G.UNSAFE_componentWillMount!="function"&&typeof G.componentWillMount!="function"||(typeof G.componentWillMount=="function"&&G.componentWillMount(),typeof G.UNSAFE_componentWillMount=="function"&&G.UNSAFE_componentWillMount()),typeof G.componentDidMount=="function"&&(d.flags|=4194308)):(typeof G.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=j,d.memoizedState=se),G.props=j,G.state=se,G.context=he,j=ee):(typeof G.componentDidMount=="function"&&(d.flags|=4194308),j=!1)}else{G=d.stateNode,ik(c,d),ee=d.memoizedProps,he=d.type===d.elementType?ee:cs(d.type,ee),G.props=he,$e=d.pendingProps,Ee=G.context,se=x.contextType,typeof se=="object"&&se!==null?se=Gr(se):(se=fr(x)?Fi:Qn.current,se=Za(d,se));var Ke=x.getDerivedStateFromProps;(Te=typeof Ke=="function"||typeof G.getSnapshotBeforeUpdate=="function")||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(ee!==$e||Ee!==se)&&Dk(d,G,j,se),Zo=!1,Ee=d.memoizedState,G.state=Ee,Df(d,j,G,E);var Ze=d.memoizedState;ee!==$e||Ee!==Ze||dr.current||Zo?(typeof Ke=="function"&&(xx(d,x,Ke,j),Ze=d.memoizedState),(he=Zo||Pk(d,x,he,j,Ee,Ze,se)||!1)?(Te||typeof G.UNSAFE_componentWillUpdate!="function"&&typeof G.componentWillUpdate!="function"||(typeof G.componentWillUpdate=="function"&&G.componentWillUpdate(j,Ze,se),typeof G.UNSAFE_componentWillUpdate=="function"&&G.UNSAFE_componentWillUpdate(j,Ze,se)),typeof G.componentDidUpdate=="function"&&(d.flags|=4),typeof G.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof G.componentDidUpdate!="function"||ee===c.memoizedProps&&Ee===c.memoizedState||(d.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||ee===c.memoizedProps&&Ee===c.memoizedState||(d.flags|=1024),d.memoizedProps=j,d.memoizedState=Ze),G.props=j,G.state=Ze,G.context=se,j=he):(typeof G.componentDidUpdate!="function"||ee===c.memoizedProps&&Ee===c.memoizedState||(d.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||ee===c.memoizedProps&&Ee===c.memoizedState||(d.flags|=1024),j=!1)}return jx(c,d,x,j,P,E)}function jx(c,d,x,j,E,P){Hk(c,d);var G=(d.flags&128)!==0;if(!j&&!G)return E&&Yj(d,x,!1),wo(c,d,P);j=d.stateNode,XI.current=d;var ee=G&&typeof x.getDerivedStateFromError!="function"?null:j.render();return d.flags|=1,c!==null&&G?(d.child=rl(d,c.child,null,P),d.child=rl(d,null,ee,P)):ar(c,d,ee,P),d.memoizedState=j.state,E&&Yj(d,x,!0),d.child}function Wk(c){var d=c.stateNode;d.pendingContext?qj(c,d.pendingContext,d.pendingContext!==d.context):d.context&&qj(c,d.context,!1),ox(c,d.containerInfo)}function Kk(c,d,x,j,E){return nl(),Jg(E),d.flags|=256,ar(c,d,x,j),d.child}var kx={dehydrated:null,treeContext:null,retryLane:0};function Nx(c){return{baseLanes:c,cachePool:null,transitions:null}}function qk(c,d,x){var j=d.pendingProps,E=ln.current,P=!1,G=(d.flags&128)!==0,ee;if((ee=G)||(ee=c!==null&&c.memoizedState===null?!1:(E&2)!==0),ee?(P=!0,d.flags&=-129):(c===null||c.memoizedState!==null)&&(E|=1),qt(ln,E&1),c===null)return Qg(d),c=d.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?((d.mode&1)===0?d.lanes=1:c.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(G=j.children,c=j.fallback,P?(j=d.mode,P=d.child,G={mode:"hidden",children:G},(j&1)===0&&P!==null?(P.childLanes=0,P.pendingProps=G):P=ep(G,j,0,null),c=Yi(c,j,x,null),P.return=d,c.return=d,P.sibling=c,d.child=P,d.child.memoizedState=Nx(x),d.memoizedState=kx,c):Sx(d,G));if(E=c.memoizedState,E!==null&&(ee=E.dehydrated,ee!==null))return QI(c,d,G,j,ee,E,x);if(P){P=j.fallback,G=d.mode,E=c.child,ee=E.sibling;var se={mode:"hidden",children:j.children};return(G&1)===0&&d.child!==E?(j=d.child,j.childLanes=0,j.pendingProps=se,d.deletions=null):(j=ii(E,se),j.subtreeFlags=E.subtreeFlags&14680064),ee!==null?P=ii(ee,P):(P=Yi(P,G,x,null),P.flags|=2),P.return=d,j.return=d,j.sibling=P,d.child=j,j=P,P=d.child,G=c.child.memoizedState,G=G===null?Nx(x):{baseLanes:G.baseLanes|x,cachePool:null,transitions:G.transitions},P.memoizedState=G,P.childLanes=c.childLanes&~x,d.memoizedState=kx,j}return P=c.child,c=P.sibling,j=ii(P,{mode:"visible",children:j.children}),(d.mode&1)===0&&(j.lanes=x),j.return=d,j.sibling=null,c!==null&&(x=d.deletions,x===null?(d.deletions=[c],d.flags|=16):x.push(c)),d.child=j,d.memoizedState=null,j}function Sx(c,d){return d=ep({mode:"visible",children:d},c.mode,0,null),d.return=c,c.child=d}function Bf(c,d,x,j){return j!==null&&Jg(j),rl(d,c.child,null,x),c=Sx(d,d.pendingProps.children),c.flags|=2,d.memoizedState=null,c}function QI(c,d,x,j,E,P,G){if(x)return d.flags&256?(d.flags&=-257,j=bx(Error(n(422))),Bf(c,d,G,j)):d.memoizedState!==null?(d.child=c.child,d.flags|=128,null):(P=j.fallback,E=d.mode,j=ep({mode:"visible",children:j.children},E,0,null),P=Yi(P,E,G,null),P.flags|=2,j.return=d,P.return=d,j.sibling=P,d.child=j,(d.mode&1)!==0&&rl(d,c.child,null,G),d.child.memoizedState=Nx(G),d.memoizedState=kx,P);if((d.mode&1)===0)return Bf(c,d,G,null);if(E.data==="$!"){if(j=E.nextSibling&&E.nextSibling.dataset,j)var ee=j.dgst;return j=ee,P=Error(n(419)),j=bx(P,j,void 0),Bf(c,d,G,j)}if(ee=(G&c.childLanes)!==0,pr||ee){if(j=Hn,j!==null){switch(G&-G){case 4:E=2;break;case 16:E=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:E=32;break;case 536870912:E=268435456;break;default:E=0}E=(E&(j.suspendedLanes|G))!==0?0:E,E!==0&&E!==P.retryLane&&(P.retryLane=E,bo(c,E),fs(j,c,E,-1))}return Bx(),j=bx(Error(n(421))),Bf(c,d,G,j)}return E.data==="$?"?(d.flags|=128,d.child=c.child,d=uM.bind(null,c),E._reactRetry=d,null):(c=P.treeContext,Pr=Yo(E.nextSibling),Ar=d,rn=!0,ls=null,c!==null&&(Kr[qr++]=xo,Kr[qr++]=yo,Kr[qr++]=zi,xo=c.id,yo=c.overflow,zi=d),d=Sx(d,j.children),d.flags|=4096,d)}function Gk(c,d,x){c.lanes|=d;var j=c.alternate;j!==null&&(j.lanes|=d),nx(c.return,d,x)}function Cx(c,d,x,j,E){var P=c.memoizedState;P===null?c.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:j,tail:x,tailMode:E}:(P.isBackwards=d,P.rendering=null,P.renderingStartTime=0,P.last=j,P.tail=x,P.tailMode=E)}function Yk(c,d,x){var j=d.pendingProps,E=j.revealOrder,P=j.tail;if(ar(c,d,j.children,x),j=ln.current,(j&2)!==0)j=j&1|2,d.flags|=128;else{if(c!==null&&(c.flags&128)!==0)e:for(c=d.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&Gk(c,x,d);else if(c.tag===19)Gk(c,x,d);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===d)break e;for(;c.sibling===null;){if(c.return===null||c.return===d)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}j&=1}if(qt(ln,j),(d.mode&1)===0)d.memoizedState=null;else switch(E){case"forwards":for(x=d.child,E=null;x!==null;)c=x.alternate,c!==null&&$f(c)===null&&(E=x),x=x.sibling;x=E,x===null?(E=d.child,d.child=null):(E=x.sibling,x.sibling=null),Cx(d,!1,E,x,P);break;case"backwards":for(x=null,E=d.child,d.child=null;E!==null;){if(c=E.alternate,c!==null&&$f(c)===null){d.child=E;break}c=E.sibling,E.sibling=x,x=E,E=c}Cx(d,!0,x,null,P);break;case"together":Cx(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function Uf(c,d){(d.mode&1)===0&&c!==null&&(c.alternate=null,d.alternate=null,d.flags|=2)}function wo(c,d,x){if(c!==null&&(d.dependencies=c.dependencies),Wi|=d.lanes,(x&d.childLanes)===0)return null;if(c!==null&&d.child!==c.child)throw Error(n(153));if(d.child!==null){for(c=d.child,x=ii(c,c.pendingProps),d.child=x,x.return=d;c.sibling!==null;)c=c.sibling,x=x.sibling=ii(c,c.pendingProps),x.return=d;x.sibling=null}return d.child}function JI(c,d,x){switch(d.tag){case 3:Wk(d),nl();break;case 5:ck(d);break;case 1:fr(d.type)&&Nf(d);break;case 4:ox(d,d.stateNode.containerInfo);break;case 10:var j=d.type._context,E=d.memoizedProps.value;qt(Af,j._currentValue),j._currentValue=E;break;case 13:if(j=d.memoizedState,j!==null)return j.dehydrated!==null?(qt(ln,ln.current&1),d.flags|=128,null):(x&d.child.childLanes)!==0?qk(c,d,x):(qt(ln,ln.current&1),c=wo(c,d,x),c!==null?c.sibling:null);qt(ln,ln.current&1);break;case 19:if(j=(x&d.childLanes)!==0,(c.flags&128)!==0){if(j)return Yk(c,d,x);d.flags|=128}if(E=d.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),qt(ln,ln.current),j)break;return null;case 22:case 23:return d.lanes=0,Uk(c,d,x)}return wo(c,d,x)}var Xk,Ex,Qk,Jk;Xk=function(c,d){for(var x=d.child;x!==null;){if(x.tag===5||x.tag===6)c.appendChild(x.stateNode);else if(x.tag!==4&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===d)break;for(;x.sibling===null;){if(x.return===null||x.return===d)return;x=x.return}x.sibling.return=x.return,x=x.sibling}},Ex=function(){},Qk=function(c,d,x,j){var E=c.memoizedProps;if(E!==j){c=d.stateNode,Hi(Bs.current);var P=null;switch(x){case"input":E=Be(c,E),j=Be(c,j),P=[];break;case"select":E=M({},E,{value:void 0}),j=M({},j,{value:void 0}),P=[];break;case"textarea":E=ot(c,E),j=ot(c,j),P=[];break;default:typeof E.onClick!="function"&&typeof j.onClick=="function"&&(c.onclick=wf)}fe(x,j);var G;x=null;for(he in E)if(!j.hasOwnProperty(he)&&E.hasOwnProperty(he)&&E[he]!=null)if(he==="style"){var ee=E[he];for(G in ee)ee.hasOwnProperty(G)&&(x||(x={}),x[G]="")}else he!=="dangerouslySetInnerHTML"&&he!=="children"&&he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&he!=="autoFocus"&&(o.hasOwnProperty(he)?P||(P=[]):(P=P||[]).push(he,null));for(he in j){var se=j[he];if(ee=E!=null?E[he]:void 0,j.hasOwnProperty(he)&&se!==ee&&(se!=null||ee!=null))if(he==="style")if(ee){for(G in ee)!ee.hasOwnProperty(G)||se&&se.hasOwnProperty(G)||(x||(x={}),x[G]="");for(G in se)se.hasOwnProperty(G)&&ee[G]!==se[G]&&(x||(x={}),x[G]=se[G])}else x||(P||(P=[]),P.push(he,x)),x=se;else he==="dangerouslySetInnerHTML"?(se=se?se.__html:void 0,ee=ee?ee.__html:void 0,se!=null&&ee!==se&&(P=P||[]).push(he,se)):he==="children"?typeof se!="string"&&typeof se!="number"||(P=P||[]).push(he,""+se):he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&(o.hasOwnProperty(he)?(se!=null&&he==="onScroll"&&Xt("scroll",c),P||ee===se||(P=[])):(P=P||[]).push(he,se))}x&&(P=P||[]).push("style",x);var he=P;(d.updateQueue=he)&&(d.flags|=4)}},Jk=function(c,d,x,j){x!==j&&(d.flags|=4)};function pu(c,d){if(!rn)switch(c.tailMode){case"hidden":d=c.tail;for(var x=null;d!==null;)d.alternate!==null&&(x=d),d=d.sibling;x===null?c.tail=null:x.sibling=null;break;case"collapsed":x=c.tail;for(var j=null;x!==null;)x.alternate!==null&&(j=x),x=x.sibling;j===null?d||c.tail===null?c.tail=null:c.tail.sibling=null:j.sibling=null}}function Zn(c){var d=c.alternate!==null&&c.alternate.child===c.child,x=0,j=0;if(d)for(var E=c.child;E!==null;)x|=E.lanes|E.childLanes,j|=E.subtreeFlags&14680064,j|=E.flags&14680064,E.return=c,E=E.sibling;else for(E=c.child;E!==null;)x|=E.lanes|E.childLanes,j|=E.subtreeFlags,j|=E.flags,E.return=c,E=E.sibling;return c.subtreeFlags|=j,c.childLanes=x,d}function ZI(c,d,x){var j=d.pendingProps;switch(Yg(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zn(d),null;case 1:return fr(d.type)&&kf(),Zn(d),null;case 3:return j=d.stateNode,il(),Qt(dr),Qt(Qn),lx(),j.pendingContext&&(j.context=j.pendingContext,j.pendingContext=null),(c===null||c.child===null)&&(Tf(d)?d.flags|=4:c===null||c.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,ls!==null&&(Ox(ls),ls=null))),Ex(c,d),Zn(d),null;case 5:ix(d);var E=Hi(lu.current);if(x=d.type,c!==null&&d.stateNode!=null)Qk(c,d,x,j,E),c.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!j){if(d.stateNode===null)throw Error(n(166));return Zn(d),null}if(c=Hi(Bs.current),Tf(d)){j=d.stateNode,x=d.type;var P=d.memoizedProps;switch(j[zs]=d,j[ru]=P,c=(d.mode&1)!==0,x){case"dialog":Xt("cancel",j),Xt("close",j);break;case"iframe":case"object":case"embed":Xt("load",j);break;case"video":case"audio":for(E=0;E<eu.length;E++)Xt(eu[E],j);break;case"source":Xt("error",j);break;case"img":case"image":case"link":Xt("error",j),Xt("load",j);break;case"details":Xt("toggle",j);break;case"input":ie(j,P),Xt("invalid",j);break;case"select":j._wrapperState={wasMultiple:!!P.multiple},Xt("invalid",j);break;case"textarea":St(j,P),Xt("invalid",j)}fe(x,P),E=null;for(var G in P)if(P.hasOwnProperty(G)){var ee=P[G];G==="children"?typeof ee=="string"?j.textContent!==ee&&(P.suppressHydrationWarning!==!0&&vf(j.textContent,ee,c),E=["children",ee]):typeof ee=="number"&&j.textContent!==""+ee&&(P.suppressHydrationWarning!==!0&&vf(j.textContent,ee,c),E=["children",""+ee]):o.hasOwnProperty(G)&&ee!=null&&G==="onScroll"&&Xt("scroll",j)}switch(x){case"input":Ce(j),Ae(j,P,!0);break;case"textarea":Ce(j),it(j);break;case"select":case"option":break;default:typeof P.onClick=="function"&&(j.onclick=wf)}j=E,d.updateQueue=j,j!==null&&(d.flags|=4)}else{G=E.nodeType===9?E:E.ownerDocument,c==="http://www.w3.org/1999/xhtml"&&(c=ce(x)),c==="http://www.w3.org/1999/xhtml"?x==="script"?(c=G.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild)):typeof j.is=="string"?c=G.createElement(x,{is:j.is}):(c=G.createElement(x),x==="select"&&(G=c,j.multiple?G.multiple=!0:j.size&&(G.size=j.size))):c=G.createElementNS(c,x),c[zs]=d,c[ru]=j,Xk(c,d,!1,!1),d.stateNode=c;e:{switch(G=q(x,j),x){case"dialog":Xt("cancel",c),Xt("close",c),E=j;break;case"iframe":case"object":case"embed":Xt("load",c),E=j;break;case"video":case"audio":for(E=0;E<eu.length;E++)Xt(eu[E],c);E=j;break;case"source":Xt("error",c),E=j;break;case"img":case"image":case"link":Xt("error",c),Xt("load",c),E=j;break;case"details":Xt("toggle",c),E=j;break;case"input":ie(c,j),E=Be(c,j),Xt("invalid",c);break;case"option":E=j;break;case"select":c._wrapperState={wasMultiple:!!j.multiple},E=M({},j,{value:void 0}),Xt("invalid",c);break;case"textarea":St(c,j),E=ot(c,j),Xt("invalid",c);break;default:E=j}fe(x,E),ee=E;for(P in ee)if(ee.hasOwnProperty(P)){var se=ee[P];P==="style"?Je(c,se):P==="dangerouslySetInnerHTML"?(se=se?se.__html:void 0,se!=null&&Pe(c,se)):P==="children"?typeof se=="string"?(x!=="textarea"||se!=="")&&We(c,se):typeof se=="number"&&We(c,""+se):P!=="suppressContentEditableWarning"&&P!=="suppressHydrationWarning"&&P!=="autoFocus"&&(o.hasOwnProperty(P)?se!=null&&P==="onScroll"&&Xt("scroll",c):se!=null&&N(c,P,se,G))}switch(x){case"input":Ce(c),Ae(c,j,!1);break;case"textarea":Ce(c),it(c);break;case"option":j.value!=null&&c.setAttribute("value",""+te(j.value));break;case"select":c.multiple=!!j.multiple,P=j.value,P!=null?Oe(c,!!j.multiple,P,!1):j.defaultValue!=null&&Oe(c,!!j.multiple,j.defaultValue,!0);break;default:typeof E.onClick=="function"&&(c.onclick=wf)}switch(x){case"button":case"input":case"select":case"textarea":j=!!j.autoFocus;break e;case"img":j=!0;break e;default:j=!1}}j&&(d.flags|=4)}d.ref!==null&&(d.flags|=512,d.flags|=2097152)}return Zn(d),null;case 6:if(c&&d.stateNode!=null)Jk(c,d,c.memoizedProps,j);else{if(typeof j!="string"&&d.stateNode===null)throw Error(n(166));if(x=Hi(lu.current),Hi(Bs.current),Tf(d)){if(j=d.stateNode,x=d.memoizedProps,j[zs]=d,(P=j.nodeValue!==x)&&(c=Ar,c!==null))switch(c.tag){case 3:vf(j.nodeValue,x,(c.mode&1)!==0);break;case 5:c.memoizedProps.suppressHydrationWarning!==!0&&vf(j.nodeValue,x,(c.mode&1)!==0)}P&&(d.flags|=4)}else j=(x.nodeType===9?x:x.ownerDocument).createTextNode(j),j[zs]=d,d.stateNode=j}return Zn(d),null;case 13:if(Qt(ln),j=d.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(rn&&Pr!==null&&(d.mode&1)!==0&&(d.flags&128)===0)tk(),nl(),d.flags|=98560,P=!1;else if(P=Tf(d),j!==null&&j.dehydrated!==null){if(c===null){if(!P)throw Error(n(318));if(P=d.memoizedState,P=P!==null?P.dehydrated:null,!P)throw Error(n(317));P[zs]=d}else nl(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Zn(d),P=!1}else ls!==null&&(Ox(ls),ls=null),P=!0;if(!P)return d.flags&65536?d:null}return(d.flags&128)!==0?(d.lanes=x,d):(j=j!==null,j!==(c!==null&&c.memoizedState!==null)&&j&&(d.child.flags|=8192,(d.mode&1)!==0&&(c===null||(ln.current&1)!==0?$n===0&&($n=3):Bx())),d.updateQueue!==null&&(d.flags|=4),Zn(d),null);case 4:return il(),Ex(c,d),c===null&&tu(d.stateNode.containerInfo),Zn(d),null;case 10:return tx(d.type._context),Zn(d),null;case 17:return fr(d.type)&&kf(),Zn(d),null;case 19:if(Qt(ln),P=d.memoizedState,P===null)return Zn(d),null;if(j=(d.flags&128)!==0,G=P.rendering,G===null)if(j)pu(P,!1);else{if($n!==0||c!==null&&(c.flags&128)!==0)for(c=d.child;c!==null;){if(G=$f(c),G!==null){for(d.flags|=128,pu(P,!1),j=G.updateQueue,j!==null&&(d.updateQueue=j,d.flags|=4),d.subtreeFlags=0,j=x,x=d.child;x!==null;)P=x,c=j,P.flags&=14680066,G=P.alternate,G===null?(P.childLanes=0,P.lanes=c,P.child=null,P.subtreeFlags=0,P.memoizedProps=null,P.memoizedState=null,P.updateQueue=null,P.dependencies=null,P.stateNode=null):(P.childLanes=G.childLanes,P.lanes=G.lanes,P.child=G.child,P.subtreeFlags=0,P.deletions=null,P.memoizedProps=G.memoizedProps,P.memoizedState=G.memoizedState,P.updateQueue=G.updateQueue,P.type=G.type,c=G.dependencies,P.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),x=x.sibling;return qt(ln,ln.current&1|2),d.child}c=c.sibling}P.tail!==null&&Ht()>ul&&(d.flags|=128,j=!0,pu(P,!1),d.lanes=4194304)}else{if(!j)if(c=$f(G),c!==null){if(d.flags|=128,j=!0,x=c.updateQueue,x!==null&&(d.updateQueue=x,d.flags|=4),pu(P,!0),P.tail===null&&P.tailMode==="hidden"&&!G.alternate&&!rn)return Zn(d),null}else 2*Ht()-P.renderingStartTime>ul&&x!==1073741824&&(d.flags|=128,j=!0,pu(P,!1),d.lanes=4194304);P.isBackwards?(G.sibling=d.child,d.child=G):(x=P.last,x!==null?x.sibling=G:d.child=G,P.last=G)}return P.tail!==null?(d=P.tail,P.rendering=d,P.tail=d.sibling,P.renderingStartTime=Ht(),d.sibling=null,x=ln.current,qt(ln,j?x&1|2:x&1),d):(Zn(d),null);case 22:case 23:return zx(),j=d.memoizedState!==null,c!==null&&c.memoizedState!==null!==j&&(d.flags|=8192),j&&(d.mode&1)!==0?(_r&1073741824)!==0&&(Zn(d),d.subtreeFlags&6&&(d.flags|=8192)):Zn(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function eM(c,d){switch(Yg(d),d.tag){case 1:return fr(d.type)&&kf(),c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 3:return il(),Qt(dr),Qt(Qn),lx(),c=d.flags,(c&65536)!==0&&(c&128)===0?(d.flags=c&-65537|128,d):null;case 5:return ix(d),null;case 13:if(Qt(ln),c=d.memoizedState,c!==null&&c.dehydrated!==null){if(d.alternate===null)throw Error(n(340));nl()}return c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 19:return Qt(ln),null;case 4:return il(),null;case 10:return tx(d.type._context),null;case 22:case 23:return zx(),null;case 24:return null;default:return null}}var Hf=!1,er=!1,tM=typeof WeakSet=="function"?WeakSet:Set,Xe=null;function ll(c,d){var x=c.ref;if(x!==null)if(typeof x=="function")try{x(null)}catch(j){dn(c,d,j)}else x.current=null}function Tx(c,d,x){try{x()}catch(j){dn(c,d,j)}}var Zk=!1;function nM(c,d){if(zg=hn,c=Pj(),_g(c)){if("selectionStart"in c)var x={start:c.selectionStart,end:c.selectionEnd};else e:{x=(x=c.ownerDocument)&&x.defaultView||window;var j=x.getSelection&&x.getSelection();if(j&&j.rangeCount!==0){x=j.anchorNode;var E=j.anchorOffset,P=j.focusNode;j=j.focusOffset;try{x.nodeType,P.nodeType}catch{x=null;break e}var G=0,ee=-1,se=-1,he=0,Te=0,$e=c,Ee=null;t:for(;;){for(var Ke;$e!==x||E!==0&&$e.nodeType!==3||(ee=G+E),$e!==P||j!==0&&$e.nodeType!==3||(se=G+j),$e.nodeType===3&&(G+=$e.nodeValue.length),(Ke=$e.firstChild)!==null;)Ee=$e,$e=Ke;for(;;){if($e===c)break t;if(Ee===x&&++he===E&&(ee=G),Ee===P&&++Te===j&&(se=G),(Ke=$e.nextSibling)!==null)break;$e=Ee,Ee=$e.parentNode}$e=Ke}x=ee===-1||se===-1?null:{start:ee,end:se}}else x=null}x=x||{start:0,end:0}}else x=null;for(Bg={focusedElem:c,selectionRange:x},hn=!1,Xe=d;Xe!==null;)if(d=Xe,c=d.child,(d.subtreeFlags&1028)!==0&&c!==null)c.return=d,Xe=c;else for(;Xe!==null;){d=Xe;try{var Ze=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Ze!==null){var tt=Ze.memoizedProps,mn=Ze.memoizedState,de=d.stateNode,ae=de.getSnapshotBeforeUpdate(d.elementType===d.type?tt:cs(d.type,tt),mn);de.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var pe=d.stateNode.containerInfo;pe.nodeType===1?pe.textContent="":pe.nodeType===9&&pe.documentElement&&pe.removeChild(pe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Le){dn(d,d.return,Le)}if(c=d.sibling,c!==null){c.return=d.return,Xe=c;break}Xe=d.return}return Ze=Zk,Zk=!1,Ze}function hu(c,d,x){var j=d.updateQueue;if(j=j!==null?j.lastEffect:null,j!==null){var E=j=j.next;do{if((E.tag&c)===c){var P=E.destroy;E.destroy=void 0,P!==void 0&&Tx(d,x,P)}E=E.next}while(E!==j)}}function Vf(c,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var x=d=d.next;do{if((x.tag&c)===c){var j=x.create;x.destroy=j()}x=x.next}while(x!==d)}}function Rx(c){var d=c.ref;if(d!==null){var x=c.stateNode;switch(c.tag){case 5:c=x;break;default:c=x}typeof d=="function"?d(c):d.current=c}}function e1(c){var d=c.alternate;d!==null&&(c.alternate=null,e1(d)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(d=c.stateNode,d!==null&&(delete d[zs],delete d[ru],delete d[Wg],delete d[OI],delete d[FI])),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function t1(c){return c.tag===5||c.tag===3||c.tag===4}function n1(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||t1(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function Ax(c,d,x){var j=c.tag;if(j===5||j===6)c=c.stateNode,d?x.nodeType===8?x.parentNode.insertBefore(c,d):x.insertBefore(c,d):(x.nodeType===8?(d=x.parentNode,d.insertBefore(c,x)):(d=x,d.appendChild(c)),x=x._reactRootContainer,x!=null||d.onclick!==null||(d.onclick=wf));else if(j!==4&&(c=c.child,c!==null))for(Ax(c,d,x),c=c.sibling;c!==null;)Ax(c,d,x),c=c.sibling}function Px(c,d,x){var j=c.tag;if(j===5||j===6)c=c.stateNode,d?x.insertBefore(c,d):x.appendChild(c);else if(j!==4&&(c=c.child,c!==null))for(Px(c,d,x),c=c.sibling;c!==null;)Px(c,d,x),c=c.sibling}var qn=null,us=!1;function ti(c,d,x){for(x=x.child;x!==null;)r1(c,d,x),x=x.sibling}function r1(c,d,x){if(ir&&typeof ir.onCommitFiberUnmount=="function")try{ir.onCommitFiberUnmount(Uo,x)}catch{}switch(x.tag){case 5:er||ll(x,d);case 6:var j=qn,E=us;qn=null,ti(c,d,x),qn=j,us=E,qn!==null&&(us?(c=qn,x=x.stateNode,c.nodeType===8?c.parentNode.removeChild(x):c.removeChild(x)):qn.removeChild(x.stateNode));break;case 18:qn!==null&&(us?(c=qn,x=x.stateNode,c.nodeType===8?Vg(c.parentNode,x):c.nodeType===1&&Vg(c,x),Bn(c)):Vg(qn,x.stateNode));break;case 4:j=qn,E=us,qn=x.stateNode.containerInfo,us=!0,ti(c,d,x),qn=j,us=E;break;case 0:case 11:case 14:case 15:if(!er&&(j=x.updateQueue,j!==null&&(j=j.lastEffect,j!==null))){E=j=j.next;do{var P=E,G=P.destroy;P=P.tag,G!==void 0&&((P&2)!==0||(P&4)!==0)&&Tx(x,d,G),E=E.next}while(E!==j)}ti(c,d,x);break;case 1:if(!er&&(ll(x,d),j=x.stateNode,typeof j.componentWillUnmount=="function"))try{j.props=x.memoizedProps,j.state=x.memoizedState,j.componentWillUnmount()}catch(ee){dn(x,d,ee)}ti(c,d,x);break;case 21:ti(c,d,x);break;case 22:x.mode&1?(er=(j=er)||x.memoizedState!==null,ti(c,d,x),er=j):ti(c,d,x);break;default:ti(c,d,x)}}function s1(c){var d=c.updateQueue;if(d!==null){c.updateQueue=null;var x=c.stateNode;x===null&&(x=c.stateNode=new tM),d.forEach(function(j){var E=dM.bind(null,c,j);x.has(j)||(x.add(j),j.then(E,E))})}}function ds(c,d){var x=d.deletions;if(x!==null)for(var j=0;j<x.length;j++){var E=x[j];try{var P=c,G=d,ee=G;e:for(;ee!==null;){switch(ee.tag){case 5:qn=ee.stateNode,us=!1;break e;case 3:qn=ee.stateNode.containerInfo,us=!0;break e;case 4:qn=ee.stateNode.containerInfo,us=!0;break e}ee=ee.return}if(qn===null)throw Error(n(160));r1(P,G,E),qn=null,us=!1;var se=E.alternate;se!==null&&(se.return=null),E.return=null}catch(he){dn(E,d,he)}}if(d.subtreeFlags&12854)for(d=d.child;d!==null;)o1(d,c),d=d.sibling}function o1(c,d){var x=c.alternate,j=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:if(ds(d,c),Hs(c),j&4){try{hu(3,c,c.return),Vf(3,c)}catch(tt){dn(c,c.return,tt)}try{hu(5,c,c.return)}catch(tt){dn(c,c.return,tt)}}break;case 1:ds(d,c),Hs(c),j&512&&x!==null&&ll(x,x.return);break;case 5:if(ds(d,c),Hs(c),j&512&&x!==null&&ll(x,x.return),c.flags&32){var E=c.stateNode;try{We(E,"")}catch(tt){dn(c,c.return,tt)}}if(j&4&&(E=c.stateNode,E!=null)){var P=c.memoizedProps,G=x!==null?x.memoizedProps:P,ee=c.type,se=c.updateQueue;if(c.updateQueue=null,se!==null)try{ee==="input"&&P.type==="radio"&&P.name!=null&&ve(E,P),q(ee,G);var he=q(ee,P);for(G=0;G<se.length;G+=2){var Te=se[G],$e=se[G+1];Te==="style"?Je(E,$e):Te==="dangerouslySetInnerHTML"?Pe(E,$e):Te==="children"?We(E,$e):N(E,Te,$e,he)}switch(ee){case"input":ye(E,P);break;case"textarea":ht(E,P);break;case"select":var Ee=E._wrapperState.wasMultiple;E._wrapperState.wasMultiple=!!P.multiple;var Ke=P.value;Ke!=null?Oe(E,!!P.multiple,Ke,!1):Ee!==!!P.multiple&&(P.defaultValue!=null?Oe(E,!!P.multiple,P.defaultValue,!0):Oe(E,!!P.multiple,P.multiple?[]:"",!1))}E[ru]=P}catch(tt){dn(c,c.return,tt)}}break;case 6:if(ds(d,c),Hs(c),j&4){if(c.stateNode===null)throw Error(n(162));E=c.stateNode,P=c.memoizedProps;try{E.nodeValue=P}catch(tt){dn(c,c.return,tt)}}break;case 3:if(ds(d,c),Hs(c),j&4&&x!==null&&x.memoizedState.isDehydrated)try{Bn(d.containerInfo)}catch(tt){dn(c,c.return,tt)}break;case 4:ds(d,c),Hs(c);break;case 13:ds(d,c),Hs(c),E=c.child,E.flags&8192&&(P=E.memoizedState!==null,E.stateNode.isHidden=P,!P||E.alternate!==null&&E.alternate.memoizedState!==null||($x=Ht())),j&4&&s1(c);break;case 22:if(Te=x!==null&&x.memoizedState!==null,c.mode&1?(er=(he=er)||Te,ds(d,c),er=he):ds(d,c),Hs(c),j&8192){if(he=c.memoizedState!==null,(c.stateNode.isHidden=he)&&!Te&&(c.mode&1)!==0)for(Xe=c,Te=c.child;Te!==null;){for($e=Xe=Te;Xe!==null;){switch(Ee=Xe,Ke=Ee.child,Ee.tag){case 0:case 11:case 14:case 15:hu(4,Ee,Ee.return);break;case 1:ll(Ee,Ee.return);var Ze=Ee.stateNode;if(typeof Ze.componentWillUnmount=="function"){j=Ee,x=Ee.return;try{d=j,Ze.props=d.memoizedProps,Ze.state=d.memoizedState,Ze.componentWillUnmount()}catch(tt){dn(j,x,tt)}}break;case 5:ll(Ee,Ee.return);break;case 22:if(Ee.memoizedState!==null){l1($e);continue}}Ke!==null?(Ke.return=Ee,Xe=Ke):l1($e)}Te=Te.sibling}e:for(Te=null,$e=c;;){if($e.tag===5){if(Te===null){Te=$e;try{E=$e.stateNode,he?(P=E.style,typeof P.setProperty=="function"?P.setProperty("display","none","important"):P.display="none"):(ee=$e.stateNode,se=$e.memoizedProps.style,G=se!=null&&se.hasOwnProperty("display")?se.display:null,ee.style.display=Qe("display",G))}catch(tt){dn(c,c.return,tt)}}}else if($e.tag===6){if(Te===null)try{$e.stateNode.nodeValue=he?"":$e.memoizedProps}catch(tt){dn(c,c.return,tt)}}else if(($e.tag!==22&&$e.tag!==23||$e.memoizedState===null||$e===c)&&$e.child!==null){$e.child.return=$e,$e=$e.child;continue}if($e===c)break e;for(;$e.sibling===null;){if($e.return===null||$e.return===c)break e;Te===$e&&(Te=null),$e=$e.return}Te===$e&&(Te=null),$e.sibling.return=$e.return,$e=$e.sibling}}break;case 19:ds(d,c),Hs(c),j&4&&s1(c);break;case 21:break;default:ds(d,c),Hs(c)}}function Hs(c){var d=c.flags;if(d&2){try{e:{for(var x=c.return;x!==null;){if(t1(x)){var j=x;break e}x=x.return}throw Error(n(160))}switch(j.tag){case 5:var E=j.stateNode;j.flags&32&&(We(E,""),j.flags&=-33);var P=n1(c);Px(c,P,E);break;case 3:case 4:var G=j.stateNode.containerInfo,ee=n1(c);Ax(c,ee,G);break;default:throw Error(n(161))}}catch(se){dn(c,c.return,se)}c.flags&=-3}d&4096&&(c.flags&=-4097)}function rM(c,d,x){Xe=c,i1(c)}function i1(c,d,x){for(var j=(c.mode&1)!==0;Xe!==null;){var E=Xe,P=E.child;if(E.tag===22&&j){var G=E.memoizedState!==null||Hf;if(!G){var ee=E.alternate,se=ee!==null&&ee.memoizedState!==null||er;ee=Hf;var he=er;if(Hf=G,(er=se)&&!he)for(Xe=E;Xe!==null;)G=Xe,se=G.child,G.tag===22&&G.memoizedState!==null?c1(E):se!==null?(se.return=G,Xe=se):c1(E);for(;P!==null;)Xe=P,i1(P),P=P.sibling;Xe=E,Hf=ee,er=he}a1(c)}else(E.subtreeFlags&8772)!==0&&P!==null?(P.return=E,Xe=P):a1(c)}}function a1(c){for(;Xe!==null;){var d=Xe;if((d.flags&8772)!==0){var x=d.alternate;try{if((d.flags&8772)!==0)switch(d.tag){case 0:case 11:case 15:er||Vf(5,d);break;case 1:var j=d.stateNode;if(d.flags&4&&!er)if(x===null)j.componentDidMount();else{var E=d.elementType===d.type?x.memoizedProps:cs(d.type,x.memoizedProps);j.componentDidUpdate(E,x.memoizedState,j.__reactInternalSnapshotBeforeUpdate)}var P=d.updateQueue;P!==null&&lk(d,P,j);break;case 3:var G=d.updateQueue;if(G!==null){if(x=null,d.child!==null)switch(d.child.tag){case 5:x=d.child.stateNode;break;case 1:x=d.child.stateNode}lk(d,G,x)}break;case 5:var ee=d.stateNode;if(x===null&&d.flags&4){x=ee;var se=d.memoizedProps;switch(d.type){case"button":case"input":case"select":case"textarea":se.autoFocus&&x.focus();break;case"img":se.src&&(x.src=se.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(d.memoizedState===null){var he=d.alternate;if(he!==null){var Te=he.memoizedState;if(Te!==null){var $e=Te.dehydrated;$e!==null&&Bn($e)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}er||d.flags&512&&Rx(d)}catch(Ee){dn(d,d.return,Ee)}}if(d===c){Xe=null;break}if(x=d.sibling,x!==null){x.return=d.return,Xe=x;break}Xe=d.return}}function l1(c){for(;Xe!==null;){var d=Xe;if(d===c){Xe=null;break}var x=d.sibling;if(x!==null){x.return=d.return,Xe=x;break}Xe=d.return}}function c1(c){for(;Xe!==null;){var d=Xe;try{switch(d.tag){case 0:case 11:case 15:var x=d.return;try{Vf(4,d)}catch(se){dn(d,x,se)}break;case 1:var j=d.stateNode;if(typeof j.componentDidMount=="function"){var E=d.return;try{j.componentDidMount()}catch(se){dn(d,E,se)}}var P=d.return;try{Rx(d)}catch(se){dn(d,P,se)}break;case 5:var G=d.return;try{Rx(d)}catch(se){dn(d,G,se)}}}catch(se){dn(d,d.return,se)}if(d===c){Xe=null;break}var ee=d.sibling;if(ee!==null){ee.return=d.return,Xe=ee;break}Xe=d.return}}var sM=Math.ceil,Wf=C.ReactCurrentDispatcher,_x=C.ReactCurrentOwner,Xr=C.ReactCurrentBatchConfig,It=0,Hn=null,bn=null,Gn=0,_r=0,cl=Xo(0),$n=0,mu=null,Wi=0,Kf=0,Dx=0,gu=null,hr=null,$x=0,ul=1/0,jo=null,qf=!1,Ix=null,ni=null,Gf=!1,ri=null,Yf=0,xu=0,Mx=null,Xf=-1,Qf=0;function lr(){return(It&6)!==0?Ht():Xf!==-1?Xf:Xf=Ht()}function si(c){return(c.mode&1)===0?1:(It&2)!==0&&Gn!==0?Gn&-Gn:BI.transition!==null?(Qf===0&&(Qf=Ko()),Qf):(c=Ft,c!==0||(c=window.event,c=c===void 0?16:dj(c.type)),c)}function fs(c,d,x,j){if(50<xu)throw xu=0,Mx=null,Error(n(185));zn(c,x,j),((It&2)===0||c!==Hn)&&(c===Hn&&((It&2)===0&&(Kf|=x),$n===4&&oi(c,Gn)),mr(c,j),x===1&&It===0&&(d.mode&1)===0&&(ul=Ht()+500,Sf&&Jo()))}function mr(c,d){var x=c.callbackNode;$i(c,d);var j=Vr(c,c===Hn?Gn:0);if(j===0)x!==null&&Oa(x),c.callbackNode=null,c.callbackPriority=0;else if(d=j&-j,c.callbackPriority!==d){if(x!=null&&Oa(x),d===1)c.tag===0?zI(d1.bind(null,c)):Xj(d1.bind(null,c)),MI(function(){(It&6)===0&&Jo()}),x=null;else{switch(uf(j)){case 1:x=co;break;case 4:x=zo;break;case 16:x=Ds;break;case 536870912:x=za;break;default:x=Ds}x=b1(x,u1.bind(null,c))}c.callbackPriority=d,c.callbackNode=x}}function u1(c,d){if(Xf=-1,Qf=0,(It&6)!==0)throw Error(n(327));var x=c.callbackNode;if(dl()&&c.callbackNode!==x)return null;var j=Vr(c,c===Hn?Gn:0);if(j===0)return null;if((j&30)!==0||(j&c.expiredLanes)!==0||d)d=Jf(c,j);else{d=j;var E=It;It|=2;var P=p1();(Hn!==c||Gn!==d)&&(jo=null,ul=Ht()+500,qi(c,d));do try{aM();break}catch(ee){f1(c,ee)}while(!0);ex(),Wf.current=P,It=E,bn!==null?d=0:(Hn=null,Gn=0,d=$n)}if(d!==0){if(d===2&&(E=Wo(c),E!==0&&(j=E,d=Lx(c,E))),d===1)throw x=mu,qi(c,0),oi(c,j),mr(c,Ht()),x;if(d===6)oi(c,j);else{if(E=c.current.alternate,(j&30)===0&&!oM(E)&&(d=Jf(c,j),d===2&&(P=Wo(c),P!==0&&(j=P,d=Lx(c,P))),d===1))throw x=mu,qi(c,0),oi(c,j),mr(c,Ht()),x;switch(c.finishedWork=E,c.finishedLanes=j,d){case 0:case 1:throw Error(n(345));case 2:Gi(c,hr,jo);break;case 3:if(oi(c,j),(j&130023424)===j&&(d=$x+500-Ht(),10<d)){if(Vr(c,0)!==0)break;if(E=c.suspendedLanes,(E&j)!==j){lr(),c.pingedLanes|=c.suspendedLanes&E;break}c.timeoutHandle=Hg(Gi.bind(null,c,hr,jo),d);break}Gi(c,hr,jo);break;case 4:if(oi(c,j),(j&4194240)===j)break;for(d=c.eventTimes,E=-1;0<j;){var G=31-Fn(j);P=1<<G,G=d[G],G>E&&(E=G),j&=~P}if(j=E,j=Ht()-j,j=(120>j?120:480>j?480:1080>j?1080:1920>j?1920:3e3>j?3e3:4320>j?4320:1960*sM(j/1960))-j,10<j){c.timeoutHandle=Hg(Gi.bind(null,c,hr,jo),j);break}Gi(c,hr,jo);break;case 5:Gi(c,hr,jo);break;default:throw Error(n(329))}}}return mr(c,Ht()),c.callbackNode===x?u1.bind(null,c):null}function Lx(c,d){var x=gu;return c.current.memoizedState.isDehydrated&&(qi(c,d).flags|=256),c=Jf(c,d),c!==2&&(d=hr,hr=x,d!==null&&Ox(d)),c}function Ox(c){hr===null?hr=c:hr.push.apply(hr,c)}function oM(c){for(var d=c;;){if(d.flags&16384){var x=d.updateQueue;if(x!==null&&(x=x.stores,x!==null))for(var j=0;j<x.length;j++){var E=x[j],P=E.getSnapshot;E=E.value;try{if(!as(P(),E))return!1}catch{return!1}}}if(x=d.child,d.subtreeFlags&16384&&x!==null)x.return=d,d=x;else{if(d===c)break;for(;d.sibling===null;){if(d.return===null||d.return===c)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function oi(c,d){for(d&=~Dx,d&=~Kf,c.suspendedLanes|=d,c.pingedLanes&=~d,c=c.expirationTimes;0<d;){var x=31-Fn(d),j=1<<x;c[x]=-1,d&=~j}}function d1(c){if((It&6)!==0)throw Error(n(327));dl();var d=Vr(c,0);if((d&1)===0)return mr(c,Ht()),null;var x=Jf(c,d);if(c.tag!==0&&x===2){var j=Wo(c);j!==0&&(d=j,x=Lx(c,j))}if(x===1)throw x=mu,qi(c,0),oi(c,d),mr(c,Ht()),x;if(x===6)throw Error(n(345));return c.finishedWork=c.current.alternate,c.finishedLanes=d,Gi(c,hr,jo),mr(c,Ht()),null}function Fx(c,d){var x=It;It|=1;try{return c(d)}finally{It=x,It===0&&(ul=Ht()+500,Sf&&Jo())}}function Ki(c){ri!==null&&ri.tag===0&&(It&6)===0&&dl();var d=It;It|=1;var x=Xr.transition,j=Ft;try{if(Xr.transition=null,Ft=1,c)return c()}finally{Ft=j,Xr.transition=x,It=d,(It&6)===0&&Jo()}}function zx(){_r=cl.current,Qt(cl)}function qi(c,d){c.finishedWork=null,c.finishedLanes=0;var x=c.timeoutHandle;if(x!==-1&&(c.timeoutHandle=-1,II(x)),bn!==null)for(x=bn.return;x!==null;){var j=x;switch(Yg(j),j.tag){case 1:j=j.type.childContextTypes,j!=null&&kf();break;case 3:il(),Qt(dr),Qt(Qn),lx();break;case 5:ix(j);break;case 4:il();break;case 13:Qt(ln);break;case 19:Qt(ln);break;case 10:tx(j.type._context);break;case 22:case 23:zx()}x=x.return}if(Hn=c,bn=c=ii(c.current,null),Gn=_r=d,$n=0,mu=null,Dx=Kf=Wi=0,hr=gu=null,Ui!==null){for(d=0;d<Ui.length;d++)if(x=Ui[d],j=x.interleaved,j!==null){x.interleaved=null;var E=j.next,P=x.pending;if(P!==null){var G=P.next;P.next=E,j.next=G}x.pending=j}Ui=null}return c}function f1(c,d){do{var x=bn;try{if(ex(),If.current=Ff,Mf){for(var j=cn.memoizedState;j!==null;){var E=j.queue;E!==null&&(E.pending=null),j=j.next}Mf=!1}if(Vi=0,Un=Dn=cn=null,cu=!1,uu=0,_x.current=null,x===null||x.return===null){$n=1,mu=d,bn=null;break}e:{var P=c,G=x.return,ee=x,se=d;if(d=Gn,ee.flags|=32768,se!==null&&typeof se=="object"&&typeof se.then=="function"){var he=se,Te=ee,$e=Te.tag;if((Te.mode&1)===0&&($e===0||$e===11||$e===15)){var Ee=Te.alternate;Ee?(Te.updateQueue=Ee.updateQueue,Te.memoizedState=Ee.memoizedState,Te.lanes=Ee.lanes):(Te.updateQueue=null,Te.memoizedState=null)}var Ke=Lk(G);if(Ke!==null){Ke.flags&=-257,Ok(Ke,G,ee,P,d),Ke.mode&1&&Mk(P,he,d),d=Ke,se=he;var Ze=d.updateQueue;if(Ze===null){var tt=new Set;tt.add(se),d.updateQueue=tt}else Ze.add(se);break e}else{if((d&1)===0){Mk(P,he,d),Bx();break e}se=Error(n(426))}}else if(rn&&ee.mode&1){var mn=Lk(G);if(mn!==null){(mn.flags&65536)===0&&(mn.flags|=256),Ok(mn,G,ee,P,d),Jg(al(se,ee));break e}}P=se=al(se,ee),$n!==4&&($n=2),gu===null?gu=[P]:gu.push(P),P=G;do{switch(P.tag){case 3:P.flags|=65536,d&=-d,P.lanes|=d;var de=$k(P,se,d);ak(P,de);break e;case 1:ee=se;var ae=P.type,pe=P.stateNode;if((P.flags&128)===0&&(typeof ae.getDerivedStateFromError=="function"||pe!==null&&typeof pe.componentDidCatch=="function"&&(ni===null||!ni.has(pe)))){P.flags|=65536,d&=-d,P.lanes|=d;var Le=Ik(P,ee,d);ak(P,Le);break e}}P=P.return}while(P!==null)}m1(x)}catch(st){d=st,bn===x&&x!==null&&(bn=x=x.return);continue}break}while(!0)}function p1(){var c=Wf.current;return Wf.current=Ff,c===null?Ff:c}function Bx(){($n===0||$n===3||$n===2)&&($n=4),Hn===null||(Wi&268435455)===0&&(Kf&268435455)===0||oi(Hn,Gn)}function Jf(c,d){var x=It;It|=2;var j=p1();(Hn!==c||Gn!==d)&&(jo=null,qi(c,d));do try{iM();break}catch(E){f1(c,E)}while(!0);if(ex(),It=x,Wf.current=j,bn!==null)throw Error(n(261));return Hn=null,Gn=0,$n}function iM(){for(;bn!==null;)h1(bn)}function aM(){for(;bn!==null&&!Bc();)h1(bn)}function h1(c){var d=y1(c.alternate,c,_r);c.memoizedProps=c.pendingProps,d===null?m1(c):bn=d,_x.current=null}function m1(c){var d=c;do{var x=d.alternate;if(c=d.return,(d.flags&32768)===0){if(x=ZI(x,d,_r),x!==null){bn=x;return}}else{if(x=eM(x,d),x!==null){x.flags&=32767,bn=x;return}if(c!==null)c.flags|=32768,c.subtreeFlags=0,c.deletions=null;else{$n=6,bn=null;return}}if(d=d.sibling,d!==null){bn=d;return}bn=d=c}while(d!==null);$n===0&&($n=5)}function Gi(c,d,x){var j=Ft,E=Xr.transition;try{Xr.transition=null,Ft=1,lM(c,d,x,j)}finally{Xr.transition=E,Ft=j}return null}function lM(c,d,x,j){do dl();while(ri!==null);if((It&6)!==0)throw Error(n(327));x=c.finishedWork;var E=c.finishedLanes;if(x===null)return null;if(c.finishedWork=null,c.finishedLanes=0,x===c.current)throw Error(n(177));c.callbackNode=null,c.callbackPriority=0;var P=x.lanes|x.childLanes;if(_n(c,P),c===Hn&&(bn=Hn=null,Gn=0),(x.subtreeFlags&2064)===0&&(x.flags&2064)===0||Gf||(Gf=!0,b1(Ds,function(){return dl(),null})),P=(x.flags&15990)!==0,(x.subtreeFlags&15990)!==0||P){P=Xr.transition,Xr.transition=null;var G=Ft;Ft=1;var ee=It;It|=4,_x.current=null,nM(c,x),o1(x,c),TI(Bg),hn=!!zg,Bg=zg=null,c.current=x,rM(x),Fa(),It=ee,Ft=G,Xr.transition=P}else c.current=x;if(Gf&&(Gf=!1,ri=c,Yf=E),P=c.pendingLanes,P===0&&(ni=null),ur(x.stateNode),mr(c,Ht()),d!==null)for(j=c.onRecoverableError,x=0;x<d.length;x++)E=d[x],j(E.value,{componentStack:E.stack,digest:E.digest});if(qf)throw qf=!1,c=Ix,Ix=null,c;return(Yf&1)!==0&&c.tag!==0&&dl(),P=c.pendingLanes,(P&1)!==0?c===Mx?xu++:(xu=0,Mx=c):xu=0,Jo(),null}function dl(){if(ri!==null){var c=uf(Yf),d=Xr.transition,x=Ft;try{if(Xr.transition=null,Ft=16>c?16:c,ri===null)var j=!1;else{if(c=ri,ri=null,Yf=0,(It&6)!==0)throw Error(n(331));var E=It;for(It|=4,Xe=c.current;Xe!==null;){var P=Xe,G=P.child;if((Xe.flags&16)!==0){var ee=P.deletions;if(ee!==null){for(var se=0;se<ee.length;se++){var he=ee[se];for(Xe=he;Xe!==null;){var Te=Xe;switch(Te.tag){case 0:case 11:case 15:hu(8,Te,P)}var $e=Te.child;if($e!==null)$e.return=Te,Xe=$e;else for(;Xe!==null;){Te=Xe;var Ee=Te.sibling,Ke=Te.return;if(e1(Te),Te===he){Xe=null;break}if(Ee!==null){Ee.return=Ke,Xe=Ee;break}Xe=Ke}}}var Ze=P.alternate;if(Ze!==null){var tt=Ze.child;if(tt!==null){Ze.child=null;do{var mn=tt.sibling;tt.sibling=null,tt=mn}while(tt!==null)}}Xe=P}}if((P.subtreeFlags&2064)!==0&&G!==null)G.return=P,Xe=G;else e:for(;Xe!==null;){if(P=Xe,(P.flags&2048)!==0)switch(P.tag){case 0:case 11:case 15:hu(9,P,P.return)}var de=P.sibling;if(de!==null){de.return=P.return,Xe=de;break e}Xe=P.return}}var ae=c.current;for(Xe=ae;Xe!==null;){G=Xe;var pe=G.child;if((G.subtreeFlags&2064)!==0&&pe!==null)pe.return=G,Xe=pe;else e:for(G=ae;Xe!==null;){if(ee=Xe,(ee.flags&2048)!==0)try{switch(ee.tag){case 0:case 11:case 15:Vf(9,ee)}}catch(st){dn(ee,ee.return,st)}if(ee===G){Xe=null;break e}var Le=ee.sibling;if(Le!==null){Le.return=ee.return,Xe=Le;break e}Xe=ee.return}}if(It=E,Jo(),ir&&typeof ir.onPostCommitFiberRoot=="function")try{ir.onPostCommitFiberRoot(Uo,c)}catch{}j=!0}return j}finally{Ft=x,Xr.transition=d}}return!1}function g1(c,d,x){d=al(x,d),d=$k(c,d,1),c=ei(c,d,1),d=lr(),c!==null&&(zn(c,1,d),mr(c,d))}function dn(c,d,x){if(c.tag===3)g1(c,c,x);else for(;d!==null;){if(d.tag===3){g1(d,c,x);break}else if(d.tag===1){var j=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof j.componentDidCatch=="function"&&(ni===null||!ni.has(j))){c=al(x,c),c=Ik(d,c,1),d=ei(d,c,1),c=lr(),d!==null&&(zn(d,1,c),mr(d,c));break}}d=d.return}}function cM(c,d,x){var j=c.pingCache;j!==null&&j.delete(d),d=lr(),c.pingedLanes|=c.suspendedLanes&x,Hn===c&&(Gn&x)===x&&($n===4||$n===3&&(Gn&130023424)===Gn&&500>Ht()-$x?qi(c,0):Dx|=x),mr(c,d)}function x1(c,d){d===0&&((c.mode&1)===0?d=1:(d=Kn,Kn<<=1,(Kn&130023424)===0&&(Kn=4194304)));var x=lr();c=bo(c,d),c!==null&&(zn(c,d,x),mr(c,x))}function uM(c){var d=c.memoizedState,x=0;d!==null&&(x=d.retryLane),x1(c,x)}function dM(c,d){var x=0;switch(c.tag){case 13:var j=c.stateNode,E=c.memoizedState;E!==null&&(x=E.retryLane);break;case 19:j=c.stateNode;break;default:throw Error(n(314))}j!==null&&j.delete(d),x1(c,x)}var y1;y1=function(c,d,x){if(c!==null)if(c.memoizedProps!==d.pendingProps||dr.current)pr=!0;else{if((c.lanes&x)===0&&(d.flags&128)===0)return pr=!1,JI(c,d,x);pr=(c.flags&131072)!==0}else pr=!1,rn&&(d.flags&1048576)!==0&&Qj(d,Ef,d.index);switch(d.lanes=0,d.tag){case 2:var j=d.type;Uf(c,d),c=d.pendingProps;var E=Za(d,Qn.current);ol(d,x),E=dx(null,d,j,c,E,x);var P=fx();return d.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,fr(j)?(P=!0,Nf(d)):P=!1,d.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,sx(d),E.updater=zf,d.stateNode=E,E._reactInternals=d,yx(d,j,c,x),d=jx(null,d,j,!0,P,x)):(d.tag=0,rn&&P&&Gg(d),ar(null,d,E,x),d=d.child),d;case 16:j=d.elementType;e:{switch(Uf(c,d),c=d.pendingProps,E=j._init,j=E(j._payload),d.type=j,E=d.tag=pM(j),c=cs(j,c),E){case 0:d=wx(null,d,j,c,x);break e;case 1:d=Vk(null,d,j,c,x);break e;case 11:d=Fk(null,d,j,c,x);break e;case 14:d=zk(null,d,j,cs(j.type,c),x);break e}throw Error(n(306,j,""))}return d;case 0:return j=d.type,E=d.pendingProps,E=d.elementType===j?E:cs(j,E),wx(c,d,j,E,x);case 1:return j=d.type,E=d.pendingProps,E=d.elementType===j?E:cs(j,E),Vk(c,d,j,E,x);case 3:e:{if(Wk(d),c===null)throw Error(n(387));j=d.pendingProps,P=d.memoizedState,E=P.element,ik(c,d),Df(d,j,null,x);var G=d.memoizedState;if(j=G.element,P.isDehydrated)if(P={element:j,isDehydrated:!1,cache:G.cache,pendingSuspenseBoundaries:G.pendingSuspenseBoundaries,transitions:G.transitions},d.updateQueue.baseState=P,d.memoizedState=P,d.flags&256){E=al(Error(n(423)),d),d=Kk(c,d,j,x,E);break e}else if(j!==E){E=al(Error(n(424)),d),d=Kk(c,d,j,x,E);break e}else for(Pr=Yo(d.stateNode.containerInfo.firstChild),Ar=d,rn=!0,ls=null,x=sk(d,null,j,x),d.child=x;x;)x.flags=x.flags&-3|4096,x=x.sibling;else{if(nl(),j===E){d=wo(c,d,x);break e}ar(c,d,j,x)}d=d.child}return d;case 5:return ck(d),c===null&&Qg(d),j=d.type,E=d.pendingProps,P=c!==null?c.memoizedProps:null,G=E.children,Ug(j,E)?G=null:P!==null&&Ug(j,P)&&(d.flags|=32),Hk(c,d),ar(c,d,G,x),d.child;case 6:return c===null&&Qg(d),null;case 13:return qk(c,d,x);case 4:return ox(d,d.stateNode.containerInfo),j=d.pendingProps,c===null?d.child=rl(d,null,j,x):ar(c,d,j,x),d.child;case 11:return j=d.type,E=d.pendingProps,E=d.elementType===j?E:cs(j,E),Fk(c,d,j,E,x);case 7:return ar(c,d,d.pendingProps,x),d.child;case 8:return ar(c,d,d.pendingProps.children,x),d.child;case 12:return ar(c,d,d.pendingProps.children,x),d.child;case 10:e:{if(j=d.type._context,E=d.pendingProps,P=d.memoizedProps,G=E.value,qt(Af,j._currentValue),j._currentValue=G,P!==null)if(as(P.value,G)){if(P.children===E.children&&!dr.current){d=wo(c,d,x);break e}}else for(P=d.child,P!==null&&(P.return=d);P!==null;){var ee=P.dependencies;if(ee!==null){G=P.child;for(var se=ee.firstContext;se!==null;){if(se.context===j){if(P.tag===1){se=vo(-1,x&-x),se.tag=2;var he=P.updateQueue;if(he!==null){he=he.shared;var Te=he.pending;Te===null?se.next=se:(se.next=Te.next,Te.next=se),he.pending=se}}P.lanes|=x,se=P.alternate,se!==null&&(se.lanes|=x),nx(P.return,x,d),ee.lanes|=x;break}se=se.next}}else if(P.tag===10)G=P.type===d.type?null:P.child;else if(P.tag===18){if(G=P.return,G===null)throw Error(n(341));G.lanes|=x,ee=G.alternate,ee!==null&&(ee.lanes|=x),nx(G,x,d),G=P.sibling}else G=P.child;if(G!==null)G.return=P;else for(G=P;G!==null;){if(G===d){G=null;break}if(P=G.sibling,P!==null){P.return=G.return,G=P;break}G=G.return}P=G}ar(c,d,E.children,x),d=d.child}return d;case 9:return E=d.type,j=d.pendingProps.children,ol(d,x),E=Gr(E),j=j(E),d.flags|=1,ar(c,d,j,x),d.child;case 14:return j=d.type,E=cs(j,d.pendingProps),E=cs(j.type,E),zk(c,d,j,E,x);case 15:return Bk(c,d,d.type,d.pendingProps,x);case 17:return j=d.type,E=d.pendingProps,E=d.elementType===j?E:cs(j,E),Uf(c,d),d.tag=1,fr(j)?(c=!0,Nf(d)):c=!1,ol(d,x),_k(d,j,E),yx(d,j,E,x),jx(null,d,j,!0,c,x);case 19:return Yk(c,d,x);case 22:return Uk(c,d,x)}throw Error(n(156,d.tag))};function b1(c,d){return La(c,d)}function fM(c,d,x,j){this.tag=c,this.key=x,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=j,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qr(c,d,x,j){return new fM(c,d,x,j)}function Ux(c){return c=c.prototype,!(!c||!c.isReactComponent)}function pM(c){if(typeof c=="function")return Ux(c)?1:0;if(c!=null){if(c=c.$$typeof,c===B)return 11;if(c===L)return 14}return 2}function ii(c,d){var x=c.alternate;return x===null?(x=Qr(c.tag,d,c.key,c.mode),x.elementType=c.elementType,x.type=c.type,x.stateNode=c.stateNode,x.alternate=c,c.alternate=x):(x.pendingProps=d,x.type=c.type,x.flags=0,x.subtreeFlags=0,x.deletions=null),x.flags=c.flags&14680064,x.childLanes=c.childLanes,x.lanes=c.lanes,x.child=c.child,x.memoizedProps=c.memoizedProps,x.memoizedState=c.memoizedState,x.updateQueue=c.updateQueue,d=c.dependencies,x.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},x.sibling=c.sibling,x.index=c.index,x.ref=c.ref,x}function Zf(c,d,x,j,E,P){var G=2;if(j=c,typeof c=="function")Ux(c)&&(G=1);else if(typeof c=="string")G=5;else e:switch(c){case A:return Yi(x.children,E,P,d);case I:G=8,E|=8;break;case _:return c=Qr(12,x,d,E|2),c.elementType=_,c.lanes=P,c;case V:return c=Qr(13,x,d,E),c.elementType=V,c.lanes=P,c;case $:return c=Qr(19,x,d,E),c.elementType=$,c.lanes=P,c;case K:return ep(x,E,P,d);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case z:G=10;break e;case O:G=9;break e;case B:G=11;break e;case L:G=14;break e;case U:G=16,j=null;break e}throw Error(n(130,c==null?c:typeof c,""))}return d=Qr(G,x,d,E),d.elementType=c,d.type=j,d.lanes=P,d}function Yi(c,d,x,j){return c=Qr(7,c,j,d),c.lanes=x,c}function ep(c,d,x,j){return c=Qr(22,c,j,d),c.elementType=K,c.lanes=x,c.stateNode={isHidden:!1},c}function Hx(c,d,x){return c=Qr(6,c,null,d),c.lanes=x,c}function Vx(c,d,x){return d=Qr(4,c.children!==null?c.children:[],c.key,d),d.lanes=x,d.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},d}function hM(c,d,x,j,E){this.tag=d,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$s(0),this.expirationTimes=$s(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$s(0),this.identifierPrefix=j,this.onRecoverableError=E,this.mutableSourceEagerHydrationData=null}function Wx(c,d,x,j,E,P,G,ee,se){return c=new hM(c,d,x,ee,se),d===1?(d=1,P===!0&&(d|=8)):d=0,P=Qr(3,null,null,d),c.current=P,P.stateNode=c,P.memoizedState={element:j,isDehydrated:x,cache:null,transitions:null,pendingSuspenseBoundaries:null},sx(P),c}function mM(c,d,x){var j=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:j==null?null:""+j,children:c,containerInfo:d,implementation:x}}function v1(c){if(!c)return Qo;c=c._reactInternals;e:{if(wt(c)!==c||c.tag!==1)throw Error(n(170));var d=c;do{switch(d.tag){case 3:d=d.stateNode.context;break e;case 1:if(fr(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(n(171))}if(c.tag===1){var x=c.type;if(fr(x))return Gj(c,x,d)}return d}function w1(c,d,x,j,E,P,G,ee,se){return c=Wx(x,j,!0,c,E,P,G,ee,se),c.context=v1(null),x=c.current,j=lr(),E=si(x),P=vo(j,E),P.callback=d??null,ei(x,P,E),c.current.lanes=E,zn(c,E,j),mr(c,j),c}function tp(c,d,x,j){var E=d.current,P=lr(),G=si(E);return x=v1(x),d.context===null?d.context=x:d.pendingContext=x,d=vo(P,G),d.payload={element:c},j=j===void 0?null:j,j!==null&&(d.callback=j),c=ei(E,d,G),c!==null&&(fs(c,E,G,P),_f(c,E,G)),G}function np(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return c.child.stateNode;default:return c.child.stateNode}}function j1(c,d){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var x=c.retryLane;c.retryLane=x!==0&&x<d?x:d}}function Kx(c,d){j1(c,d),(c=c.alternate)&&j1(c,d)}function gM(){return null}var k1=typeof reportError=="function"?reportError:function(c){console.error(c)};function qx(c){this._internalRoot=c}rp.prototype.render=qx.prototype.render=function(c){var d=this._internalRoot;if(d===null)throw Error(n(409));tp(c,d,null,null)},rp.prototype.unmount=qx.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var d=c.containerInfo;Ki(function(){tp(null,c,null,null)}),d[mo]=null}};function rp(c){this._internalRoot=c}rp.prototype.unstable_scheduleHydration=function(c){if(c){var d=fo();c={blockedOn:null,target:c,priority:d};for(var x=0;x<Os.length&&d!==0&&d<Os[x].priority;x++);Os.splice(x,0,c),x===0&&we(c)}};function Gx(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)}function sp(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11&&(c.nodeType!==8||c.nodeValue!==" react-mount-point-unstable "))}function N1(){}function xM(c,d,x,j,E){if(E){if(typeof j=="function"){var P=j;j=function(){var he=np(G);P.call(he)}}var G=w1(d,j,c,0,null,!1,!1,"",N1);return c._reactRootContainer=G,c[mo]=G.current,tu(c.nodeType===8?c.parentNode:c),Ki(),G}for(;E=c.lastChild;)c.removeChild(E);if(typeof j=="function"){var ee=j;j=function(){var he=np(se);ee.call(he)}}var se=Wx(c,0,!1,null,null,!1,!1,"",N1);return c._reactRootContainer=se,c[mo]=se.current,tu(c.nodeType===8?c.parentNode:c),Ki(function(){tp(d,se,x,j)}),se}function op(c,d,x,j,E){var P=x._reactRootContainer;if(P){var G=P;if(typeof E=="function"){var ee=E;E=function(){var se=np(G);ee.call(se)}}tp(d,G,c,E)}else G=xM(x,d,c,E,j);return np(G)}Vc=function(c){switch(c.tag){case 3:var d=c.stateNode;if(d.current.memoizedState.isDehydrated){var x=uo(d.pendingLanes);x!==0&&(Is(d,x|1),mr(d,Ht()),(It&6)===0&&(ul=Ht()+500,Jo()))}break;case 13:Ki(function(){var j=bo(c,1);if(j!==null){var E=lr();fs(j,c,1,E)}}),Kx(c,1)}},Ii=function(c){if(c.tag===13){var d=bo(c,134217728);if(d!==null){var x=lr();fs(d,c,134217728,x)}Kx(c,134217728)}},Wc=function(c){if(c.tag===13){var d=si(c),x=bo(c,d);if(x!==null){var j=lr();fs(x,c,d,j)}Kx(c,d)}},fo=function(){return Ft},Kc=function(c,d){var x=Ft;try{return Ft=c,d()}finally{Ft=x}},qe=function(c,d,x){switch(d){case"input":if(ye(c,x),d=x.name,x.type==="radio"&&d!=null){for(x=c;x.parentNode;)x=x.parentNode;for(x=x.querySelectorAll("input[name="+JSON.stringify(""+d)+'][type="radio"]'),d=0;d<x.length;d++){var j=x[d];if(j!==c&&j.form===c.form){var E=jf(j);if(!E)throw Error(n(90));Se(j),ye(j,E)}}}break;case"textarea":ht(c,x);break;case"select":d=x.value,d!=null&&Oe(c,!!x.multiple,d,!1)}},_t=Fx,Bt=Ki;var yM={usingClientEntryPoint:!1,Events:[su,Qa,jf,vt,nt,Fx]},yu={findFiberByHostInstance:Oi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},bM={bundleType:yu.bundleType,version:yu.version,rendererPackageName:yu.rendererPackageName,rendererConfig:yu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(c){return c=nn(c),c===null?null:c.stateNode},findFiberByHostInstance:yu.findFiberByHostInstance||gM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ip=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ip.isDisabled&&ip.supportsFiber)try{Uo=ip.inject(bM),ir=ip}catch{}}return gr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yM,gr.createPortal=function(c,d){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Gx(d))throw Error(n(200));return mM(c,d,null,x)},gr.createRoot=function(c,d){if(!Gx(c))throw Error(n(299));var x=!1,j="",E=k1;return d!=null&&(d.unstable_strictMode===!0&&(x=!0),d.identifierPrefix!==void 0&&(j=d.identifierPrefix),d.onRecoverableError!==void 0&&(E=d.onRecoverableError)),d=Wx(c,1,!1,null,null,x,!1,j,E),c[mo]=d.current,tu(c.nodeType===8?c.parentNode:c),new qx(d)},gr.findDOMNode=function(c){if(c==null)return null;if(c.nodeType===1)return c;var d=c._reactInternals;if(d===void 0)throw typeof c.render=="function"?Error(n(188)):(c=Object.keys(c).join(","),Error(n(268,c)));return c=nn(d),c=c===null?null:c.stateNode,c},gr.flushSync=function(c){return Ki(c)},gr.hydrate=function(c,d,x){if(!sp(d))throw Error(n(200));return op(null,c,d,!0,x)},gr.hydrateRoot=function(c,d,x){if(!Gx(c))throw Error(n(405));var j=x!=null&&x.hydratedSources||null,E=!1,P="",G=k1;if(x!=null&&(x.unstable_strictMode===!0&&(E=!0),x.identifierPrefix!==void 0&&(P=x.identifierPrefix),x.onRecoverableError!==void 0&&(G=x.onRecoverableError)),d=w1(d,null,c,1,x??null,E,!1,P,G),c[mo]=d.current,tu(c),j)for(c=0;c<j.length;c++)x=j[c],E=x._getVersion,E=E(x._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[x,E]:d.mutableSourceEagerHydrationData.push(x,E);return new rp(d)},gr.render=function(c,d,x){if(!sp(d))throw Error(n(200));return op(null,c,d,!1,x)},gr.unmountComponentAtNode=function(c){if(!sp(c))throw Error(n(40));return c._reactRootContainer?(Ki(function(){op(null,null,c,!1,function(){c._reactRootContainer=null,c[mo]=null})}),!0):!1},gr.unstable_batchedUpdates=Fx,gr.unstable_renderSubtreeIntoContainer=function(c,d,x,j){if(!sp(x))throw Error(n(200));if(c==null||c._reactInternals===void 0)throw Error(n(38));return op(c,d,x,!1,j)},gr.version="18.3.1-next-f1338f8080-20240426",gr}var _1;function o2(){if(_1)return Jx.exports;_1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Jx.exports=RM(),Jx.exports}var D1;function AM(){if(D1)return ap;D1=1;var e=o2();return ap.createRoot=e.createRoot,ap.hydrateRoot=e.hydrateRoot,ap}var PM=AM();/**
|
|
41
|
+
* react-router v7.13.1
|
|
42
|
+
*
|
|
43
|
+
* Copyright (c) Remix Software Inc.
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
+
*
|
|
48
|
+
* @license MIT
|
|
49
|
+
*/var $1="popstate";function I1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function _M(e={}){function t(r,o){var f;let i=(f=o.state)==null?void 0:f.masked,{pathname:a,search:l,hash:u}=i||r.location;return kb("",{pathname:a,search:l,hash:u},o.state&&o.state.usr||null,o.state&&o.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,o){return typeof o=="string"?o:id(o)}return $M(t,n,null,e)}function un(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function bs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function DM(){return Math.random().toString(36).substring(2,10)}function M1(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function kb(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?yc(t):t,state:n,key:t&&t.key||r||DM(),unstable_mask:o}}function id({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function yc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function $M(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:i=!1}=r,a=o.history,l="POP",u=null,f=p();f==null&&(f=0,a.replaceState({...a.state,idx:f},""));function p(){return(a.state||{idx:null}).idx}function h(){l="POP";let b=p(),w=b==null?null:b-f;f=b,u&&u({action:l,location:v.location,delta:w})}function g(b,w){l="PUSH";let S=I1(b)?b:kb(v.location,b,w);f=p()+1;let N=M1(S,f),C=v.createHref(S.unstable_mask||S);try{a.pushState(N,"",C)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;o.location.assign(C)}i&&u&&u({action:l,location:v.location,delta:1})}function y(b,w){l="REPLACE";let S=I1(b)?b:kb(v.location,b,w);f=p();let N=M1(S,f),C=v.createHref(S.unstable_mask||S);a.replaceState(N,"",C),i&&u&&u({action:l,location:v.location,delta:0})}function k(b){return IM(b)}let v={get action(){return l},get location(){return e(o,a)},listen(b){if(u)throw new Error("A history only accepts one active listener");return o.addEventListener($1,h),u=b,()=>{o.removeEventListener($1,h),u=null}},createHref(b){return t(o,b)},createURL:k,encodeLocation(b){let w=k(b);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:g,replace:y,go(b){return a.go(b)}};return v}function IM(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),un(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:id(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function i2(e,t,n="/"){return MM(e,t,n,!1)}function MM(e,t,n,r){let o=typeof t=="string"?yc(t):t,i=Po(o.pathname||"/",n);if(i==null)return null;let a=a2(e);LM(a);let l=null;for(let u=0;l==null&&u<a.length;++u){let f=GM(i);l=KM(a[u],f,r)}return l}function a2(e,t=[],n=[],r="",o=!1){let i=(a,l,u=o,f)=>{let p={relativePath:f===void 0?a.path||"":f,caseSensitive:a.caseSensitive===!0,childrenIndex:l,route:a};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&u)return;un(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let h=Zs([r,p.relativePath]),g=n.concat(p);a.children&&a.children.length>0&&(un(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),a2(a.children,t,g,h,u)),!(a.path==null&&!a.index)&&t.push({path:h,score:VM(h,a.index),routesMeta:g})};return e.forEach((a,l)=>{var u;if(a.path===""||!((u=a.path)!=null&&u.includes("?")))i(a,l);else for(let f of l2(a.path))i(a,l,!0,f)}),t}function l2(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let a=l2(r.join("/")),l=[];return l.push(...a.map(u=>u===""?i:[i,u].join("/"))),o&&l.push(...a),l.map(u=>e.startsWith("/")&&u===""?"/":u)}function LM(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:WM(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var OM=/^:[\w-]+$/,FM=3,zM=2,BM=1,UM=10,HM=-2,L1=e=>e==="*";function VM(e,t){let n=e.split("/"),r=n.length;return n.some(L1)&&(r+=HM),t&&(r+=zM),n.filter(o=>!L1(o)).reduce((o,i)=>o+(OM.test(i)?FM:i===""?BM:UM),r)}function WM(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function KM(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",a=[];for(let l=0;l<r.length;++l){let u=r[l],f=l===r.length-1,p=i==="/"?t:t.slice(i.length)||"/",h=ch({path:u.relativePath,caseSensitive:u.caseSensitive,end:f},p),g=u.route;if(!h&&f&&n&&!r[r.length-1].route.index&&(h=ch({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},p)),!h)return null;Object.assign(o,h.params),a.push({params:o,pathname:Zs([i,h.pathname]),pathnameBase:JM(Zs([i,h.pathnameBase])),route:g}),h.pathnameBase!=="/"&&(i=Zs([i,h.pathnameBase]))}return a}function ch(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=qM(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],a=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((f,{paramName:p,isOptional:h},g)=>{if(p==="*"){let k=l[g]||"";a=i.slice(0,i.length-k.length).replace(/(.)\/+$/,"$1")}const y=l[g];return h&&!y?f[p]=void 0:f[p]=(y||"").replace(/%2F/g,"/"),f},{}),pathname:i,pathnameBase:a,pattern:e}}function qM(e,t=!1,n=!0){bs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,u,f,p)=>{if(r.push({paramName:l,isOptional:u!=null}),u){let h=p.charAt(f+a.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function GM(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return bs(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Po(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var YM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function XM(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?yc(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=O1(n.substring(1),"/"):i=O1(n,t)):i=t,{pathname:i,search:ZM(r),hash:eL(o)}}function O1(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function ty(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function QM(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function c2(e){let t=QM(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function zv(e,t,n,r=!1){let o;typeof e=="string"?o=yc(e):(o={...e},un(!o.pathname||!o.pathname.includes("?"),ty("?","pathname","search",o)),un(!o.pathname||!o.pathname.includes("#"),ty("#","pathname","hash",o)),un(!o.search||!o.search.includes("#"),ty("#","search","hash",o)));let i=e===""||o.pathname==="",a=i?"/":o.pathname,l;if(a==null)l=n;else{let h=t.length-1;if(!r&&a.startsWith("..")){let g=a.split("/");for(;g[0]==="..";)g.shift(),h-=1;o.pathname=g.join("/")}l=h>=0?t[h]:"/"}let u=XM(o,l),f=a&&a!=="/"&&a.endsWith("/"),p=(i||a===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(f||p)&&(u.pathname+="/"),u}var Zs=e=>e.join("/").replace(/\/\/+/g,"/"),JM=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ZM=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,eL=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,tL=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function nL(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function rL(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var u2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function d2(e,t){let n=e;if(typeof n!="string"||!YM.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(u2)try{let i=new URL(window.location.href),a=n.startsWith("//")?new URL(i.protocol+n):new URL(n),l=Po(a.pathname,t);a.origin===i.origin&&l!=null?n=l+a.search+a.hash:o=!0}catch{bs(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var f2=["POST","PUT","PATCH","DELETE"];new Set(f2);var sL=["GET",...f2];new Set(sL);var bc=m.createContext(null);bc.displayName="DataRouter";var rm=m.createContext(null);rm.displayName="DataRouterState";var oL=m.createContext(!1),p2=m.createContext({isTransitioning:!1});p2.displayName="ViewTransition";var iL=m.createContext(new Map);iL.displayName="Fetchers";var aL=m.createContext(null);aL.displayName="Await";var ts=m.createContext(null);ts.displayName="Navigation";var Id=m.createContext(null);Id.displayName="Location";var Ts=m.createContext({outlet:null,matches:[],isDataRoute:!1});Ts.displayName="Route";var Bv=m.createContext(null);Bv.displayName="RouteError";var h2="REACT_ROUTER_ERROR",lL="REDIRECT",cL="ROUTE_ERROR_RESPONSE";function uL(e){if(e.startsWith(`${h2}:${lL}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function dL(e){if(e.startsWith(`${h2}:${cL}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new tL(t.status,t.statusText,t.data)}catch{}}function fL(e,{relative:t}={}){un(Md(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=m.useContext(ts),{hash:o,pathname:i,search:a}=Ld(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:Zs([n,i])),r.createHref({pathname:l,search:a,hash:o})}function Md(){return m.useContext(Id)!=null}function rr(){return un(Md(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(Id).location}var m2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function g2(e){m.useContext(ts).static||m.useLayoutEffect(e)}function Wt(){let{isDataRoute:e}=m.useContext(Ts);return e?EL():pL()}function pL(){un(Md(),"useNavigate() may be used only in the context of a <Router> component.");let e=m.useContext(bc),{basename:t,navigator:n}=m.useContext(ts),{matches:r}=m.useContext(Ts),{pathname:o}=rr(),i=JSON.stringify(c2(r)),a=m.useRef(!1);return g2(()=>{a.current=!0}),m.useCallback((u,f={})=>{if(bs(a.current,m2),!a.current)return;if(typeof u=="number"){n.go(u);return}let p=zv(u,JSON.parse(i),o,f.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Zs([t,p.pathname])),(f.replace?n.replace:n.push)(p,f.state,f)},[t,n,i,o,e])}var hL=m.createContext(null);function mL(e){let t=m.useContext(Ts).outlet;return m.useMemo(()=>t&&m.createElement(hL.Provider,{value:e},t),[t,e])}function Kt(){let{matches:e}=m.useContext(Ts),t=e[e.length-1];return t?t.params:{}}function Ld(e,{relative:t}={}){let{matches:n}=m.useContext(Ts),{pathname:r}=rr(),o=JSON.stringify(c2(n));return m.useMemo(()=>zv(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function gL(e,t){return x2(e,t)}function x2(e,t,n){var b;un(Md(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=m.useContext(ts),{matches:o}=m.useContext(Ts),i=o[o.length-1],a=i?i.params:{},l=i?i.pathname:"/",u=i?i.pathnameBase:"/",f=i&&i.route;{let w=f&&f.path||"";b2(l,!f||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
50
|
+
|
|
51
|
+
Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let p=rr(),h;if(t){let w=typeof t=="string"?yc(t):t;un(u==="/"||((b=w.pathname)==null?void 0:b.startsWith(u)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${w.pathname}" was given in the \`location\` prop.`),h=w}else h=p;let g=h.pathname||"/",y=g;if(u!=="/"){let w=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let k=i2(e,{pathname:y});bs(f||k!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),bs(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=wL(k&&k.map(w=>Object.assign({},w,{params:Object.assign({},a,w.params),pathname:Zs([u,r.encodeLocation?r.encodeLocation(w.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?u:Zs([u,r.encodeLocation?r.encodeLocation(w.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),o,n);return t&&v?m.createElement(Id.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},v):v}function xL(){let e=CL(),t=nL(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=m.createElement(m.Fragment,null,m.createElement("p",null,"💿 Hey developer 👋"),m.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",m.createElement("code",{style:i},"ErrorBoundary")," or"," ",m.createElement("code",{style:i},"errorElement")," prop on your route.")),m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},t),n?m.createElement("pre",{style:o},n):null,a)}var yL=m.createElement(xL,null),y2=class extends m.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=dL(e.digest);n&&(e=n)}let t=e!==void 0?m.createElement(Ts.Provider,{value:this.props.routeContext},m.createElement(Bv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?m.createElement(bL,{error:e},t):t}};y2.contextType=oL;var ny=new WeakMap;function bL({children:e,error:t}){let{basename:n}=m.useContext(ts);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=uL(t.digest);if(r){let o=ny.get(t);if(o)throw o;let i=d2(r.location,n);if(u2&&!ny.get(t))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw ny.set(t,a),a}return m.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function vL({routeContext:e,match:t,children:n}){let r=m.useContext(bc);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),m.createElement(Ts.Provider,{value:e},n)}function wL(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,i=r==null?void 0:r.errors;if(i!=null){let p=o.findIndex(h=>h.route.id&&(i==null?void 0:i[h.route.id])!==void 0);un(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,p+1))}let a=!1,l=-1;if(n&&r){a=r.renderFallback;for(let p=0;p<o.length;p++){let h=o[p];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(l=p),h.route.id){let{loaderData:g,errors:y}=r,k=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!y||y[h.route.id]===void 0);if(h.route.lazy||k){n.isStatic&&(a=!0),l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}}let u=n==null?void 0:n.onError,f=r&&u?(p,h)=>{var g,y;u(p,{location:r.location,params:((y=(g=r.matches)==null?void 0:g[0])==null?void 0:y.params)??{},unstable_pattern:rL(r.matches),errorInfo:h})}:void 0;return o.reduceRight((p,h,g)=>{let y,k=!1,v=null,b=null;r&&(y=i&&h.route.id?i[h.route.id]:void 0,v=h.route.errorElement||yL,a&&(l<0&&g===0?(b2("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,b=null):l===g&&(k=!0,b=h.route.hydrateFallbackElement||null)));let w=t.concat(o.slice(0,g+1)),S=()=>{let N;return y?N=v:k?N=b:h.route.Component?N=m.createElement(h.route.Component,null):h.route.element?N=h.route.element:N=p,m.createElement(vL,{match:h,routeContext:{outlet:p,matches:w,isDataRoute:r!=null},children:N})};return r&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?m.createElement(y2,{location:r.location,revalidation:r.revalidation,component:v,error:y,children:S(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:f}):S()},null)}function Uv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function jL(e){let t=m.useContext(bc);return un(t,Uv(e)),t}function kL(e){let t=m.useContext(rm);return un(t,Uv(e)),t}function NL(e){let t=m.useContext(Ts);return un(t,Uv(e)),t}function Hv(e){let t=NL(e),n=t.matches[t.matches.length-1];return un(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function SL(){return Hv("useRouteId")}function CL(){var r;let e=m.useContext(Bv),t=kL("useRouteError"),n=Hv("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function EL(){let{router:e}=jL("useNavigate"),t=Hv("useNavigate"),n=m.useRef(!1);return g2(()=>{n.current=!0}),m.useCallback(async(o,i={})=>{bs(n.current,m2),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var F1={};function b2(e,t,n){!t&&!F1[e]&&(F1[e]=!0,bs(!1,n))}m.memo(TL);function TL({routes:e,future:t,state:n,isStatic:r,onError:o}){return x2(e,void 0,{state:n,isStatic:r,onError:o})}function RL(e){return mL(e.context)}function Ge(e){un(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function AL({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:i=!1,unstable_useTransitions:a}){un(!Md(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),u=m.useMemo(()=>({basename:l,navigator:o,static:i,unstable_useTransitions:a,future:{}}),[l,o,i,a]);typeof n=="string"&&(n=yc(n));let{pathname:f="/",search:p="",hash:h="",state:g=null,key:y="default",unstable_mask:k}=n,v=m.useMemo(()=>{let b=Po(f,l);return b==null?null:{location:{pathname:b,search:p,hash:h,state:g,key:y,unstable_mask:k},navigationType:r}},[l,f,p,h,g,y,r,k]);return bs(v!=null,`<Router basename="${l}"> is not able to match the URL "${f}${p}${h}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:m.createElement(ts.Provider,{value:u},m.createElement(Id.Provider,{children:t,value:v}))}function PL({children:e,location:t}){return gL(Nb(e),t)}function Nb(e,t=[]){let n=[];return m.Children.forEach(e,(r,o)=>{if(!m.isValidElement(r))return;let i=[...t,o];if(r.type===m.Fragment){n.push.apply(n,Nb(r.props.children,i));return}un(r.type===Ge,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),un(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=Nb(r.props.children,i)),n.push(a)}),n}var Lp="get",Op="application/x-www-form-urlencoded";function sm(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function _L(e){return sm(e)&&e.tagName.toLowerCase()==="button"}function DL(e){return sm(e)&&e.tagName.toLowerCase()==="form"}function $L(e){return sm(e)&&e.tagName.toLowerCase()==="input"}function IL(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ML(e,t){return e.button===0&&(!t||t==="_self")&&!IL(e)}function Sb(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function LL(e,t){let n=Sb(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var lp=null;function OL(){if(lp===null)try{new FormData(document.createElement("form"),0),lp=!1}catch{lp=!0}return lp}var FL=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ry(e){return e!=null&&!FL.has(e)?(bs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Op}"`),null):e}function zL(e,t){let n,r,o,i,a;if(DL(e)){let l=e.getAttribute("action");r=l?Po(l,t):null,n=e.getAttribute("method")||Lp,o=ry(e.getAttribute("enctype"))||Op,i=new FormData(e)}else if(_L(e)||$L(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||l.getAttribute("action");if(r=u?Po(u,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Lp,o=ry(e.getAttribute("formenctype"))||ry(l.getAttribute("enctype"))||Op,i=new FormData(l,e),!OL()){let{name:f,type:p,value:h}=e;if(p==="image"){let g=f?`${f}.`:"";i.append(`${g}x`,"0"),i.append(`${g}y`,"0")}else f&&i.append(f,h)}}else{if(sm(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Lp,r=null,o=Op,a=e}return i&&o==="text/plain"&&(a=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Vv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function BL(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Po(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function UL(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function HL(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function VL(e,t,n){let r=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let a=await UL(i,n);return a.links?a.links():[]}return[]}));return GL(r.flat(1).filter(HL).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function z1(e,t,n,r,o,i){let a=(u,f)=>n[f]?u.route.id!==n[f].route.id:!0,l=(u,f)=>{var p;return n[f].pathname!==u.pathname||((p=n[f].route.path)==null?void 0:p.endsWith("*"))&&n[f].params["*"]!==u.params["*"]};return i==="assets"?t.filter((u,f)=>a(u,f)||l(u,f)):i==="data"?t.filter((u,f)=>{var h;let p=r.routes[u.route.id];if(!p||!p.hasLoader)return!1;if(a(u,f)||l(u,f))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((h=n[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function WL(e,t,{includeHydrateFallback:n}={}){return KL(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function KL(e){return[...new Set(e)]}function qL(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function GL(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let i=JSON.stringify(qL(o));return n.has(i)||(n.add(i),r.push({key:i,link:o})),r},[])}function v2(){let e=m.useContext(bc);return Vv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function YL(){let e=m.useContext(rm);return Vv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Wv=m.createContext(void 0);Wv.displayName="FrameworkContext";function w2(){let e=m.useContext(Wv);return Vv(e,"You must render this element inside a <HydratedRouter> element"),e}function XL(e,t){let n=m.useContext(Wv),[r,o]=m.useState(!1),[i,a]=m.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:f,onMouseLeave:p,onTouchStart:h}=t,g=m.useRef(null);m.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let v=w=>{w.forEach(S=>{a(S.isIntersecting)})},b=new IntersectionObserver(v,{threshold:.5});return g.current&&b.observe(g.current),()=>{b.disconnect()}}},[e]),m.useEffect(()=>{if(r){let v=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(v)}}},[r]);let y=()=>{o(!0)},k=()=>{o(!1),a(!1)};return n?e!=="intent"?[i,g,{}]:[i,g,{onFocus:vu(l,y),onBlur:vu(u,k),onMouseEnter:vu(f,y),onMouseLeave:vu(p,k),onTouchStart:vu(h,y)}]:[!1,g,{}]}function vu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function QL({page:e,...t}){let{router:n}=v2(),r=m.useMemo(()=>i2(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?m.createElement(ZL,{page:e,matches:r,...t}):null}function JL(e){let{manifest:t,routeModules:n}=w2(),[r,o]=m.useState([]);return m.useEffect(()=>{let i=!1;return VL(e,t,n).then(a=>{i||o(a)}),()=>{i=!0}},[e,t,n]),r}function ZL({page:e,matches:t,...n}){let r=rr(),{future:o,manifest:i,routeModules:a}=w2(),{basename:l}=v2(),{loaderData:u,matches:f}=YL(),p=m.useMemo(()=>z1(e,t,f,i,r,"data"),[e,t,f,i,r]),h=m.useMemo(()=>z1(e,t,f,i,r,"assets"),[e,t,f,i,r]),g=m.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let v=new Set,b=!1;if(t.forEach(S=>{var C;let N=i.routes[S.route.id];!N||!N.hasLoader||(!p.some(R=>R.route.id===S.route.id)&&S.route.id in u&&((C=a[S.route.id])!=null&&C.shouldRevalidate)||N.hasClientLoader?b=!0:v.add(S.route.id))}),v.size===0)return[];let w=BL(e,l,o.unstable_trailingSlashAwareDataRequests,"data");return b&&v.size>0&&w.searchParams.set("_routes",t.filter(S=>v.has(S.route.id)).map(S=>S.route.id).join(",")),[w.pathname+w.search]},[l,o.unstable_trailingSlashAwareDataRequests,u,r,i,p,t,e,a]),y=m.useMemo(()=>WL(h,i),[h,i]),k=JL(h);return m.createElement(m.Fragment,null,g.map(v=>m.createElement("link",{key:v,rel:"prefetch",as:"fetch",href:v,...n})),y.map(v=>m.createElement("link",{key:v,rel:"modulepreload",href:v,...n})),k.map(({key:v,link:b})=>m.createElement("link",{key:v,nonce:n.nonce,...b,crossOrigin:b.crossOrigin??n.crossOrigin})))}function e5(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var t5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{t5&&(window.__reactRouterVersion="7.13.1")}catch{}function n5({basename:e,children:t,unstable_useTransitions:n,window:r}){let o=m.useRef();o.current==null&&(o.current=_M({window:r,v5Compat:!0}));let i=o.current,[a,l]=m.useState({action:i.action,location:i.location}),u=m.useCallback(f=>{n===!1?l(f):m.startTransition(()=>l(f))},[n]);return m.useLayoutEffect(()=>i.listen(u),[i,u]),m.createElement(AL,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,unstable_useTransitions:n})}var j2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_e=m.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:i,replace:a,unstable_mask:l,state:u,target:f,to:p,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...k},v){let{basename:b,navigator:w,unstable_useTransitions:S}=m.useContext(ts),N=typeof p=="string"&&j2.test(p),C=d2(p,b);p=C.to;let R=fL(p,{relative:o}),T=rr(),A=null;if(l){let L=zv(l,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);b!=="/"&&(L.pathname=L.pathname==="/"?b:Zs([b,L.pathname])),A=w.createHref(L)}let[I,_,z]=XL(r,k),O=i5(p,{replace:a,unstable_mask:l,state:u,target:f,preventScrollReset:h,relative:o,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:S});function B(L){t&&t(L),L.defaultPrevented||O(L)}let V=!(C.isExternal||i),$=m.createElement("a",{...k,...z,href:(V?A:void 0)||C.absoluteURL||R,onClick:V?B:t,ref:e5(v,_),target:f,"data-discover":!N&&n==="render"?"true":void 0});return I&&!N?m.createElement(m.Fragment,null,$,m.createElement(QL,{page:R})):$});_e.displayName="Link";var r5=m.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:i,to:a,viewTransition:l,children:u,...f},p){let h=Ld(a,{relative:f.relative}),g=rr(),y=m.useContext(rm),{navigator:k,basename:v}=m.useContext(ts),b=y!=null&&d5(h)&&l===!0,w=k.encodeLocation?k.encodeLocation(h).pathname:h.pathname,S=g.pathname,N=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(S=S.toLowerCase(),N=N?N.toLowerCase():null,w=w.toLowerCase()),N&&v&&(N=Po(N,v)||N);const C=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let R=S===w||!o&&S.startsWith(w)&&S.charAt(C)==="/",T=N!=null&&(N===w||!o&&N.startsWith(w)&&N.charAt(w.length)==="/"),A={isActive:R,isPending:T,isTransitioning:b},I=R?t:void 0,_;typeof r=="function"?_=r(A):_=[r,R?"active":null,T?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let z=typeof i=="function"?i(A):i;return m.createElement(_e,{...f,"aria-current":I,className:_,ref:p,style:z,to:a,viewTransition:l},typeof u=="function"?u(A):u)});r5.displayName="NavLink";var s5=m.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:i,method:a=Lp,action:l,onSubmit:u,relative:f,preventScrollReset:p,viewTransition:h,unstable_defaultShouldRevalidate:g,...y},k)=>{let{unstable_useTransitions:v}=m.useContext(ts),b=c5(),w=u5(l,{relative:f}),S=a.toLowerCase()==="get"?"get":"post",N=typeof l=="string"&&j2.test(l),C=R=>{if(u&&u(R),R.defaultPrevented)return;R.preventDefault();let T=R.nativeEvent.submitter,A=(T==null?void 0:T.getAttribute("formmethod"))||a,I=()=>b(T||R.currentTarget,{fetcherKey:t,method:A,navigate:n,replace:o,state:i,relative:f,preventScrollReset:p,viewTransition:h,unstable_defaultShouldRevalidate:g});v&&n!==!1?m.startTransition(()=>I()):I()};return m.createElement("form",{ref:k,method:S,action:w,onSubmit:r?u:C,...y,"data-discover":!N&&e==="render"?"true":void 0})});s5.displayName="Form";function o5(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function k2(e){let t=m.useContext(bc);return un(t,o5(e)),t}function i5(e,{target:t,replace:n,unstable_mask:r,state:o,preventScrollReset:i,relative:a,viewTransition:l,unstable_defaultShouldRevalidate:u,unstable_useTransitions:f}={}){let p=Wt(),h=rr(),g=Ld(e,{relative:a});return m.useCallback(y=>{if(ML(y,t)){y.preventDefault();let k=n!==void 0?n:id(h)===id(g),v=()=>p(e,{replace:k,unstable_mask:r,state:o,preventScrollReset:i,relative:a,viewTransition:l,unstable_defaultShouldRevalidate:u});f?m.startTransition(()=>v()):v()}},[h,p,g,n,r,o,t,e,i,a,l,u,f])}function Rs(e){bs(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=m.useRef(Sb(e)),n=m.useRef(!1),r=rr(),o=m.useMemo(()=>LL(r.search,n.current?null:t.current),[r.search]),i=Wt(),a=m.useCallback((l,u)=>{const f=Sb(typeof l=="function"?l(new URLSearchParams(o)):l);n.current=!0,i("?"+f,u)},[i,o]);return[o,a]}var a5=0,l5=()=>`__${String(++a5)}__`;function c5(){let{router:e}=k2("useSubmit"),{basename:t}=m.useContext(ts),n=SL(),r=e.fetch,o=e.navigate;return m.useCallback(async(i,a={})=>{let{action:l,method:u,encType:f,formData:p,body:h}=zL(i,t);if(a.navigate===!1){let g=a.fetcherKey||l5();await r(g,n,a.action||l,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:h,formMethod:a.method||u,formEncType:a.encType||f,flushSync:a.flushSync})}else await o(a.action||l,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:h,formMethod:a.method||u,formEncType:a.encType||f,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,o,t,n])}function u5(e,{relative:t}={}){let{basename:n}=m.useContext(ts),r=m.useContext(Ts);un(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),i={...Ld(e||".",{relative:t})},a=rr();if(e==null){i.search=a.search;let l=new URLSearchParams(i.search),u=l.getAll("index");if(u.some(p=>p==="")){l.delete("index"),u.filter(h=>h).forEach(h=>l.append("index",h));let p=l.toString();i.search=p?`?${p}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:Zs([n,i.pathname])),id(i)}function d5(e,{relative:t}={}){let n=m.useContext(p2);un(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=k2("useViewTransitionState"),o=Ld(e,{relative:t});if(!n.isTransitioning)return!1;let i=Po(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=Po(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ch(o.pathname,a)!=null||ch(o.pathname,i)!=null}var Xs=o2();const f5=Dd(Xs);/**
|
|
52
|
+
* @license lucide-react v0.460.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const p5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),N2=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
57
|
+
* @license lucide-react v0.460.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/var h5={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"};/**
|
|
62
|
+
* @license lucide-react v0.460.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const m5=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...l},u)=>m.createElement("svg",{ref:u,...h5,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:N2("lucide",o),...l},[...a.map(([f,p])=>m.createElement(f,p)),...Array.isArray(i)?i:[i]]));/**
|
|
67
|
+
* @license lucide-react v0.460.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const Re=(e,t)=>{const n=m.forwardRef(({className:r,...o},i)=>m.createElement(m5,{ref:i,iconNode:t,className:N2(`lucide-${p5(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
|
|
72
|
+
* @license lucide-react v0.460.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const om=Re("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
|
77
|
+
* @license lucide-react v0.460.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/const uh=Re("ArchiveRestore",[["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"}]]);/**
|
|
82
|
+
* @license lucide-react v0.460.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const im=Re("Archive",[["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"}]]);/**
|
|
87
|
+
* @license lucide-react v0.460.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/const dh=Re("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
92
|
+
* @license lucide-react v0.460.0 - ISC
|
|
93
|
+
*
|
|
94
|
+
* This source code is licensed under the ISC license.
|
|
95
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
+
*/const am=Re("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
|
|
97
|
+
* @license lucide-react v0.460.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/const lm=Re("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
102
|
+
* @license lucide-react v0.460.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/const fh=Re("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
|
|
107
|
+
* @license lucide-react v0.460.0 - ISC
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the ISC license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/const g5=Re("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
|
|
112
|
+
* @license lucide-react v0.460.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const x5=Re("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/**
|
|
117
|
+
* @license lucide-react v0.460.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/const S2=Re("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
122
|
+
* @license lucide-react v0.460.0 - ISC
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the ISC license.
|
|
125
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
+
*/const Kv=Re("Bot",[["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"}]]);/**
|
|
127
|
+
* @license lucide-react v0.460.0 - ISC
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the ISC license.
|
|
130
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/const qv=Re("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
|
|
132
|
+
* @license lucide-react v0.460.0 - ISC
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the ISC license.
|
|
135
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
+
*/const y5=Re("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
137
|
+
* @license lucide-react v0.460.0 - ISC
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the ISC license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/const C2=Re("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
|
|
142
|
+
* @license lucide-react v0.460.0 - ISC
|
|
143
|
+
*
|
|
144
|
+
* This source code is licensed under the ISC license.
|
|
145
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
+
*/const Nr=Re("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
147
|
+
* @license lucide-react v0.460.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/const tr=Re("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
152
|
+
* @license lucide-react v0.460.0 - ISC
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the ISC license.
|
|
155
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/const b5=Re("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
157
|
+
* @license lucide-react v0.460.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/const Gv=Re("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
162
|
+
* @license lucide-react v0.460.0 - ISC
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the ISC license.
|
|
165
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
+
*/const E2=Re("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
167
|
+
* @license lucide-react v0.460.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/const ph=Re("CircleAlert",[["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"}]]);/**
|
|
172
|
+
* @license lucide-react v0.460.0 - ISC
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the ISC license.
|
|
175
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
+
*/const cm=Re("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
177
|
+
* @license lucide-react v0.460.0 - ISC
|
|
178
|
+
*
|
|
179
|
+
* This source code is licensed under the ISC license.
|
|
180
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
+
*/const Cb=Re("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
|
|
182
|
+
* @license lucide-react v0.460.0 - ISC
|
|
183
|
+
*
|
|
184
|
+
* This source code is licensed under the ISC license.
|
|
185
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
+
*/const T2=Re("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
187
|
+
* @license lucide-react v0.460.0 - ISC
|
|
188
|
+
*
|
|
189
|
+
* This source code is licensed under the ISC license.
|
|
190
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
+
*/const v5=Re("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/**
|
|
192
|
+
* @license lucide-react v0.460.0 - ISC
|
|
193
|
+
*
|
|
194
|
+
* This source code is licensed under the ISC license.
|
|
195
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
+
*/const w5=Re("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
197
|
+
* @license lucide-react v0.460.0 - ISC
|
|
198
|
+
*
|
|
199
|
+
* This source code is licensed under the ISC license.
|
|
200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
+
*/const j5=Re("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/**
|
|
202
|
+
* @license lucide-react v0.460.0 - ISC
|
|
203
|
+
*
|
|
204
|
+
* This source code is licensed under the ISC license.
|
|
205
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
+
*/const k5=Re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
207
|
+
* @license lucide-react v0.460.0 - ISC
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the ISC license.
|
|
210
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/const N5=Re("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
212
|
+
* @license lucide-react v0.460.0 - ISC
|
|
213
|
+
*
|
|
214
|
+
* This source code is licensed under the ISC license.
|
|
215
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
+
*/const S5=Re("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
|
217
|
+
* @license lucide-react v0.460.0 - ISC
|
|
218
|
+
*
|
|
219
|
+
* This source code is licensed under the ISC license.
|
|
220
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
+
*/const um=Re("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
|
|
222
|
+
* @license lucide-react v0.460.0 - ISC
|
|
223
|
+
*
|
|
224
|
+
* This source code is licensed under the ISC license.
|
|
225
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
+
*/const C5=Re("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
227
|
+
* @license lucide-react v0.460.0 - ISC
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the ISC license.
|
|
230
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/const R2=Re("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
232
|
+
* @license lucide-react v0.460.0 - ISC
|
|
233
|
+
*
|
|
234
|
+
* This source code is licensed under the ISC license.
|
|
235
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
+
*/const hh=Re("Copy",[["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"}]]);/**
|
|
237
|
+
* @license lucide-react v0.460.0 - ISC
|
|
238
|
+
*
|
|
239
|
+
* This source code is licensed under the ISC license.
|
|
240
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
+
*/const E5=Re("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
242
|
+
* @license lucide-react v0.460.0 - ISC
|
|
243
|
+
*
|
|
244
|
+
* This source code is licensed under the ISC license.
|
|
245
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
+
*/const T5=Re("Ellipsis",[["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"}]]);/**
|
|
247
|
+
* @license lucide-react v0.460.0 - ISC
|
|
248
|
+
*
|
|
249
|
+
* This source code is licensed under the ISC license.
|
|
250
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
+
*/const vc=Re("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
252
|
+
* @license lucide-react v0.460.0 - ISC
|
|
253
|
+
*
|
|
254
|
+
* This source code is licensed under the ISC license.
|
|
255
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
+
*/const B1=Re("Eye",[["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"}]]);/**
|
|
257
|
+
* @license lucide-react v0.460.0 - ISC
|
|
258
|
+
*
|
|
259
|
+
* This source code is licensed under the ISC license.
|
|
260
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
+
*/const R5=Re("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
|
|
262
|
+
* @license lucide-react v0.460.0 - ISC
|
|
263
|
+
*
|
|
264
|
+
* This source code is licensed under the ISC license.
|
|
265
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
+
*/const A5=Re("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/**
|
|
267
|
+
* @license lucide-react v0.460.0 - ISC
|
|
268
|
+
*
|
|
269
|
+
* This source code is licensed under the ISC license.
|
|
270
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
+
*/const A2=Re("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
272
|
+
* @license lucide-react v0.460.0 - ISC
|
|
273
|
+
*
|
|
274
|
+
* This source code is licensed under the ISC license.
|
|
275
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
+
*/const P5=Re("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/**
|
|
277
|
+
* @license lucide-react v0.460.0 - ISC
|
|
278
|
+
*
|
|
279
|
+
* This source code is licensed under the ISC license.
|
|
280
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
+
*/const _5=Re("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/**
|
|
282
|
+
* @license lucide-react v0.460.0 - ISC
|
|
283
|
+
*
|
|
284
|
+
* This source code is licensed under the ISC license.
|
|
285
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
+
*/const D5=Re("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
|
|
287
|
+
* @license lucide-react v0.460.0 - ISC
|
|
288
|
+
*
|
|
289
|
+
* This source code is licensed under the ISC license.
|
|
290
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
+
*/const Yv=Re("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
|
|
292
|
+
* @license lucide-react v0.460.0 - ISC
|
|
293
|
+
*
|
|
294
|
+
* This source code is licensed under the ISC license.
|
|
295
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
+
*/const $5=Re("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]]);/**
|
|
297
|
+
* @license lucide-react v0.460.0 - ISC
|
|
298
|
+
*
|
|
299
|
+
* This source code is licensed under the ISC license.
|
|
300
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
+
*/const I5=Re("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/**
|
|
302
|
+
* @license lucide-react v0.460.0 - ISC
|
|
303
|
+
*
|
|
304
|
+
* This source code is licensed under the ISC license.
|
|
305
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
+
*/const Xv=Re("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
|
|
307
|
+
* @license lucide-react v0.460.0 - ISC
|
|
308
|
+
*
|
|
309
|
+
* This source code is licensed under the ISC license.
|
|
310
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
+
*/const M5=Re("GitFork",[["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"}]]);/**
|
|
312
|
+
* @license lucide-react v0.460.0 - ISC
|
|
313
|
+
*
|
|
314
|
+
* This source code is licensed under the ISC license.
|
|
315
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
+
*/const wc=Re("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
317
|
+
* @license lucide-react v0.460.0 - ISC
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the ISC license.
|
|
320
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/const L5=Re("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
|
|
322
|
+
* @license lucide-react v0.460.0 - ISC
|
|
323
|
+
*
|
|
324
|
+
* This source code is licensed under the ISC license.
|
|
325
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
326
|
+
*/const O5=Re("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
|
|
327
|
+
* @license lucide-react v0.460.0 - ISC
|
|
328
|
+
*
|
|
329
|
+
* This source code is licensed under the ISC license.
|
|
330
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
+
*/const P2=Re("Inbox",[["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"}]]);/**
|
|
332
|
+
* @license lucide-react v0.460.0 - ISC
|
|
333
|
+
*
|
|
334
|
+
* This source code is licensed under the ISC license.
|
|
335
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
336
|
+
*/const Qv=Re("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
337
|
+
* @license lucide-react v0.460.0 - ISC
|
|
338
|
+
*
|
|
339
|
+
* This source code is licensed under the ISC license.
|
|
340
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
+
*/const Eb=Re("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
|
|
342
|
+
* @license lucide-react v0.460.0 - ISC
|
|
343
|
+
*
|
|
344
|
+
* This source code is licensed under the ISC license.
|
|
345
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
346
|
+
*/const F5=Re("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
|
|
347
|
+
* @license lucide-react v0.460.0 - ISC
|
|
348
|
+
*
|
|
349
|
+
* This source code is licensed under the ISC license.
|
|
350
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
351
|
+
*/const _2=Re("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
|
|
352
|
+
* @license lucide-react v0.460.0 - ISC
|
|
353
|
+
*
|
|
354
|
+
* This source code is licensed under the ISC license.
|
|
355
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
356
|
+
*/const z5=Re("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
|
|
357
|
+
* @license lucide-react v0.460.0 - ISC
|
|
358
|
+
*
|
|
359
|
+
* This source code is licensed under the ISC license.
|
|
360
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
361
|
+
*/const B5=Re("LifeBuoy",[["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"}]]);/**
|
|
362
|
+
* @license lucide-react v0.460.0 - ISC
|
|
363
|
+
*
|
|
364
|
+
* This source code is licensed under the ISC license.
|
|
365
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
366
|
+
*/const U5=Re("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
|
|
367
|
+
* @license lucide-react v0.460.0 - ISC
|
|
368
|
+
*
|
|
369
|
+
* This source code is licensed under the ISC license.
|
|
370
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
371
|
+
*/const H5=Re("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
372
|
+
* @license lucide-react v0.460.0 - ISC
|
|
373
|
+
*
|
|
374
|
+
* This source code is licensed under the ISC license.
|
|
375
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
376
|
+
*/const V5=Re("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/**
|
|
377
|
+
* @license lucide-react v0.460.0 - ISC
|
|
378
|
+
*
|
|
379
|
+
* This source code is licensed under the ISC license.
|
|
380
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
381
|
+
*/const Jv=Re("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
382
|
+
* @license lucide-react v0.460.0 - ISC
|
|
383
|
+
*
|
|
384
|
+
* This source code is licensed under the ISC license.
|
|
385
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
386
|
+
*/const W5=Re("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/**
|
|
387
|
+
* @license lucide-react v0.460.0 - ISC
|
|
388
|
+
*
|
|
389
|
+
* This source code is licensed under the ISC license.
|
|
390
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
391
|
+
*/const D2=Re("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
392
|
+
* @license lucide-react v0.460.0 - ISC
|
|
393
|
+
*
|
|
394
|
+
* This source code is licensed under the ISC license.
|
|
395
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
396
|
+
*/const K5=Re("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
397
|
+
* @license lucide-react v0.460.0 - ISC
|
|
398
|
+
*
|
|
399
|
+
* This source code is licensed under the ISC license.
|
|
400
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
401
|
+
*/const U1=Re("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
402
|
+
* @license lucide-react v0.460.0 - ISC
|
|
403
|
+
*
|
|
404
|
+
* This source code is licensed under the ISC license.
|
|
405
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
406
|
+
*/const Zv=Re("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
407
|
+
* @license lucide-react v0.460.0 - ISC
|
|
408
|
+
*
|
|
409
|
+
* This source code is licensed under the ISC license.
|
|
410
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
411
|
+
*/const q5=Re("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/**
|
|
412
|
+
* @license lucide-react v0.460.0 - ISC
|
|
413
|
+
*
|
|
414
|
+
* This source code is licensed under the ISC license.
|
|
415
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
416
|
+
*/const sy=Re("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/**
|
|
417
|
+
* @license lucide-react v0.460.0 - ISC
|
|
418
|
+
*
|
|
419
|
+
* This source code is licensed under the ISC license.
|
|
420
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
421
|
+
*/const $2=Re("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
|
|
422
|
+
* @license lucide-react v0.460.0 - ISC
|
|
423
|
+
*
|
|
424
|
+
* This source code is licensed under the ISC license.
|
|
425
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
426
|
+
*/const jc=Re("Pencil",[["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"}]]);/**
|
|
427
|
+
* @license lucide-react v0.460.0 - ISC
|
|
428
|
+
*
|
|
429
|
+
* This source code is licensed under the ISC license.
|
|
430
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
431
|
+
*/const G5=Re("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
432
|
+
* @license lucide-react v0.460.0 - ISC
|
|
433
|
+
*
|
|
434
|
+
* This source code is licensed under the ISC license.
|
|
435
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
436
|
+
*/const Tt=Re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
437
|
+
* @license lucide-react v0.460.0 - ISC
|
|
438
|
+
*
|
|
439
|
+
* This source code is licensed under the ISC license.
|
|
440
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
441
|
+
*/const ew=Re("RefreshCw",[["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"}]]);/**
|
|
442
|
+
* @license lucide-react v0.460.0 - ISC
|
|
443
|
+
*
|
|
444
|
+
* This source code is licensed under the ISC license.
|
|
445
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
446
|
+
*/const Y5=Re("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/**
|
|
447
|
+
* @license lucide-react v0.460.0 - ISC
|
|
448
|
+
*
|
|
449
|
+
* This source code is licensed under the ISC license.
|
|
450
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
451
|
+
*/const X5=Re("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
|
|
452
|
+
* @license lucide-react v0.460.0 - ISC
|
|
453
|
+
*
|
|
454
|
+
* This source code is licensed under the ISC license.
|
|
455
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
456
|
+
*/const vs=Re("RotateCcw",[["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"}]]);/**
|
|
457
|
+
* @license lucide-react v0.460.0 - ISC
|
|
458
|
+
*
|
|
459
|
+
* This source code is licensed under the ISC license.
|
|
460
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
461
|
+
*/const Q5=Re("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
|
|
462
|
+
* @license lucide-react v0.460.0 - ISC
|
|
463
|
+
*
|
|
464
|
+
* This source code is licensed under the ISC license.
|
|
465
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
466
|
+
*/const Od=Re("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
|
|
467
|
+
* @license lucide-react v0.460.0 - ISC
|
|
468
|
+
*
|
|
469
|
+
* This source code is licensed under the ISC license.
|
|
470
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
471
|
+
*/const J5=Re("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
472
|
+
* @license lucide-react v0.460.0 - ISC
|
|
473
|
+
*
|
|
474
|
+
* This source code is licensed under the ISC license.
|
|
475
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
476
|
+
*/const Ci=Re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
477
|
+
* @license lucide-react v0.460.0 - ISC
|
|
478
|
+
*
|
|
479
|
+
* This source code is licensed under the ISC license.
|
|
480
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
481
|
+
*/const Z5=Re("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/**
|
|
482
|
+
* @license lucide-react v0.460.0 - ISC
|
|
483
|
+
*
|
|
484
|
+
* This source code is licensed under the ISC license.
|
|
485
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
486
|
+
*/const e4=Re("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
487
|
+
* @license lucide-react v0.460.0 - ISC
|
|
488
|
+
*
|
|
489
|
+
* This source code is licensed under the ISC license.
|
|
490
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
491
|
+
*/const t4=Re("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
|
|
492
|
+
* @license lucide-react v0.460.0 - ISC
|
|
493
|
+
*
|
|
494
|
+
* This source code is licensed under the ISC license.
|
|
495
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
496
|
+
*/const n4=Re("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
497
|
+
* @license lucide-react v0.460.0 - ISC
|
|
498
|
+
*
|
|
499
|
+
* This source code is licensed under the ISC license.
|
|
500
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
501
|
+
*/const r4=Re("ShieldAlert",[["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"}]]);/**
|
|
502
|
+
* @license lucide-react v0.460.0 - ISC
|
|
503
|
+
*
|
|
504
|
+
* This source code is licensed under the ISC license.
|
|
505
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
506
|
+
*/const I2=Re("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
507
|
+
* @license lucide-react v0.460.0 - ISC
|
|
508
|
+
*
|
|
509
|
+
* This source code is licensed under the ISC license.
|
|
510
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
511
|
+
*/const ys=Re("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
512
|
+
* @license lucide-react v0.460.0 - ISC
|
|
513
|
+
*
|
|
514
|
+
* This source code is licensed under the ISC license.
|
|
515
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
516
|
+
*/const oy=Re("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
|
|
517
|
+
* @license lucide-react v0.460.0 - ISC
|
|
518
|
+
*
|
|
519
|
+
* This source code is licensed under the ISC license.
|
|
520
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
521
|
+
*/const H1=Re("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
|
|
522
|
+
* @license lucide-react v0.460.0 - ISC
|
|
523
|
+
*
|
|
524
|
+
* This source code is licensed under the ISC license.
|
|
525
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
526
|
+
*/const tw=Re("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
527
|
+
* @license lucide-react v0.460.0 - ISC
|
|
528
|
+
*
|
|
529
|
+
* This source code is licensed under the ISC license.
|
|
530
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
531
|
+
*/const s4=Re("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/**
|
|
532
|
+
* @license lucide-react v0.460.0 - ISC
|
|
533
|
+
*
|
|
534
|
+
* This source code is licensed under the ISC license.
|
|
535
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
536
|
+
*/const o4=Re("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/**
|
|
537
|
+
* @license lucide-react v0.460.0 - ISC
|
|
538
|
+
*
|
|
539
|
+
* This source code is licensed under the ISC license.
|
|
540
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
541
|
+
*/const M2=Re("Tag",[["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"}]]);/**
|
|
542
|
+
* @license lucide-react v0.460.0 - ISC
|
|
543
|
+
*
|
|
544
|
+
* This source code is licensed under the ISC license.
|
|
545
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
546
|
+
*/const pa=Re("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
547
|
+
* @license lucide-react v0.460.0 - ISC
|
|
548
|
+
*
|
|
549
|
+
* This source code is licensed under the ISC license.
|
|
550
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
551
|
+
*/const fn=Re("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
552
|
+
* @license lucide-react v0.460.0 - ISC
|
|
553
|
+
*
|
|
554
|
+
* This source code is licensed under the ISC license.
|
|
555
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
556
|
+
*/const kc=Re("TriangleAlert",[["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"}]]);/**
|
|
557
|
+
* @license lucide-react v0.460.0 - ISC
|
|
558
|
+
*
|
|
559
|
+
* This source code is licensed under the ISC license.
|
|
560
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
561
|
+
*/const i4=Re("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
|
|
562
|
+
* @license lucide-react v0.460.0 - ISC
|
|
563
|
+
*
|
|
564
|
+
* This source code is licensed under the ISC license.
|
|
565
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
566
|
+
*/const a4=Re("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
567
|
+
* @license lucide-react v0.460.0 - ISC
|
|
568
|
+
*
|
|
569
|
+
* This source code is licensed under the ISC license.
|
|
570
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
571
|
+
*/const L2=Re("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
|
|
572
|
+
* @license lucide-react v0.460.0 - ISC
|
|
573
|
+
*
|
|
574
|
+
* This source code is licensed under the ISC license.
|
|
575
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
576
|
+
*/const Nc=Re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function O2(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=O2(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function l4(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=O2(e))&&(r&&(r+=" "),r+=t);return r}const nw="-",c4=e=>{const t=d4(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const l=a.split(nw);return l[0]===""&&l.length!==1&&l.shift(),F2(l,t)||u4(a)},getConflictingClassGroupIds:(a,l)=>{const u=n[a]||[];return l&&r[a]?[...u,...r[a]]:u}}},F2=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?F2(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(nw);return(a=t.validators.find(({validator:l})=>l(i)))==null?void 0:a.classGroupId},V1=/^\[(.+)\]$/,u4=e=>{if(V1.test(e)){const t=V1.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},d4=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return p4(Object.entries(e.classGroups),n).forEach(([i,a])=>{Tb(a,r,i,t)}),r},Tb=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:W1(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(f4(o)){Tb(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,a])=>{Tb(a,W1(t,i),n,r)})})},W1=(e,t)=>{let n=e;return t.split(nw).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},f4=e=>e.isThemeGetter,p4=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,l])=>[t+a,l])):i);return[n,o]}):e,h4=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let a=n.get(i);if(a!==void 0)return a;if((a=r.get(i))!==void 0)return o(i,a),a},set(i,a){n.has(i)?n.set(i,a):o(i,a)}}},z2="!",m4=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,a=l=>{const u=[];let f=0,p=0,h;for(let b=0;b<l.length;b++){let w=l[b];if(f===0){if(w===o&&(r||l.slice(b,b+i)===t)){u.push(l.slice(p,b)),p=b+i;continue}if(w==="/"){h=b;continue}}w==="["?f++:w==="]"&&f--}const g=u.length===0?l:l.substring(p),y=g.startsWith(z2),k=y?g.substring(1):g,v=h&&h>p?h-p:void 0;return{modifiers:u,hasImportantModifier:y,baseClassName:k,maybePostfixModifierPosition:v}};return n?l=>n({className:l,parseClassName:a}):a},g4=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},x4=e=>({cache:h4(e.cacheSize),parseClassName:m4(e),...c4(e)}),y4=/\s+/,b4=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],a=e.trim().split(y4);let l="";for(let u=a.length-1;u>=0;u-=1){const f=a[u],{modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:y}=n(f);let k=!!y,v=r(k?g.substring(0,y):g);if(!v){if(!k){l=f+(l.length>0?" "+l:l);continue}if(v=r(g),!v){l=f+(l.length>0?" "+l:l);continue}k=!1}const b=g4(p).join(":"),w=h?b+z2:b,S=w+v;if(i.includes(S))continue;i.push(S);const N=o(v,k);for(let C=0;C<N.length;++C){const R=N[C];i.push(w+R)}l=f+(l.length>0?" "+l:l)}return l};function v4(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=B2(t))&&(r&&(r+=" "),r+=n);return r}const B2=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=B2(e[r]))&&(n&&(n+=" "),n+=t);return n};function w4(e,...t){let n,r,o,i=a;function a(u){const f=t.reduce((p,h)=>h(p),e());return n=x4(f),r=n.cache.get,o=n.cache.set,i=l,l(u)}function l(u){const f=r(u);if(f)return f;const p=b4(u,n);return o(u,p),p}return function(){return i(v4.apply(null,arguments))}}const Jt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},U2=/^\[(?:([a-z-]+):)?(.+)\]$/i,j4=/^\d+\/\d+$/,k4=new Set(["px","full","screen"]),N4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,S4=/\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$/,C4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,E4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,T4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ko=e=>Fl(e)||k4.has(e)||j4.test(e),li=e=>Sc(e,"length",M4),Fl=e=>!!e&&!Number.isNaN(Number(e)),iy=e=>Sc(e,"number",Fl),wu=e=>!!e&&Number.isInteger(Number(e)),R4=e=>e.endsWith("%")&&Fl(e.slice(0,-1)),jt=e=>U2.test(e),ci=e=>N4.test(e),A4=new Set(["length","size","percentage"]),P4=e=>Sc(e,A4,H2),_4=e=>Sc(e,"position",H2),D4=new Set(["image","url"]),$4=e=>Sc(e,D4,O4),I4=e=>Sc(e,"",L4),ju=()=>!0,Sc=(e,t,n)=>{const r=U2.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},M4=e=>S4.test(e)&&!C4.test(e),H2=()=>!1,L4=e=>E4.test(e),O4=e=>T4.test(e),F4=()=>{const e=Jt("colors"),t=Jt("spacing"),n=Jt("blur"),r=Jt("brightness"),o=Jt("borderColor"),i=Jt("borderRadius"),a=Jt("borderSpacing"),l=Jt("borderWidth"),u=Jt("contrast"),f=Jt("grayscale"),p=Jt("hueRotate"),h=Jt("invert"),g=Jt("gap"),y=Jt("gradientColorStops"),k=Jt("gradientColorStopPositions"),v=Jt("inset"),b=Jt("margin"),w=Jt("opacity"),S=Jt("padding"),N=Jt("saturate"),C=Jt("scale"),R=Jt("sepia"),T=Jt("skew"),A=Jt("space"),I=Jt("translate"),_=()=>["auto","contain","none"],z=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",jt,t],B=()=>[jt,t],V=()=>["",ko,li],$=()=>["auto",Fl,jt],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],D=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",jt],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],F=()=>[Fl,jt];return{cacheSize:500,separator:":",theme:{colors:[ju],spacing:[ko,li],blur:["none","",ci,jt],brightness:F(),borderColor:[e],borderRadius:["none","","full",ci,jt],borderSpacing:B(),borderWidth:V(),contrast:F(),grayscale:W(),hueRotate:F(),invert:W(),gap:B(),gradientColorStops:[e],gradientColorStopPositions:[R4,li],inset:O(),margin:O(),opacity:F(),padding:B(),saturate:F(),scale:F(),sepia:W(),skew:F(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",jt]}],container:["container"],columns:[{columns:[ci]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"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"],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:[...L(),jt]}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",wu,jt]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",jt]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",wu,jt]}],"grid-cols":[{"grid-cols":[ju]}],"col-start-end":[{col:["auto",{span:["full",wu,jt]},jt]}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":[ju]}],"row-start-end":[{row:["auto",{span:[wu,jt]},jt]}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",jt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",jt]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...D()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...D(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...D(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],pt:[{pt:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",jt,t]}],"min-w":[{"min-w":[jt,t,"min","max","fit"]}],"max-w":[{"max-w":[jt,t,"none","full","min","max","fit","prose",{screen:[ci]},ci]}],h:[{h:[jt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[jt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[jt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[jt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ci,li]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",iy]}],"font-family":[{font:[ju]}],"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:["tighter","tight","normal","wide","wider","widest",jt]}],"line-clamp":[{"line-clamp":["none",Fl,iy]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ko,jt]}],"list-image":[{"list-image":["none",jt]}],"list-style-type":[{list:["none","disc","decimal",jt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ko,li]}],"underline-offset":[{"underline-offset":["auto",ko,jt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",jt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",jt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),_4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",P4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-to-pos":[{to:[k]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:U()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[ko,jt]}],"outline-w":[{outline:[ko,li]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[ko,li]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ci,I4]}],"shadow-color":[{shadow:[ju]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...K(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":K()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",ci,jt]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[h]}],saturate:[{saturate:[N]}],sepia:[{sepia:[R]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[R]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",jt]}],duration:[{duration:F()}],ease:[{ease:["linear","in","out","in-out",jt]}],delay:[{delay:F()}],animate:[{animate:["none","spin","ping","pulse","bounce",jt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[wu,jt]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",jt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",jt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"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",jt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ko,li,iy]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"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-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-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"],"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"]}}},z4=w4(F4);function be(...e){return z4(l4(e))}function Xn(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Sr(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function V2(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function zl(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Fu(e){if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=Math.floor((Date.now()-t.getTime())/1e3);if(n<60)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function ec(e){return e.toLocaleString("en-US")}function tc(e){if(!Number.isFinite(e))return"$0.00";const t=e!==0&&Math.abs(e)<1?4:2;return e.toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:t})}function B4(e){if(!e)return"—";const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return e;const[,n,r,o]=t,i=new Date(Number(n),Number(r)-1,Number(o));return Number.isNaN(i.getTime())?e:i.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function U4(e,t){const n=new Date(e);if(Number.isNaN(n.getTime()))return"—";const r=t?new Date(t):new Date;if(Number.isNaN(r.getTime()))return"—";const o=Math.floor((r.getTime()-n.getTime())/6e4);if(o<1)return"< 1m";if(o<60)return`${o}m`;const i=Math.floor(o/1440),a=Math.floor(o/60);if(i>0){const u=Math.floor((o-i*24*60)/60);return u>0?`${i}d ${u}h`:`${i}d`}const l=o%60;return`${a}h ${l}m`}function gn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function W2(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function K2(e){let t=W2(e);const n=t.match(/^\/w\/[^/]+(\/.*)?$/);return n&&(t=n[1]||"/"),t==="/"?"/":t.startsWith("/archive")?"/archive":t.startsWith("/projects")?/^\/projects\/[^/]+\/assignments\//.test(t)?"/assignments":"/projects":t.startsWith("/assignments")?"/assignments":t.startsWith("/servers")?"/servers":t.startsWith("/inventories")?"/inventories":t.startsWith("/schedules")?"/schedules":t.startsWith("/usage")?"/usage":t.startsWith("/agent-sessions")?"/agent-sessions":t.startsWith("/agents")?"/agents":t.startsWith("/playbooks")?"/playbooks":t.startsWith("/memories")?"/memories":t.startsWith("/resources")?"/resources":t.startsWith("/todos")?"/todos":t.startsWith("/views")?"/views":t.startsWith("/help")?"/help":t.startsWith("/settings")?"/settings":t.startsWith("/workflow")?"/workflow":t.startsWith("/inbox")?"/inbox":null}function q2(e,t){return K2(e)===t}function G2(e){let n=W2(e).split("/").filter(Boolean);const r=[];let o="Overview",i=null,a="";if(n[0]==="w"&&n[1]&&(a=`/w/${n[1]}`,r.push({label:gn(n[1]),path:`${a}/projects`}),n=n.slice(2)),n.length===0)return{title:o,breadcrumbs:r,projectSlug:i};if(n[0]==="projects"){if(r.push({label:"Projects",path:`${a}/projects`}),o="Projects",n[1]&&(i=n[1],r.push({label:gn(n[1]),path:`${a}/projects/${n[1]}`}),o=gn(n[1])),n[2]==="edit")o="Edit Project";else if(n[2]==="create"&&n[3]==="assignment")o="Create Assignment";else if(n[2]==="assignments"&&n[3])r.push({label:gn(n[3]),path:`${a}/projects/${n[1]}/assignments/${n[3]}`}),o=gn(n[3]),n[4]==="edit"?o="Edit Assignment":n[4]==="plan"&&n[5]==="edit"?o="Edit Plan":n[4]==="scratchpad"&&n[5]==="edit"?o="Edit Scratchpad":n[4]==="handoff"&&n[5]==="edit"?o="Append Handoff":n[4]==="decision-record"&&n[5]==="edit"&&(o="Append Decision");else if((n[2]==="memories"||n[2]==="resources")&&n[3]){const l=n[2]==="memories"?"Memories":"Resources",u=n[2]==="memories"?"/memories":"/resources";r.push({label:l,path:u}),r.push({label:gn(n[3]),path:`${a}/projects/${n[1]}/${n[2]}/${n[3]}`}),o=gn(n[3]),n[4]==="edit"&&(o=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(o="Servers",r.push({label:"Servers",path:`${a}/servers`})):n[0]==="inventories"?(o="Inventories",r.push({label:"Inventories",path:`${a}/inventories`})):n[0]==="schedules"?(o="Schedules",r.push({label:"Schedules",path:`${a}/schedules`})):n[0]==="usage"?(o="Usage",r.push({label:"Usage",path:`${a}/usage`})):n[0]==="agent-sessions"?(o="Agent Sessions",r.push({label:"Agent Sessions",path:`${a}/agent-sessions`})):n[0]==="agents"?(o="Agents",r.push({label:"Agents",path:"/agents"})):n[0]==="assignments"?(o="Assignments",r.push({label:"Assignments",path:`${a}/assignments`})):n[0]==="archive"?(o="Archive",r.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(r.push({label:"Playbooks",path:"/playbooks"}),o="Playbooks",n[1]==="create"?o="Create Playbook":n[1]&&n[2]==="edit"?(r.push({label:gn(n[1]),path:`/playbooks/${n[1]}`}),o="Edit Playbook"):n[1]&&(r.push({label:gn(n[1]),path:`/playbooks/${n[1]}`}),o=gn(n[1]))):n[0]==="memories"?(r.push({label:"Memories",path:"/memories"}),o="Memories",n[1]==="new"&&(o="New Memory")):n[0]==="resources"?(r.push({label:"Resources",path:"/resources"}),o="Resources",n[1]==="new"&&(o="New Resource")):n[0]==="todos"?(o="Todos",r.push({label:"Todos",path:`${a}/todos`})):n[0]==="views"?(o="Saved Views",r.push({label:"Saved Views",path:`${a}/views`}),n[1]&&(o="View")):n[0]==="help"?(o="Help",r.push({label:"Help",path:"/help"})):n[0]==="settings"?(o="Settings",r.push({label:"Settings",path:"/settings"})):n[0]==="workflow"?(o="Workflow",r.push({label:"Workflow",path:"/workflow"})):n[0]==="create"&&n[1]==="project"&&(o="Create Project",r.push({label:"Create Project",path:`${a}/create/project`}));return{title:o,breadcrumbs:r,projectSlug:i}}function Y2({item:e,onNavigate:t}){const n=rr(),r=e.icon,o=q2(n.pathname,e.to)&&!n.pathname.startsWith("/w/");return s.jsxs(_e,{to:e.to,onClick:t,className:be("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition",o?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),children:[s.jsx(r,{className:"h-4 w-4"}),s.jsx("span",{children:e.label}),e.badge&&e.badge>0?s.jsx("span",{className:be("ml-auto inline-flex min-w-[1.25rem] items-center justify-center rounded-full px-1.5 py-0.5 text-[11px] font-semibold",o?"bg-background/20 text-background":"bg-foreground text-background"),children:e.badge}):null]})}function K1({items:e,onNavigate:t}){return s.jsx("nav",{className:"space-y-1",children:e.map(n=>s.jsx(Y2,{item:n,onNavigate:t},n.to))})}function H4({label:e,items:t,collapsed:n,onToggle:r,containsActive:o,onNavigate:i}){const a=n&&o;return s.jsxs("div",{children:[s.jsxs("button",{type:"button",onClick:r,"aria-expanded":!n,className:be("flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition",a?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"),children:[s.jsx(tr,{className:be("h-3 w-3 transition-transform",n&&"-rotate-90")}),e]}),n?null:s.jsx("nav",{className:"space-y-1",children:t.map(l=>s.jsx(Y2,{item:l,onNavigate:i},l.to))})]})}const X2=[{slug:"default",label:"Syntaur",description:"Brand purple, warm yellow, coral & teal accents.",swatches:{primary:"oklch(70% 0.18 290)",secondary:"oklch(80% 0.14 75)",coral:"oklch(72% 0.17 15)",teal:"oklch(72% 0.14 185)",amber:"oklch(82% 0.16 75)"}},{slug:"ocean",label:"Midnight",description:"Deep indigo-blue with cyan accents. Inspired by One Dark Pro.",swatches:{primary:"oklch(70% 0.16 240)",secondary:"oklch(78% 0.13 200)",coral:"oklch(72% 0.18 350)",teal:"oklch(78% 0.14 195)",amber:"oklch(84% 0.15 90)"}},{slug:"forest",label:"Verdant",description:"Saturated emerald and pine on a dark olive base.",swatches:{primary:"oklch(72% 0.17 145)",secondary:"oklch(80% 0.13 110)",coral:"oklch(72% 0.17 25)",teal:"oklch(75% 0.13 175)",amber:"oklch(82% 0.16 95)"}},{slug:"sunset",label:"Ember",description:"Warm sepia surfaces with copper and amber accents.",swatches:{primary:"oklch(72% 0.18 35)",secondary:"oklch(80% 0.16 60)",coral:"oklch(72% 0.19 15)",teal:"oklch(72% 0.12 180)",amber:"oklch(86% 0.17 70)"}}],V4=X2.map(e=>e.slug),mh="default";function Q2(e){return typeof e=="string"&&V4.includes(e)}const J2={preset:mh,custom:!1};let zu=null,fl=null;function rw(e){if(!e||typeof e!="object")return J2;const t=e;return{preset:Q2(t.preset)?t.preset:mh,custom:t.custom===!0}}function W4(){return zu?Promise.resolve(zu):fl||(fl=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=rw(e);return zu=t,fl=null,t}).catch(()=>(fl=null,J2)),fl)}async function K4(e){const t=await fetch("/api/config/theme",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({preset:e})});if(!t.ok){const r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));throw new Error(r.error??"Failed to save theme")}const n=rw(await t.json());return zu=n,n}async function q4(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=rw(await e.json());return zu=t,t}const Rb="syntaur-theme",Fp="syntaur-preset",Z2=m.createContext(null);function Ab(){try{const e=window.localStorage.getItem(Rb);return e==="light"||e==="dark"?e:null}catch{return null}}function eT(){try{const e=window.localStorage.getItem(Fp);return Q2(e)?e:mh}catch{return mh}}function tT(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function nT(e){document.documentElement.classList.toggle("dark",e==="dark")}function rT(e){document.documentElement.dataset.theme=e}function G4(){typeof document>"u"||(nT(Ab()??tT()),rT(eT()))}function Y4({children:e}){const[t,n]=m.useState(()=>Ab()),[r,o]=m.useState(()=>Ab()??tT()),[i,a]=m.useState(()=>eT());m.useEffect(()=>{nT(r)},[r]),m.useEffect(()=>{rT(i)},[i]),m.useEffect(()=>{let p=!1;return W4().then(h=>{if(!p&&h.preset!==i){a(h.preset);try{window.localStorage.setItem(Fp,h.preset)}catch{}}}),()=>{p=!0}},[]),m.useEffect(()=>{if(!window.matchMedia)return;const p=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{t||o(p.matches?"dark":"light")};return h(),p.addEventListener("change",h),()=>{p.removeEventListener("change",h)}},[t]);async function l(p){a(p);try{window.localStorage.setItem(Fp,p)}catch{}await K4(p)}async function u(){const p=await q4();a(p.preset);try{window.localStorage.setItem(Fp,p.preset)}catch{}}const f={resolvedTheme:r,explicitTheme:t,setTheme:p=>{window.localStorage.setItem(Rb,p),n(p),o(p)},toggleTheme:()=>{const p=r==="dark"?"light":"dark";window.localStorage.setItem(Rb,p),n(p),o(p)},preset:i,setPreset:l,resetPreset:u};return s.jsx(Z2.Provider,{value:f,children:e})}function sw(){const e=m.useContext(Z2);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const X4=2e3,Bu=new Set;let ps=null,aa=null,zp=!1,gh="closed";const Pb=new Set;function Iu(e){if(gh!==e){gh=e;for(const t of Pb)t(e)}}function q1(){return gh}function Q4(e){return Pb.add(e),()=>{Pb.delete(e)}}function J4(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}let Z4=J4;function eO(){aa&&clearTimeout(aa),aa=setTimeout(()=>{aa=null,sT()},X4)}function sT(){if(ps&&(ps.readyState===WebSocket.OPEN||ps.readyState===WebSocket.CONNECTING))return;zp=!1,gh==="closed"&&Iu("connecting");const e=new WebSocket(Z4());ps=e,e.onopen=()=>{ps===e&&Iu("open")},e.onmessage=t=>{if(ps===e)try{const n=JSON.parse(t.data);for(const r of Bu)r(n)}catch{}},e.onclose=()=>{if(ps===e){if(ps=null,zp||Bu.size===0){zp=!1,Iu("closed");return}Iu("reconnecting"),eO()}},e.onerror=()=>{e.close()}}function tO(e){return Bu.add(e),sT(),()=>{Bu.delete(e),Bu.size===0&&(aa&&(clearTimeout(aa),aa=null),ps&&(zp=!0,ps.close(),ps=null),Iu("closed"))}}function Ei(e){const t=m.useRef(e);t.current=e,m.useEffect(()=>tO(o=>t.current(o)),[])}const dm=["7d","30d","90d","all","custom"],oT="30d",nO=/^\d{4}-\d{2}-\d{2}$/,Fd=["project","workspace","model","tool"],rO={"7d":7,"30d":30,"90d":90};function Uu(e){if(typeof e!="string"||!nO.test(e))return!1;const[t,n,r]=e.split("-").map(Number);if(n<1||n>12||r<1||r>31)return!1;const o=new Date(Date.UTC(t,n-1,r));return o.getUTCFullYear()===t&&o.getUTCMonth()===n-1&&o.getUTCDate()===r}function G1(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${r}`}function sO(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function oO(e,t=new Date){const n=e.window??oT;if(n==="all")return{};if(n==="custom"){const o={};return e.since&&(o.since=e.since),e.until&&(o.until=e.until),o}const r=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return{since:G1(sO(r,-(rO[n]-1))),until:G1(r)}}function iO(e){const t=[];if(!e||typeof e!="object"||Array.isArray(e))return{ok:!1,errors:["filters must be an object"]};const n=e;n.window!==void 0&&!dm.includes(n.window)&&t.push(`invalid window: ${String(n.window)}`);for(const r of["since","until"])n[r]!==void 0&&!Uu(n[r])&&t.push(`invalid ${r}: ${String(n[r])} (expected YYYY-MM-DD)`);for(const r of Fd)n[r]!==void 0&&(typeof n[r]!="string"||n[r].length===0)&&t.push(`invalid ${r}: must be a non-empty string`);return Uu(n.since)&&Uu(n.until)&&n.since>n.until&&t.push("since must be on or before until"),{ok:t.length===0,errors:t}}function zd(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;typeof n.window=="string"&&dm.includes(n.window)&&(t.window=n.window),Uu(n.since)&&(t.since=n.since),Uu(n.until)&&(t.until=n.until);for(const r of Fd)typeof n[r]=="string"&&n[r].length>0&&(t[r]=n[r]);return t.window!=="custom"&&(delete t.since,delete t.until),t}function _b(e){const t=zd(e),n=new URLSearchParams;t.window&&n.set("window",t.window),t.window==="custom"&&(t.since&&n.set("since",t.since),t.until&&n.set("until",t.until));for(const r of Fd)t[r]&&n.set(r,t[r]);return n}function aO(e){const t={};for(const n of["window","since","until",...Fd]){const r=e.get(n);r!==null&&(t[n]=r)}return zd(t)}function iT(e,t=new Date){const n=zd(e),{since:r,until:o}=oO(n,t),i=new URLSearchParams;r&&i.set("since",r),o&&i.set("until",o);for(const a of Fd)n[a]&&i.set(a,n[a]);return i}const lO={"7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",all:"All time",custom:"Custom range"};function Y1(e){const t=zd(e),n=t.window??oT,r=[];return r.push(n==="custom"?`${t.since??"…"} → ${t.until??"…"}`:lO[n]),t.workspace&&r.push(`workspace: ${t.workspace}`),t.project&&r.push(`project: ${t.project}`),t.model&&r.push(`model: ${t.model}`),t.tool&&r.push(`tool: ${t.tool}`),r.join(" · ")}function tn(e,t,n=!0,r=!1){const[o,i]=m.useState(null),[a,l]=m.useState(!0),[u,f]=m.useState(null),[p,h]=m.useState(0),g=m.useRef(!1),y=n?e:null,k=m.useCallback(()=>{h(b=>b+1)},[]),v=m.useRef(y);return r&&v.current!==y&&(v.current=y,i(null),g.current=!1,f(null),l(!0)),m.useEffect(()=>{if(!y){l(!1),i(null),g.current=!1;return}let b=!1;return l(!g.current),f(null),fetch(y).then(async w=>{if(!w.ok){const S=await w.json().catch(()=>null);throw new Error((S==null?void 0:S.error)||`HTTP ${w.status}`)}return w.json()}).then(w=>{b||(i(w),g.current=!0,l(!1))}).catch(w=>{b||(f(w.message),l(!1))}),()=>{b=!0}},[y,p]),Ei(b=>{!t||!y||((b.type==="project-updated"||b.type==="assignment-updated")&&k(),b.type==="servers-updated"&&t==="servers"&&k(),b.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&k(),b.type==="playbooks-updated"&&t==="playbooks"&&k(),b.type==="leases-updated"&&t==="inventories"&&k())}),{data:o,loading:a,error:u,refetch:k}}function oo(e=!0){return tn("/api/projects","projects",e)}function Ra(){return tn("/api/workspaces","projects")}function xn(){const{workspace:e}=Kt();return e?`/w/${e}`:""}function cO(e={}){const t=new URLSearchParams;typeof e.staleLimit=="number"&&Number.isFinite(e.staleLimit)&&t.set("staleLimit",String(e.staleLimit)),typeof e.staleOffset=="number"&&Number.isFinite(e.staleOffset)&&t.set("staleOffset",String(e.staleOffset));const n=t.toString(),r=n?`/api/overview?${n}`:"/api/overview";return tn(r,"overview")}function fm(e=!0){return tn("/api/assignments","assignments",e)}function uO(e=!0){return tn("/api/archived","assignments",e)}function aT(){return tn("/api/help")}function lT(e){const t=e?`/api/projects/${e}`:null;return tn(t,"project",!0,!0)}function dO(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return tn(n,"assignment",!0,!0)}function fO(e){const t=e?`/api/assignments/${e}`:null;return tn(t,"assignment",!0,!0)}function cT(e){return tn(e,void 0,!0,!0)}function ow(e=!0){return tn("/api/servers","servers",e)}function uT(){return tn("/api/leases","inventories")}function pm(){return tn("/api/agent-sessions","agent-sessions")}function pO(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return tn(n,"agent-sessions",!0,!0)}function hO(e){const t=e?`/api/assignments/${e}/sessions`:null;return tn(t,"agent-sessions",!0,!0)}function mO(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return tn(n,void 0,!0,!0)}function gO(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return tn(t,void 0,!0,!0)}function iw(e=!0){return tn("/api/playbooks","playbooks",e)}function xO(e){const t=iT(e).toString(),n=t?`/api/usage?${t}`:"/api/usage";return tn(n,void 0,!0,!0)}function dT(e=!0){return tn("/api/usage/facets",void 0,e)}function yO(e){const t=e?`/api/playbooks/${e}`:null;return tn(t,"playbooks",!0,!0)}function bO(){return tn("/api/memories","project")}function vO(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return tn(n,"project",!0,!0)}function wO(){return tn("/api/resources","project")}function jO(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return tn(n,"project",!0,!0)}const hm=["new-workspace","new-project","new-todo","new-assignment"];function kO(e){return typeof e=="string"&&hm.includes(e)}const NO=["mod+k","mod+shift+k","?","escape","enter","shift+t","g","g o","g m","g a","g t","g s","g !","g ,","j","k","o","a","e","/","r","p","h","d","s","[","]"],SO=["mod","ctrl","alt","shift"];function vr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(vr).filter(l=>l.length>0).join(" ");const n=t.split("+").map(l=>l.trim()).filter(l=>l.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const r=n[n.length-1].toLowerCase(),o=n.slice(0,-1).map(l=>l.toLowerCase()),i=new Set,a=[];for(const l of SO)o.includes(l)&&!i.has(l)&&(a.push(l),i.add(l));for(const l of o)i.has(l)||(a.push(l),i.add(l));return[...a,r].join("+")}function CO(e){const t=vr(e);return t?NO.includes(t):!1}const EO={"new-workspace":vr("Mod+Shift+Alt+w"),"new-project":vr("Mod+Shift+Alt+p"),"new-todo":vr("Mod+Shift+Alt+t"),"new-assignment":vr("Mod+Shift+Alt+a")};function TO(e){const t={...EO};for(const n of hm){const r=e[n];typeof r=="string"&&r.length>0&&(t[n]=r)}return t}function oa(){if(typeof navigator>"u")return!1;const e=navigator.platform||"",t=navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)||/Mac OS X/.test(t)}function RO(e){const t=e.split("+").map(o=>o.trim()),n=t[t.length-1]??"",r=new Set(t.slice(0,-1).map(o=>o.toLowerCase()));return{key:n.toLowerCase(),mod:r.has("mod"),shift:r.has("shift"),alt:r.has("alt"),ctrl:r.has("ctrl")}}function cp(e,t){const n=RO(t);if(e.key.toLowerCase()!==n.key)return!1;const o=oa()?e.metaKey:e.ctrlKey;return!(n.mod&&!o||!n.mod&&!n.ctrl&&o||n.ctrl&&!e.ctrlKey||n.shift&&!e.shiftKey||!n.shift&&!(n.key.length===1&&!/^[a-z0-9]$/.test(n.key))&&e.shiftKey||n.alt&&!e.altKey||!n.alt&&e.altKey)}function fT(e){const t=[],n=oa()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const r=e.key;let o;r===" "||r==="Spacebar"?o="space":(r.length,o=r.toLowerCase());const i=o.length===1&&/^[a-z0-9]$/.test(o);e.shiftKey&&i&&t.push("shift");const a=[...t,o].join("+");return vr(a)}function eo(e){return e.split("+").map(n=>{const r=n.toLowerCase();return r==="mod"?oa()?"⌘":"Ctrl":r==="shift"?oa()?"⇧":"Shift":r==="alt"?oa()?"⌥":"Alt":r==="ctrl"?oa()?"⌃":"Ctrl":r==="enter"?"↵":r==="escape"?"Esc":r==="arrowup"?"↑":r==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(oa()?"":"+")}function AO(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const u=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),Ei(u=>{u.type==="todos-updated"&&!u.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}function pT(e=!0){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const u=await fetch("/api/todos");if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch todos")}finally{o(!1)}},[]);return m.useEffect(()=>{if(!e){o(!1);return}l()},[l,e]),Ei(u=>{e&&u.type==="todos-updated"&&!u.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}async function aw(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}`,{description:t,tags:n})}async function hT(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/complete`,{summary:"Completed."})}async function mT(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/block`,{reason:n})}async function gT(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/start`,{session:n})}async function xT(e,t){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{})}async function yT(e,t){await PO(`/api/todos/${encodeURIComponent(e)}/${t}`)}async function bT(e,t,n){const r=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}function lw(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function vT(e,t,n){for(const r of n){const o=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(r.name||"file"),"x-attachment-mime":r.type||"application/octet-stream"},body:r});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function wT(e,t,n){const r=await fetch(lw(e,t,n),{method:"DELETE"});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}async function Ti(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.text().catch(()=>"");let o=null;try{o=r?JSON.parse(r):null}catch{}const i=(o==null?void 0:o.error)||r||`HTTP ${n.status}`,a=new Error(i);throw a.status=n.status,a}return n.json().catch(()=>({}))}async function PO(e){const t=await fetch(e,{method:"DELETE"});if(!t.ok){const n=await t.text().catch(()=>"");let r=null;try{r=n?JSON.parse(n):null}catch{}const o=(r==null?void 0:r.error)||n||`HTTP ${t.status}`,i=new Error(o);throw i.status=t.status,i}}async function _O(e,t){return await Ti(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function DO(e){return await Ti("/api/todos/promote-bulk",e)}async function $O(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const mm=["assignment","project","todo","server","playbook"],ha={defaultScope:"all",aliases:{a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},externalIds:!0},jT=["kind","status","tag","tags","assignee","type","project","externalid","jira","title","search"],Db="all",kT=/^[a-z][a-z0-9]*$/;function cw(e){return typeof e=="string"&&mm.includes(e)}function IO(e){return e==="all"||cw(e)}function MO(e){if(!e||typeof e!="object")return OO();const t=e,n=IO(t.defaultScope)?t.defaultScope:ha.defaultScope,r=typeof t.externalIds=="boolean"?t.externalIds:ha.externalIds;let o;if(t.aliases&&typeof t.aliases=="object"){o={};for(const[i,a]of Object.entries(t.aliases))kT.test(i)&&i!==Db&&!jT.includes(i)&&cw(a)&&(o[i]=a)}else o={...ha.aliases};return{defaultScope:n,aliases:o,externalIds:r}}function LO(e){if(!e||typeof e!="object")return{ok:!1,errors:["aliases must be an object"]};const t=[];for(const[n,r]of Object.entries(e))kT.test(n)||t.push(`alias key "${n}" must be lowercase and match [a-z][a-z0-9]*`),n===Db&&t.push(`alias key "${Db}" is reserved (the "search everything" escape)`),jT.includes(n)&&t.push(`alias key "${n}" collides with the reserved field name "${n}"`),cw(r)||t.push(`alias "${n}" must map to one of: ${mm.join(", ")}`);return t.length===0?{ok:!0}:{ok:!1,errors:t}}function OO(){return{defaultScope:ha.defaultScope,aliases:{...ha.aliases},externalIds:ha.externalIds}}const uw={search:ha,custom:!1};let Pl=null,pl=null,xh=0;const $b=new Set;function NT(e){Pl=e;for(const t of $b)t(e)}function dw(e){if(!e||typeof e!="object")return uw;const t=e;return{search:MO(t.search),custom:t.custom===!0}}function FO(){if(Pl)return Promise.resolve(Pl);if(pl)return pl;const e=++xh;return pl=fetch("/api/config/search").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{pl=null;const n=dw(t);return e!==xh?Pl??n:(Pl=n,n)}).catch(()=>(pl=null,uw)),pl}function fw(){const[e,t]=m.useState(()=>Pl??uw);return m.useEffect(()=>{let n=!1;return FO().then(r=>{n||t(r)}),$b.add(t),()=>{n=!0,$b.delete(t)}},[]),e}async function zO(e){var r;++xh;const t=await fetch("/api/config/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const o=await t.json().catch(()=>null);throw new Error(((r=o==null?void 0:o.errors)==null?void 0:r.join("; "))??(o==null?void 0:o.error)??`HTTP ${t.status}`)}const n=dw(await t.json());return NT(n),n}async function BO(){++xh;const e=await fetch("/api/config/search",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=dw(await e.json());return NT(t),t}const UO=new Set(["/projects","/assignments","/servers","/todos"]);function Bp(e,t){return UO.has(e)?`${t}${e}`:e}const HO=[{id:"page-overview",title:"Overview",basePath:"/",keywords:["home","dashboard"]},{id:"page-projects",title:"Projects",basePath:"/projects",keywords:[]},{id:"page-assignments",title:"Assignments",basePath:"/assignments",keywords:[]},{id:"page-todos",title:"Todos",basePath:"/todos",keywords:["tasks"]},{id:"page-servers",title:"Servers",basePath:"/servers",keywords:["sessions"]},{id:"page-playbooks",title:"Playbooks",basePath:"/playbooks",keywords:[]},{id:"page-memories",title:"Memories",basePath:"/memories",keywords:["knowledge","learnings"]},{id:"page-resources",title:"Resources",basePath:"/resources",keywords:["knowledge","reference"]},{id:"page-workflow",title:"Workflow",basePath:"/workflow",keywords:["statuses","transitions","derive","facts"]},{id:"page-settings",title:"Settings",basePath:"/settings",keywords:[]},{id:"page-help",title:"Help",basePath:"/help",keywords:["shortcuts"]}];function VO(e){if(!(e!=null&&e.length))return[];const t=[];for(const n of e)n.id&&(t.push(n.id),n.system&&t.push(`${n.system}:${n.id}`));return t}function WO(e){const t=[],n=e.externalIds!==!1,r=i=>n?VO(i):[],o=i=>n?i:void 0;for(const i of HO)t.push({type:"page",id:i.id,title:i.title,keywords:[...i.keywords],route:Bp(i.basePath,e.wsPrefix)});for(const i of e.projects??[]){const a=i.workspace?`/w/${i.workspace}`:"";t.push({type:"project",id:`project-${i.slug}`,title:i.title,subtitle:i.slug,keywords:[...i.tags??[],...r(i.externalIds)],route:`${a}/projects/${i.slug}`,tags:i.tags,project:i.slug,externalIds:o(i.externalIds)}),t.push({type:"todo",id:`project-todos-${i.slug}`,title:`${i.title} todos`,subtitle:`${i.slug} · project`,keywords:[...i.tags??[],"project","todos"],route:`${a}/projects/${i.slug}?tab=todos`})}for(const i of e.assignments??[]){const a=i.projectWorkspace?`/w/${i.projectWorkspace}`:"";t.push({type:"assignment",id:i.projectSlug===null?`assignment-standalone-${i.id}`:`assignment-${i.projectSlug}-${i.slug}`,title:i.title,subtitle:`${i.projectTitle} · ${i.status}`,keywords:[i.projectSlug??"standalone",i.assignee??"",...r(i.externalIds)].filter(l=>!!l),route:i.projectSlug===null?`/assignments/${i.id}`:`${a}/projects/${i.projectSlug}/assignments/${i.slug}`,status:i.status,tags:i.tags,assignee:i.assignee,assignmentType:i.type,project:i.projectSlug,externalIds:o(i.externalIds)})}for(const i of e.playbooks??[])t.push({type:"playbook",id:`playbook-${i.slug}`,title:i.name,subtitle:i.description,keywords:i.tags,route:`/playbooks/${i.slug}`,tags:i.tags});for(const i of e.servers??[])t.push({type:"server",id:`server-${i.name}`,title:i.name,subtitle:i.alive?"alive":"dead",route:`${Bp("/servers",e.wsPrefix)}#server-${encodeURIComponent(i.name)}`});for(const i of e.todos??[]){const a=i.workspace&&i.workspace!=="_ungrouped"?`/w/${i.workspace}`:e.wsPrefix,l=Bp("/todos",a);t.push({type:"todo",id:`todo-${i.id}`,title:i.description,subtitle:i.status,keywords:i.tags,route:`${l}?focus=${encodeURIComponent(i.id)}`,status:i.status,tags:i.tags})}return t}function KO(e){return!e.standalone&&!!e.projectWorkspace&&e.fileKind!=="memory"&&e.fileKind!=="resource"?`/w/${e.projectWorkspace}`:""}function qO(e){return e.map((t,n)=>({type:"content",id:`content-${t.path}-${n}`,title:`${t.assignmentSlug??t.itemSlug??""} › ${t.section??t.fileKind}`,subtitle:t.projectSlug??(t.standalone?"standalone":void 0),route:`${KO(t)}${t.route}`,project:t.projectSlug,snippet:t.snippet,snippetMatches:t.matches}))}function $r(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Up(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function GO(e,t,n){const r=t?"disable":"enable",o=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${r}`,{method:"POST"});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error||`Failed to ${r} playbook`)}n()}async function ay(e,t){const n=await fetch(`/api/todos/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Failed to create todo (HTTP ${n.status})`)}}async function X1(){const e=await fetch("/api/workspaces");if(!e.ok)throw new Error(`Failed to load workspaces (HTTP ${e.status})`);const t=await e.json();return{workspaces:Array.isArray(t.workspaces)?t.workspaces:[],hasUngrouped:t.hasUngrouped===!0}}async function Q1(){const e=await fetch("/api/projects");if(!e.ok)throw new Error(`Failed to load projects (HTTP ${e.status})`);const t=await e.json();return Array.isArray(t)?t:[]}async function ly(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to load template (HTTP ${t.status})`);const n=await t.json();if(!n.content)throw new Error("Template returned no content");return n.content}function Xi(e,t,n){const r=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!r)return`---
|
|
577
|
+
${t}: ${JSON.stringify(n)}
|
|
578
|
+
---
|
|
579
|
+
${e}`;const o=r[1],i=r[2],a=r[3],l=e.slice(r[0].length),u=JSON.stringify(n),f=new RegExp(`^${t}:\\s*.*$`,"m");let p;return f.test(i)?p=i.replace(f,`${t}: ${u}`):p=`${i}
|
|
580
|
+
${t}: ${u}`,`${o}${p}${a}${l}`}const YO=/^[a-z0-9][a-z0-9-]*$/;function XO(e){const{playbooks:t,projectSlug:n,currentProjectTitle:r,currentProjectWorkspace:o,wsPrefix:i,refetchPlaybooks:a,navigate:l,toggleTheme:u}=e,f=[];if(f.push({id:"new-workspace",title:"New Workspace",subtitle:"Create a Syntaur workspace",group:"Create",keywords:["new","create","workspace"],bindableKind:"new-workspace",flow:{steps:[{kind:"text",id:"name",label:"Workspace name",placeholder:"lowercase, hyphenated (e.g. acme-app)",required:!0,pattern:{regex:YO,message:"Use lowercase letters, digits, and hyphens (e.g. acme-app). Must start with a letter or digit."}}],submit:async(p,h)=>{const g=(p.name??"").trim();if(!g)throw new Error("Name is required");const y=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:g})});if(!y.ok){const k=await y.json().catch(()=>({}));throw new Error(k.error||`Failed to create workspace (HTTP ${y.status})`)}h.navigate(`/w/${g}/projects`)}}}),f.push({id:"new-project",title:"New Project",subtitle:"Create a project (pick workspace)",group:"Create",keywords:["new","create","project"],bindableKind:"new-project",flow:{steps:[{kind:"picker",id:"workspace",label:"Workspace",emptyMessage:'No workspaces yet — create one with "New Workspace"',loadOptions:async()=>{const{workspaces:p,hasUngrouped:h}=await X1(),g=[{value:"_ungrouped",label:"Ungrouped",hint:"no workspace"}];for(const y of p)g.push({value:y,label:y,hint:"workspace"});return g}},{kind:"text",id:"title",label:"Project title",placeholder:"e.g. Marketing site rebuild",required:!0}],submit:async(p,h)=>{const g=(p.workspace??"").trim(),y=(p.title??"").trim();if(!y)throw new Error("Title is required");const k=$r(y);if(!k)throw new Error("Title must contain at least one alphanumeric character");let v=await ly("/api/templates/project");v=Xi(v,"slug",k),v=Xi(v,"title",y),g&&g!=="_ungrouped"&&(v=Xi(v,"workspace",g));const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:v})}),w=await b.json().catch(()=>({}));if(!b.ok)throw new Error(w.error||`Failed to create project (HTTP ${b.status})`);const S=g&&g!=="_ungrouped"?`/w/${g}/projects/${w.slug??k}`:`/projects/${w.slug??k}`;h.navigate(S)}}}),f.push({id:"new-todo",title:"New Todo",subtitle:"Pick scope (global / workspace / project)",group:"Create",keywords:["new","create","todo","task"],bindableKind:"new-todo",flow:{steps:[{kind:"picker",id:"scope",label:"Scope",loadOptions:async()=>{const[{workspaces:p},h]=await Promise.all([X1(),Q1()]),g=[{value:"_ungrouped",label:"Global",hint:"no workspace"}];for(const y of p)g.push({value:y,label:y,hint:"workspace"});for(const y of h){const k=y.workspace??"_ungrouped";g.push({value:k,label:`${y.title}`,hint:`project · ${y.workspace??"ungrouped"}`})}return g}},{kind:"text",id:"description",label:"Description",placeholder:"Describe the todo…",required:!0}],submit:async p=>{const h=(p.scope??"_ungrouped").trim()||"_ungrouped",g=(p.description??"").trim();if(!g)throw new Error("Description is required");await aw(h,g)}}}),f.push({id:"new-assignment",title:"New Assignment",subtitle:"Pick standalone or a project",group:"Create",keywords:["new","create","assignment"],bindableKind:"new-assignment",flow:{steps:[{kind:"picker",id:"project",label:"Project",loadOptions:async()=>{const p=await Q1(),h=[{value:"_standalone",label:"Standalone",hint:"one-off / not in a project"}];for(const g of p)h.push({value:g.slug,label:g.title,hint:g.workspace?`workspace · ${g.workspace}`:"ungrouped"});return h}},{kind:"text",id:"title",label:"Assignment title",placeholder:"What needs to get done?",required:!0}],submit:async(p,h)=>{var N;const g=(p.project??"_standalone").trim()||"_standalone",y=(p.title??"").trim();if(!y)throw new Error("Title is required");const k=$r(y);if(!k)throw new Error("Title must contain at least one alphanumeric character");if(g==="_standalone"){let C=await ly("/api/templates/assignment?standalone=1");C=Xi(C,"slug",k),C=Xi(C,"title",y);const R=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:C})}),T=await R.json().catch(()=>({}));if(!R.ok)throw new Error(T.error||`Failed to create assignment (HTTP ${R.status})`);const A=((N=T==null?void 0:T.assignment)==null?void 0:N.id)??(T==null?void 0:T.id);A?h.navigate(`/assignments/${A}`):h.navigate("/assignments");return}let v=await ly("/api/templates/assignment");v=Xi(v,"slug",k),v=Xi(v,"title",y);const b=await fetch(`/api/projects/${encodeURIComponent(g)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:v})}),w=await b.json().catch(()=>({}));if(!b.ok)throw new Error(w.error||`Failed to create assignment (HTTP ${b.status})`);const S=w.slug??k;h.navigate(`/projects/${g}/assignments/${S}`)}}}),f.push({id:"create-project-route",title:"New Project (advanced editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","project","advanced","editor"],run:()=>l(`${i}/create/project`)}),f.push({id:"create-standalone-assignment",title:"New Standalone Assignment (editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","assignment","standalone","one-off","editor"],run:()=>l(`${i}/assignments/new`)}),n&&f.push({id:`create-assignment-in-${n}`,title:`New Assignment in ${r??n}`,subtitle:n,group:"Create",keywords:["new","create","assignment",n],run:()=>l(`${i}/projects/${n}/create/assignment`)}),f.push({id:"create-playbook",title:"New Playbook",group:"Create",keywords:["new","create","playbook"],run:()=>l("/playbooks/create")}),f.push({id:"create-todo-global",title:"New Todo (global, quick)",subtitle:"Ungrouped, single-step",group:"Create",keywords:["new","create","todo","global","ungrouped","quick"],requiresInput:{placeholder:"Describe the todo…",runWithInput:async p=>{const h=p.trim();h&&await ay("_ungrouped",h)}}}),i){const p=i.replace(/^\/w\//,"");f.push({id:`create-todo-workspace-${p}`,title:`New Todo in workspace ${p}`,subtitle:p,group:"Create",keywords:["new","create","todo","workspace",p],requiresInput:{placeholder:`Describe the todo for workspace ${p}…`,runWithInput:async h=>{const g=h.trim();g&&await ay(p,g)}}})}n&&o&&f.push({id:`create-todo-project-${n}`,title:`New Todo in project ${r??n}`,subtitle:`${n} · workspace ${o}`,group:"Create",keywords:["new","create","todo","project",n,o],requiresInput:{placeholder:`Describe the todo for project ${r??n}…`,runWithInput:async p=>{const h=p.trim();h&&await ay(o,h)}}});for(const p of t)f.push({id:`toggle-playbook-${p.slug}`,title:`Toggle Playbook: ${p.name}`,subtitle:p.enabled?"enabled":"disabled",group:"Toggle",keywords:["toggle","playbook",p.slug,...p.tags??[]],run:()=>GO(p.slug,p.enabled,a)});return f.push({id:"toggle-theme",title:"Toggle theme",subtitle:"Light / dark",group:"Theme",keywords:["theme","toggle","light","dark","appearance"],run:()=>u()}),f}const QO=["low","medium","high","critical"],gm={status:{kind:"enum"},priority:{kind:"ordinal",order:QO},type:{kind:"enum"},assignee:{kind:"string",noneSentinel:!0},project:{kind:"string",noneSentinel:!0},tag:{kind:"list",get:e=>e.tags},tags:{kind:"list"},archived:{kind:"bool"},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title},created:{kind:"timestamp"},updated:{kind:"timestamp"},completedat:{kind:"timestamp",get:e=>e.completedAt},statusage:{kind:"duration",get:e=>e.statusAge},phase:{kind:"enum"},disposition:{kind:"enum"},phaseage:{kind:"duration",get:e=>e.phaseAge},hasrealobjective:{kind:"bool",get:e=>e.hasRealObjective},acrealtotal:{kind:"number",get:e=>e.acRealTotal},acrealchecked:{kind:"number",get:e=>e.acRealChecked},acallchecked:{kind:"bool",get:e=>e.acAllChecked},planexists:{kind:"bool",get:e=>e.planExists},planapproved:{kind:"bool",get:e=>e.planApproved},workspaceset:{kind:"bool",get:e=>e.workspaceSet},implementationstarted:{kind:"bool",get:e=>e.implementationStarted},depssatisfied:{kind:"bool",get:e=>e.depsSatisfied},unresolvedquestions:{kind:"number",get:e=>e.unresolvedQuestions},progressstaledays:{kind:"duration",get:e=>e.progressStaleDays},blocked:{kind:"bool"},parked:{kind:"bool"},reviewrequested:{kind:"bool",get:e=>e.reviewRequested},reworkrequested:{kind:"bool",get:e=>e.reworkRequested},pinned:{kind:"bool"}};function JO(e,t){return e[t.toLowerCase()]??null}function Ir(e,t,n){return e.get?e.get(n):n[t]??n[t.toLowerCase()]}class yr extends Error{constructor(t){super(t.map(n=>`${n.message} (at ${n.pos})`).join("; ")),this.errors=t,this.name="CompileError"}}function ST(e){const[t,n,r]=e.raw.split("-").map(a=>parseInt(a,10)),o=new Date(t,n-1,r);if(o.getFullYear()!==t||o.getMonth()!==n-1||o.getDate()!==r)throw new yr([{pos:e.pos,message:`Invalid date "${e.raw}"`}]);const i=new Date(t,n-1,r+1).getTime();return[o.getTime(),i]}function Ib(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.length>0){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null}function Hu(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){const t=Number(e);return Number.isFinite(t)?t:null}return null}function cy(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function ZO(e){return e==null||e===""}function Hp(e,t,n,r){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?o=>ZO(Ir(e,t,o)):o=>cy(Ir(e,t,o),n.raw);case"substring":return o=>{const i=Ir(e,t,o);return typeof i=="string"&&i.toLowerCase().includes(n.raw.toLowerCase())};case"bool":{const o=n.raw.toLowerCase();if(o!=="true"&&o!=="false")throw new yr([{pos:n.pos,message:`Field "${t}" is boolean — use ${t}:true or ${t}:false`}]);const i=o==="true";return a=>{const l=Ir(e,t,a),u=typeof l=="boolean"?l:l==="true"?!0:l==="false"||l===null||l===void 0||l===""?!1:null;return u!==null&&u===i}}case"number":{const o=n.num??Hu(n.raw);if(o===null)throw new yr([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return i=>Hu(Ir(e,t,i))===o}case"ordinal":return o=>cy(Ir(e,t,o),n.raw);case"list":return o=>{const i=Ir(e,t,o);return Array.isArray(i)&&i.some(a=>cy(a,n.raw))};case"timestamp":{if(n.type==="date"){const[o,i]=ST(n);return a=>{const l=Ib(Ir(e,t,a));return l!==null&&l>=o&&l<i}}throw new yr([{pos:n.pos,message:`Field "${t}" is a timestamp — use a comparison (e.g. ${t} > -36h) or an absolute date (${t}:2026-06-01)`}])}case"duration":throw new yr([{pos:r,message:`Field "${t}" is a duration — use a comparison (e.g. ${t} > 3d)`}])}}function eF(e,t,n,r){const o=(i,a)=>{switch(n){case"<":return i<a;case">":return i>a;case"<=":return i<=a;case">=":return i>=a;case"=":return i===a;case"!=":return i!==a;default:return!1}};switch(e.kind){case"number":{const i=r.num??Hu(r.raw);if(i===null)throw new yr([{pos:r.pos,message:`"${r.raw}" is not a number (field "${t}")`}]);return a=>{const l=Hu(Ir(e,t,a));return l!==null&&o(l,i)}}case"ordinal":{const i=e.order??[],a=i.findIndex(l=>l.toLowerCase()===r.raw.toLowerCase());if(a<0)throw new yr([{pos:r.pos,message:`"${r.raw}" is not a valid ${t} (expected one of: ${i.join(", ")})`}]);return l=>{const u=Ir(e,t,l),f=typeof u=="string"?i.findIndex(p=>p.toLowerCase()===u.toLowerCase()):-1;return f>=0&&o(f,a)}}case"timestamp":{if(r.type==="duration"){const a=(r.sign===0?-1:r.sign??-1)*(r.num??0);return(l,u)=>{const f=Ib(Ir(e,t,l));return f!==null&&o(f,u.now+a)}}if(r.type==="date"){const[i,a]=ST(r);return l=>{const u=Ib(Ir(e,t,l));if(u===null)return!1;switch(n){case"<":return u<i;case"<=":return u<a;case">":return u>=a;case">=":return u>=i;case"=":return u>=i&&u<a;case"!=":return u<i||u>=a;default:return!1}}}throw new yr([{pos:r.pos,message:`Compare timestamp field "${t}" to a duration (e.g. -36h) or a date (YYYY-MM-DD)`}])}case"duration":{if(r.type!=="duration")throw new yr([{pos:r.pos,message:`Compare duration field "${t}" to a duration literal (e.g. 3d)`}]);const i=r.num??0;return a=>{const l=Hu(Ir(e,t,a));return l!==null&&o(l,i)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return Hp(e,t,r,r.pos);if(n==="!="){const i=Hp(e,t,r,r.pos);return(a,l)=>!i(a,l)}throw new yr([{pos:r.pos,message:`Field "${t}" does not support ordering comparisons (use ":" or "=").`}])}case"bool":{if(n==="="||n==="!="){const i=Hp(e,t,r,r.pos);return n==="="?i:(a,l)=>!i(a,l)}throw new yr([{pos:r.pos,message:`Field "${t}" is boolean — use ${t}:true / ${t}:false`}])}}}function tF(e,t){const n=JO(t,e.field);if(!n)throw new yr([{pos:e.pos,message:`Unknown field "${e.field}"`}]);if(e.op===":"){const r=e.values.map(o=>Hp(n,e.field,o,e.pos));return r.length===1?r[0]:(o,i)=>r.some(a=>a(o,i))}return eF(n,e.field,e.op,e.values[0])}function Vu(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return tF(e,t);case"not":{const n=Vu(e.child,t);return(r,o)=>!n(r,o)}case"and":{const n=e.children.map(r=>Vu(r,t));return(r,o)=>n.every(i=>i(r,o))}case"or":{const n=e.children.map(r=>Vu(r,t));return(r,o)=>n.some(i=>i(r,o))}}}class ia extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const nF={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},rF=/[A-Za-z_]/,sF=/[A-Za-z0-9_-]/,oF=/^\d{4}-\d{2}-\d{2}(?![\d-])/;function xm(e){const t=[];let n=0;const r=(o,i)=>{let a=n;for(;a<e.length&&/\d/.test(e[a]);)a++;const l=e.slice(n,a);let u="";for(;a<e.length&&/[a-z]/i.test(e[a]);)u+=e[a],a++;if(n=a,u.length>0){const f=nF[u.toLowerCase()];if(f===void 0)throw new ia(o,`Unknown duration unit "${u}" (expected h, d, w, m, mo, or y)`);return{type:"DURATION",text:e.slice(o,a),pos:o,num:parseInt(l,10)*f,sign:i}}return i!==0?{type:"NUMBER",text:e.slice(o,a),pos:o,num:i*parseInt(l,10)}:{type:"NUMBER",text:l,pos:o,num:parseInt(l,10)}};for(;n<e.length;){const o=e[n],i=n;if(o===" "||o===" "||o===`
|
|
581
|
+
`||o==="\r"){n++;continue}if(o==="("){t.push({type:"LPAREN",text:o,pos:i}),n++;continue}if(o===")"){t.push({type:"RPAREN",text:o,pos:i}),n++;continue}if(o===","){t.push({type:"COMMA",text:o,pos:i}),n++;continue}if(o===":"){t.push({type:"COLON",text:o,pos:i}),n++;continue}if(o==="*"){t.push({type:"STAR",text:o,pos:i}),n++;continue}if(o==="<"||o===">"){e[n+1]==="="?(t.push({type:"OP",text:o+"=",pos:i}),n+=2):(t.push({type:"OP",text:o,pos:i}),n++);continue}if(o==="!"){if(e[n+1]==="="){t.push({type:"OP",text:"!=",pos:i}),n+=2;continue}throw new ia(i,'Unexpected "!" (did you mean "!="?)')}if(o==="="){n+=e[n+1]==="="?2:1,t.push({type:"OP",text:"=",pos:i});continue}if(o==='"'||o==="'"){const a=o;let l=n+1,u="";for(;l<e.length&&e[l]!==a;)e[l]==="\\"&&l+1<e.length?(u+=e[l+1],l+=2):(u+=e[l],l++);if(l>=e.length)throw new ia(i,"Unterminated string literal");t.push({type:"STRING",text:u,pos:i}),n=l+1;continue}if(o==="-"||o==="+"){if(/\d/.test(e[n+1]??"")){const a=o==="-"?-1:1;n++,t.push(r(i,a));continue}if(o==="-"){t.push({type:"MINUS",text:"-",pos:i}),n++;continue}throw new ia(i,'Unexpected "+"')}if(/\d/.test(o)){const a=e.slice(n).match(oF);if(a){t.push({type:"DATE",text:a[0],pos:i}),n+=a[0].length;continue}t.push(r(i,0));continue}if(rF.test(o)){let a=n+1;for(;a<e.length&&sF.test(e[a]);)a++;const l=e.slice(n,a),u=l.toLowerCase();u==="and"?t.push({type:"AND",text:l,pos:i}):u==="or"?t.push({type:"OR",text:l,pos:i}):u==="not"?t.push({type:"NOT",text:l,pos:i}):t.push({type:"IDENT",text:l,pos:i}),n=a;continue}throw new ia(i,`Unexpected character "${o}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class Ji extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const iF=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),aF=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class lF{constructor(t){Yx(this,"pos",0);this.tokens=t}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(t,n){const r=this.peek();if(r.type!==t)throw new Ji(r.pos,`Expected ${n}, got "${r.text||r.type}"`);return this.next()}parseQuery(){if(this.peek().type==="EOF")return{kind:"all"};const t=this.orExpr(),n=this.peek();if(n.type!=="EOF")throw new Ji(n.pos,`Unexpected "${n.text}" — unbalanced parentheses or stray token`);return t}orExpr(){const t=[this.andExpr()];for(;this.peek().type==="OR";)this.next(),t.push(this.andExpr());return t.length===1?t[0]:{kind:"or",children:t}}andExpr(){const t=[this.unary()];for(;;){const n=this.peek();if(n.type==="AND")this.next(),t.push(this.unary());else if(aF.has(n.type))t.push(this.unary());else break}return t.length===1?t[0]:{kind:"and",children:t}}unary(){const t=this.peek();if(t.type==="NOT")return this.next(),{kind:"not",child:this.unary()};if(t.type==="MINUS"){this.next();const n=this.peek();if(n.type!=="IDENT")throw new Ji(n.pos,'Expected a field atom after "-" negation');return{kind:"not",child:this.atom()}}return this.primary()}primary(){const t=this.peek();if(t.type==="LPAREN"){this.next();const n=this.orExpr();return this.expect("RPAREN",'")"'),n}if(t.type==="STAR")return this.next(),{kind:"all"};if(t.type==="IDENT")return this.atom();throw new Ji(t.pos,`Expected a field, "(", "*", or NOT — got "${t.text||"end of query"}"`)}atom(){const t=this.expect("IDENT","a field name"),n=this.peek();if(n.type==="COLON"){this.next();const r=this.valueOrList();return{kind:"atom",field:t.text,op:":",values:r,pos:t.pos}}if(n.type==="OP"){this.next();const r=this.value();return{kind:"atom",field:t.text,op:n.text,values:[r],pos:t.pos}}throw new Ji(n.pos,`Expected ":" or a comparison operator after field "${t.text}"`)}valueOrList(){if(this.peek().type==="LPAREN"){this.next();const t=[this.value()];for(;this.peek().type==="COMMA";)this.next(),t.push(this.value());return this.expect("RPAREN",'")" to close the value list'),t}return[this.value()]}value(){const t=this.peek();if(!iF.has(t.type))throw new Ji(t.pos,`Expected a value, got "${t.text||t.type}"`);switch(this.next(),t.type){case"STRING":return{type:"string",raw:t.text,pos:t.pos};case"NUMBER":return{type:"number",raw:t.text,num:t.num,pos:t.pos};case"DATE":return{type:"date",raw:t.text,pos:t.pos};case"DURATION":return{type:"duration",raw:t.text,num:t.num,sign:t.sign??0,pos:t.pos};default:return{type:"word",raw:t.text,pos:t.pos}}}}function ym(e){try{const t=xm(e);return{ast:new lF(t).parseQuery(),errors:[]}}catch(t){if(t instanceof ia||t instanceof Ji)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function nc(e,t=gm){const n=ym(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:Vu(n.ast,t),ast:n.ast},errors:[]}}catch(r){if(r instanceof yr)return{query:null,errors:r.errors};throw r}}function sn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function J1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function bm(...e){return t=>{let n=!1;const r=e.map(o=>{const i=J1(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():J1(e[o],null)}}}}function nr(...e){return m.useCallback(bm(...e),e)}function cF(e,t){const n=m.createContext(t),r=i=>{const{children:a,...l}=i,u=m.useMemo(()=>l,Object.values(l));return s.jsx(n.Provider,{value:u,children:a})};r.displayName=e+"Provider";function o(i){const a=m.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function Aa(e,t=[]){let n=[];function r(i,a){const l=m.createContext(a),u=n.length;n=[...n,a];const f=h=>{var w;const{scope:g,children:y,...k}=h,v=((w=g==null?void 0:g[e])==null?void 0:w[u])||l,b=m.useMemo(()=>k,Object.values(k));return s.jsx(v.Provider,{value:b,children:y})};f.displayName=i+"Provider";function p(h,g){var v;const y=((v=g==null?void 0:g[e])==null?void 0:v[u])||l,k=m.useContext(y);if(k)return k;if(a!==void 0)return a;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[f,p]}const o=()=>{const i=n.map(a=>m.createContext(a));return function(l){const u=(l==null?void 0:l[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return o.scopeName=e,[r,uF(o,...t)]}function uF(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const a=r.reduce((l,{useScope:u,scopeName:f})=>{const h=u(i)[`__scope${f}`];return{...l,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var wi=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},dF=s2[" useId ".trim().toString()]||(()=>{}),fF=0;function Bl(e){const[t,n]=m.useState(dF());return wi(()=>{n(r=>r??String(fF++))},[e]),e||(t?`radix-${t}`:"")}var pF=s2[" useInsertionEffect ".trim().toString()]||wi;function vm({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,a]=hF({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:o;{const p=m.useRef(e!==void 0);m.useEffect(()=>{const h=p.current;h!==l&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=l},[l,r])}const f=m.useCallback(p=>{var h;if(l){const g=mF(p)?p(e):p;g!==e&&((h=a.current)==null||h.call(a,g))}else i(p)},[l,e,i,a]);return[u,f]}function hF({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),o=m.useRef(n),i=m.useRef(t);return pF(()=>{i.current=t},[t]),m.useEffect(()=>{var a;o.current!==n&&((a=i.current)==null||a.call(i,n),o.current=n)},[n,o]),[n,r,i]}function mF(e){return typeof e=="function"}function gF(e){const t=xF(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),u=l.find(bF);if(u){const f=u.props.children,p=l.map(h=>h===u?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return s.jsx(t,{...a,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,p):null})}return s.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function xF(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=wF(o),l=vF(i,o.props);return o.type!==m.Fragment&&(l.ref=r?bm(r,a):a),m.cloneElement(o,l)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yF=Symbol("radix.slottable");function bF(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yF}function vF(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const u=i(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function wF(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sn=jF.reduce((e,t)=>{const n=gF(`Primitive.${t}`),r=m.forwardRef((o,i)=>{const{asChild:a,...l}=o,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function kF(e,t){e&&Xs.flushSync(()=>e.dispatchEvent(t))}function wa(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function NF(e,t=globalThis==null?void 0:globalThis.document){const n=wa(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var SF="DismissableLayer",Mb="dismissableLayer.update",CF="dismissableLayer.pointerDownOutside",EF="dismissableLayer.focusOutside",Z1,CT=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pw=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...u}=e,f=m.useContext(CT),[p,h]=m.useState(null),g=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=m.useState({}),k=nr(t,A=>h(A)),v=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),w=v.indexOf(b),S=p?v.indexOf(p):-1,N=f.layersWithOutsidePointerEventsDisabled.size>0,C=S>=w,R=AF(A=>{const I=A.target,_=[...f.branches].some(z=>z.contains(I));!C||_||(o==null||o(A),a==null||a(A),A.defaultPrevented||l==null||l())},g),T=PF(A=>{const I=A.target;[...f.branches].some(z=>z.contains(I))||(i==null||i(A),a==null||a(A),A.defaultPrevented||l==null||l())},g);return NF(A=>{S===f.layers.size-1&&(r==null||r(A),!A.defaultPrevented&&l&&(A.preventDefault(),l()))},g),m.useEffect(()=>{if(p)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Z1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),eN(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Z1)}},[p,g,n,f]),m.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),eN())},[p,f]),m.useEffect(()=>{const A=()=>y({});return document.addEventListener(Mb,A),()=>document.removeEventListener(Mb,A)},[]),s.jsx(Sn.div,{...u,ref:k,style:{pointerEvents:N?C?"auto":"none":void 0,...e.style},onFocusCapture:sn(e.onFocusCapture,T.onFocusCapture),onBlurCapture:sn(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:sn(e.onPointerDownCapture,R.onPointerDownCapture)})});pw.displayName=SF;var TF="DismissableLayerBranch",RF=m.forwardRef((e,t)=>{const n=m.useContext(CT),r=m.useRef(null),o=nr(t,r);return m.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(Sn.div,{...e,ref:o})});RF.displayName=TF;function AF(e,t=globalThis==null?void 0:globalThis.document){const n=wa(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let u=function(){ET(CF,n,f,{discrete:!0})};const f={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function PF(e,t=globalThis==null?void 0:globalThis.document){const n=wa(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&ET(EF,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function eN(){const e=new CustomEvent(Mb);document.dispatchEvent(e)}function ET(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?kF(o,i):o.dispatchEvent(i)}var uy="focusScope.autoFocusOnMount",dy="focusScope.autoFocusOnUnmount",tN={bubbles:!1,cancelable:!0},_F="FocusScope",TT=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[l,u]=m.useState(null),f=wa(o),p=wa(i),h=m.useRef(null),g=nr(t,v=>u(v)),y=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let v=function(N){if(y.paused||!l)return;const C=N.target;l.contains(C)?h.current=C:mi(h.current,{select:!0})},b=function(N){if(y.paused||!l)return;const C=N.relatedTarget;C!==null&&(l.contains(C)||mi(h.current,{select:!0}))},w=function(N){if(document.activeElement===document.body)for(const R of N)R.removedNodes.length>0&&mi(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",b);const S=new MutationObserver(w);return l&&S.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",b),S.disconnect()}}},[r,l,y.paused]),m.useEffect(()=>{if(l){rN.add(y);const v=document.activeElement;if(!l.contains(v)){const w=new CustomEvent(uy,tN);l.addEventListener(uy,f),l.dispatchEvent(w),w.defaultPrevented||(DF(OF(RT(l)),{select:!0}),document.activeElement===v&&mi(l))}return()=>{l.removeEventListener(uy,f),setTimeout(()=>{const w=new CustomEvent(dy,tN);l.addEventListener(dy,p),l.dispatchEvent(w),w.defaultPrevented||mi(v??document.body,{select:!0}),l.removeEventListener(dy,p),rN.remove(y)},0)}}},[l,f,p,y]);const k=m.useCallback(v=>{if(!n&&!r||y.paused)return;const b=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,w=document.activeElement;if(b&&w){const S=v.currentTarget,[N,C]=$F(S);N&&C?!v.shiftKey&&w===C?(v.preventDefault(),n&&mi(N,{select:!0})):v.shiftKey&&w===N&&(v.preventDefault(),n&&mi(C,{select:!0})):w===S&&v.preventDefault()}},[n,r,y.paused]);return s.jsx(Sn.div,{tabIndex:-1,...a,ref:g,onKeyDown:k})});TT.displayName=_F;function DF(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(mi(r,{select:t}),document.activeElement!==n)return}function $F(e){const t=RT(e),n=nN(t,e),r=nN(t.reverse(),e);return[n,r]}function RT(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function nN(e,t){for(const n of e)if(!IF(n,{upTo:t}))return n}function IF(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 MF(e){return e instanceof HTMLInputElement&&"select"in e}function mi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&MF(e)&&t&&e.select()}}var rN=LF();function LF(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=sN(e,t),e.unshift(t)},remove(t){var n;e=sN(e,t),(n=e[0])==null||n.resume()}}}function sN(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function OF(e){return e.filter(t=>t.tagName!=="A")}var FF="Portal",hw=m.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,i]=m.useState(!1);wi(()=>i(!0),[]);const a=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?f5.createPortal(s.jsx(Sn.div,{...r,ref:t}),a):null});hw.displayName=FF;function zF(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var Pa=e=>{const{present:t,children:n}=e,r=BF(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=nr(r.ref,UF(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};Pa.displayName="Presence";function BF(e){const[t,n]=m.useState(),r=m.useRef(null),o=m.useRef(e),i=m.useRef("none"),a=e?"mounted":"unmounted",[l,u]=zF(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const f=up(r.current);i.current=l==="mounted"?f:"none"},[l]),wi(()=>{const f=r.current,p=o.current;if(p!==e){const g=i.current,y=up(f);e?u("MOUNT"):y==="none"||(f==null?void 0:f.display)==="none"?u("UNMOUNT"):u(p&&g!==y?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),wi(()=>{if(t){let f;const p=t.ownerDocument.defaultView??window,h=y=>{const v=up(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&v&&(u("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",f=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},g=y=>{y.target===t&&(i.current=up(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{p.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function up(e){return(e==null?void 0:e.animationName)||"none"}function UF(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fy=0;function HF(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??oN()),document.body.insertAdjacentElement("beforeend",e[1]??oN()),fy++,()=>{fy===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),fy--}},[])}function oN(){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 Gs=function(){return Gs=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Gs.apply(this,arguments)};function AT(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function VF(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Vp="right-scroll-bar-position",Wp="width-before-scroll-bar",WF="with-scroll-bars-hidden",KF="--removed-body-scroll-bar-size";function py(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function qF(e,t){var n=m.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var GF=typeof window<"u"?m.useLayoutEffect:m.useEffect,iN=new WeakMap;function YF(e,t){var n=qF(null,function(r){return e.forEach(function(o){return py(o,r)})});return GF(function(){var r=iN.get(n);if(r){var o=new Set(r),i=new Set(e),a=n.current;o.forEach(function(l){i.has(l)||py(l,null)}),i.forEach(function(l){o.has(l)||py(l,a)})}iN.set(n,e)},[e]),n}function XF(e){return e}function QF(e,t){t===void 0&&(t=XF);var n=[],r=!1,o={read:function(){if(r)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(i){var a=t(i,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(i){for(r=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(i),a=n}var u=function(){var p=a;a=[],p.forEach(i)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(p){a.push(p),f()},filter:function(p){return a=a.filter(p),n}}}};return o}function JF(e){e===void 0&&(e={});var t=QF(null);return t.options=Gs({async:!0,ssr:!1},e),t}var PT=function(e){var t=e.sideCar,n=AT(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,Gs({},n))};PT.isSideCarExport=!0;function ZF(e,t){return e.useMedium(t),PT}var _T=JF(),hy=function(){},wm=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:hy,onWheelCapture:hy,onTouchMoveCapture:hy}),o=r[0],i=r[1],a=e.forwardProps,l=e.children,u=e.className,f=e.removeScrollBar,p=e.enabled,h=e.shards,g=e.sideCar,y=e.noRelative,k=e.noIsolation,v=e.inert,b=e.allowPinchZoom,w=e.as,S=w===void 0?"div":w,N=e.gapMode,C=AT(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=g,T=YF([n,t]),A=Gs(Gs({},C),o);return m.createElement(m.Fragment,null,p&&m.createElement(R,{sideCar:_T,removeScrollBar:f,shards:h,noRelative:y,noIsolation:k,inert:v,setCallbacks:i,allowPinchZoom:!!b,lockRef:n,gapMode:N}),a?m.cloneElement(m.Children.only(l),Gs(Gs({},A),{ref:T})):m.createElement(S,Gs({},A,{className:u,ref:T}),l))});wm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};wm.classNames={fullWidth:Wp,zeroRight:Vp};var e6=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function t6(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=e6();return t&&e.setAttribute("nonce",t),e}function n6(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function r6(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var s6=function(){var e=0,t=null;return{add:function(n){e==0&&(t=t6())&&(n6(t,n),r6(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},o6=function(){var e=s6();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},DT=function(){var e=o6(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},i6={left:0,top:0,right:0,gap:0},my=function(e){return parseInt(e||"",10)||0},a6=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[my(n),my(r),my(o)]},l6=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return i6;var t=a6(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},c6=DT(),Ul="data-scroll-locked",u6=function(e,t,n,r){var o=e.left,i=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
582
|
+
.`.concat(WF,` {
|
|
583
|
+
overflow: hidden `).concat(r,`;
|
|
584
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
585
|
+
}
|
|
586
|
+
body[`).concat(Ul,`] {
|
|
587
|
+
overflow: hidden `).concat(r,`;
|
|
588
|
+
overscroll-behavior: contain;
|
|
589
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
590
|
+
padding-left: `.concat(o,`px;
|
|
591
|
+
padding-top: `).concat(i,`px;
|
|
592
|
+
padding-right: `).concat(a,`px;
|
|
593
|
+
margin-left:0;
|
|
594
|
+
margin-top:0;
|
|
595
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
596
|
+
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.`).concat(Vp,` {
|
|
600
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.`).concat(Wp,` {
|
|
604
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.`).concat(Vp," .").concat(Vp,` {
|
|
608
|
+
right: 0 `).concat(r,`;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
.`).concat(Wp," .").concat(Wp,` {
|
|
612
|
+
margin-right: 0 `).concat(r,`;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
body[`).concat(Ul,`] {
|
|
616
|
+
`).concat(KF,": ").concat(l,`px;
|
|
617
|
+
}
|
|
618
|
+
`)},aN=function(){var e=parseInt(document.body.getAttribute(Ul)||"0",10);return isFinite(e)?e:0},d6=function(){m.useEffect(function(){return document.body.setAttribute(Ul,(aN()+1).toString()),function(){var e=aN()-1;e<=0?document.body.removeAttribute(Ul):document.body.setAttribute(Ul,e.toString())}},[])},f6=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;d6();var i=m.useMemo(function(){return l6(o)},[o]);return m.createElement(c6,{styles:u6(i,!t,o,n?"":"!important")})},Lb=!1;if(typeof window<"u")try{var dp=Object.defineProperty({},"passive",{get:function(){return Lb=!0,!0}});window.addEventListener("test",dp,dp),window.removeEventListener("test",dp,dp)}catch{Lb=!1}var hl=Lb?{passive:!1}:!1,p6=function(e){return e.tagName==="TEXTAREA"},$T=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!p6(e)&&n[t]==="visible")},h6=function(e){return $T(e,"overflowY")},m6=function(e){return $T(e,"overflowX")},lN=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=IT(e,r);if(o){var i=MT(e,r),a=i[1],l=i[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},g6=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},x6=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},IT=function(e,t){return e==="v"?h6(t):m6(t)},MT=function(e,t){return e==="v"?g6(t):x6(t)},y6=function(e,t){return e==="h"&&t==="rtl"?-1:1},b6=function(e,t,n,r,o){var i=y6(e,window.getComputedStyle(t).direction),a=i*r,l=n.target,u=t.contains(l),f=!1,p=a>0,h=0,g=0;do{if(!l)break;var y=MT(e,l),k=y[0],v=y[1],b=y[2],w=v-b-i*k;(k||w)&&IT(e,l)&&(h+=w,g+=k);var S=l.parentNode;l=S&&S.nodeType===Node.DOCUMENT_FRAGMENT_NODE?S.host:S}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(p&&Math.abs(h)<1||!p&&Math.abs(g)<1)&&(f=!0),f},fp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cN=function(e){return[e.deltaX,e.deltaY]},uN=function(e){return e&&"current"in e?e.current:e},v6=function(e,t){return e[0]===t[0]&&e[1]===t[1]},w6=function(e){return`
|
|
619
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
620
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
621
|
+
`)},j6=0,ml=[];function k6(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(j6++)[0],i=m.useState(DT)[0],a=m.useRef(e);m.useEffect(function(){a.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=VF([e.lockRef.current],(e.shards||[]).map(uN),!0).filter(Boolean);return v.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=m.useCallback(function(v,b){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!a.current.allowPinchZoom;var w=fp(v),S=n.current,N="deltaX"in v?v.deltaX:S[0]-w[0],C="deltaY"in v?v.deltaY:S[1]-w[1],R,T=v.target,A=Math.abs(N)>Math.abs(C)?"h":"v";if("touches"in v&&A==="h"&&T.type==="range")return!1;var I=window.getSelection(),_=I&&I.anchorNode,z=_?_===T||_.contains(T):!1;if(z)return!1;var O=lN(A,T);if(!O)return!0;if(O?R=A:(R=A==="v"?"h":"v",O=lN(A,T)),!O)return!1;if(!r.current&&"changedTouches"in v&&(N||C)&&(r.current=R),!R)return!0;var B=r.current||R;return b6(B,b,v,B==="h"?N:C)},[]),u=m.useCallback(function(v){var b=v;if(!(!ml.length||ml[ml.length-1]!==i)){var w="deltaY"in b?cN(b):fp(b),S=t.current.filter(function(R){return R.name===b.type&&(R.target===b.target||b.target===R.shadowParent)&&v6(R.delta,w)})[0];if(S&&S.should){b.cancelable&&b.preventDefault();return}if(!S){var N=(a.current.shards||[]).map(uN).filter(Boolean).filter(function(R){return R.contains(b.target)}),C=N.length>0?l(b,N[0]):!a.current.noIsolation;C&&b.cancelable&&b.preventDefault()}}},[]),f=m.useCallback(function(v,b,w,S){var N={name:v,delta:b,target:w,should:S,shadowParent:N6(w)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(C){return C!==N})},1)},[]),p=m.useCallback(function(v){n.current=fp(v),r.current=void 0},[]),h=m.useCallback(function(v){f(v.type,cN(v),v.target,l(v,e.lockRef.current))},[]),g=m.useCallback(function(v){f(v.type,fp(v),v.target,l(v,e.lockRef.current))},[]);m.useEffect(function(){return ml.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,hl),document.addEventListener("touchmove",u,hl),document.addEventListener("touchstart",p,hl),function(){ml=ml.filter(function(v){return v!==i}),document.removeEventListener("wheel",u,hl),document.removeEventListener("touchmove",u,hl),document.removeEventListener("touchstart",p,hl)}},[]);var y=e.removeScrollBar,k=e.inert;return m.createElement(m.Fragment,null,k?m.createElement(i,{styles:w6(o)}):null,y?m.createElement(f6,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function N6(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const S6=ZF(_T,k6);var LT=m.forwardRef(function(e,t){return m.createElement(wm,Gs({},e,{ref:t,sideCar:S6}))});LT.classNames=wm.classNames;var C6=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},gl=new WeakMap,pp=new WeakMap,hp={},gy=0,OT=function(e){return e&&(e.host||OT(e.parentNode))},E6=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=OT(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},T6=function(e,t,n,r){var o=E6(t,Array.isArray(e)?e:[e]);hp[n]||(hp[n]=new WeakMap);var i=hp[n],a=[],l=new Set,u=new Set(o),f=function(h){!h||l.has(h)||(l.add(h),f(h.parentNode))};o.forEach(f);var p=function(h){!h||u.has(h)||Array.prototype.forEach.call(h.children,function(g){if(l.has(g))p(g);else try{var y=g.getAttribute(r),k=y!==null&&y!=="false",v=(gl.get(g)||0)+1,b=(i.get(g)||0)+1;gl.set(g,v),i.set(g,b),a.push(g),v===1&&k&&pp.set(g,!0),b===1&&g.setAttribute(n,"true"),k||g.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",g,w)}})};return p(t),l.clear(),gy++,function(){a.forEach(function(h){var g=gl.get(h)-1,y=i.get(h)-1;gl.set(h,g),i.set(h,y),g||(pp.has(h)||h.removeAttribute(r),pp.delete(h)),y||h.removeAttribute(n)}),gy--,gy||(gl=new WeakMap,gl=new WeakMap,pp=new WeakMap,hp={})}},R6=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=C6(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),T6(r,o,n,"aria-hidden")):function(){return null}};function A6(e){const t=P6(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),u=l.find(D6);if(u){const f=u.props.children,p=l.map(h=>h===u?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return s.jsx(t,{...a,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,p):null})}return s.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function P6(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=I6(o),l=$6(i,o.props);return o.type!==m.Fragment&&(l.ref=r?bm(r,a):a),m.cloneElement(o,l)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _6=Symbol("radix.slottable");function D6(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_6}function $6(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const u=i(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function I6(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jm="Dialog",[FT,zT]=Aa(jm),[M6,As]=FT(jm),BT=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,l=m.useRef(null),u=m.useRef(null),[f,p]=vm({prop:r,defaultProp:o??!1,onChange:i,caller:jm});return s.jsx(M6,{scope:t,triggerRef:l,contentRef:u,contentId:Bl(),titleId:Bl(),descriptionId:Bl(),open:f,onOpenChange:p,onOpenToggle:m.useCallback(()=>p(h=>!h),[p]),modal:a,children:n})};BT.displayName=jm;var UT="DialogTrigger",HT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=As(UT,n),i=nr(t,o.triggerRef);return s.jsx(Sn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":xw(o.open),...r,ref:i,onClick:sn(e.onClick,o.onOpenToggle)})});HT.displayName=UT;var mw="DialogPortal",[L6,VT]=FT(mw,{forceMount:void 0}),WT=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=As(mw,t);return s.jsx(L6,{scope:t,forceMount:n,children:m.Children.map(r,a=>s.jsx(Pa,{present:n||i.open,children:s.jsx(hw,{asChild:!0,container:o,children:a})}))})};WT.displayName=mw;var yh="DialogOverlay",KT=m.forwardRef((e,t)=>{const n=VT(yh,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=As(yh,e.__scopeDialog);return i.modal?s.jsx(Pa,{present:r||i.open,children:s.jsx(F6,{...o,ref:t})}):null});KT.displayName=yh;var O6=A6("DialogOverlay.RemoveScroll"),F6=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=As(yh,n);return s.jsx(LT,{as:O6,allowPinchZoom:!0,shards:[o.contentRef],children:s.jsx(Sn.div,{"data-state":xw(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ja="DialogContent",qT=m.forwardRef((e,t)=>{const n=VT(ja,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=As(ja,e.__scopeDialog);return s.jsx(Pa,{present:r||i.open,children:i.modal?s.jsx(z6,{...o,ref:t}):s.jsx(B6,{...o,ref:t})})});qT.displayName=ja;var z6=m.forwardRef((e,t)=>{const n=As(ja,e.__scopeDialog),r=m.useRef(null),o=nr(t,n.contentRef,r);return m.useEffect(()=>{const i=r.current;if(i)return R6(i)},[]),s.jsx(GT,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:sn(e.onCloseAutoFocus,i=>{var a;i.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:sn(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&i.preventDefault()}),onFocusOutside:sn(e.onFocusOutside,i=>i.preventDefault())})}),B6=m.forwardRef((e,t)=>{const n=As(ja,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return s.jsx(GT,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var u,f;(u=e.onInteractOutside)==null||u.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=i.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),GT=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=e,l=As(ja,n),u=m.useRef(null),f=nr(t,u);return HF(),s.jsxs(s.Fragment,{children:[s.jsx(TT,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:s.jsx(pw,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":xw(l.open),...a,ref:f,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(H6,{titleId:l.titleId}),s.jsx(W6,{contentRef:u,descriptionId:l.descriptionId})]})]})}),gw="DialogTitle",YT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=As(gw,n);return s.jsx(Sn.h2,{id:o.titleId,...r,ref:t})});YT.displayName=gw;var XT="DialogDescription",QT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=As(XT,n);return s.jsx(Sn.p,{id:o.descriptionId,...r,ref:t})});QT.displayName=XT;var JT="DialogClose",ZT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=As(JT,n);return s.jsx(Sn.button,{type:"button",...r,ref:t,onClick:sn(e.onClick,()=>o.onOpenChange(!1))})});ZT.displayName=JT;function xw(e){return e?"open":"closed"}var eR="DialogTitleWarning",[U6,tR]=cF(eR,{contentName:ja,titleName:gw,docsSlug:"dialog"}),H6=({titleId:e})=>{const t=tR(eR),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
622
|
+
|
|
623
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
624
|
+
|
|
625
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},V6="DialogDescriptionWarning",W6=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${tR(V6).contentName}}.`;return m.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},nR=BT,rR=HT,sR=WT,yw=KT,bw=qT,vw=YT,ww=QT,jw=ZT;const On=nR,K6=rR,q6=sR,oR=jw,iR=m.forwardRef(({className:e,...t},n)=>s.jsx(yw,{ref:n,className:be("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));iR.displayName=yw.displayName;const Cn=m.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(q6,{children:[s.jsx(iR,{}),s.jsx(bw,{ref:r,className:be("chrome-card fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 !p-6 outline-none",e),...n,children:t})]}));Cn.displayName=bw.displayName;function sr({className:e,...t}){return s.jsx("div",{className:be("flex flex-col space-y-2 text-left",e),...t})}function Hr({className:e,...t}){return s.jsx("div",{className:be("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const En=m.forwardRef(({className:e,...t},n)=>s.jsx(vw,{ref:n,className:be("text-lg font-semibold tracking-tight text-foreground",e),...t}));En.displayName=vw.displayName;const ns=m.forwardRef(({className:e,...t},n)=>s.jsx(ww,{ref:n,className:be("text-sm leading-6 text-muted-foreground",e),...t}));ns.displayName=ww.displayName;const G6=-1,Y6=-40;function xy(e,t){if(e.length===0)return 0;if(t.length===0)return-1/0;let n=0,r=0,o=-2,i=0;for(let a=0;a<e.length;a++){const l=e[a];let u=!1;for(;r<t.length;)if(t[r]===l){if(n+=100,r===o+1&&(n+=20),r===0)n+=30;else{const f=t[r-1];(f===" "||f==="-"||f==="_"||f==="/")&&(n+=15)}i>0&&(n+=Math.max(Y6,i*G6)),o=r,i=0,r++,u=!0;break}else i++,r++;if(!u)return-1/0}return n}const dN={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function kw(e,t,n=50){const r=e.toLowerCase();if(!r)return t.slice(0,n).map(a=>({...a,score:0}));const i=t.map(a=>{var h;const l=xy(r,a.title.toLowerCase())*1,u=a.subtitle?xy(r,a.subtitle.toLowerCase())*.5:-1/0,f=(h=a.keywords)!=null&&h.length?xy(r,a.keywords.join(" ").toLowerCase())*.3:-1/0,p=Math.max(l,u,f);return{...a,score:p}}).filter(a=>a.score>-1/0);return i.sort((a,l)=>l.score!==a.score?l.score-a.score:a.title.length!==l.title.length?a.title.length-l.title.length:a.title!==l.title?a.title<l.title?-1:1:(dN[a.type]??99)-(dN[l.type]??99)),i.slice(0,n)}const X6={a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},fN=Symbol("absent");function mp(e){return e.replace(/\s+/g," ").trim()}const pN=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]);function Q6(e){const t=e.externalIds;return Array.isArray(t)?t.map(n=>n&&typeof n=="object"?`${n.system}:${n.id}`:"").join(" "):""}function J6(e){const t=e.externalIds;return Array.isArray(t)?t.filter(n=>{const r=n==null?void 0:n.system;return typeof r=="string"&&r.toLowerCase()==="jira"}).map(n=>String(n.id)).join(" "):""}const ad={kind:{kind:"enum",get:e=>e.type},status:{kind:"enum"},tag:{kind:"list",get:e=>e.tags},tags:{kind:"list"},assignee:{kind:"string",noneSentinel:!0,get:e=>"assignee"in e?e.assignee:fN},type:{kind:"enum",get:e=>e.assignmentType},project:{kind:"string",noneSentinel:!0,get:e=>"project"in e?e.project:fN},externalid:{kind:"substring",get:Q6},jira:{kind:"substring",get:J6},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title}};function Z6(e,t=X6,n){const r=(n==null?void 0:n.defaultScope)??"all",o=e.match(/^\s*all:\s*/i),i=o!==null,a=i?e.slice(o[0].length):e,l=tz(a,t),u={aqlExpr:l.aqlExpr,fuzzy:l.fuzzy};if(r!=="all"&&!i&&e.trim()!==""&&!ez(l.aqlExpr)){const f=`kind:${r}`;u.aqlExpr=l.aqlExpr?l.explicit?`${f} (${l.aqlExpr})`:`${f} ${l.aqlExpr}`:f}return u}function ez(e){if(!e)return!1;let t;try{t=xm(e)}catch{return!1}for(let n=0;n<t.length-1;n++)if(t[n].type==="IDENT"&&t[n].text.toLowerCase()==="kind"&&t[n+1].type==="COLON")return!0;return!1}function tz(e,t){let n;try{n=xm(e)}catch(h){if(h instanceof ia)return{aqlExpr:"",fuzzy:mp(e),explicit:!1};throw h}const r=n.length,o=(h,g)=>e.slice(n[h].pos,g<r?n[g].pos:e.length);let i=!1;for(let h=0;h<r;h++){const g=n[h];if(g.type==="OR"||g.type==="LPAREN"&&(h===0||n[h-1].type!=="COLON")){i=!0;break}}if(i){const h=mp(sz(e,n,r,t));return nc(h,ad).query?{aqlExpr:h,fuzzy:"",explicit:!0}:{aqlExpr:"",fuzzy:mp(e),explicit:!0}}const a=[],l=[];let u=0,f=0;const p=h=>{if(h>f){const g=mp(o(f,h));g&&l.push(g)}};for(;u<r-1;){const h=nz(n,u,t);if(h){p(u),a.push(h.atom),u=h.end,f=u;continue}const g=rz(n,u,r);if(g!==null){const y=o(u,g).trim();if(nc(y,ad).query){p(u),a.push(y),u=g,f=u;continue}u=g;continue}u++}return p(r-1),{aqlExpr:a.join(" "),fuzzy:l.join(" "),explicit:!1}}function nz(e,t,n){var l;let r=t,o="";e[r].type==="MINUS"?(o="-",r++):e[r].type==="NOT"&&(o="NOT ",r++);const i=e[r];if(!i||i.type!=="IDENT")return null;const a=n[i.text.toLowerCase()];return!a||((l=e[r+1])==null?void 0:l.type)!=="COLON"?null:{atom:`${o}kind:${a}`,end:r+2}}function rz(e,t,n){let r=t;(e[r].type==="MINUS"||e[r].type==="NOT")&&r++;const o=e[r];if(!o||o.type!=="IDENT"||!Object.prototype.hasOwnProperty.call(ad,o.text.toLowerCase()))return null;const i=e[r+1];if(!i)return null;if(i.type==="COLON"){const a=e[r+2];if(!a)return null;if(a.type==="LPAREN"){let l=0;for(let u=r+2;u<n;u++)if(e[u].type==="LPAREN")l++;else if(e[u].type==="RPAREN"){if(l--,l===0)return u+1}else if(e[u].type==="EOF")return null;return null}return pN.has(a.type)?r+3:null}if(i.type==="OP"){const a=e[r+2];return a&&pN.has(a.type)?r+3:null}return null}function sz(e,t,n,r){var a;let o="",i=0;for(let l=0;l<n;l++){const u=t[l];u.type==="IDENT"&&Object.prototype.hasOwnProperty.call(r,u.text.toLowerCase())&&((a=t[l+1])==null?void 0:a.type)==="COLON"&&(o+=e.slice(i,u.pos)+`kind:${r[u.text.toLowerCase()]} `,i=t[l+1].pos+1)}return o+=e.slice(i),o}const Nw=["kanban","list","table"],aR=["title","status","priority","assignee","dependencies","created","updated"],oz=["asc","desc"],iz=["comfortable","compact"],az=["none","status","type","priority","assignee","project"],lz=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function He(e){const t=e===void 0?[]:Array.isArray(e)?e:[e],n=[];for(const r of t){if(typeof r!="string")continue;const o=r.trim();!o||o==="all"||n.includes(o)||n.push(o)}return n}function cz(e,t){const n=He(e),r=He(t);return n.length===r.length&&n.every(o=>r.includes(o))}const uz={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},ld={version:1,global:uz,projects:{}};function yy(e){return e==="table"?"table":"kanban"}function dz(e,t){return t?{...e,...t}:{...e}}function lR(e,t){const n=e.global;if(t===null)return n;const r=e.projects[t];return r?{defaultView:r.defaultView??n.defaultView,sortField:r.sortField??n.sortField,sortDirection:r.sortDirection??n.sortDirection,density:n.density,grouping:r.grouping??n.grouping,filters:dz(n.filters,r.filters)}:n}const fz=/^[A-Za-z_][A-Za-z0-9_-]*$/,pz=new Set(["and","or","not"]);function Sw(e){return fz.test(e)&&!pz.has(e.toLowerCase())?e:cR(e)}function cR(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const uR="__unassigned__",dR="__standalone__",hz={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function mz(e){return e.startsWith("older_")?"<":">="}const Cw=["status","type","priority","assignee","project","tags"],gz=["created","updated"];function xz(e){var i;const t={};for(const a of Cw){const l=He(e[a]);l.length&&(t[a]=l)}const n=(i=e.search)==null?void 0:i.trim();n&&(t.search=n);let r=e.activity&&e.activity!=="all"?e.activity:void 0;const o=e.dateRange;if(o){const a=yz(o);if(a)r||(r=a);else{const l=bz(o);l&&(t.dateRange=l)}}return r&&(t.activity=r),t}function yz(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function bz(e){if(e.preset)return{field:e.field,preset:e.preset};const t=e.from&&e.from.length>0?e.from:void 0,n=e.to&&e.to.length>0?e.to:void 0;if(!t&&!n)return null;const r={field:e.field};return t&&(r.from=t),n&&(r.to=n),r}function Wu(e){const t=xz(e),n=[];for(const r of Cw){const o=t[r]??[];o.length&&n.push(vz(r,o))}return t.search&&n.push(`search:${cR(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...jz(t.dateRange)),n.join(" AND ")}function vz(e,t){const n=t.map(r=>wz(e,r));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function wz(e,t){return e==="assignee"&&t===uR||e==="project"&&t===dR?"none":Sw(t)}function jz(e){if(e.preset)return[`${e.field} ${mz(e.preset)} -${hz[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function Ku(e){const t=ym(e);if(!t.ast)return null;const n=kz(t.ast);if(n===null)return null;const r={},o=new Set,i=new Map;for(const a of n){const l=Nz(a);if(!l)return null;switch(l.kind){case"value":{if(o.has(l.field))return null;o.add(l.field),r[l.field]=l.values;break}case"search":{if(o.has("search"))return null;o.add("search"),r.search=l.text;break}case"activity":{if(o.has("activity"))return null;o.add("activity"),r.activity=l.activity;break}case"datePreset":{const u=`date:${l.field}`;if(o.has(u)||i.has(l.field))return null;o.add(u),r.dateRange={field:l.field,preset:l.preset};break}case"dateBound":{const u=`date:${l.field}`;if(o.has(u))return null;const f=i.get(l.field)??{};if(l.bound==="from"){if(f.from!==void 0)return null;f.from=l.date}else{if(f.to!==void 0)return null;f.to=l.date}i.set(l.field,f);break}}}if(i.size>1)return null;for(const[a,l]of i){if(r.dateRange)return null;const u={field:a};l.from!==void 0&&(u.from=l.from),l.to!==void 0&&(u.to=l.to),r.dateRange=u}return r}function kz(e){if(e.kind==="all")return[];if(e.kind==="atom")return[e];if(e.kind==="and"){const t=[];for(const n of e.children){if(n.kind!=="atom")return null;t.push(n)}return t}return null}function Nz(e){const t=e.field.toLowerCase();if(e.op===":"){if(Cw.includes(t)){const o=t,i=[];for(const a of e.values){const l=Rz(o,a);if(l===null)return null;i.push(l)}return i.length===0?null:{kind:"value",field:o,values:i}}return t==="search"?e.values.length!==1?null:{kind:"search",text:e.values[0].raw}:null}if(!gz.includes(t))return null;const n=t;if(e.values.length!==1)return null;const r=e.values[0];return r.type==="duration"?Sz(n,e.op,r):r.type==="date"?e.op===">="?{kind:"dateBound",field:n,bound:"from",date:r.raw}:e.op==="<="?{kind:"dateBound",field:n,bound:"to",date:r.raw}:null:null}function Sz(e,t,n){if(n.sign!==-1)return null;const r=Cz(n.raw);if(e==="updated"){if(t==="<"&&r==="7d")return{kind:"activity",activity:"stale"};if(t===">="&&r==="7d")return{kind:"activity",activity:"fresh"}}const o=Tz(t,r);return o?{kind:"datePreset",field:e,preset:o}:null}function Cz(e){return e.replace(/^[-+]/,"")}const Ez={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function Tz(e,t){return e!==">="&&e!=="<"?null:Ez[e][t]??null}function Rz(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?uR:e==="project"&&n.toLowerCase()==="none"?dR:n}const Az=new Set(["status","type","tag","assignee","externalid"]),by=new Set(["IDENT","STRING","NUMBER","DATE","DURATION","STAR"]),hN=8;function Pz(e,t,n){var k,v,b,w,S;let r;try{r=xm(e)}catch{return[]}const o=r.length,i=N=>{const C=N+1<o?r[N+1].pos:e.length;return r[N].pos+e.slice(r[N].pos,C).replace(/\s+$/,"").length};let a=-1;for(let N=0;N<o-1;N++)if(t>r[N].pos&&t<=i(N)){a=N;break}let l=a>=0?a-1:-1;if(a<0)for(let N=0;N<o-1&&i(N)<=t;N++)l=N;let u=null,f=null,p="";if(a>=0&&r[a].type==="COLON"&&((k=r[a-1])==null?void 0:k.type)==="IDENT"?(u=r[a-1].text.toLowerCase(),f=[t,t]):a>=0&&by.has(r[a].type)&&((v=r[a-1])==null?void 0:v.type)==="COLON"&&((b=r[a-2])==null?void 0:b.type)==="IDENT"?(u=r[a-2].text.toLowerCase(),f=[r[a].pos,i(a)],p=r[a].text):a<0&&l>=0&&r[l].type==="COLON"&&((w=r[l-1])==null?void 0:w.type)==="IDENT"&&(u=r[l-1].text.toLowerCase(),f=[t,t]),u!==null){if(!Az.has(u))return[];const N=n.values[u]??[],C=p.toLowerCase(),R=[];for(const T of N)if(!(C&&!T.toLowerCase().startsWith(C))&&T.toLowerCase()!==C&&(R.push({label:T,insert:Sw(T),replace:f,kind:"value"}),R.length>=hN))break;return R}if(a>=0&&!by.has(r[a].type))return[];if(a>=0&&r[a].type==="IDENT"&&((S=r[a+1])==null?void 0:S.type)==="COLON")return[];if(l>=0){const N=r[l].type;if(!(N==="AND"||N==="OR"||N==="NOT"||N==="MINUS"||N==="LPAREN"||N==="RPAREN"||by.has(N)))return[]}const h=(a>=0?r[a].text:"").toLowerCase(),g=a>=0?[r[a].pos,i(a)]:[t,t],y=[];for(const[N,C]of Object.entries(n.aliases))h&&!N.toLowerCase().startsWith(h)||y.push({label:`${N}: (${C})`,insert:`${N}:`,replace:g,kind:"prefix"});for(const N of n.fields)h&&!N.toLowerCase().startsWith(h)||y.push({label:`${N}:`,insert:`${N}:`,replace:g,kind:"field"});return y.slice(0,hN)}const _z=200,Dz=2;function $z(e,t){const[n,r]=m.useState(e),[o,i]=m.useState([]),[a,l]=m.useState(!1),[u,f]=m.useState(null),p=m.useRef(null);m.useEffect(()=>{const y=setTimeout(()=>r(e),_z);return()=>clearTimeout(y)},[e]);const h=n.trim(),g=t&&h.length>=Dz;return m.useEffect(()=>{if(!g){p.current=null,i([]),l(!1),f(null);return}const y=new AbortController;p.current=h,l(!0),f(null);const k=()=>p.current===h&&!y.signal.aborted;return fetch(`/api/search?q=${encodeURIComponent(h)}`,{signal:y.signal}).then(async v=>{if(!v.ok){const b=await v.json().catch(()=>null);throw new Error((b==null?void 0:b.error)||`HTTP ${v.status}`)}return v.json()}).then(v=>{k()&&(i(v.hits??[]),l(!1))}).catch(v=>{v.name!=="AbortError"&&k()&&(f(v.message),i([]),l(!1))}),()=>{y.abort()}},[g,h]),{hits:o,loading:a,error:u}}const Kp={phaseLadder:[{phase:"draft",when:"*",next:"Fill in the objective and acceptance criteria"},{phase:"ready_for_planning",when:"hasRealObjective:true AND acRealTotal > 0",next:"Write a plan and get it approved"},{phase:"ready_to_implement",when:"planApproved:true",next:"Start implementing"},{phase:"in_progress",when:"planApproved:true AND implementationStarted:true",next:"Finish acceptance criteria, then request review"},{phase:"review",when:"(acAllChecked:true OR reviewRequested:true) AND NOT reworkRequested:true",next:"Complete, or address review feedback"}],disposition:[{when:"parked:true",is:"parked"},{when:"blocked:true",is:"blocked"},{when:null,is:"active"}],headline:{terminal:"passthrough",parked:"parked",blocked:"blocked",active:"phase"}};function Iz(e,t,n=()=>null){const r=[],o=new Set(t.statuses.map(l=>l.id));e.phaseLadder.length===0&&r.push("phaseLadder must have at least one rung");for(const l of e.phaseLadder){o.has(l.phase)||r.push(`phaseLadder rung "${l.phase}" is not a defined status id`);const u=l.when==="*"?null:n(l.when);u&&r.push(`phaseLadder rung "${l.phase}": invalid condition — ${u}`)}const i=new Set(["active","blocked","parked"]);for(const l of e.disposition)if(i.has(l.is)||r.push(`disposition "${l.is}" is not valid (expected active, blocked, or parked — terminal is never a rule)`),l.when!==null){const u=n(l.when);u&&r.push(`disposition rule "${l.is}": invalid condition — ${u}`)}const a=e.disposition.map((l,u)=>l.when===null?u:-1).filter(l=>l>=0);a.length===0?r.push("disposition rules must end with an `else:` arm (a rule with when: null)"):a.length>1?r.push("disposition rules must have exactly one `else:` arm (when: null)"):a[0]!==e.disposition.length-1&&r.push("the `else:` arm (when: null) must be the LAST disposition rule — rules after it are unreachable");for(const l of["parked","blocked"])o.has(e.headline[l])||r.push(`headline.${l} → "${e.headline[l]}" is not a defined status id (add the definition or run migrate-derive)`);return r}const fR={statuses:[{id:"pending",label:"Pending"},{id:"in_progress",label:"In Progress"},{id:"blocked",label:"Blocked"},{id:"review",label:"Review"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}],order:["pending","in_progress","blocked","review","completed","failed"],transitions:[],transitionsCustom:!1,custom:!1,derive:Kp,deriveCustom:!1,knownCommands:[],factDeclarations:[],rawFacts:[]};let qu=null,Zi=null;function Mz(){return qu?Promise.resolve(qu):Zi||(Zi=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(qu=e,Zi=null,e)).catch(()=>(Zi=null,fR)),Zi)}function rs(){const[e,t]=m.useState(()=>qu??fR);return m.useEffect(()=>{Mz().then(t)},[]),e}function mN(){qu=null,Zi=null}function es(e,t){const n=e.statuses.find(r=>r.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}const pR={definitions:[{id:"feature",label:"Feature"},{id:"bug",label:"Bug"},{id:"refactor",label:"Refactor"},{id:"research",label:"Research"},{id:"chore",label:"Chore"}],default:"feature",custom:!1};let qp=null,xl=null;function Lz(){return qp?Promise.resolve(qp):xl||(xl=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(qp=e,xl=null,e)).catch(()=>(xl=null,pR)),xl)}function Bd(){const[e,t]=m.useState(()=>qp??pR);return m.useEffect(()=>{Lz().then(t)},[]),e}function Hl(e,t){if(!t)return"—";const n=e.definitions.find(r=>r.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function Oz(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}const Fz={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo",content:"Content"};function zz(e,t){const n=e.map(o=>({start:Math.max(0,Math.min(o.start,t)),end:Math.max(0,Math.min(o.end,t))})).filter(o=>o.end>o.start).sort((o,i)=>o.start-i.start||o.end-i.end),r=[];for(const o of n){const i=r[r.length-1];i&&o.start<=i.end?i.end=Math.max(i.end,o.end):r.push({...o})}return r}function Bz(e,t){if(!t||t.length===0)return e;const n=zz(t,e.length);if(n.length===0)return e;const r=[];let o=0;return n.forEach((i,a)=>{i.start>o&&r.push(s.jsx(m.Fragment,{children:e.slice(o,i.start)},`t${a}`)),r.push(s.jsx("mark",{className:"rounded bg-yellow-200/70 px-0.5 text-foreground dark:bg-yellow-500/30",children:e.slice(i.start,i.end)},`m${a}`)),o=i.end}),o<e.length&&r.push(s.jsx(m.Fragment,{children:e.slice(o)},"tail")),r}function Uz({entries:e}){const{paletteOpen:t,closePalette:n}=Ri(),r=Wt(),[o,i]=m.useState(""),[a,l]=m.useState(0),[u,f]=m.useState(0),[p,h]=m.useState(!0),[g,y]=m.useState(0),k=m.useRef(null),v=m.useRef(null),b=m.useId(),{search:w}=fw(),S=rs(),N=Bd(),{aqlExpr:C,fuzzy:R}=m.useMemo(()=>Z6(o,w.aliases,{defaultScope:w.defaultScope}),[o,w.aliases,w.defaultScope]),T=m.useMemo(()=>{const D=new Set,W=new Set,M=new Set;for(const Y of e){for(const H of Y.tags??[])D.add(H);Y.assignee&&W.add(Y.assignee);for(const H of Y.externalIds??[])H.id&&(M.add(H.id),H.system&&M.add(`${H.system}:${H.id}`))}const F=Object.keys(ad);return{aliases:w.aliases,fields:w.externalIds?F:F.filter(Y=>Y!=="jira"&&Y!=="externalid"),values:{status:S.statuses.map(Y=>Y.id),type:N.definitions.map(Y=>Y.id),tag:[...D],assignee:[...W],externalid:w.externalIds?[...M]:[]}}},[e,w.aliases,w.externalIds,S.statuses,N.definitions]),A=m.useMemo(()=>Pz(o,u,T),[o,u,T]),I=p&&A.length>0&&o.trim()!=="",_=m.useMemo(()=>{let D=e,W=R;if(C){const M=nc(C,ad);if(M.query){const F=Date.now(),{predicate:Y}=M.query;D=e.filter(H=>Y(H,{now:F}))}else W=o}return kw(W,D,50)},[e,C,R,o]),{hits:z}=$z(o,t),O=m.useMemo(()=>qO(z),[z]),B=m.useMemo(()=>[..._,...O],[_,O]);m.useEffect(()=>{l(0)},[o,t]),m.useEffect(()=>{y(0)},[A]),m.useEffect(()=>{t||(i(""),f(0),h(!0))},[t]),m.useEffect(()=>{var W;const D=(W=k.current)==null?void 0:W.querySelector(`[data-palette-idx="${a}"]`);D==null||D.scrollIntoView({block:"nearest"})},[a]);function V(D){r(D.route),n()}function $(D,W){const M=W===a,F=D.type==="content";return s.jsxs("button",{type:"button","data-palette-idx":W,onClick:()=>V(D),onMouseEnter:()=>l(W),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${M?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[s.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:Fz[D.type]??D.type}),s.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsx("span",{className:"truncate",children:D.title}),F&&D.snippet?s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Bz(D.snippet,D.snippetMatches)}):null]}),D.subtitle?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:D.subtitle}):null]},D.id)}function L(D){const W=o.slice(0,D.replace[0])+D.insert+o.slice(D.replace[1]),M=D.replace[0]+D.insert.length;i(W),f(M),requestAnimationFrame(()=>{const F=v.current;F&&(F.focus(),F.setSelectionRange(M,M))})}function U(D){if(I){if(D.key==="Tab"||D.key==="ArrowRight"&&u>=o.length){D.preventDefault();const W=A[g];W&&L(W);return}if(D.key==="ArrowDown"){D.preventDefault(),y(W=>Math.min(A.length-1,W+1));return}if(D.key==="ArrowUp"){D.preventDefault(),y(W=>Math.max(0,W-1));return}if(D.key==="Enter"){D.preventDefault();const W=B[a];W&&V(W);return}return}if(D.key==="ArrowDown")D.preventDefault(),l(W=>Math.min(B.length-1,W+1));else if(D.key==="ArrowUp")D.preventDefault(),l(W=>Math.max(0,W-1));else if(D.key==="Enter"){D.preventDefault();const W=B[a];W&&V(W)}}const K=I&&A[g]?`${b}-option-${g}`:void 0;return s.jsx(On,{open:t,onOpenChange:D=>D?null:n(),children:s.jsxs(Cn,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:D=>{I&&(D.preventDefault(),h(!1))},children:[s.jsx(En,{className:"sr-only",children:"Command palette"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{ref:v,autoFocus:!0,type:"text",role:"combobox","aria-expanded":I,"aria-controls":I?b:void 0,"aria-activedescendant":K,"aria-autocomplete":"list",value:o,onChange:D=>{i(D.target.value),f(D.target.selectionStart??D.target.value.length),h(!0)},onSelect:D=>f(D.currentTarget.selectionStart??0),onKeyDown:U,placeholder:"Search… try a: p: jira:PROJ-123 tag:backend",className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:border-primary"}),I?s.jsx("div",{role:"listbox",id:b,"aria-label":"Query suggestions",className:"absolute left-0 right-0 top-full z-50 max-h-64 overflow-y-auto border-b border-border/70 bg-background shadow-lg",children:A.map((D,W)=>{const M=W===g;return s.jsxs("button",{id:`${b}-option-${W}`,role:"option","aria-selected":M,type:"button",onMouseDown:F=>{F.preventDefault(),L(D)},onMouseEnter:()=>y(W),className:`flex w-full items-center justify-between gap-3 px-4 py-1.5 text-left text-sm ${M?"bg-accent text-accent-foreground":"text-foreground"}`,children:[s.jsx("code",{className:"truncate",children:D.label}),s.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:D.kind})]},`${D.kind}-${D.insert}-${W}`)})}):null]}),C?s.jsxs("div",{className:"border-b border-border/70 px-4 py-1.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:"Filtering"})," ",s.jsx("code",{className:"text-foreground",children:C}),R?s.jsxs("span",{children:[" · ranking “",R,"”"]}):null]}):o.trim()===""?s.jsxs("div",{className:"border-b border-border/70 px-4 py-1.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:"Prefixes"})," ",Object.keys(w.aliases).map(D=>s.jsxs("code",{className:"mr-1",children:[D,":"]},D))," · ",s.jsx("code",{children:"status:"})," ",s.jsx("code",{children:"tag:"})," ",s.jsx("code",{children:"assignee:"})," ",s.jsx("code",{children:"type:"})," ",w.externalIds?s.jsx("code",{children:"jira:"}):null]}):null,s.jsx("div",{ref:k,className:"max-h-[60vh] overflow-y-auto p-1",children:B.length===0?s.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No matches"}):s.jsxs(s.Fragment,{children:[_.map((D,W)=>$(D,W)),O.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-3 pb-1 pt-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Content"}),O.map((D,W)=>$(D,_.length+W))]}):null]})}),s.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:I?"⇥/→ accept · ↑↓ suggestions · Esc close":"↑↓ navigate · ↵ open · Esc close"}),s.jsxs("span",{children:[B.length," result",B.length===1?"":"s"]})]})]})})}function Hz({label:e,onBack:t,disabled:n,stepCounter:r}){return s.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-3 py-2",children:[s.jsxs("button",{type:"button",onClick:t,disabled:n,className:"inline-flex h-7 items-center gap-1 rounded border border-border/70 bg-background/60 px-2 text-[11px] text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground disabled:opacity-50","aria-label":"Back",children:[s.jsx(b5,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{children:"Back"})]}),s.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e}),r?s.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground/80",children:["step ",r.current," of ",r.total]}):null]})}function Vz({step:e,initialValue:t,disabled:n,onSubmit:r}){const[o,i]=m.useState(t??""),[a,l]=m.useState(!1),u=m.useRef(null);m.useEffect(()=>{var k;(k=u.current)==null||k.focus()},[]);const f=o.trim(),p=e.required!==!1,h=e.pattern&&f.length>0&&!e.pattern.regex.test(f),g=!n&&(!p||f.length>0)&&!h;function y(k){if(k.key==="Enter"){if(k.preventDefault(),!g){l(!0);return}r(f)}}return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:u,type:"text",value:o,onChange:k=>{i(k.target.value),l(!1)},onKeyDown:y,placeholder:e.placeholder,disabled:n,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:border-primary disabled:opacity-60"}),a&&e.pattern&&h?s.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:e.pattern.message}):null]})}function Wz({step:e,disabled:t,onSubmit:n}){const[r,o]=m.useState({phase:"loading"}),[i,a]=m.useState(""),[l,u]=m.useState(0),[f,p]=m.useState(0),h=m.useRef(null),g=m.useRef(null);m.useEffect(()=>{var v;(v=h.current)==null||v.focus()},[]),m.useEffect(()=>{let v=!1;return o({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(b=>{v||o({phase:"loaded",options:b})}).catch(b=>{if(v)return;const w=b instanceof Error?b.message:"Failed to load options";o({phase:"error",message:w})}),()=>{v=!0}},[e,f]);const y=m.useMemo(()=>{if(r.phase!=="loaded")return[];const v=r.options.map(b=>({type:"option",title:b.label,subtitle:b.hint,keywords:[b.value],option:b}));return kw(i,v,100)},[r,i]);m.useEffect(()=>{u(0)},[y.length]),m.useEffect(()=>{var b;const v=(b=g.current)==null?void 0:b.querySelector(`[data-picker-idx="${l}"]`);v==null||v.scrollIntoView({block:"nearest"})},[l]);function k(v){if(r.phase==="loaded"){if(v.key==="ArrowDown")v.preventDefault(),u(b=>Math.min(y.length-1,b+1));else if(v.key==="ArrowUp")v.preventDefault(),u(b=>Math.max(0,b-1));else if(v.key==="Enter"){v.preventDefault();const b=y[l];b&&n(b.option.value)}}}return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:h,type:"text",value:i,onChange:v=>a(v.target.value),onKeyDown:k,placeholder:`Filter ${e.label.toLowerCase()}…`,disabled:t||r.phase==="loading",className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:border-primary disabled:opacity-60"}),s.jsx("div",{ref:g,className:"max-h-[60vh] min-h-[120px] overflow-y-auto p-1",children:r.phase==="loading"?s.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"Loading…"}):r.phase==="error"?s.jsxs("div",{className:"px-4 py-4 text-sm",children:[s.jsxs("div",{className:"mb-2 text-destructive",children:["Failed to load: ",r.message]}),s.jsx("button",{type:"button",onClick:()=>p(v=>v+1),className:"rounded border border-border/70 bg-background/60 px-2 py-1 text-xs text-foreground hover:bg-accent/40",children:"Retry"})]}):y.length===0?s.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:r.options.length===0?e.emptyMessage??"No options available":"No matches"}):y.map((v,b)=>{const w=b===l;return s.jsxs("button",{type:"button","data-picker-idx":b,onClick:()=>n(v.option.value),onMouseEnter:()=>u(b),disabled:t,className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${w?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:v.option.label}),v.option.hint?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:v.option.hint}):null]},v.option.value)})})]})}function Kz({entries:e}){var Q,J;const t=Wt(),{actionsPaletteOpen:n,closeActionsPalette:r,customBindings:o,bindAction:i,findConflict:a,pendingActionKind:l,consumePendingActionKind:u}=Ri(),[f,p]=m.useState(""),[h,g]=m.useState(0),[y,k]=m.useState(null),[v,b]=m.useState(""),[w,S]=m.useState(null),[N,C]=m.useState(null),[R,T]=m.useState(!1),[A,I]=m.useState(null),_=m.useRef(null),z=m.useMemo(()=>e.map(Z=>({type:Z.group.toLowerCase(),title:Z.title,subtitle:Z.subtitle,keywords:Z.keywords,action:Z})),[e]),O=m.useMemo(()=>kw(f,z,50),[f,z]);m.useEffect(()=>{g(0)},[f,n]),m.useEffect(()=>{n||(p(""),k(null),b(""),S(null),C(null),T(!1),I(null))},[n]),m.useEffect(()=>{if(!n||!l)return;const Z=u();if(!Z)return;const oe=e.find(te=>te.bindableKind===Z);oe&&B(oe)},[n,l]),m.useEffect(()=>{var oe;const Z=(oe=_.current)==null?void 0:oe.querySelector(`[data-palette-idx="${h}"]`);Z==null||Z.scrollIntoView({block:"nearest"})},[h]);async function B(Z){if(!R){if(Z.flow&&Z.flow.steps.length>0){S({action:Z,stepIndex:0,values:{}}),I(null);return}if(Z.requiresInput){k(Z),b(""),I(null);return}if(Z.run){T(!0),I(null);try{await Z.run(),r()}catch(oe){I(oe instanceof Error?oe.message:"Action failed")}finally{T(!1)}}}}async function V(Z){if(!w)return;const oe=w.action.flow.steps[w.stepIndex],te={...w.values,[oe.id]:Z};if(w.stepIndex+1<w.action.flow.steps.length){S({action:w.action,stepIndex:w.stepIndex+1,values:te});return}T(!0),I(null);try{await w.action.flow.submit(te,{navigate:t}),r()}catch(ue){I(ue instanceof Error?ue.message:"Action failed")}finally{T(!1)}}function $(){if(w&&!R){if(w.stepIndex===0){S(null),I(null);return}S({action:w.action,stepIndex:w.stepIndex-1,values:w.values}),I(null)}}async function L(){if(R||!(y!=null&&y.requiresInput))return;const Z=v.trim();if(Z){T(!0),I(null);try{await y.requiresInput.runWithInput(Z),r()}catch(oe){I(oe instanceof Error?oe.message:"Action failed")}finally{T(!1)}}}function U(Z){if(Z.key==="ArrowDown")Z.preventDefault(),g(oe=>Math.min(O.length-1,oe+1));else if(Z.key==="ArrowUp")Z.preventDefault(),g(oe=>Math.max(0,oe-1));else if(Z.key==="Enter"&&(Z.metaKey||Z.ctrlKey)){Z.preventDefault();const oe=O[h];oe!=null&&oe.action.bindableKind&&C({action:oe.action,combo:null,conflict:null,saving:!1,error:null})}else if(Z.key==="Enter"){Z.preventDefault();const oe=O[h];oe&&B(oe.action)}}function K(Z){Z.key==="Enter"?(Z.preventDefault(),L()):Z.key==="Escape"&&(Z.preventDefault(),k(null),b(""))}function D(Z){if(!N||Z.key==="Escape"||Z.key==="Enter"&&!N.combo)return;if(Z.key==="Enter"&&N.combo){Z.preventDefault(),Z.stopPropagation(),W();return}Z.preventDefault(),Z.stopPropagation();const oe=fT(Z.nativeEvent);if(!oe)return;const te=a(oe,N.action.bindableKind);C({...N,combo:oe,conflict:te,error:null})}async function W(){var Z;if(!(!N||!N.combo||!N.action.bindableKind)){if((Z=N.conflict)!=null&&Z.description){C({...N,error:`Reserved: ${N.conflict.description}`});return}C({...N,saving:!0,error:null});try{await i(N.action.bindableKind,N.combo),C(null)}catch(oe){C({...N,saving:!1,error:oe instanceof Error?oe.message:"Failed to save binding"})}}}const M=y!==null,F=w!==null,Y=N!==null,H=w?w.action.flow.steps[w.stepIndex]:null;return s.jsx(On,{open:n,onOpenChange:Z=>Z?null:r(),children:s.jsxs(Cn,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:Z=>{if(!R){if(Y){Z.preventDefault(),C(null);return}if(F){Z.preventDefault(),$();return}M&&(Z.preventDefault(),k(null),b(""),I(null))}},children:[s.jsx(En,{className:"sr-only",children:"Actions palette"}),Y&&N?s.jsxs("div",{onKeyDown:D,tabIndex:-1,autoFocus:!0,children:[s.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[s.jsx(Eb,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),s.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",N.action.title]})]}),s.jsx("div",{className:"px-4 py-6 text-center",children:N.combo?s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:eo(N.combo)}),(Q=N.conflict)!=null&&Q.description?s.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",N.conflict.description," (cannot bind)"]}):(J=N.conflict)!=null&&J.kind?s.jsxs("div",{className:"text-sm text-amber-500 dark:text-amber-400",children:['Already bound to "',N.conflict.kind,'". Press Enter to overwrite.']}):s.jsx("div",{className:"text-sm text-muted-foreground",children:"Press Enter to save, or another key to retry."}),N.error?s.jsx("div",{className:"text-sm text-destructive",children:N.error}):null]}):s.jsx("div",{className:"text-sm text-muted-foreground",children:"Press the key combination you want to bind…"})}),s.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:"any key records · Enter saves · Esc cancels"}),s.jsx("span",{children:N.saving?"Saving…":""})]}),s.jsx("button",{type:"button",className:"sr-only",onClick:()=>void W(),"data-bind-confirm":!0}),s.jsx("input",{type:"hidden",onKeyDown:Z=>{Z.key==="Enter"&&W()}})]}):F&&H&&w?s.jsxs(s.Fragment,{children:[s.jsx(Hz,{label:`${w.action.title} · ${H.label}`,onBack:$,disabled:R,stepCounter:{current:w.stepIndex+1,total:w.action.flow.steps.length}}),H.kind==="text"?s.jsx(Vz,{step:H,initialValue:w.values[H.id],disabled:R,onSubmit:V}):s.jsx(Wz,{step:H,disabled:R,onSubmit:V}),A?s.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:A}):null,s.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:"↵ next · ← back · Esc back"}),s.jsx("span",{children:R?"Running…":""})]})]}):M?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[s.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:y.group}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:y.title})]}),s.jsx("input",{autoFocus:!0,type:"text",value:v,onChange:Z=>b(Z.target.value),onKeyDown:K,placeholder:y.requiresInput.placeholder,disabled:R,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:border-primary disabled:opacity-60"}),A?s.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:A}):null,s.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[s.jsxs("span",{children:["↵"," submit ","·"," Esc back"]}),s.jsx("span",{children:R?"Running…":""})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("input",{autoFocus:!0,type:"text",value:f,onChange:Z=>p(Z.target.value),onKeyDown:U,placeholder:"Run an action: new project, new todo, toggle…",disabled:R,className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:border-primary disabled:opacity-60"}),A?s.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:A}):null,s.jsx("div",{ref:_,className:"max-h-[60vh] overflow-y-auto p-1",children:O.length===0?s.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:f?"No matches":"Start typing to search actions"}):O.map((Z,oe)=>{const te=oe===h,ue=Z.action.bindableKind,ge=ue?o[ue]:void 0;return s.jsxs("button",{type:"button","data-palette-idx":oe,onClick:()=>B(Z.action),onMouseEnter:()=>g(oe),disabled:R,className:`group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${te?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[s.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:Z.action.group}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z.action.title}),Z.action.subtitle?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:Z.action.subtitle}):null,ge?s.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium tracking-wide text-foreground",children:eo(ge)}):null,ue?s.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:Ce=>{Ce.preventDefault(),Ce.stopPropagation(),C({action:Z.action,combo:null,conflict:null,saving:!1,error:null})},className:`shrink-0 inline-flex h-6 w-6 items-center justify-center rounded border border-border/70 bg-background/60 text-muted-foreground transition-opacity hover:text-foreground ${te?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:s.jsx(Eb,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},Z.action.id)})}),s.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[s.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," run ","·"," ⌘↵ bind ","·"," Esc close"]}),s.jsx("span",{children:R?"Running…":`${O.length} action${O.length===1?"":"s"}`})]})]})]})})}const qz=[{combo:"mod+k",description:"Open command palette",scope:"global"},{combo:"mod+shift+k",description:"Open actions palette",scope:"global"},{combo:"?",description:"Show keyboard shortcuts",scope:"global"},{combo:"escape",description:"Close dialog or cancel",scope:"global"},{combo:"enter",description:"Activate selected item",scope:"global"},{combo:"shift+t",description:"Toggle light/dark theme",scope:"global"},{combo:"g",description:"Start navigation chord",scope:"global"},{combo:"g o",description:"Go to Overview",scope:"global"},{combo:"g m",description:"Go to Projects",scope:"global"},{combo:"g a",description:"Go to Assignments",scope:"global"},{combo:"g t",description:"Go to Todos",scope:"global"},{combo:"g s",description:"Go to Servers",scope:"global"},{combo:"g !",description:"Go to Attention",scope:"global"},{combo:"g ,",description:"Go to Settings",scope:"global"},{combo:"j",description:"Move selection down",scope:"list"},{combo:"k",description:"Move selection up",scope:"list"},{combo:"o",description:"Open selected item",scope:"list"},{combo:"a",description:"New assignment in project",scope:"project"},{combo:"e",description:"Edit project / assignment",scope:"project|assignment"},{combo:"/",description:"Focus search",scope:"assignments-board"},{combo:"r",description:"Refresh board",scope:"assignments-board"},{combo:"p",description:"Edit plan",scope:"assignment"},{combo:"h",description:"Append handoff",scope:"assignment"},{combo:"d",description:"Append decision record",scope:"assignment"},{combo:"s",description:"Edit scratchpad",scope:"assignment"},{combo:"[",description:"Previous assignment",scope:"assignment"},{combo:"]",description:"Next assignment",scope:"assignment"}];function Gz(e){const t=vr(e);return t?qz.find(n=>n.combo===t)??null:null}const ku={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},Yz={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},Xz=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function gN(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${eo(t)} then ${eo(n)}`}return eo(e)}function Qz(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:r,actionEntries:o}=Ri(),i=m.useMemo(()=>{const u=new Set;for(const f of Object.values(r))typeof f=="string"&&f&&u.add(vr(f));return u},[r]),a=m.useMemo(()=>{if(!e)return new Map;const u=n(),f=new Map;for(const p of u){if(i.has(vr(p.keys)))continue;const h=f.get(p.scope)??[];h.push({keys:p.keys,description:p.description}),f.set(p.scope,h)}return f},[e,n,i]),l=m.useMemo(()=>{const u=[];for(const[f,p]of Object.entries(r)){if(!p)continue;const h=o.find(g=>g.bindableKind===f);u.push({kind:f,combo:p,title:h?h.title:f})}return u},[r,o]);return s.jsx(On,{open:e,onOpenChange:u=>u?null:t(),children:s.jsxs(Cn,{className:"max-w-2xl",children:[s.jsx(En,{children:"Keyboard shortcuts"}),s.jsxs(ns,{children:["Press Esc to close. ",eo("Mod+k")," opens the command palette. Press g twice to restart the chord timer."]}),s.jsxs("div",{className:"mt-2 max-h-[60vh] space-y-4 overflow-y-auto pr-1",children:[Xz.map(u=>{const f=a.get(u);return!f||f.length===0?null:s.jsxs("section",{children:[s.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:Yz[u]}),s.jsx("ul",{className:"space-y-1",children:f.map((p,h)=>s.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-1.5 text-sm",children:[s.jsx("span",{className:"text-foreground",children:p.description}),s.jsx("kbd",{className:"shrink-0 rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:gN(p.keys)})]},`${u}-${p.keys}-${h}`))})]},u)}),l.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Custom bindings"}),s.jsx("ul",{className:"space-y-1",children:l.map(u=>s.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-1.5 text-sm",children:[s.jsx("span",{className:"text-foreground",children:u.title}),s.jsx("kbd",{className:"shrink-0 rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:gN(u.combo)})]},`custom-${u.kind}`))})]}):null]})]})})}const Ew={bindings:{},custom:!1};let Gu=null,yl=null;const Ob=new Set;function hR(e){Gu=e;for(const t of Ob)t(e)}function Tw(e){if(!e||typeof e!="object")return Ew;const t=e,n={};if(t.bindings&&typeof t.bindings=="object"&&!Array.isArray(t.bindings))for(const[r,o]of Object.entries(t.bindings)){if(!kO(r)||typeof o!="string"||o.trim()==="")continue;const i=vr(o);i&&(n[r]=i)}return{bindings:n,custom:t.custom===!0}}function Jz(){return Gu?Promise.resolve(Gu):yl||(yl=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Tw(e);return Gu=t,yl=null,t}).catch(()=>(yl=null,Ew)),yl)}function Zz(){const[e,t]=m.useState(()=>Gu??Ew);return m.useEffect(()=>{let n=!1;return Jz().then(r=>{n||t(r)}),Ob.add(t),()=>{n=!0,Ob.delete(t)}},[]),e}async function xN(e){const t={};for(const o of hm){const i=e[o];if(typeof i!="string")continue;const a=vr(i);a&&(t[o]=a)}const n=await fetch("/api/config/hotkeys",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({bindings:t})});if(!n.ok){const o=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(o.error??"Failed to save hotkey bindings")}const r=Tw(await n.json());return hR(r),r}async function e8(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Tw(await e.json());return hR(t),t}const yN=1500;function t8(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const mR=m.createContext(null);function n8({children:e}){const{toggleTheme:t}=sw(),n=rr(),r=Wt(),o=t8(n.pathname),[i,a]=m.useState(!1),l=oo(i),u=fm(i),f=iw(i),p=ow(i),h=pT(i),{search:g}=fw(),y=m.useMemo(()=>{var ot,St,ht,it;const ve=l.data??[],ye=((ot=u.data)==null?void 0:ot.assignments)??[],Ae=((St=f.data)==null?void 0:St.playbooks)??[],Ue=((ht=p.data)==null?void 0:ht.sessions)??[],Oe=(((it=h.data)==null?void 0:it.workspaces)??[]).flatMap(ce=>ce.items.map(me=>({...me,workspace:ce.workspace})));return WO({projects:ve,assignments:ye,playbooks:Ae,servers:Ue,todos:Oe,wsPrefix:o,externalIds:g.externalIds})},[l.data,u.data,f.data,p.data,h.data,o,g.externalIds]),v=m.useMemo(()=>G2(n.pathname),[n.pathname]).projectSlug,b=m.useMemo(()=>{var ve;return v?((ve=l.data)==null?void 0:ve.find(ye=>ye.slug===v))??null:null},[l.data,v]),w=(b==null?void 0:b.title)??null,S=(b==null?void 0:b.workspace)??null,N=m.useMemo(()=>{var ve;return XO({playbooks:((ve=f.data)==null?void 0:ve.playbooks)??[],projectSlug:v,currentProjectTitle:w,currentProjectWorkspace:S,wsPrefix:o,refetchPlaybooks:f.refetch,navigate:r,toggleTheme:t})},[f.data,f.refetch,v,w,S,o,r,t]),C=m.useRef(new Map),R=m.useRef(["global"]),T=m.useRef({phase:"idle"}),A=m.useRef(null),I=m.useRef(1),[_,z]=m.useState(!1),[O,B]=m.useState(!1),[V,$]=m.useState(!1),[L,U]=m.useState(null);m.useEffect(()=>{(_||V)&&a(!0)},[_,V]);const{bindings:K}=Zz(),D=m.useMemo(()=>TO(K),[K]),W=m.useCallback(ve=>{const ye=I.current++;return C.current.set(ye,{...ve,id:ye}),ye},[]),M=m.useCallback(ve=>{C.current.delete(ve)},[]),F=m.useCallback(ve=>{R.current.push(ve)},[]),Y=m.useCallback(ve=>{const ye=R.current;for(let Ae=ye.length-1;Ae>=0;Ae--)if(ye[Ae]===ve){ye.splice(Ae,1);return}},[]),H=m.useCallback(()=>z(!0),[]),Q=m.useCallback(()=>z(!1),[]),J=m.useCallback(()=>B(!0),[]),Z=m.useCallback(()=>B(!1),[]),oe=m.useCallback(()=>$(!0),[]),te=m.useCallback(()=>{$(!1),U(null)},[]),ue=m.useCallback(()=>Array.from(C.current.values()),[]),ge=m.useCallback(()=>{let ve=null;return U(ye=>(ve=ye,null)),ve},[]),Ce=m.useCallback(ve=>{U(ve),$(!0)},[]),Se=m.useCallback((ve,ye)=>{const Ae=vr(ve);if(!Ae)return null;if(CO(Ae)){const Ue=Gz(Ae);return{description:(Ue==null?void 0:Ue.description)??"Reserved built-in shortcut"}}for(const[Ue,rt]of Object.entries(D))if(!(ye&&Ue===ye)&&rt===Ae)return{kind:Ue};return null},[D]),ke=m.useCallback(async(ve,ye)=>{const Ae=vr(ye);if(!Ae)throw new Error("Empty combo");const Ue=Se(Ae,ve);if(Ue){const Oe=Ue.description?`Reserved: ${Ue.description}`:`Already bound to "${Ue.kind}"`;throw new Error(Oe)}const rt={...K,[ve]:Ae};return await xN(rt),Ae},[K,Se]),Be=m.useCallback(async ve=>{if(!K[ve])return;const ye={...K};delete ye[ve],await xN(ye)},[K]);m.useEffect(()=>{T.current={phase:"idle"},A.current!==null&&(window.clearTimeout(A.current),A.current=null)},[n.pathname]),m.useEffect(()=>{function ve(Oe){if(!(Oe instanceof HTMLElement))return!1;const ot=Oe.tagName;return!!(ot==="INPUT"||ot==="TEXTAREA"||ot==="SELECT"||Oe.isContentEditable||Oe.closest('[role="combobox"], [role="textbox"]'))}function ye(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function Ae(){const Oe=R.current;return Oe[Oe.length-1]??"global"}function Ue(Oe){return Oe.scope==="global"?!0:Oe.scope===Ae()}function rt(Oe){const ot=cp(Oe,"Mod+k"),St=cp(Oe,"Mod+Shift+k"),ht=Oe.key==="Escape",it=ot||St||ht;if(ye()&&!it||ve(Oe.target)&&!it)return;const ce=T.current;if(ce.phase==="awaiting-second")if(Date.now()-ce.startedAt>yN)T.current={phase:"idle"},A.current!==null&&(window.clearTimeout(A.current),A.current=null);else{const Pe=Array.from(C.current.values());for(const We of Pe){if(!Ue(We))continue;const pt=We.keys.split(" ");if(!(pt.length!==2||pt[0]!=="g")&&cp(Oe,pt[1])&&!(We.when&&!We.when())){Oe.preventDefault(),T.current={phase:"idle"},A.current!==null&&(window.clearTimeout(A.current),A.current=null),We.handler(Oe);return}}T.current={phase:"idle"},A.current!==null&&(window.clearTimeout(A.current),A.current=null)}const me=Array.from(C.current.values());for(const Ie of me){if(!Ue(Ie))continue;const Pe=Ie.keys.split(" ");if(Pe.length===1&&cp(Oe,Pe[0])&&!(Ie.when&&!Ie.when())){Oe.preventDefault(),Ie.handler(Oe);return}}Oe.key==="g"&&!Oe.metaKey&&!Oe.ctrlKey&&!Oe.altKey&&!Oe.shiftKey&&Array.from(C.current.values()).some(Pe=>Ue(Pe)&&Pe.keys.startsWith("g "))&&(Oe.preventDefault(),T.current={phase:"awaiting-second",startedAt:Date.now()},A.current!==null&&window.clearTimeout(A.current),A.current=window.setTimeout(()=>{T.current={phase:"idle"},A.current=null},yN))}return window.addEventListener("keydown",rt),()=>{window.removeEventListener("keydown",rt),A.current!==null&&(window.clearTimeout(A.current),A.current=null)}},[]),m.useEffect(()=>{const ve=W({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>M(ve)},[W,M,t]),m.useEffect(()=>{const ve=W({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>J()});return()=>M(ve)},[W,M,J]),m.useEffect(()=>{const ve=W({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(_){Q();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||H()}});return()=>M(ve)},[W,M,H,Q,_]),m.useEffect(()=>{const ve=W({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(V){te();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||oe()}});return()=>M(ve)},[W,M,oe,te,V]),m.useEffect(()=>{const ye=[{suffix:"o",basePath:"/",desc:"Go to Overview"},{suffix:"m",basePath:"/projects",desc:"Go to Projects"},{suffix:"a",basePath:"/assignments",desc:"Go to Assignments"},{suffix:"t",basePath:"/todos",desc:"Go to Todos"},{suffix:"s",basePath:"/servers",desc:"Go to Servers"},{suffix:",",basePath:"/settings",desc:"Go to Settings"}].map(Ae=>W({keys:`g ${Ae.suffix}`,scope:"global",description:Ae.desc,handler:()=>r(Bp(Ae.basePath,o))}));return()=>ye.forEach(M)},[W,M,r,o]),m.useEffect(()=>{const ve=[];for(const[ye,Ae]of Object.entries(D)){if(!Ae)continue;const Ue=N.find(Oe=>Oe.bindableKind===ye),rt=Ue?`Custom: ${Ue.title}`:`Custom: ${ye}`;ve.push(W({keys:Ae,scope:"global",description:rt,handler:()=>{U(ye),$(!0)}}))}return()=>ve.forEach(M)},[W,M,D,N]);const ie=m.useMemo(()=>({register:W,unregister:M,pushScope:F,popScope:Y,openPalette:H,closePalette:Q,paletteOpen:_,openCheatsheet:J,closeCheatsheet:Z,cheatsheetOpen:O,openActionsPalette:oe,closeActionsPalette:te,actionsPaletteOpen:V,listBindings:ue,wsPrefix:o,paletteEntries:y,actionEntries:N,userBindings:K,customBindings:D,bindAction:ke,unbindAction:Be,findConflict:Se,openActionsPaletteWithAction:Ce,pendingActionKind:L,consumePendingActionKind:ge}),[W,M,F,Y,H,Q,_,J,Z,O,oe,te,V,ue,o,y,N,K,D,ke,Be,Se,Ce,L,ge]);return s.jsxs(mR.Provider,{value:ie,children:[e,s.jsx(Uz,{entries:y}),s.jsx(Kz,{entries:N}),s.jsx(Qz,{})]})}function Ri(){const e=m.useContext(mR);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function en({keys:e,handler:t,scope:n="global",description:r,when:o,enabled:i=!0}){const{register:a,unregister:l}=Ri(),u=m.useRef(t),f=m.useRef(o);m.useEffect(()=>{u.current=t,f.current=o},[t,o]),m.useEffect(()=>{if(!i)return;const p=a({keys:e,handler:h=>u.current(h),scope:n,description:r,when:f.current?()=>f.current():void 0});return()=>l(p)},[a,l,e,n,r,i])}function Ai(e){const{pushScope:t,popScope:n}=Ri();m.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function Ud(e,t){const[n,r]=m.useState(e.length===0?-1:0),o=rr();m.useEffect(()=>{r(e.length===0?-1:0)},[o.pathname]),m.useEffect(()=>{r(a=>e.length===0?-1:Math.min(Math.max(0,a),e.length-1))},[e.length]),m.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(l=>{const u=Number(l.getAttribute("data-hotkey-row-index"));l.setAttribute("data-hotkey-selected",u===n?"true":"false")}),n>=0){const l=document.querySelector(`[data-hotkey-row-index="${n}"]`);l==null||l.scrollIntoView({block:"nearest"})}},[n,e.length]),en({keys:"j",scope:t.scope,description:"Select next row",handler:()=>r(a=>e.length===0?-1:Math.min(e.length-1,a<0?0:a+1))}),en({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>r(a=>e.length===0?-1:Math.max(0,a<0?0:a-1))}),en({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),en({keys:"o",scope:t.scope,description:"Open selected row",enabled:t.bindO??!0,handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}});const i=m.useCallback(a=>({"data-hotkey-row-index":a,"data-hotkey-selected":a===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:i}}function r8(){return m.useSyncExternalStore(Q4,q1,q1)}function s8(e){switch(e){case"reconnecting":return{show:!0,label:"Reconnecting…",tone:"amber"};case"closed":return{show:!0,label:"Offline",tone:"amber"};case"connecting":return{show:!0,label:"Connecting…",tone:"muted"};case"open":return{show:!1,label:"Live",tone:"muted"}}}function o8(){const e=r8(),t=s8(e);return s.jsx("div",{role:"status","aria-live":"polite",className:"flex items-center",children:t.show?s.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium ${t.tone==="amber"?"border-warning-foreground/30 bg-warning text-warning-foreground":"border-border/70 bg-background/80 text-muted-foreground"}`,children:[s.jsx("span",{"aria-hidden":"true",className:`h-1.5 w-1.5 rounded-full ${t.tone==="amber"?"bg-warning-foreground animate-pulse":"bg-muted-foreground/60"}`}),t.label]}):s.jsx("span",{className:"sr-only"})})}function i8({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:r}){const o=xn(),{resolvedTheme:i,toggleTheme:a}=sw(),{openPalette:l}=Ri();return s.jsx("header",{className:"sticky top-0 z-30 border-b border-border/70 bg-background/70 backdrop-blur",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 lg:px-6",children:[s.jsx("button",{type:"button",onClick:r,className:"inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/70 bg-card/80 text-foreground lg:hidden","aria-label":"Open navigation",children:s.jsx(K5,{className:"h-4 w-4"})}),s.jsx("div",{className:"min-w-0 flex-1",children:s.jsxs("div",{className:"flex items-center gap-2",children:[t.length>1?s.jsxs("nav",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-[0.1em] text-muted-foreground",children:[t.slice(0,-1).map((u,f)=>s.jsxs("span",{className:"flex items-center gap-1.5",children:[f>0?s.jsx("span",{children:"/"}):null,s.jsx(_e,{to:u.path,className:"hover:text-foreground",children:u.label})]},u.path)),s.jsx("span",{children:"/"})]}):null,s.jsx("h1",{className:"min-w-0 truncate text-base font-semibold text-foreground",children:e})]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(o8,{}),s.jsxs("button",{type:"button",onClick:l,className:"shell-action","aria-label":"Open command palette",children:[s.jsx(Ci,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:eo("Mod+k")})]}),s.jsx(_e,{className:"shell-action hidden sm:inline-flex",to:"/help",children:"Help"}),s.jsxs(_e,{className:"shell-action",to:`${o}/create/project`,"aria-label":"New Project",children:[s.jsx(Tt,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"New Project"})]}),n?s.jsxs(_e,{className:"shell-action",to:`${o}/projects/${n}/create/assignment`,"aria-label":"New Assignment",children:[s.jsx(Tt,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"New Assignment"})]}):null,s.jsxs("button",{type:"button",onClick:a,className:"shell-action","aria-label":"Toggle theme",children:[i==="dark"?s.jsx(s4,{className:"h-4 w-4"}):s.jsx(q5,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:i==="dark"?"Light":"Dark"})]})]})]})})}const a8=4e3;function Tn(){const[e,t]=m.useState(null),n=m.useRef(null),r=m.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),o=m.useCallback((i,a="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:i,kind:a}),n.current=setTimeout(()=>{t(null),n.current=null},a8)},[]);return m.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:o,dismissToast:r}}function Nn({toast:e,onDismiss:t}){if(!e)return null;const n=e.kind==="error";return s.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-50 flex max-w-sm",role:"status","aria-live":"polite",children:s.jsx("button",{type:"button",onClick:t,className:be("syntaur-toast pointer-events-auto rounded-md border px-4 py-3 text-sm font-medium shadow-lg transition",n?"border-error-foreground/30 bg-error text-error-foreground hover:opacity-90":"border-success-foreground/30 bg-success text-success-foreground hover:opacity-90"),children:e.message},e.id)})}const bN={review:0,blocked:0,question:0,"plan-approval":0};function gR(){const[e,t]=m.useState([]),[n,r]=m.useState(bN),[o,i]=m.useState(0),[a,l]=m.useState(!0),[u,f]=m.useState(null),[p,h]=m.useState(0),g=m.useCallback(()=>{h(y=>y+1)},[]);return m.useEffect(()=>{let y=!1;return l(!0),f(null),fetch("/api/inbox").then(async k=>{if(!k.ok){const v=await k.json().catch(()=>null);throw new Error((v==null?void 0:v.error)||`HTTP ${k.status}`)}return k.json()}).then(k=>{y||(t(Array.isArray(k.items)?k.items:[]),r(k.counts??bN),i(typeof k.total=="number"?k.total:0),l(!1))}).catch(k=>{y||(f(k.message),l(!1))}),()=>{y=!0}},[p]),Ei(y=>{(y.type==="assignment-updated"||y.type==="project-updated")&&g()}),{items:e,counts:n,total:o,loading:a,error:u,refetch:g}}const xR="syntaur.sidebar.collapsed.v1";function yR(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function l8(e){if(!e)return{};try{const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t))typeof o=="boolean"&&(n[r]=o);return n}catch{return{}}}function c8(e,t){return{...e,[t]:!(e[t]??!1)}}function u8(){const e=yR();if(!e)return{};try{return l8(e.getItem(xR))}catch{return{}}}let Gp=u8();const Fb=new Set,d8={};function f8(e){const t=yR();if(t)try{t.setItem(xR,JSON.stringify(e))}catch{}}function p8(e){return Fb.add(e),()=>{Fb.delete(e)}}function h8(){return Gp}function m8(){return d8}function g8(e){Gp=c8(Gp,e),f8(Gp);for(const t of Fb)t()}function x8(){const e=m.useSyncExternalStore(p8,h8,m8);return{isCollapsed:(n,r=!1)=>e[n]??r,toggle:g8}}const bh="_ungrouped",y8=256;function b8(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const r of e){if(typeof r!="string")continue;const o=r.trim();o.length!==0&&(o.length>y8||/[\r\n]/.test(o)||t.has(o)||(t.add(o),n.push(o)))}return n}function v8(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(r=>!n.has(r))}function w8(e,t){return t.includes(e)}const Rw={hidden:[],custom:!1};let To=null,ea=null,cd=0;const zb=new Set;function bR(e){To=e;for(const t of zb)t(e)}function Aw(e){if(!e||typeof e!="object")return Rw;const t=e;return{hidden:b8(t.hidden),custom:t.custom===!0}}function j8(){if(To)return Promise.resolve({value:To,ok:!0});if(ea)return ea;const e=++cd;return ea=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ea=null;const n=Aw(t);return e!==cd?{value:To??n,ok:!0}:(To=n,{value:n,ok:!0})}).catch(()=>(ea=null,{value:Rw,ok:!1})),ea}function vR(){const[e,t]=m.useState(()=>To??Rw),[n,r]=m.useState(()=>To===null),[o,i]=m.useState(!1),[a,l]=m.useState(0);m.useEffect(()=>{let f=!1;return r(To===null),j8().then(p=>{f||(t(p.value),r(!1),i(!p.ok))}),zb.add(t),()=>{f=!0,zb.delete(t)}},[a]);function u(){k8(),l(f=>f+1)}return{...e,loading:n,error:o,reload:u}}function k8(){To=null,ea=null,++cd}async function N8(e){++cd;const t=await fetch("/api/config/workspace-visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hidden:e})});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.error)??`HTTP ${t.status}`)}const n=Aw(await t.json());return bR(n),n}async function S8(){++cd;const e=await fetch("/api/config/workspace-visibility",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=Aw(await e.json());return bR(t),t}var C8=Symbol("radix.slottable");function E8(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=C8,t}var wR="AlertDialog",[T8]=Aa(wR,[zT]),Io=zT(),jR=e=>{const{__scopeAlertDialog:t,...n}=e,r=Io(t);return s.jsx(nR,{...r,...n,modal:!0})};jR.displayName=wR;var R8="AlertDialogTrigger",A8=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Io(n);return s.jsx(rR,{...o,...r,ref:t})});A8.displayName=R8;var P8="AlertDialogPortal",kR=e=>{const{__scopeAlertDialog:t,...n}=e,r=Io(t);return s.jsx(sR,{...r,...n})};kR.displayName=P8;var _8="AlertDialogOverlay",NR=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Io(n);return s.jsx(yw,{...o,...r,ref:t})});NR.displayName=_8;var Vl="AlertDialogContent",[D8,$8]=T8(Vl),I8=E8("AlertDialogContent"),SR=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=Io(n),a=m.useRef(null),l=nr(t,a),u=m.useRef(null);return s.jsx(U6,{contentName:Vl,titleName:CR,docsSlug:"alert-dialog",children:s.jsx(D8,{scope:n,cancelRef:u,children:s.jsxs(bw,{role:"alertdialog",...i,...o,ref:l,onOpenAutoFocus:sn(o.onOpenAutoFocus,f=>{var p;f.preventDefault(),(p=u.current)==null||p.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[s.jsx(I8,{children:r}),s.jsx(L8,{contentRef:a})]})})})});SR.displayName=Vl;var CR="AlertDialogTitle",ER=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Io(n);return s.jsx(vw,{...o,...r,ref:t})});ER.displayName=CR;var TR="AlertDialogDescription",RR=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Io(n);return s.jsx(ww,{...o,...r,ref:t})});RR.displayName=TR;var M8="AlertDialogAction",AR=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Io(n);return s.jsx(jw,{...o,...r,ref:t})});AR.displayName=M8;var PR="AlertDialogCancel",_R=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=$8(PR,n),i=Io(n),a=nr(t,o);return s.jsx(jw,{...i,...r,ref:a})});_R.displayName=PR;var L8=({contentRef:e})=>{const t=`\`${Vl}\` requires a description for the component to be accessible for screen reader users.
|
|
626
|
+
|
|
627
|
+
You can add a description to the \`${Vl}\` by passing a \`${TR}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
628
|
+
|
|
629
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Vl}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
630
|
+
|
|
631
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return m.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},O8=jR,F8=kR,DR=NR,$R=SR,IR=AR,MR=_R,LR=ER,OR=RR;const _l=O8,z8=F8,FR=m.forwardRef(({className:e,...t},n)=>s.jsx(DR,{ref:n,className:be("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));FR.displayName=DR.displayName;const la=m.forwardRef(({className:e,...t},n)=>s.jsxs(z8,{children:[s.jsx(FR,{}),s.jsx($R,{ref:n,className:be("chrome-card fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 !p-6 outline-none",e),...t})]}));la.displayName=$R.displayName;function Dl({className:e,...t}){return s.jsx("div",{className:be("flex flex-col space-y-2 text-left",e),...t})}function $l({className:e,...t}){return s.jsx("div",{className:be("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const ca=m.forwardRef(({className:e,...t},n)=>s.jsx(LR,{ref:n,className:be("text-lg font-semibold tracking-tight text-foreground",e),...t}));ca.displayName=LR.displayName;const ua=m.forwardRef(({className:e,...t},n)=>s.jsx(OR,{ref:n,className:be("text-sm leading-6 text-muted-foreground",e),...t}));ua.displayName=OR.displayName;const yi=m.forwardRef(({className:e,...t},n)=>s.jsx(IR,{ref:n,className:be(e),...t}));yi.displayName=IR.displayName;const ud=m.forwardRef(({className:e,...t},n)=>s.jsx(MR,{ref:n,className:be(e),...t}));ud.displayName=MR.displayName;const B8=[{to:"/",label:"Overview",icon:R2},{to:"/inbox",label:"Needs me",icon:P2},{to:"/agents",label:"Agents",icon:Kv}],U8=[{id:"library",label:"Library",items:[{to:"/playbooks",label:"Playbooks",icon:S2},{to:"/memories",label:"Memories",icon:y5},{to:"/resources",label:"Resources",icon:z5}]},{id:"board",label:"Board",items:[{to:"/todos",label:"Todos",icon:ys},{to:"/views",label:"Saved Views",icon:_2},{to:"/archive",label:"Archive",icon:im}]},{id:"operations",label:"Operations",items:[{to:"/inventories",label:"Inventories",icon:qv},{to:"/schedules",label:"Schedules",icon:C2},{to:"/usage",label:"Usage",icon:um}]}],H8=[{suffix:"/projects",label:"Projects",icon:Yv},{suffix:"/assignments",label:"Assignments",icon:H5},{suffix:"/servers",label:"Servers",icon:Zv},{suffix:"/agent-sessions",label:"Agent Sessions",icon:om}],V8=[{to:"/help",label:"Help",icon:B5},{to:"/workflow",label:"Workflow",icon:L2},{to:"/settings",label:"Settings",icon:n4}];function W8({title:e,breadcrumbs:t,projectSlug:n,workspace:r,children:o}){const[i,a]=m.useState(!1);return en({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:i,handler:()=>a(!1)}),s.jsx("div",{className:"min-h-screen bg-background",children:s.jsxs("div",{className:"relative grid min-h-screen lg:grid-cols-[240px_minmax(0,1fr)]",children:[s.jsx("aside",{className:"hidden max-h-screen sticky top-0 overflow-y-auto border-r border-border/70 bg-sidebar px-4 py-4 lg:flex lg:flex-col",children:s.jsx(vN,{activeWorkspace:r})}),i?s.jsx("div",{className:"fixed inset-0 z-40 bg-overlay/40 lg:hidden",children:s.jsxs("div",{className:"flex h-full max-w-xs flex-col border-r border-border/70 bg-sidebar p-4 shadow-2xl",children:[s.jsxs("div",{className:"mb-4 flex shrink-0 items-center justify-between",children:[s.jsx(_e,{to:"/",className:"text-lg font-semibold text-foreground",onClick:()=>a(!1),children:"Syntaur"}),s.jsx("button",{type:"button",onClick:()=>a(!1),className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border/70 bg-background/80","aria-label":"Close navigation",children:s.jsx(Nc,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(vN,{activeWorkspace:r,onNavigate:()=>a(!1)})})]})}):null,s.jsxs("div",{className:"min-w-0",children:[s.jsx(i8,{title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:()=>a(!0)}),s.jsx("main",{className:"mx-auto w-full max-w-[1480px] px-4 py-4 lg:px-6 lg:py-5",children:o})]})]})})}function vN({activeWorkspace:e,onNavigate:t}){const{total:n}=gR(),r=B8.map(L=>L.to==="/inbox"?{...L,badge:n}:L),{data:o}=Ra(),i=(o==null?void 0:o.workspaces)??[],a=(o==null?void 0:o.hasUngrouped)??!1,{hidden:l}=vR(),u=rr(),{isCollapsed:f,toggle:p}=x8(),h=u.pathname.startsWith("/w/")?null:K2(u.pathname),[g,y]=m.useState(!1),[k,v]=m.useState(""),[b,w]=m.useState(null),[S,N]=m.useState(null),[C,R]=m.useState(null),[T,A]=m.useState(!1),I=Wt(),{toast:_,showToast:z,dismissToast:O}=Tn(),B=v8([...i,...a?[bh]:[]],l);async function V(L){if(S){A(!0);try{const U=`/api/workspaces/${encodeURIComponent(S)}${L?"?cascade=true":""}`,K=await fetch(U,{method:"DELETE"});if(K.status===409){const D=await K.json().catch(()=>({}));R((D==null?void 0:D.blockedBy)??{projects:[],standalones:[]});return}if(!K.ok){const D=await K.json().catch(()=>({}));throw new Error(D.error||"Failed to delete workspace")}N(null),R(null)}catch(U){console.error(U),alert(U instanceof Error?U.message:"Failed to delete workspace")}finally{A(!1)}}}async function $(L,U){try{if(L.type==="project"){const K=await fetch(`/api/projects/${encodeURIComponent(L.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:U})});if(!K.ok){const D=await K.json().catch(()=>({}));throw new Error(D.error||"Failed to move project")}return}if(L.type==="standalone-assignment"){const K=await fetch(`/api/assignments/${encodeURIComponent(L.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:U})});if(!K.ok){const D=await K.json().catch(()=>({}));throw new Error(D.error||"Failed to move assignment")}return}if(L.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(K){console.error(K),alert(K instanceof Error?K.message:"Failed to move item")}}return s.jsxs("div",{className:"flex h-full flex-col gap-3",children:[s.jsx(Nn,{toast:_,onDismiss:O}),s.jsx("div",{className:"shrink-0 space-y-3",children:s.jsxs(_e,{to:"/",className:"inline-flex items-center gap-3",onClick:t,children:[s.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-lg bg-card text-foreground shadow-sm ring-1 ring-border/60",children:s.jsxs("svg",{viewBox:"0 0 43 51","aria-label":"Syntaur",role:"img",className:"h-4 w-auto",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{d:"M13 2C13 0.89543 13.8954 0 15 0H41C42.1046 0 43 0.895431 43 2V12C43 13.1046 42.1046 14 41 14H13V2Z"}),s.jsx("path",{d:"M0 15C0 13.8954 0.895431 13 2 13H14V25C14 26.1046 13.1046 27 12 27H2C0.89543 27 0 26.1046 0 25V15Z"}),s.jsx("path",{d:"M30 49C30 50.1046 29.1046 51 28 51L2 51C0.89543 51 0 50.1046 0 49L0 39C0 37.8954 0.895431 37 2 37L30 37L30 49Z"}),s.jsx("path",{d:"M42.9646 36C42.9646 37.1046 42.0692 38 40.9646 38H28.9646V26C28.9646 24.8954 29.86 24 30.9646 24H40.9646C42.0692 24 42.9646 24.8954 42.9646 26V36Z"})]})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Syntaur"}),s.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Local-first project control"})]})]})}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(K1,{items:r,onNavigate:t}),U8.map(L=>s.jsx(H4,{label:L.label,items:L.items,collapsed:f(L.id),onToggle:()=>p(L.id),containsActive:L.items.some(U=>U.to===h),onNavigate:t},L.id))]}),s.jsx("div",{className:"border-t border-border/40"}),s.jsxs("div",{className:"space-y-1",children:[B.length===0&&!g&&s.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),B.map(L=>{const U=L==="_ungrouped",K=U?"Ungrouped":gn(L),D=U?"/w/_ungrouped":`/w/${L}`,W=f(`ws:${L}`),M=e===L||e===null&&U&&u.pathname.startsWith("/w/_ungrouped"),F=b===L;return s.jsxs("div",{className:`rounded-md transition ${F?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:Y=>{Y.dataTransfer.types.includes("application/json")&&(Y.preventDefault(),Y.dataTransfer.dropEffect="move",w(L))},onDragLeave:Y=>{Y.currentTarget.contains(Y.relatedTarget)||w(H=>H===L?null:H)},onDrop:async Y=>{try{const H=Y.dataTransfer.getData("application/json");if(!H)return;Y.preventDefault();let Q;try{Q=JSON.parse(H)}catch{return}if(!(Q!=null&&Q.type)||!(Q!=null&&Q.id))return;await $(Q,U?null:L)}finally{w(null)}},children:[s.jsxs("div",{className:"group flex items-center",children:[s.jsxs("button",{type:"button",onClick:()=>p(`ws:${L}`),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${M?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[s.jsx(tr,{className:`h-3 w-3 transition-transform ${W?"-rotate-90":""}`}),K]}),U?null:s.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),N(L),R(null)},title:`Delete workspace "${L}"`,"aria-label":`Delete workspace "${L}"`,className:"mr-1 flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 opacity-0 transition hover:bg-destructive/10 hover:text-destructive focus-visible:opacity-100 group-hover:opacity-100",children:s.jsx(fn,{className:"h-3 w-3"})})]}),!W&&s.jsx("nav",{className:"ml-2 space-y-0.5",children:H8.map(Y=>{const H=`${D}${Y.suffix}`,Q=q2(u.pathname,Y.suffix)&&u.pathname.startsWith(D),J=Y.icon;return s.jsxs(_e,{to:H,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${Q?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[s.jsx(J,{className:"h-4 w-4"}),s.jsx("span",{children:Y.label})]},H)})})]},L)}),g?s.jsx("form",{className:"px-3 py-1.5",onSubmit:async L=>{L.preventDefault();const U=k.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if(U){y(!1),v("");try{const K=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:U})});if(!K.ok){const D=await K.json().catch(()=>null);z((D==null?void 0:D.error)||`HTTP ${K.status}`,"error");return}t==null||t(),I(`/w/${U}/projects`)}catch(K){z(K instanceof Error?K.message:"Failed to create workspace","error")}}},children:s.jsx("input",{autoFocus:!0,type:"text",value:k,onChange:L=>v(L.target.value),onKeyDown:L=>{L.key==="Escape"&&(y(!1),v(""))},onBlur:()=>{k.trim()||(y(!1),v(""))},placeholder:"workspace-name",className:"w-full rounded-md border border-border/60 bg-background/80 px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-foreground/40 focus:outline-none"})}):s.jsxs("button",{type:"button",onClick:()=>y(!0),className:"flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium text-muted-foreground/60 transition hover:text-muted-foreground",children:[s.jsx(Tt,{className:"h-3 w-3"}),"New Workspace"]})]})]}),s.jsx("div",{className:"shrink-0 border-t border-border/40"}),s.jsx("div",{className:"shrink-0",children:s.jsx(K1,{items:V8,onNavigate:t})}),s.jsx(_l,{open:S!==null,onOpenChange:L=>{T||L||(N(null),R(null))},children:s.jsxs(la,{children:[s.jsxs(Dl,{children:[s.jsx(ca,{children:C?"Workspace has references":"Delete workspace?"}),s.jsx(ua,{children:C?s.jsxs(s.Fragment,{children:["The workspace ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:S})," is still referenced by:"]}):s.jsxs(s.Fragment,{children:["Remove the workspace ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:S})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),C?s.jsxs("div",{className:"space-y-2 text-sm",children:[C.projects.length>0?s.jsxs("div",{children:[s.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",C.projects.length,")"]}),s.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:C.projects.map(L=>s.jsx("li",{children:s.jsx(_e,{to:`/projects/${L}`,className:"hover:underline",children:L})},L))})]}):null,C.standalones.length>0?s.jsxs("div",{children:[s.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",C.standalones.length,")"]}),s.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:C.standalones.map(L=>s.jsx("li",{children:s.jsx(_e,{to:`/assignments/${L}`,className:"hover:underline",children:L})},L))})]}):null,s.jsxs("p",{className:"text-xs text-muted-foreground",children:['Choose "Clear references and delete" to set ',s.jsx("code",{children:"workspace:"})," / ",s.jsx("code",{children:"workspaceGroup:"})," to ",s.jsx("code",{children:"null"})," on each, then remove the workspace."]})]}):null,s.jsxs($l,{children:[s.jsx(ud,{disabled:T,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),C?s.jsx(yi,{disabled:T,onClick:L=>{L.preventDefault(),V(!0)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:T?"Working…":"Clear references and delete"}):s.jsx(yi,{disabled:T,onClick:L=>{L.preventDefault(),V(!1)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:T?"Working…":"Delete"})]})]})})]})}function K8(){const e=rr(),{workspace:t}=Kt(),{title:n,breadcrumbs:r,projectSlug:o}=G2(e.pathname);return s.jsx(W8,{title:n,breadcrumbs:r,projectSlug:o,workspace:t??null,children:s.jsx(RL,{})})}function q8(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const km=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Cc(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Pw(e){return"nodeType"in e}function cr(e){var t,n;return e?Cc(e)?e:Pw(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function _w(e){const{Document:t}=cr(e);return e instanceof t}function Hd(e){return Cc(e)?!1:e instanceof cr(e).HTMLElement}function zR(e){return e instanceof cr(e).SVGElement}function Ec(e){return e?Cc(e)?e.document:Pw(e)?_w(e)?e:Hd(e)||zR(e)?e.ownerDocument:document:document:document}const ws=km?m.useLayoutEffect:m.useEffect;function Nm(e){const t=m.useRef(e);return ws(()=>{t.current=e}),m.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function G8(){const e=m.useRef(null),t=m.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=m.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function dd(e,t){t===void 0&&(t=[e]);const n=m.useRef(e);return ws(()=>{n.current!==e&&(n.current=e)},t),n}function Vd(e,t){const n=m.useRef();return m.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function vh(e){const t=Nm(e),n=m.useRef(null),r=m.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function wh(e){const t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}let vy={};function Wd(e,t){return m.useMemo(()=>{if(t)return t;const n=vy[e]==null?0:vy[e]+1;return vy[e]=n,e+"-"+n},[e,t])}function BR(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,a)=>{const l=Object.entries(a);for(const[u,f]of l){const p=i[u];p!=null&&(i[u]=p+e*f)}return i},{...t})}}const Wl=BR(1),fd=BR(-1);function Y8(e){return"clientX"in e&&"clientY"in e}function Sm(e){if(!e)return!1;const{KeyboardEvent:t}=cr(e.target);return t&&e instanceof t}function X8(e){if(!e)return!1;const{TouchEvent:t}=cr(e.target);return t&&e instanceof t}function jh(e){if(X8(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Y8(e)?{x:e.clientX,y:e.clientY}:null}const js=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[js.Translate.toString(e),js.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),wN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Q8(e){return e.matches(wN)?e:e.querySelector(wN)}const J8={display:"none"};function Z8(e){let{id:t,value:n}=e;return Ot.createElement("div",{id:t,style:J8},n)}function eB(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ot.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function tB(){const[e,t]=m.useState("");return{announce:m.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const UR=m.createContext(null);function nB(e){const t=m.useContext(UR);m.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function rB(){const[e]=m.useState(()=>new Set),t=m.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[m.useCallback(r=>{let{type:o,event:i}=r;e.forEach(a=>{var l;return(l=a[o])==null?void 0:l.call(a,i)})},[e]),t]}const sB={draggable:`
|
|
632
|
+
To pick up a draggable item, press the space bar.
|
|
633
|
+
While dragging, use the arrow keys to move the item.
|
|
634
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
635
|
+
`},oB={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function iB(e){let{announcements:t=oB,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=sB}=e;const{announce:i,announcement:a}=tB(),l=Wd("DndLiveRegion"),[u,f]=m.useState(!1);if(m.useEffect(()=>{f(!0)},[]),nB(m.useMemo(()=>({onDragStart(h){let{active:g}=h;i(t.onDragStart({active:g}))},onDragMove(h){let{active:g,over:y}=h;t.onDragMove&&i(t.onDragMove({active:g,over:y}))},onDragOver(h){let{active:g,over:y}=h;i(t.onDragOver({active:g,over:y}))},onDragEnd(h){let{active:g,over:y}=h;i(t.onDragEnd({active:g,over:y}))},onDragCancel(h){let{active:g,over:y}=h;i(t.onDragCancel({active:g,over:y}))}}),[i,t])),!u)return null;const p=Ot.createElement(Ot.Fragment,null,Ot.createElement(Z8,{id:r,value:o.draggable}),Ot.createElement(eB,{id:l,announcement:a}));return n?Xs.createPortal(p,n):p}var In;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(In||(In={}));function kh(){}function ji(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Cm(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ks=Object.freeze({x:0,y:0});function HR(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function aB(e,t){const n=jh(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function VR(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function lB(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function jN(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function WR(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function kN(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Em=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=kN(t,t.left,t.top),i=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const f=HR(kN(u),o);i.push({id:l,data:{droppableContainer:a,value:f}})}}return i.sort(VR)},cB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=jN(t),i=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const f=jN(u),p=o.reduce((g,y,k)=>g+HR(f[k],y),0),h=Number((p/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:h}})}}return i.sort(VR)};function uB(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,l=i-n;if(r<o&&n<i){const u=t.width*t.height,f=e.width*e.height,p=a*l,h=p/(u+f-p);return Number(h.toFixed(4))}return 0}const dB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const u=uB(l,t);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(lB)};function fB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function KR(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ks}function pB(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,l)=>({...a,top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),{...n})}}const hB=pB(1);function qR(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function mB(e,t,n){const r=qR(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,u=e.left-a-(1-o)*parseFloat(n),f=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),p=o?e.width/o:e.width,h=i?e.height/i:e.height;return{width:p,height:h,top:f,right:u+p,bottom:f+h,left:u}}const gB={ignoreTransform:!1};function Tc(e,t){t===void 0&&(t=gB);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:p}=cr(e).getComputedStyle(e);f&&(n=mB(n,f,p))}const{top:r,left:o,width:i,height:a,bottom:l,right:u}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:u}}function NN(e){return Tc(e,{ignoreTransform:!0})}function xB(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function yB(e,t){return t===void 0&&(t=cr(e).getComputedStyle(e)),t.position==="fixed"}function bB(e,t){t===void 0&&(t=cr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Tm(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(_w(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Hd(o)||zR(o)||n.includes(o))return n;const i=cr(e).getComputedStyle(o);return o!==e&&bB(o,i)&&n.push(o),yB(o,i)?n:r(o.parentNode)}return e?r(e):n}function GR(e){const[t]=Tm(e,1);return t??null}function wy(e){return!km||!e?null:Cc(e)?e:Pw(e)?_w(e)||e===Ec(e).scrollingElement?window:Hd(e)?e:null:null}function YR(e){return Cc(e)?e.scrollX:e.scrollLeft}function XR(e){return Cc(e)?e.scrollY:e.scrollTop}function Bb(e){return{x:YR(e),y:XR(e)}}var Wn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Wn||(Wn={}));function QR(e){return!km||!e?!1:e===document.scrollingElement}function JR(e){const t={x:0,y:0},n=QR(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:l,maxScroll:r,minScroll:t}}const vB={x:.2,y:.2};function wB(e,t,n,r,o){let{top:i,left:a,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=vB);const{isTop:f,isBottom:p,isLeft:h,isRight:g}=JR(e),y={x:0,y:0},k={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!f&&i<=t.top+v.height?(y.y=Wn.Backward,k.y=r*Math.abs((t.top+v.height-i)/v.height)):!p&&u>=t.bottom-v.height&&(y.y=Wn.Forward,k.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!g&&l>=t.right-v.width?(y.x=Wn.Forward,k.x=r*Math.abs((t.right-v.width-l)/v.width)):!h&&a<=t.left+v.width&&(y.x=Wn.Backward,k.x=r*Math.abs((t.left+v.width-a)/v.width)),{direction:y,speed:k}}function jB(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function ZR(e){return e.reduce((t,n)=>Wl(t,Bb(n)),ks)}function kB(e){return e.reduce((t,n)=>t+YR(n),0)}function NB(e){return e.reduce((t,n)=>t+XR(n),0)}function eA(e,t){if(t===void 0&&(t=Tc),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);GR(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const SB=[["x",["left","right"],kB],["y",["top","bottom"],NB]];class Dw{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Tm(n),o=ZR(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,l]of SB)for(const u of a)Object.defineProperty(this,u,{get:()=>{const f=l(r),p=o[i]-f;return this.rect[u]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Yu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function CB(e){const{EventTarget:t}=cr(e);return e instanceof t?e:Ec(e)}function jy(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Jr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Jr||(Jr={}));function SN(e){e.preventDefault()}function EB(e){e.stopPropagation()}var At;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(At||(At={}));const tA={start:[At.Space,At.Enter],cancel:[At.Esc],end:[At.Space,At.Enter,At.Tab]},TB=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case At.Right:return{...n,x:n.x+25};case At.Left:return{...n,x:n.x-25};case At.Down:return{...n,y:n.y+25};case At.Up:return{...n,y:n.y-25}}};class Rc{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Yu(Ec(n)),this.windowListeners=new Yu(cr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Jr.Resize,this.handleCancel),this.windowListeners.add(Jr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Jr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&eA(r),n(ks)}handleKeyDown(t){if(Sm(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=tA,coordinateGetter:a=TB,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:f}=r.current,p=f?{x:f.left,y:f.top}:ks;this.referenceCoordinates||(this.referenceCoordinates=p);const h=a(t,{active:n,context:r.current,currentCoordinates:p});if(h){const g=fd(h,p),y={x:0,y:0},{scrollableAncestors:k}=r.current;for(const v of k){const b=t.code,{isTop:w,isRight:S,isLeft:N,isBottom:C,maxScroll:R,minScroll:T}=JR(v),A=jB(v),I={x:Math.min(b===At.Right?A.right-A.width/2:A.right,Math.max(b===At.Right?A.left:A.left+A.width/2,h.x)),y:Math.min(b===At.Down?A.bottom-A.height/2:A.bottom,Math.max(b===At.Down?A.top:A.top+A.height/2,h.y))},_=b===At.Right&&!S||b===At.Left&&!N,z=b===At.Down&&!C||b===At.Up&&!w;if(_&&I.x!==h.x){const O=v.scrollLeft+g.x,B=b===At.Right&&O<=R.x||b===At.Left&&O>=T.x;if(B&&!g.y){v.scrollTo({left:O,behavior:l});return}B?y.x=v.scrollLeft-O:y.x=b===At.Right?v.scrollLeft-R.x:v.scrollLeft-T.x,y.x&&v.scrollBy({left:-y.x,behavior:l});break}else if(z&&I.y!==h.y){const O=v.scrollTop+g.y,B=b===At.Down&&O<=R.y||b===At.Up&&O>=T.y;if(B&&!g.x){v.scrollTo({top:O,behavior:l});return}B?y.y=v.scrollTop-O:y.y=b===At.Down?v.scrollTop-R.y:v.scrollTop-T.y,y.y&&v.scrollBy({top:-y.y,behavior:l});break}}this.handleMove(t,Wl(fd(h,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Rc.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=tA,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function CN(e){return!!(e&&"distance"in e)}function EN(e){return!!(e&&"delay"in e)}class $w{constructor(t,n,r){var o;r===void 0&&(r=CB(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=Ec(a),this.documentListeners=new Yu(this.document),this.listeners=new Yu(r),this.windowListeners=new Yu(cr(a)),this.initialCoordinates=(o=jh(i))!=null?o:ks,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Jr.Resize,this.handleCancel),this.windowListeners.add(Jr.DragStart,SN),this.windowListeners.add(Jr.VisibilityChange,this.handleCancel),this.windowListeners.add(Jr.ContextMenu,SN),this.documentListeners.add(Jr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(EN(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(CN(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Jr.Click,EB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Jr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:l}}=i;if(!o)return;const u=(n=jh(t))!=null?n:ks,f=fd(o,u);if(!r&&l){if(CN(l)){if(l.tolerance!=null&&jy(f,l.tolerance))return this.handleCancel();if(jy(f,l.distance))return this.handleStart()}if(EN(l)&&jy(f,l.tolerance))return this.handleCancel();this.handlePending(l,f);return}t.cancelable&&t.preventDefault(),a(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===At.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const RB={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ac extends $w{constructor(t){const{event:n}=t,r=Ec(n.target);super(t,RB,r)}}Ac.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const AB={move:{name:"mousemove"},end:{name:"mouseup"}};var Ub;(function(e){e[e.RightClick=2]="RightClick"})(Ub||(Ub={}));class PB extends $w{constructor(t){super(t,AB,Ec(t.event.target))}}PB.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ub.RightClick?!1:(r==null||r({event:n}),!0)}}];const ky={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class _B extends $w{constructor(t){super(t,ky)}static setup(){return window.addEventListener(ky.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ky.move.name,t)};function t(){}}}_B.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Xu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xu||(Xu={}));var Nh;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Nh||(Nh={}));function DB(e){let{acceleration:t,activator:n=Xu.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:l=Nh.TreeOrder,pointerCoordinates:u,scrollableAncestors:f,scrollableAncestorRects:p,delta:h,threshold:g}=e;const y=IB({delta:h,disabled:!i}),[k,v]=G8(),b=m.useRef({x:0,y:0}),w=m.useRef({x:0,y:0}),S=m.useMemo(()=>{switch(n){case Xu.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Xu.DraggableRect:return o}},[n,o,u]),N=m.useRef(null),C=m.useCallback(()=>{const T=N.current;if(!T)return;const A=b.current.x*w.current.x,I=b.current.y*w.current.y;T.scrollBy(A,I)},[]),R=m.useMemo(()=>l===Nh.TreeOrder?[...f].reverse():f,[l,f]);m.useEffect(()=>{if(!i||!f.length||!S){v();return}for(const T of R){if((r==null?void 0:r(T))===!1)continue;const A=f.indexOf(T),I=p[A];if(!I)continue;const{direction:_,speed:z}=wB(T,I,S,t,g);for(const O of["x","y"])y[O][_[O]]||(z[O]=0,_[O]=0);if(z.x>0||z.y>0){v(),N.current=T,k(C,a),b.current=z,w.current=_;return}}b.current={x:0,y:0},w.current={x:0,y:0},v()},[t,C,r,v,i,a,JSON.stringify(S),JSON.stringify(y),k,f,R,p,JSON.stringify(g)])}const $B={x:{[Wn.Backward]:!1,[Wn.Forward]:!1},y:{[Wn.Backward]:!1,[Wn.Forward]:!1}};function IB(e){let{delta:t,disabled:n}=e;const r=wh(t);return Vd(o=>{if(n||!r||!o)return $B;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Wn.Backward]:o.x[Wn.Backward]||i.x===-1,[Wn.Forward]:o.x[Wn.Forward]||i.x===1},y:{[Wn.Backward]:o.y[Wn.Backward]||i.y===-1,[Wn.Forward]:o.y[Wn.Forward]||i.y===1}}},[n,t,r])}function MB(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Vd(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function LB(e,t){return m.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var pd;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(pd||(pd={}));var Hb;(function(e){e.Optimized="optimized"})(Hb||(Hb={}));const TN=new Map;function OB(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=m.useState(null),{frequency:l,measure:u,strategy:f}=o,p=m.useRef(e),h=b(),g=dd(h),y=m.useCallback(function(w){w===void 0&&(w=[]),!g.current&&a(S=>S===null?w:S.concat(w.filter(N=>!S.includes(N))))},[g]),k=m.useRef(null),v=Vd(w=>{if(h&&!n)return TN;if(!w||w===TN||p.current!==e||i!=null){const S=new Map;for(let N of e){if(!N)continue;if(i&&i.length>0&&!i.includes(N.id)&&N.rect.current){S.set(N.id,N.rect.current);continue}const C=N.node.current,R=C?new Dw(u(C),C):null;N.rect.current=R,R&&S.set(N.id,R)}return S}return w},[e,i,n,h,u]);return m.useEffect(()=>{p.current=e},[e]),m.useEffect(()=>{h||y()},[n,h]),m.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),m.useEffect(()=>{h||typeof l!="number"||k.current!==null||(k.current=setTimeout(()=>{y(),k.current=null},l))},[l,h,y,...r]),{droppableRects:v,measureDroppableContainers:y,measuringScheduled:i!=null};function b(){switch(f){case pd.Always:return!1;case pd.BeforeDragging:return n;default:return!n}}}function Iw(e,t){return Vd(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function FB(e,t){return Iw(e,t)}function zB(e){let{callback:t,disabled:n}=e;const r=Nm(t),o=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return m.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Rm(e){let{callback:t,disabled:n}=e;const r=Nm(t),o=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return m.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function BB(e){return new Dw(Tc(e),e)}function RN(e,t,n){t===void 0&&(t=BB);const[r,o]=m.useState(null);function i(){o(u=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=u??n)!=null?f:null}const p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const a=zB({callback(u){if(e)for(const f of u){const{type:p,target:h}=f;if(p==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),l=Rm({callback:i});return ws(()=>{i(),e?(l==null||l.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[e]),r}function UB(e){const t=Iw(e);return KR(e,t)}const AN=[];function HB(e){const t=m.useRef(e),n=Vd(r=>e?r&&r!==AN&&e&&t.current&&e.parentNode===t.current.parentNode?r:Tm(e):AN,[e]);return m.useEffect(()=>{t.current=e},[e]),n}function VB(e){const[t,n]=m.useState(null),r=m.useRef(e),o=m.useCallback(i=>{const a=wy(i.target);a&&n(l=>l?(l.set(a,Bb(a)),new Map(l)):null)},[]);return m.useEffect(()=>{const i=r.current;if(e!==i){a(i);const l=e.map(u=>{const f=wy(u);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,Bb(f)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(i)};function a(l){l.forEach(u=>{const f=wy(u);f==null||f.removeEventListener("scroll",o)})}},[o,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>Wl(i,a),ks):ZR(e):ks,[e,t])}function PN(e,t){t===void 0&&(t=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},t),m.useEffect(()=>{const r=e!==ks;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?fd(e,n.current):ks}function WB(e){m.useEffect(()=>{if(!km)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function KB(e,t){return m.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function nA(e){return m.useMemo(()=>e?xB(e):null,[e])}const _N=[];function qB(e,t){t===void 0&&(t=Tc);const[n]=e,r=nA(n?cr(n):null),[o,i]=m.useState(_N);function a(){i(()=>e.length?e.map(u=>QR(u)?r:new Dw(t(u),u)):_N)}const l=Rm({callback:a});return ws(()=>{l==null||l.disconnect(),a(),e.forEach(u=>l==null?void 0:l.observe(u))},[e]),o}function rA(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Hd(t)?t:e}function GB(e){let{measure:t}=e;const[n,r]=m.useState(null),o=m.useCallback(f=>{for(const{target:p}of f)if(Hd(p)){r(h=>{const g=t(p);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),i=Rm({callback:o}),a=m.useCallback(f=>{const p=rA(f);i==null||i.disconnect(),p&&(i==null||i.observe(p)),r(p?t(p):null)},[t,i]),[l,u]=vh(a);return m.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const YB=[{sensor:Ac,options:{}},{sensor:Rc,options:{}}],XB={current:{}},Yp={draggable:{measure:NN},droppable:{measure:NN,strategy:pd.WhileDragging,frequency:Hb.Optimized},dragOverlay:{measure:Tc}};class Qu extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const QB={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Qu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:kh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Yp,measureDroppableContainers:kh,windowRect:null,measuringScheduled:!1},sA={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:kh,draggableNodes:new Map,over:null,measureDroppableContainers:kh},Kd=m.createContext(sA),oA=m.createContext(QB);function JB(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qu}}}function ZB(e,t){switch(t.type){case In.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case In.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case In.DragEnd:case In.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case In.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Qu(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case In.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Qu(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case In.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Qu(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function e7(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=m.useContext(Kd),i=wh(r),a=wh(n==null?void 0:n.id);return m.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!Sm(i)||document.activeElement===i.target)return;const l=o.get(a);if(!l)return;const{activatorNode:u,node:f}=l;if(!u.current&&!f.current)return;requestAnimationFrame(()=>{for(const p of[u.current,f.current]){if(!p)continue;const h=Q8(p);if(h){h.focus();break}}})}},[r,t,o,a,i]),null}function iA(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function t7(e){return m.useMemo(()=>({draggable:{...Yp.draggable,...e==null?void 0:e.draggable},droppable:{...Yp.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Yp.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function n7(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=m.useRef(!1),{x:a,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ws(()=>{if(!a&&!l||!t){i.current=!1;return}if(i.current||!r)return;const f=t==null?void 0:t.node.current;if(!f||f.isConnected===!1)return;const p=n(f),h=KR(p,r);if(a||(h.x=0),l||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=GR(f);g&&g.scrollBy({top:h.y,left:h.x})}},[t,a,l,r,n])}const Am=m.createContext({...ks,scaleX:1,scaleY:1});var gi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(gi||(gi={}));const Pm=m.memo(function(t){var n,r,o,i;let{id:a,accessibility:l,autoScroll:u=!0,children:f,sensors:p=YB,collisionDetection:h=dB,measuring:g,modifiers:y,...k}=t;const v=m.useReducer(ZB,void 0,JB),[b,w]=v,[S,N]=rB(),[C,R]=m.useState(gi.Uninitialized),T=C===gi.Initialized,{draggable:{active:A,nodes:I,translate:_},droppable:{containers:z}}=b,O=A!=null?I.get(A):null,B=m.useRef({initial:null,translated:null}),V=m.useMemo(()=>{var lt;return A!=null?{id:A,data:(lt=O==null?void 0:O.data)!=null?lt:XB,rect:B}:null},[A,O]),$=m.useRef(null),[L,U]=m.useState(null),[K,D]=m.useState(null),W=dd(k,Object.values(k)),M=Wd("DndDescribedBy",a),F=m.useMemo(()=>z.getEnabled(),[z]),Y=t7(g),{droppableRects:H,measureDroppableContainers:Q,measuringScheduled:J}=OB(F,{dragging:T,dependencies:[_.x,_.y],config:Y.droppable}),Z=MB(I,A),oe=m.useMemo(()=>K?jh(K):null,[K]),te=Fe(),ue=FB(Z,Y.draggable.measure);n7({activeNode:A!=null?I.get(A):null,config:te.layoutShiftCompensation,initialRect:ue,measure:Y.draggable.measure});const ge=RN(Z,Y.draggable.measure,ue),Ce=RN(Z?Z.parentElement:null),Se=m.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:z,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ke=z.getNodeFor((n=Se.current.over)==null?void 0:n.id),Be=GB({measure:Y.dragOverlay.measure}),ie=(r=Be.nodeRef.current)!=null?r:Z,ve=T?(o=Be.rect)!=null?o:ge:null,ye=!!(Be.nodeRef.current&&Be.rect),Ae=UB(ye?null:ge),Ue=nA(ie?cr(ie):null),rt=HB(T?ke??Z:null),Oe=qB(rt),ot=iA(y,{transform:{x:_.x-Ae.x,y:_.y-Ae.y,scaleX:1,scaleY:1},activatorEvent:K,active:V,activeNodeRect:ge,containerNodeRect:Ce,draggingNodeRect:ve,over:Se.current.over,overlayNodeRect:Be.rect,scrollableAncestors:rt,scrollableAncestorRects:Oe,windowRect:Ue}),St=oe?Wl(oe,_):null,ht=VB(rt),it=PN(ht),ce=PN(ht,[ge]),me=Wl(ot,it),Ie=ve?hB(ve,ot):null,Pe=V&&Ie?h({active:V,collisionRect:Ie,droppableRects:H,droppableContainers:F,pointerCoordinates:St}):null,We=WR(Pe,"id"),[pt,De]=m.useState(null),Qe=ye?ot:Wl(ot,ce),Je=fB(Qe,(i=pt==null?void 0:pt.rect)!=null?i:null,ge),ut=m.useRef(null),fe=m.useCallback((lt,mt)=>{let{sensor:vt,options:nt}=mt;if($.current==null)return;const _t=I.get($.current);if(!_t)return;const Bt=lt.nativeEvent,Ut=new vt({active:$.current,activeNode:_t,event:Bt,options:nt,context:Se,onAbort(Ct){if(!I.get(Ct))return;const{onDragAbort:Ye}=W.current,at={id:Ct};Ye==null||Ye(at),S({type:"onDragAbort",event:at})},onPending(Ct,je,Ye,at){if(!I.get(Ct))return;const{onDragPending:le}=W.current,Ne={id:Ct,constraint:je,initialCoordinates:Ye,offset:at};le==null||le(Ne),S({type:"onDragPending",event:Ne})},onStart(Ct){const je=$.current;if(je==null)return;const Ye=I.get(je);if(!Ye)return;const{onDragStart:at}=W.current,Mt={activatorEvent:Bt,active:{id:je,data:Ye.data,rect:B}};Xs.unstable_batchedUpdates(()=>{at==null||at(Mt),R(gi.Initializing),w({type:In.DragStart,initialCoordinates:Ct,active:je}),S({type:"onDragStart",event:Mt}),U(ut.current),D(Bt)})},onMove(Ct){w({type:In.DragMove,coordinates:Ct})},onEnd:An(In.DragEnd),onCancel:An(In.DragCancel)});ut.current=Ut;function An(Ct){return async function(){const{active:Ye,collisions:at,over:Mt,scrollAdjustedTranslate:le}=Se.current;let Ne=null;if(Ye&&le){const{cancelDrop:et}=W.current;Ne={activatorEvent:Bt,active:Ye,collisions:at,delta:le,over:Mt},Ct===In.DragEnd&&typeof et=="function"&&await Promise.resolve(et(Ne))&&(Ct=In.DragCancel)}$.current=null,Xs.unstable_batchedUpdates(()=>{w({type:Ct}),R(gi.Uninitialized),De(null),U(null),D(null),ut.current=null;const et=Ct===In.DragEnd?"onDragEnd":"onDragCancel";if(Ne){const Pn=W.current[et];Pn==null||Pn(Ne),S({type:et,event:Ne})}})}}},[I]),q=m.useCallback((lt,mt)=>(vt,nt)=>{const _t=vt.nativeEvent,Bt=I.get(nt);if($.current!==null||!Bt||_t.dndKit||_t.defaultPrevented)return;const Ut={active:Bt};lt(vt,mt.options,Ut)===!0&&(_t.dndKit={capturedBy:mt.sensor},$.current=nt,fe(vt,mt))},[I,fe]),ne=LB(p,q);WB(p),ws(()=>{ge&&C===gi.Initializing&&R(gi.Initialized)},[ge,C]),m.useEffect(()=>{const{onDragMove:lt}=W.current,{active:mt,activatorEvent:vt,collisions:nt,over:_t}=Se.current;if(!mt||!vt)return;const Bt={active:mt,activatorEvent:vt,collisions:nt,delta:{x:me.x,y:me.y},over:_t};Xs.unstable_batchedUpdates(()=>{lt==null||lt(Bt),S({type:"onDragMove",event:Bt})})},[me.x,me.y]),m.useEffect(()=>{const{active:lt,activatorEvent:mt,collisions:vt,droppableContainers:nt,scrollAdjustedTranslate:_t}=Se.current;if(!lt||$.current==null||!mt||!_t)return;const{onDragOver:Bt}=W.current,Ut=nt.get(We),An=Ut&&Ut.rect.current?{id:Ut.id,rect:Ut.rect.current,data:Ut.data,disabled:Ut.disabled}:null,Ct={active:lt,activatorEvent:mt,collisions:vt,delta:{x:_t.x,y:_t.y},over:An};Xs.unstable_batchedUpdates(()=>{De(An),Bt==null||Bt(Ct),S({type:"onDragOver",event:Ct})})},[We]),ws(()=>{Se.current={activatorEvent:K,active:V,activeNode:Z,collisionRect:Ie,collisions:Pe,droppableRects:H,draggableNodes:I,draggingNode:ie,draggingNodeRect:ve,droppableContainers:z,over:pt,scrollableAncestors:rt,scrollAdjustedTranslate:me},B.current={initial:ve,translated:Ie}},[V,Z,Pe,Ie,I,ie,ve,H,z,pt,rt,me]),DB({...te,delta:_,draggingRect:Ie,pointerCoordinates:St,scrollableAncestors:rt,scrollableAncestorRects:Oe});const xe=m.useMemo(()=>({active:V,activeNode:Z,activeNodeRect:ge,activatorEvent:K,collisions:Pe,containerNodeRect:Ce,dragOverlay:Be,draggableNodes:I,droppableContainers:z,droppableRects:H,over:pt,measureDroppableContainers:Q,scrollableAncestors:rt,scrollableAncestorRects:Oe,measuringConfiguration:Y,measuringScheduled:J,windowRect:Ue}),[V,Z,ge,K,Pe,Ce,Be,I,z,H,pt,Q,rt,Oe,Y,J,Ue]),qe=m.useMemo(()=>({activatorEvent:K,activators:ne,active:V,activeNodeRect:ge,ariaDescribedById:{draggable:M},dispatch:w,draggableNodes:I,over:pt,measureDroppableContainers:Q}),[K,ne,V,ge,w,M,I,pt,Q]);return Ot.createElement(UR.Provider,{value:N},Ot.createElement(Kd.Provider,{value:qe},Ot.createElement(oA.Provider,{value:xe},Ot.createElement(Am.Provider,{value:Je},f)),Ot.createElement(e7,{disabled:(l==null?void 0:l.restoreFocus)===!1})),Ot.createElement(iB,{...l,hiddenTextDescribedById:M}));function Fe(){const lt=(L==null?void 0:L.autoScrollEnabled)===!1,mt=typeof u=="object"?u.enabled===!1:u===!1,vt=T&&!lt&&!mt;return typeof u=="object"?{...u,enabled:vt}:{enabled:vt}}}),r7=m.createContext(null),DN="button",s7="Draggable";function o7(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Wd(s7),{activators:a,activatorEvent:l,active:u,activeNodeRect:f,ariaDescribedById:p,draggableNodes:h,over:g}=m.useContext(Kd),{role:y=DN,roleDescription:k="draggable",tabIndex:v=0}=o??{},b=(u==null?void 0:u.id)===t,w=m.useContext(b?Am:r7),[S,N]=vh(),[C,R]=vh(),T=KB(a,t),A=dd(n);ws(()=>(h.set(t,{id:t,key:i,node:S,activatorNode:C,data:A}),()=>{const _=h.get(t);_&&_.key===i&&h.delete(t)}),[h,t]);const I=m.useMemo(()=>({role:y,tabIndex:v,"aria-disabled":r,"aria-pressed":b&&y===DN?!0:void 0,"aria-roledescription":k,"aria-describedby":p.draggable}),[r,y,v,b,k,p.draggable]);return{active:u,activatorEvent:l,activeNodeRect:f,attributes:I,isDragging:b,listeners:r?void 0:T,node:S,over:g,setNodeRef:N,setActivatorNodeRef:R,transform:w}}function aA(){return m.useContext(oA)}const i7="Droppable",a7={timeout:25};function l7(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Wd(i7),{active:a,dispatch:l,over:u,measureDroppableContainers:f}=m.useContext(Kd),p=m.useRef({disabled:n}),h=m.useRef(!1),g=m.useRef(null),y=m.useRef(null),{disabled:k,updateMeasurementsFor:v,timeout:b}={...a7,...o},w=dd(v??r),S=m.useCallback(()=>{if(!h.current){h.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{f(Array.isArray(w.current)?w.current:[w.current]),y.current=null},b)},[b]),N=Rm({callback:S,disabled:k||!a}),C=m.useCallback((I,_)=>{N&&(_&&(N.unobserve(_),h.current=!1),I&&N.observe(I))},[N]),[R,T]=vh(C),A=dd(t);return m.useEffect(()=>{!N||!R.current||(N.disconnect(),h.current=!1,N.observe(R.current))},[R,N]),m.useEffect(()=>(l({type:In.RegisterDroppable,element:{id:r,key:i,disabled:n,node:R,rect:g,data:A}}),()=>l({type:In.UnregisterDroppable,key:i,id:r})),[r]),m.useEffect(()=>{n!==p.current.disabled&&(l({type:In.SetDroppableDisabled,id:r,key:i,disabled:n}),p.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:(u==null?void 0:u.id)===r,node:R,over:u,setNodeRef:T}}function c7(e){let{animation:t,children:n}=e;const[r,o]=m.useState(null),[i,a]=m.useState(null),l=wh(n);return!n&&!r&&l&&o(l),ws(()=>{if(!i)return;const u=r==null?void 0:r.key,f=r==null?void 0:r.props.id;if(u==null||f==null){o(null);return}Promise.resolve(t(f,i)).then(()=>{o(null)})},[t,r,i]),Ot.createElement(Ot.Fragment,null,n,r?m.cloneElement(r,{ref:a}):null)}const u7={x:0,y:0,scaleX:1,scaleY:1};function d7(e){let{children:t}=e;return Ot.createElement(Kd.Provider,{value:sA},Ot.createElement(Am.Provider,{value:u7},t))}const f7={position:"fixed",touchAction:"none"},p7=e=>Sm(e)?"transform 250ms ease":void 0,h7=m.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:i,className:a,rect:l,style:u,transform:f,transition:p=p7}=e;if(!l)return null;const h=o?f:{...f,scaleX:1,scaleY:1},g={...f7,width:l.width,height:l.height,top:l.top,left:l.left,transform:js.Transform.toString(h),transformOrigin:o&&r?aB(r,l):void 0,transition:typeof p=="function"?p(r):p,...u};return Ot.createElement(n,{className:a,style:g,ref:t},i)}),m7=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:i,className:a}=e;if(i!=null&&i.active)for(const[l,u]of Object.entries(i.active))u!==void 0&&(o[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,u));if(i!=null&&i.dragOverlay)for(const[l,u]of Object.entries(i.dragOverlay))u!==void 0&&r.node.style.setProperty(l,u);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[u,f]of Object.entries(o))n.node.style.setProperty(u,f);a!=null&&a.active&&n.node.classList.remove(a.active)}},g7=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:js.Transform.toString(t)},{transform:js.Transform.toString(n)}]},x7={duration:250,easing:"ease",keyframes:g7,sideEffects:m7({styles:{active:{opacity:"0"}}})};function y7(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return Nm((i,a)=>{if(t===null)return;const l=n.get(i);if(!l)return;const u=l.node.current;if(!u)return;const f=rA(a);if(!f)return;const{transform:p}=cr(a).getComputedStyle(a),h=qR(p);if(!h)return;const g=typeof t=="function"?t:b7(t);return eA(u,o.draggable.measure),g({active:{id:i,data:l.data,node:u,rect:o.draggable.measure(u)},draggableNodes:n,dragOverlay:{node:a,rect:o.dragOverlay.measure(f)},droppableContainers:r,measuringConfiguration:o,transform:h})})}function b7(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...x7,...e};return i=>{let{active:a,dragOverlay:l,transform:u,...f}=i;if(!t)return;const p={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},h={scaleX:u.scaleX!==1?a.rect.width*u.scaleX/l.rect.width:1,scaleY:u.scaleY!==1?a.rect.height*u.scaleY/l.rect.height:1},g={x:u.x-p.x,y:u.y-p.y,...h},y=o({...f,active:a,dragOverlay:l,transform:{initial:u,final:g}}),[k]=y,v=y[y.length-1];if(JSON.stringify(k)===JSON.stringify(v))return;const b=r==null?void 0:r({active:a,dragOverlay:l,...f}),w=l.node.animate(y,{duration:t,easing:n,fill:"forwards"});return new Promise(S=>{w.onfinish=()=>{b==null||b(),S()}})}}let $N=0;function v7(e){return m.useMemo(()=>{if(e!=null)return $N++,$N},[e])}const w7=Ot.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:i,modifiers:a,wrapperElement:l="div",className:u,zIndex:f=999}=e;const{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggableNodes:k,droppableContainers:v,dragOverlay:b,over:w,measuringConfiguration:S,scrollableAncestors:N,scrollableAncestorRects:C,windowRect:R}=aA(),T=m.useContext(Am),A=v7(h==null?void 0:h.id),I=iA(a,{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggingNodeRect:b.rect,over:w,overlayNodeRect:b.rect,scrollableAncestors:N,scrollableAncestorRects:C,transform:T,windowRect:R}),_=Iw(g),z=y7({config:r,draggableNodes:k,droppableContainers:v,measuringConfiguration:S}),O=_?b.setRef:void 0;return Ot.createElement(d7,null,Ot.createElement(c7,{animation:z},h&&A?Ot.createElement(h7,{key:A,id:h.id,ref:O,as:l,activatorEvent:p,adjustScale:t,className:u,transition:i,rect:_,style:{zIndex:f,...o},transform:I},n):null))});function Pc(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function j7(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function gp(e){return e!==null&&e>=0}function k7(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function N7(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Mw=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Pc(t,r,n),a=t[o],l=i[o];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},xp={scaleX:1,scaleY:1},Lw=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(o===n){const f=i[a];return f?{x:0,y:n<a?f.top+f.height-(l.top+l.height):f.top-l.top,...xp}:null}const u=S7(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-u,...xp}:o<n&&o>=a?{x:0,y:l.height+u,...xp}:{x:0,y:0,...xp}};function S7(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const lA="Sortable",cA=Ot.createContext({activeIndex:-1,containerId:lA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Mw,disabled:{draggable:!1,droppable:!1}});function _m(e){let{children:t,id:n,items:r,strategy:o=Mw,disabled:i=!1}=e;const{active:a,dragOverlay:l,droppableRects:u,over:f,measureDroppableContainers:p}=aA(),h=Wd(lA,n),g=l.rect!==null,y=m.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),k=a!=null,v=a?y.indexOf(a.id):-1,b=f?y.indexOf(f.id):-1,w=m.useRef(y),S=!k7(y,w.current),N=b!==-1&&v===-1||S,C=N7(i);ws(()=>{S&&k&&p(y)},[S,y,k,p]),m.useEffect(()=>{w.current=y},[y]);const R=m.useMemo(()=>({activeIndex:v,containerId:h,disabled:C,disableTransforms:N,items:y,overIndex:b,useDragOverlay:g,sortedRects:j7(y,u),strategy:o}),[v,h,C.draggable,C.droppable,N,y,b,u,g,o]);return Ot.createElement(cA.Provider,{value:R},t)}const C7=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Pc(n,r,o).indexOf(t)},E7=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:u,transition:f}=e;return!f||!r||l!==i&&o===a?!1:n?!0:a!==o&&t===u},T7={duration:200,easing:"ease"},uA="transform",R7=js.Transition.toString({property:uA,duration:0,easing:"linear"}),A7={roleDescription:"sortable"};function P7(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=m.useState(null),l=m.useRef(n);return ws(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const f=Tc(r.current,{ignoreTransform:!0}),p={x:u.left-f.left,y:u.top-f.top,scaleX:u.width/f.width,scaleY:u.height/f.height};(p.x||p.y)&&a(p)}}n!==l.current&&(l.current=n)},[t,n,r,o]),m.useEffect(()=>{i&&a(null)},[i]),i}function Dm(e){let{animateLayoutChanges:t=E7,attributes:n,disabled:r,data:o,getNewIndex:i=C7,id:a,strategy:l,resizeObserverConfig:u,transition:f=T7}=e;const{items:p,containerId:h,activeIndex:g,disabled:y,disableTransforms:k,sortedRects:v,overIndex:b,useDragOverlay:w,strategy:S}=m.useContext(cA),N=_7(r,y),C=p.indexOf(a),R=m.useMemo(()=>({sortable:{containerId:h,index:C,items:p},...o}),[h,o,C,p]),T=m.useMemo(()=>p.slice(p.indexOf(a)),[p,a]),{rect:A,node:I,isOver:_,setNodeRef:z}=l7({id:a,data:R,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...u}}),{active:O,activatorEvent:B,activeNodeRect:V,attributes:$,setNodeRef:L,listeners:U,isDragging:K,over:D,setActivatorNodeRef:W,transform:M}=o7({id:a,data:R,attributes:{...A7,...n},disabled:N.draggable}),F=q8(z,L),Y=!!O,H=Y&&!k&&gp(g)&&gp(b),Q=!w&&K,J=Q&&H?M:null,oe=H?J??(l??S)({rects:v,activeNodeRect:V,activeIndex:g,overIndex:b,index:C}):null,te=gp(g)&&gp(b)?i({id:a,items:p,activeIndex:g,overIndex:b}):C,ue=O==null?void 0:O.id,ge=m.useRef({activeId:ue,items:p,newIndex:te,containerId:h}),Ce=p!==ge.current.items,Se=t({active:O,containerId:h,isDragging:K,isSorting:Y,id:a,index:C,items:p,newIndex:ge.current.newIndex,previousItems:ge.current.items,previousContainerId:ge.current.containerId,transition:f,wasDragging:ge.current.activeId!=null}),ke=P7({disabled:!Se,index:C,node:I,rect:A});return m.useEffect(()=>{Y&&ge.current.newIndex!==te&&(ge.current.newIndex=te),h!==ge.current.containerId&&(ge.current.containerId=h),p!==ge.current.items&&(ge.current.items=p)},[Y,te,h,p]),m.useEffect(()=>{if(ue===ge.current.activeId)return;if(ue!=null&&ge.current.activeId==null){ge.current.activeId=ue;return}const ie=setTimeout(()=>{ge.current.activeId=ue},50);return()=>clearTimeout(ie)},[ue]),{active:O,activeIndex:g,attributes:$,data:R,rect:A,index:C,newIndex:te,items:p,isOver:_,isSorting:Y,isDragging:K,listeners:U,node:I,overIndex:b,over:D,setNodeRef:F,setActivatorNodeRef:W,setDroppableNodeRef:z,setDraggableNodeRef:L,transform:ke??oe,transition:Be()};function Be(){if(ke||Ce&&ge.current.newIndex===C)return R7;if(!(Q&&!Sm(B)||!f)&&(Y||Se))return js.Transition.toString({...f,property:uA})}}function _7(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function Sh(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const D7=[At.Down,At.Right,At.Up,At.Left],dA=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(D7.includes(e.code)){if(e.preventDefault(),!n||!r)return;const u=[];i.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const g=o.get(h.id);if(g)switch(e.code){case At.Down:r.top<g.top&&u.push(h);break;case At.Up:r.top>g.top&&u.push(h);break;case At.Left:r.left>g.left&&u.push(h);break;case At.Right:r.left<g.left&&u.push(h);break}});const f=cB({collisionRect:r,droppableRects:o,droppableContainers:u});let p=WR(f,"id");if(p===(a==null?void 0:a.id)&&f.length>1&&(p=f[1].id),p!=null){const h=i.get(n.id),g=i.get(p),y=g?o.get(g.id):null,k=g==null?void 0:g.node.current;if(k&&y&&h&&g){const b=Tm(k).some((T,A)=>l[A]!==T),w=fA(h,g),S=$7(h,g),N=b||!w?{x:0,y:0}:{x:S?r.width-y.width:0,y:S?r.height-y.height:0},C={x:y.left,y:y.top};return N.x&&N.y?C:fd(C,N)}}}};function fA(e,t){return!Sh(e)||!Sh(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function $7(e,t){return!Sh(e)||!Sh(t)||!fA(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function bt({label:e="Loading dashboard data…"}){return s.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:s.jsx("div",{className:"chrome-card !px-4 !py-3",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:e})})})}function Rt({title:e="Something went wrong",error:t,action:n,onRetry:r,retryLabel:o="Retry"}){const i=n??(r?s.jsxs("button",{type:"button",onClick:r,className:"shell-action",children:[s.jsx(Q5,{className:"h-4 w-4"}),s.jsx("span",{children:o})]}):null);return s.jsx("div",{className:"rounded-lg border border-error-foreground/30 bg-error px-4 py-5",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"text-lg font-semibold text-error-foreground",children:e}),s.jsx("p",{className:"text-sm leading-6 text-error-foreground/90",children:t}),i?s.jsx("div",{className:"pt-2",children:i}):null]})})}function Xp({command:e,description:t,example:n}){return s.jsxs("div",{className:"rounded-lg border border-border/70 bg-code px-3 py-3 text-code-foreground shadow-sm",children:[s.jsx("code",{className:"block overflow-x-auto font-mono text-sm",children:e}),t?s.jsx("p",{className:"mt-2 text-sm text-code-foreground/80",children:t}):null,n?s.jsx("p",{className:"mt-2 font-mono text-xs text-code-foreground/60",children:n}):null]})}function Ve({title:e,description:t,children:n,className:r,actions:o}){return s.jsxs("section",{className:be("surface-panel space-y-3",r),children:[e||o?s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[e?s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}):null,t?s.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),o]}):null,n]})}function I7({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return s.jsx(Ve,{title:t?"Getting Started Refresher":"Getting Started",description:t?"A fast reminder of the real flow for creating and running work in Syntaur.":"A first-run checklist that maps to the current CLI and dashboard flow.",actions:s.jsx(_e,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:s.jsx("div",{className:"space-y-3",children:n.map((r,o)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:o+1}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:r.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:r.detail}),r.command?s.jsx(Xp,{command:r.command.command,example:r.command.example}):null]})]})},r.title))})})}const Ny={review:"{total} items ready for your review","review.singular":"Review {title}",ready_to_implement:"{total} plans ready to implement — start with {title}","ready_to_implement.singular":"Start implementing {title}",ready_for_planning:"{total} assignments ready to plan — start with {title}","ready_for_planning.singular":"Plan {title}",in_progress:"Resume {title} ({total} in progress)","in_progress.singular":"Resume {title}",draft:"Shape your {total} drafts — start with {title}","draft.singular":"Shape {title}",blocked:"Unblock {title} ({total} blocked)","blocked.singular":"Unblock {title}",stale:"Triage {total} stale items","stale.singular":"Triage {title} — sitting stale",clean:"You’re all clear. Nothing needs you right now."},ma={emptyStateCleanTitle:"You’re all clear",emptyStateCleanCTA:"Browse projects",recentSessionsEmptyTitle:"No recent sessions",recentSessionsEmptyHint:"Use /grab-assignment or `syntaur track-session` to register one.",recentSessionsCopyPathLabel:"Copy path",recentSessionsCopyPathDisabled:"Session has no path",recentSessionsCopyFallbackHint:"Press ⌘C to copy"};function M7(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function L7({hero:e,itemsById:t}){const n=xn();if(e.kind==="clean")return s.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-border/60 bg-background/60 p-6 shadow-sm",children:[s.jsx("p",{className:"eyebrow",children:ma.emptyStateCleanTitle}),s.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:Ny.clean}),s.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"When work shows up — a draft, a review, a stale row — it’ll surface here."}),s.jsx("div",{className:"mt-4",children:s.jsx(_e,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:ma.emptyStateCleanCTA})})]});const r=e.itemId?t[e.itemId]:void 0,o=(r==null?void 0:r.assignmentTitle)??"",i=Ny[e.copyKey]??Ny[e.kind],a=M7(i,{total:e.total,title:o}),l=r?O7(r,n):`${n}/assignments`;return s.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-primary/20 bg-primary/5 p-6 shadow-sm",children:[s.jsx("p",{className:"eyebrow",children:"Top priority"}),s.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:a}),r?s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["In ",s.jsx("span",{className:"font-medium text-foreground",children:r.projectTitle??"Standalone"})," ","· status ",s.jsx("span",{className:"font-medium text-foreground",children:r.status})]}):null,s.jsx("div",{className:"mt-4",children:s.jsxs(_e,{to:l,className:"shell-action shell-action--cta",children:["Open ",o||"assignment"]})})]})}function O7(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Sy=["title","status","priority","assignee","dependencies","created","updated"],hd=24,pA=60;function F7(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Number.isInteger(t.w)&&t.w>=1&&t.w<=hd&&Number.isInteger(t.h)&&t.h>=1&&t.h<=pA}const z7={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},IN="2026-05-21T00:00:00Z";function Cy(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...z7,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:IN,updatedAt:IN}}const bi={version:1,views:[Cy("default-recently-updated","Recently updated",{}),Cy("default-high-priority","High priority",{priority:"high"}),Cy("default-stale","Stale",{activity:"stale"})],dashboard:{version:1,slots:[{id:"slot-0",widget:{kind:"agent-sessions"}},{id:"slot-1",widget:{kind:"saved-view",viewId:"default-recently-updated"}},{id:"slot-2",widget:{kind:"saved-view",viewId:"default-high-priority"}},{id:"slot-3",widget:{kind:"saved-view",viewId:"default-stale"}},{id:"slot-4",widget:{kind:"inventories"}}]}};function hA(e,t){const n=He(e.filters.project),r=n.length===0||n.length===1&&n[0]===t,o=e.filters.activity,i=typeof e.filters.search=="string"&&e.filters.search.trim().length>0,a=e.filters.query,l=typeof a=="string"&&a.trim().length>0&&Ku(a)===null;return r&&(!o||o==="all")&&!i&&!l}function mA(e,t){switch(t.kind){case"global":return e.workspace===null;case"workspace":return e.workspace===t.workspace||e.workspace===null;case"project":return e.workspace===t.workspace||e.workspace===null?hA(e.config,t.slug):!1}}const gA=`syntaur.savedViews.cache.v${bi.version}`;let Kl=B7(),ta=null,Ow=null;const Vb=new Set,Ch=new Set;let xA=0;function yA(){return++xA}function Wb(e){return e===xA}function B7(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(gA);if(!e)return null;const t=JSON.parse(e);return t.version!==bi.version?null:t}catch{return null}}function U7(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(gA,JSON.stringify(e))}catch{}}function bA(e){Kl=e,Ow=null,U7(e);for(const t of Vb)t(e);for(const t of Ch)t(null)}function H7(e){Ow=e;for(const t of Ch)t(e)}function vA(e){if(!e||typeof e!="object")return bi;const t=e;return t.version!==bi.version||!Array.isArray(t.views)||!t.dashboard?bi:t}function MN(){if(ta)return ta;const e=yA();return ta=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=vA(t);return Wb(e)&&bA(n),ta=null,Kl??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Wb(e)&&H7(n),ta=null,Kl??bi}),ta}function Fw(){const[e,t]=m.useState(()=>Kl??bi),[n,r]=m.useState(()=>Kl===null),[o,i]=m.useState(!1),[a,l]=m.useState(()=>Ow);return m.useEffect(()=>{let f=!1;Kl===null&&r(!0),MN().then(g=>{f||(t(g),r(!1),i(!0))});const p=g=>{f||(t(g),r(!1),i(!0),l(null))},h=g=>{f||(l(g),r(!1),i(!0))};return Vb.add(p),Ch.add(h),()=>{f=!0,Vb.delete(p),Ch.delete(h)}},[]),{file:e,loading:n,ready:o,error:a,refetch:()=>{ta=null,r(!0),l(null),i(!1),MN()}}}function qd(){const{file:e,loading:t}=Fw();return{views:e.views,loading:t}}function wA(){const{file:e,loading:t}=Fw();return{layout:e.dashboard,loading:t}}function ki(e){const{file:t,loading:n,ready:r,error:o,refetch:i}=Fw();return e?{view:t.views.find(l=>l.id===e)??null,loading:n,ready:r,error:o,refetch:i}:{view:null,loading:!1,ready:!0,error:null,refetch:i}}async function $m(e,t,n){const r=yA(),o=await fetch(t,{method:e,headers:n!==void 0?{"Content-Type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!o.ok){const a=await o.json().catch(()=>({error:`HTTP ${o.status}`}));throw new Error(a.error??`HTTP ${o.status}`)}const i=vA(await o.json());return Wb(r)&&bA(i),i}function rc(e){return $m("POST","/api/saved-views",e)}function Eh(e,t){return $m("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function V7(e){return $m("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function Kb(e){return $m("PUT","/api/dashboard",{slots:e})}const W7=["top","right","bottom","left"],Ni=Math.min,Mr=Math.max,Th=Math.round,yp=Math.floor,to=e=>({x:e,y:e}),K7={left:"right",right:"left",bottom:"top",top:"bottom"};function qb(e,t,n){return Mr(e,Ni(t,n))}function _o(e,t){return typeof e=="function"?e(t):e}function Do(e){return e.split("-")[0]}function _c(e){return e.split("-")[1]}function zw(e){return e==="x"?"y":"x"}function Bw(e){return e==="y"?"height":"width"}function Qs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Uw(e){return zw(Qs(e))}function q7(e,t,n){n===void 0&&(n=!1);const r=_c(e),o=Uw(e),i=Bw(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Rh(a)),[a,Rh(a)]}function G7(e){const t=Rh(e);return[Gb(e),t,Gb(t)]}function Gb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const LN=["left","right"],ON=["right","left"],Y7=["top","bottom"],X7=["bottom","top"];function Q7(e,t,n){switch(e){case"top":case"bottom":return n?t?ON:LN:t?LN:ON;case"left":case"right":return t?Y7:X7;default:return[]}}function J7(e,t,n,r){const o=_c(e);let i=Q7(Do(e),n==="start",r);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Gb)))),i}function Rh(e){const t=Do(e);return K7[t]+e.slice(t.length)}function Z7(e){return{top:0,right:0,bottom:0,left:0,...e}}function jA(e){return typeof e!="number"?Z7(e):{top:e,right:e,bottom:e,left:e}}function Ah(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function FN(e,t,n){let{reference:r,floating:o}=e;const i=Qs(t),a=Uw(t),l=Bw(a),u=Do(t),f=i==="y",p=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,g=r[l]/2-o[l]/2;let y;switch(u){case"top":y={x:p,y:r.y-o.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:h};break;case"left":y={x:r.x-o.width,y:h};break;default:y={x:r.x,y:r.y}}switch(_c(t)){case"start":y[a]-=g*(n&&f?-1:1);break;case"end":y[a]+=g*(n&&f?-1:1);break}return y}async function eU(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:h="floating",altBoundary:g=!1,padding:y=0}=_o(t,e),k=jA(y),b=l[g?h==="floating"?"reference":"floating":h],w=Ah(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:f,rootBoundary:p,strategy:u})),S=h==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=await(i.isElement==null?void 0:i.isElement(N))?await(i.getScale==null?void 0:i.getScale(N))||{x:1,y:1}:{x:1,y:1},R=Ah(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:S,offsetParent:N,strategy:u}):S);return{top:(w.top-R.top+k.top)/C.y,bottom:(R.bottom-w.bottom+k.bottom)/C.y,left:(w.left-R.left+k.left)/C.x,right:(R.right-w.right+k.right)/C.x}}const tU=50,nU=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:eU},u=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:h}=FN(f,r,u),g=r,y=0;const k={};for(let v=0;v<i.length;v++){const b=i[v];if(!b)continue;const{name:w,fn:S}=b,{x:N,y:C,data:R,reset:T}=await S({x:p,y:h,initialPlacement:r,placement:g,strategy:o,middlewareData:k,rects:f,platform:l,elements:{reference:e,floating:t}});p=N??p,h=C??h,k[w]={...k[w],...R},T&&y<tU&&(y++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(f=T.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:p,y:h}=FN(f,g,u)),v=-1)}return{x:p,y:h,placement:g,strategy:o,middlewareData:k}},rU=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:l,middlewareData:u}=t,{element:f,padding:p=0}=_o(e,t)||{};if(f==null)return{};const h=jA(p),g={x:n,y:r},y=Uw(o),k=Bw(y),v=await a.getDimensions(f),b=y==="y",w=b?"top":"left",S=b?"bottom":"right",N=b?"clientHeight":"clientWidth",C=i.reference[k]+i.reference[y]-g[y]-i.floating[k],R=g[y]-i.reference[y],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let A=T?T[N]:0;(!A||!await(a.isElement==null?void 0:a.isElement(T)))&&(A=l.floating[N]||i.floating[k]);const I=C/2-R/2,_=A/2-v[k]/2-1,z=Ni(h[w],_),O=Ni(h[S],_),B=z,V=A-v[k]-O,$=A/2-v[k]/2+I,L=qb(B,$,V),U=!u.arrow&&_c(o)!=null&&$!==L&&i.reference[k]/2-($<B?z:O)-v[k]/2<0,K=U?$<B?$-B:$-V:0;return{[y]:g[y]+K,data:{[y]:L,centerOffset:$-L-K,...U&&{alignmentOffset:K}},reset:U}}}),sU=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:u,elements:f}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:v=!0,...b}=_o(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=Do(o),S=Qs(l),N=Do(l)===l,C=await(u.isRTL==null?void 0:u.isRTL(f.floating)),R=g||(N||!v?[Rh(l)]:G7(l)),T=k!=="none";!g&&T&&R.push(...J7(l,v,k,C));const A=[l,...R],I=await u.detectOverflow(t,b),_=[];let z=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&_.push(I[w]),h){const $=q7(o,a,C);_.push(I[$[0]],I[$[1]])}if(z=[...z,{placement:o,overflows:_}],!_.every($=>$<=0)){var O,B;const $=(((O=i.flip)==null?void 0:O.index)||0)+1,L=A[$];if(L&&(!(h==="alignment"?S!==Qs(L):!1)||z.every(D=>Qs(D.placement)===S?D.overflows[0]>0:!0)))return{data:{index:$,overflows:z},reset:{placement:L}};let U=(B=z.filter(K=>K.overflows[0]<=0).sort((K,D)=>K.overflows[1]-D.overflows[1])[0])==null?void 0:B.placement;if(!U)switch(y){case"bestFit":{var V;const K=(V=z.filter(D=>{if(T){const W=Qs(D.placement);return W===S||W==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(W=>W>0).reduce((W,M)=>W+M,0)]).sort((D,W)=>D[1]-W[1])[0])==null?void 0:V[0];K&&(U=K);break}case"initialPlacement":U=l;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function zN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function BN(e){return W7.some(t=>e[t]>=0)}const oU=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=_o(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=zN(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:BN(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...i,altBoundary:!0}),l=zN(a,n.floating);return{data:{escapedOffsets:l,escaped:BN(l)}}}default:return{}}}}},kA=new Set(["left","top"]);async function iU(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=Do(n),l=_c(n),u=Qs(n)==="y",f=kA.has(a)?-1:1,p=i&&u?-1:1,h=_o(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:k}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof k=="number"&&(y=l==="end"?k*-1:k),u?{x:y*p,y:g*f}:{x:g*f,y:y*p}}const aU=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,u=await iU(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:a}}}}},lU=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:u={fn:w=>{let{x:S,y:N}=w;return{x:S,y:N}}},...f}=_o(e,t),p={x:n,y:r},h=await i.detectOverflow(t,f),g=Qs(Do(o)),y=zw(g);let k=p[y],v=p[g];if(a){const w=y==="y"?"top":"left",S=y==="y"?"bottom":"right",N=k+h[w],C=k-h[S];k=qb(N,k,C)}if(l){const w=g==="y"?"top":"left",S=g==="y"?"bottom":"right",N=v+h[w],C=v-h[S];v=qb(N,v,C)}const b=u.fn({...t,[y]:k,[g]:v});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:a,[g]:l}}}}}},cU=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:u=!0,crossAxis:f=!0}=_o(e,t),p={x:n,y:r},h=Qs(o),g=zw(h);let y=p[g],k=p[h];const v=_o(l,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(u){const N=g==="y"?"height":"width",C=i.reference[g]-i.floating[N]+b.mainAxis,R=i.reference[g]+i.reference[N]-b.mainAxis;y<C?y=C:y>R&&(y=R)}if(f){var w,S;const N=g==="y"?"width":"height",C=kA.has(Do(o)),R=i.reference[h]-i.floating[N]+(C&&((w=a.offset)==null?void 0:w[h])||0)+(C?0:b.crossAxis),T=i.reference[h]+i.reference[N]+(C?0:((S=a.offset)==null?void 0:S[h])||0)-(C?b.crossAxis:0);k<R?k=R:k>T&&(k=T)}return{[g]:y,[h]:k}}}},uU=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:a,elements:l}=t,{apply:u=()=>{},...f}=_o(e,t),p=await a.detectOverflow(t,f),h=Do(o),g=_c(o),y=Qs(o)==="y",{width:k,height:v}=i.floating;let b,w;h==="top"||h==="bottom"?(b=h,w=g===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(w=h,b=g==="end"?"top":"bottom");const S=v-p.top-p.bottom,N=k-p.left-p.right,C=Ni(v-p[b],S),R=Ni(k-p[w],N),T=!t.middlewareData.shift;let A=C,I=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=N),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(A=S),T&&!g){const z=Mr(p.left,0),O=Mr(p.right,0),B=Mr(p.top,0),V=Mr(p.bottom,0);y?I=k-2*(z!==0||O!==0?z+O:Mr(p.left,p.right)):A=v-2*(B!==0||V!==0?B+V:Mr(p.top,p.bottom))}await u({...t,availableWidth:I,availableHeight:A});const _=await a.getDimensions(l.floating);return k!==_.width||v!==_.height?{reset:{rects:!0}}:{}}}};function Im(){return typeof window<"u"}function Dc(e){return NA(e)?(e.nodeName||"").toLowerCase():"#document"}function Br(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function io(e){var t;return(t=(NA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function NA(e){return Im()?e instanceof Node||e instanceof Br(e).Node:!1}function Ns(e){return Im()?e instanceof Element||e instanceof Br(e).Element:!1}function Mo(e){return Im()?e instanceof HTMLElement||e instanceof Br(e).HTMLElement:!1}function UN(e){return!Im()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Br(e).ShadowRoot}function Gd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ss(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function dU(e){return/^(table|td|th)$/.test(Dc(e))}function Mm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const fU=/transform|translate|scale|rotate|perspective|filter/,pU=/paint|layout|strict|content/,Qi=e=>!!e&&e!=="none";let Ey;function Hw(e){const t=Ns(e)?Ss(e):e;return Qi(t.transform)||Qi(t.translate)||Qi(t.scale)||Qi(t.rotate)||Qi(t.perspective)||!Vw()&&(Qi(t.backdropFilter)||Qi(t.filter))||fU.test(t.willChange||"")||pU.test(t.contain||"")}function hU(e){let t=Si(e);for(;Mo(t)&&!sc(t);){if(Hw(t))return t;if(Mm(t))return null;t=Si(t)}return null}function Vw(){return Ey==null&&(Ey=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ey}function sc(e){return/^(html|body|#document)$/.test(Dc(e))}function Ss(e){return Br(e).getComputedStyle(e)}function Lm(e){return Ns(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Si(e){if(Dc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||UN(e)&&e.host||io(e);return UN(t)?t.host:t}function SA(e){const t=Si(e);return sc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Mo(t)&&Gd(t)?t:SA(t)}function md(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=SA(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),a=Br(o);if(i){const l=Yb(a);return t.concat(a,a.visualViewport||[],Gd(o)?o:[],l&&n?md(l):[])}else return t.concat(o,md(o,[],n))}function Yb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function CA(e){const t=Ss(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Mo(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=Th(n)!==i||Th(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Ww(e){return Ns(e)?e:e.contextElement}function ql(e){const t=Ww(e);if(!Mo(t))return to(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=CA(t);let a=(i?Th(n.width):n.width)/r,l=(i?Th(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const mU=to(0);function EA(e){const t=Br(e);return!Vw()||!t.visualViewport?mU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gU(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Br(e)?!1:t}function ka(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ww(e);let a=to(1);t&&(r?Ns(r)&&(a=ql(r)):a=ql(e));const l=gU(i,n,r)?EA(i):to(0);let u=(o.left+l.x)/a.x,f=(o.top+l.y)/a.y,p=o.width/a.x,h=o.height/a.y;if(i){const g=Br(i),y=r&&Ns(r)?Br(r):r;let k=g,v=Yb(k);for(;v&&r&&y!==k;){const b=ql(v),w=v.getBoundingClientRect(),S=Ss(v),N=w.left+(v.clientLeft+parseFloat(S.paddingLeft))*b.x,C=w.top+(v.clientTop+parseFloat(S.paddingTop))*b.y;u*=b.x,f*=b.y,p*=b.x,h*=b.y,u+=N,f+=C,k=Br(v),v=Yb(k)}}return Ah({width:p,height:h,x:u,y:f})}function Om(e,t){const n=Lm(e).scrollLeft;return t?t.left+n:ka(io(e)).left+n}function TA(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Om(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function xU(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",a=io(r),l=t?Mm(t.floating):!1;if(r===a||l&&i)return n;let u={scrollLeft:0,scrollTop:0},f=to(1);const p=to(0),h=Mo(r);if((h||!h&&!i)&&((Dc(r)!=="body"||Gd(a))&&(u=Lm(r)),h)){const y=ka(r);f=ql(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const g=a&&!h&&!i?TA(a,u):to(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+p.x+g.x,y:n.y*f.y-u.scrollTop*f.y+p.y+g.y}}function yU(e){return Array.from(e.getClientRects())}function bU(e){const t=io(e),n=Lm(e),r=e.ownerDocument.body,o=Mr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Mr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Om(e);const l=-n.scrollTop;return Ss(r).direction==="rtl"&&(a+=Mr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}const HN=25;function vU(e,t){const n=Br(e),r=io(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,u=0;if(o){i=o.width,a=o.height;const p=Vw();(!p||p&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}const f=Om(r);if(f<=0){const p=r.ownerDocument,h=p.body,g=getComputedStyle(h),y=p.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,k=Math.abs(r.clientWidth-h.clientWidth-y);k<=HN&&(i-=k)}else f<=HN&&(i+=f);return{width:i,height:a,x:l,y:u}}function wU(e,t){const n=ka(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Mo(e)?ql(e):to(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,u=o*i.x,f=r*i.y;return{width:a,height:l,x:u,y:f}}function VN(e,t,n){let r;if(t==="viewport")r=vU(e,n);else if(t==="document")r=bU(io(e));else if(Ns(t))r=wU(t,n);else{const o=EA(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ah(r)}function RA(e,t){const n=Si(e);return n===t||!Ns(n)||sc(n)?!1:Ss(n).position==="fixed"||RA(n,t)}function jU(e,t){const n=t.get(e);if(n)return n;let r=md(e,[],!1).filter(l=>Ns(l)&&Dc(l)!=="body"),o=null;const i=Ss(e).position==="fixed";let a=i?Si(e):e;for(;Ns(a)&&!sc(a);){const l=Ss(a),u=Hw(a);!u&&l.position==="fixed"&&(o=null),(i?!u&&!o:!u&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Gd(a)&&!u&&RA(e,a))?r=r.filter(p=>p!==a):o=l,a=Si(a)}return t.set(e,r),r}function kU(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?Mm(t)?[]:jU(t,this._c):[].concat(n),r],l=VN(t,a[0],o);let u=l.top,f=l.right,p=l.bottom,h=l.left;for(let g=1;g<a.length;g++){const y=VN(t,a[g],o);u=Mr(y.top,u),f=Ni(y.right,f),p=Ni(y.bottom,p),h=Mr(y.left,h)}return{width:f-h,height:p-u,x:h,y:u}}function NU(e){const{width:t,height:n}=CA(e);return{width:t,height:n}}function SU(e,t,n){const r=Mo(t),o=io(t),i=n==="fixed",a=ka(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const u=to(0);function f(){u.x=Om(o)}if(r||!r&&!i)if((Dc(t)!=="body"||Gd(o))&&(l=Lm(t)),r){const y=ka(t,!0,i,t);u.x=y.x+t.clientLeft,u.y=y.y+t.clientTop}else o&&f();i&&!r&&o&&f();const p=o&&!r&&!i?TA(o,l):to(0),h=a.left+l.scrollLeft-u.x-p.x,g=a.top+l.scrollTop-u.y-p.y;return{x:h,y:g,width:a.width,height:a.height}}function Ty(e){return Ss(e).position==="static"}function WN(e,t){if(!Mo(e)||Ss(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return io(e)===n&&(n=n.ownerDocument.body),n}function AA(e,t){const n=Br(e);if(Mm(e))return n;if(!Mo(e)){let o=Si(e);for(;o&&!sc(o);){if(Ns(o)&&!Ty(o))return o;o=Si(o)}return n}let r=WN(e,t);for(;r&&dU(r)&&Ty(r);)r=WN(r,t);return r&&sc(r)&&Ty(r)&&!Hw(r)?n:r||hU(e)||n}const CU=async function(e){const t=this.getOffsetParent||AA,n=this.getDimensions,r=await n(e.floating);return{reference:SU(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function EU(e){return Ss(e).direction==="rtl"}const TU={convertOffsetParentRelativeRectToViewportRelativeRect:xU,getDocumentElement:io,getClippingRect:kU,getOffsetParent:AA,getElementRects:CU,getClientRects:yU,getDimensions:NU,getScale:ql,isElement:Ns,isRTL:EU};function PA(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function RU(e,t){let n=null,r;const o=io(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),i();const f=e.getBoundingClientRect(),{left:p,top:h,width:g,height:y}=f;if(l||t(),!g||!y)return;const k=yp(h),v=yp(o.clientWidth-(p+g)),b=yp(o.clientHeight-(h+y)),w=yp(p),N={rootMargin:-k+"px "+-v+"px "+-b+"px "+-w+"px",threshold:Mr(0,Ni(1,u))||1};let C=!0;function R(T){const A=T[0].intersectionRatio;if(A!==u){if(!C)return a();A?a(!1,A):r=setTimeout(()=>{a(!1,1e-7)},1e3)}A===1&&!PA(f,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(R,{...N,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,N)}n.observe(e)}return a(!0),i}function AU(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=Ww(e),p=o||i?[...f?md(f):[],...t?md(t):[]]:[];p.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const h=f&&l?RU(f,n):null;let g=-1,y=null;a&&(y=new ResizeObserver(w=>{let[S]=w;S&&S.target===f&&y&&t&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var N;(N=y)==null||N.observe(t)})),n()}),f&&!u&&y.observe(f),t&&y.observe(t));let k,v=u?ka(e):null;u&&b();function b(){const w=ka(e);v&&!PA(v,w)&&n(),v=w,k=requestAnimationFrame(b)}return n(),()=>{var w;p.forEach(S=>{o&&S.removeEventListener("scroll",n),i&&S.removeEventListener("resize",n)}),h==null||h(),(w=y)==null||w.disconnect(),y=null,u&&cancelAnimationFrame(k)}}const PU=aU,_U=lU,DU=sU,$U=uU,IU=oU,KN=rU,MU=cU,LU=(e,t,n)=>{const r=new Map,o={platform:TU,...n},i={...o.platform,_c:r};return nU(e,t,{...o,platform:i})};var OU=typeof document<"u",FU=function(){},Qp=OU?m.useLayoutEffect:FU;function Ph(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,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ph(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Ph(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function _A(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qN(e,t){const n=_A(e);return Math.round(t*n)/n}function Ry(e){const t=m.useRef(e);return Qp(()=>{t.current=e}),t}function zU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:u,open:f}=e,[p,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=m.useState(r);Ph(g,r)||y(r);const[k,v]=m.useState(null),[b,w]=m.useState(null),S=m.useCallback(D=>{D!==T.current&&(T.current=D,v(D))},[]),N=m.useCallback(D=>{D!==A.current&&(A.current=D,w(D))},[]),C=i||k,R=a||b,T=m.useRef(null),A=m.useRef(null),I=m.useRef(p),_=u!=null,z=Ry(u),O=Ry(o),B=Ry(f),V=m.useCallback(()=>{if(!T.current||!A.current)return;const D={placement:t,strategy:n,middleware:g};O.current&&(D.platform=O.current),LU(T.current,A.current,D).then(W=>{const M={...W,isPositioned:B.current!==!1};$.current&&!Ph(I.current,M)&&(I.current=M,Xs.flushSync(()=>{h(M)}))})},[g,t,n,O,B]);Qp(()=>{f===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,h(D=>({...D,isPositioned:!1})))},[f]);const $=m.useRef(!1);Qp(()=>($.current=!0,()=>{$.current=!1}),[]),Qp(()=>{if(C&&(T.current=C),R&&(A.current=R),C&&R){if(z.current)return z.current(C,R,V);V()}},[C,R,V,z,_]);const L=m.useMemo(()=>({reference:T,floating:A,setReference:S,setFloating:N}),[S,N]),U=m.useMemo(()=>({reference:C,floating:R}),[C,R]),K=m.useMemo(()=>{const D={position:n,left:0,top:0};if(!U.floating)return D;const W=qN(U.floating,p.x),M=qN(U.floating,p.y);return l?{...D,transform:"translate("+W+"px, "+M+"px)",..._A(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:M}},[n,l,U.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:V,refs:L,elements:U,floatingStyles:K}),[p,V,L,U,K])}const BU=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?KN({element:r.current,padding:o}).fn(n):{}:r?KN({element:r,padding:o}).fn(n):{}}}},UU=(e,t)=>{const n=PU(e);return{name:n.name,fn:n.fn,options:[e,t]}},HU=(e,t)=>{const n=_U(e);return{name:n.name,fn:n.fn,options:[e,t]}},VU=(e,t)=>({fn:MU(e).fn,options:[e,t]}),WU=(e,t)=>{const n=DU(e);return{name:n.name,fn:n.fn,options:[e,t]}},KU=(e,t)=>{const n=$U(e);return{name:n.name,fn:n.fn,options:[e,t]}},qU=(e,t)=>{const n=IU(e);return{name:n.name,fn:n.fn,options:[e,t]}},GU=(e,t)=>{const n=BU(e);return{name:n.name,fn:n.fn,options:[e,t]}};var YU="Arrow",DA=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return s.jsx(Sn.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});DA.displayName=YU;var XU=DA;function QU(e){const[t,n]=m.useState(void 0);return wi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let a,l;if("borderBoxSize"in i){const u=i.borderBoxSize,f=Array.isArray(u)?u[0]:u;a=f.inlineSize,l=f.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Kw="Popper",[$A,IA]=Aa(Kw),[JU,MA]=$A(Kw),LA=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return s.jsx(JU,{scope:t,anchor:r,onAnchorChange:o,children:n})};LA.displayName=Kw;var OA="PopperAnchor",FA=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=MA(OA,n),a=m.useRef(null),l=nr(t,a),u=m.useRef(null);return m.useEffect(()=>{const f=u.current;u.current=(r==null?void 0:r.current)||a.current,f!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(Sn.div,{...o,ref:l})});FA.displayName=OA;var qw="PopperContent",[ZU,e9]=$A(qw),zA=m.forwardRef((e,t)=>{var oe,te,ue,ge,Ce,Se;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:k,...v}=e,b=MA(qw,n),[w,S]=m.useState(null),N=nr(t,ke=>S(ke)),[C,R]=m.useState(null),T=QU(C),A=(T==null?void 0:T.width)??0,I=(T==null?void 0:T.height)??0,_=r+(i!=="center"?"-"+i:""),z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},O=Array.isArray(f)?f:[f],B=O.length>0,V={padding:z,boundary:O.filter(n9),altBoundary:B},{refs:$,floatingStyles:L,placement:U,isPositioned:K,middlewareData:D}=zU({strategy:"fixed",placement:_,whileElementsMounted:(...ke)=>AU(...ke,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[UU({mainAxis:o+I,alignmentAxis:a}),u&&HU({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?VU():void 0,...V}),u&&WU({...V}),KU({...V,apply:({elements:ke,rects:Be,availableWidth:ie,availableHeight:ve})=>{const{width:ye,height:Ae}=Be.reference,Ue=ke.floating.style;Ue.setProperty("--radix-popper-available-width",`${ie}px`),Ue.setProperty("--radix-popper-available-height",`${ve}px`),Ue.setProperty("--radix-popper-anchor-width",`${ye}px`),Ue.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),C&&GU({element:C,padding:l}),r9({arrowWidth:A,arrowHeight:I}),g&&qU({strategy:"referenceHidden",...V})]}),[W,M]=HA(U),F=wa(k);wi(()=>{K&&(F==null||F())},[K,F]);const Y=(oe=D.arrow)==null?void 0:oe.x,H=(te=D.arrow)==null?void 0:te.y,Q=((ue=D.arrow)==null?void 0:ue.centerOffset)!==0,[J,Z]=m.useState();return wi(()=>{w&&Z(window.getComputedStyle(w).zIndex)},[w]),s.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:K?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[(ge=D.transformOrigin)==null?void 0:ge.x,(Ce=D.transformOrigin)==null?void 0:Ce.y].join(" "),...((Se=D.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(ZU,{scope:n,placedSide:W,onArrowChange:R,arrowX:Y,arrowY:H,shouldHideArrow:Q,children:s.jsx(Sn.div,{"data-side":W,"data-align":M,...v,ref:N,style:{...v.style,animation:K?void 0:"none"}})})})});zA.displayName=qw;var BA="PopperArrow",t9={top:"bottom",right:"left",bottom:"top",left:"right"},UA=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=e9(BA,r),a=t9[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx(XU,{...o,ref:n,style:{...o.style,display:"block"}})})});UA.displayName=BA;function n9(e){return e!==null}var r9=e=>({name:"transformOrigin",options:e,fn(t){var b,w,S;const{placement:n,rects:r,middlewareData:o}=t,a=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[f,p]=HA(n),h={start:"0%",center:"50%",end:"100%"}[p],g=(((w=o.arrow)==null?void 0:w.x)??0)+l/2,y=(((S=o.arrow)==null?void 0:S.y)??0)+u/2;let k="",v="";return f==="bottom"?(k=a?h:`${g}px`,v=`${-u}px`):f==="top"?(k=a?h:`${g}px`,v=`${r.floating.height+u}px`):f==="right"?(k=`${-u}px`,v=a?h:`${y}px`):f==="left"&&(k=`${r.floating.width+u}px`,v=a?h:`${y}px`),{data:{x:k,y:v}}}});function HA(e){const[t,n="center"]=e.split("-");return[t,n]}var s9=LA,o9=FA,i9=zA,a9=UA,l9=Symbol("radix.slottable");function c9(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=l9,t}var u9=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"}),d9="VisuallyHidden",VA=m.forwardRef((e,t)=>s.jsx(Sn.span,{...e,ref:t,style:{...u9,...e.style}}));VA.displayName=d9;var f9=VA,[Fm]=Aa("Tooltip",[IA]),zm=IA(),WA="TooltipProvider",p9=700,Xb="tooltip.open",[h9,Gw]=Fm(WA),KA=e=>{const{__scopeTooltip:t,delayDuration:n=p9,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,a=m.useRef(!0),l=m.useRef(!1),u=m.useRef(0);return m.useEffect(()=>{const f=u.current;return()=>window.clearTimeout(f)},[]),s.jsx(h9,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(f=>{l.current=f},[]),disableHoverableContent:o,children:i})};KA.displayName=WA;var gd="Tooltip",[m9,Yd]=Fm(gd),qA=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=e,u=Gw(gd,e.__scopeTooltip),f=zm(t),[p,h]=m.useState(null),g=Bl(),y=m.useRef(0),k=a??u.disableHoverableContent,v=l??u.delayDuration,b=m.useRef(!1),[w,S]=vm({prop:r,defaultProp:o??!1,onChange:A=>{A?(u.onOpen(),document.dispatchEvent(new CustomEvent(Xb))):u.onClose(),i==null||i(A)},caller:gd}),N=m.useMemo(()=>w?b.current?"delayed-open":"instant-open":"closed",[w]),C=m.useCallback(()=>{window.clearTimeout(y.current),y.current=0,b.current=!1,S(!0)},[S]),R=m.useCallback(()=>{window.clearTimeout(y.current),y.current=0,S(!1)},[S]),T=m.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{b.current=!0,S(!0),y.current=0},v)},[v,S]);return m.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),s.jsx(s9,{...f,children:s.jsx(m9,{scope:t,contentId:g,open:w,stateAttribute:N,trigger:p,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{u.isOpenDelayedRef.current?T():C()},[u.isOpenDelayedRef,T,C]),onTriggerLeave:m.useCallback(()=>{k?R():(window.clearTimeout(y.current),y.current=0)},[R,k]),onOpen:C,onClose:R,disableHoverableContent:k,children:n})})};qA.displayName=gd;var Qb="TooltipTrigger",GA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Yd(Qb,n),i=Gw(Qb,n),a=zm(n),l=m.useRef(null),u=nr(t,l,o.onTriggerChange),f=m.useRef(!1),p=m.useRef(!1),h=m.useCallback(()=>f.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx(o9,{asChild:!0,...a,children:s.jsx(Sn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:sn(e.onPointerMove,g=>{g.pointerType!=="touch"&&!p.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:sn(e.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:sn(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:sn(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:sn(e.onBlur,o.onClose),onClick:sn(e.onClick,o.onClose)})})});GA.displayName=Qb;var Yw="TooltipPortal",[g9,x9]=Fm(Yw,{forceMount:void 0}),YA=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Yd(Yw,t);return s.jsx(g9,{scope:t,forceMount:n,children:s.jsx(Pa,{present:n||i.open,children:s.jsx(hw,{asChild:!0,container:o,children:r})})})};YA.displayName=Yw;var oc="TooltipContent",XA=m.forwardRef((e,t)=>{const n=x9(oc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,a=Yd(oc,e.__scopeTooltip);return s.jsx(Pa,{present:r||a.open,children:a.disableHoverableContent?s.jsx(QA,{side:o,...i,ref:t}):s.jsx(y9,{side:o,...i,ref:t})})}),y9=m.forwardRef((e,t)=>{const n=Yd(oc,e.__scopeTooltip),r=Gw(oc,e.__scopeTooltip),o=m.useRef(null),i=nr(t,o),[a,l]=m.useState(null),{trigger:u,onClose:f}=n,p=o.current,{onPointerInTransitChange:h}=r,g=m.useCallback(()=>{l(null),h(!1)},[h]),y=m.useCallback((k,v)=>{const b=k.currentTarget,w={x:k.clientX,y:k.clientY},S=k9(w,b.getBoundingClientRect()),N=N9(w,S),C=S9(v.getBoundingClientRect()),R=E9([...N,...C]);l(R),h(!0)},[h]);return m.useEffect(()=>()=>g(),[g]),m.useEffect(()=>{if(u&&p){const k=b=>y(b,p),v=b=>y(b,u);return u.addEventListener("pointerleave",k),p.addEventListener("pointerleave",v),()=>{u.removeEventListener("pointerleave",k),p.removeEventListener("pointerleave",v)}}},[u,p,y,g]),m.useEffect(()=>{if(a){const k=v=>{const b=v.target,w={x:v.clientX,y:v.clientY},S=(u==null?void 0:u.contains(b))||(p==null?void 0:p.contains(b)),N=!C9(w,a);S?g():N&&(g(),f())};return document.addEventListener("pointermove",k),()=>document.removeEventListener("pointermove",k)}},[u,p,a,f,g]),s.jsx(QA,{...e,ref:i})}),[b9,v9]=Fm(gd,{isInside:!1}),w9=c9("TooltipContent"),QA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=e,u=Yd(oc,n),f=zm(n),{onClose:p}=u;return m.useEffect(()=>(document.addEventListener(Xb,p),()=>document.removeEventListener(Xb,p)),[p]),m.useEffect(()=>{if(u.trigger){const h=g=>{const y=g.target;y!=null&&y.contains(u.trigger)&&p()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,p]),s.jsx(pw,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:p,children:s.jsxs(i9,{"data-state":u.stateAttribute,...f,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(w9,{children:r}),s.jsx(b9,{scope:n,isInside:!0,children:s.jsx(f9,{id:u.contentId,role:"tooltip",children:o||r})})]})})});XA.displayName=oc;var JA="TooltipArrow",j9=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=zm(n);return v9(JA,n).isInside?null:s.jsx(a9,{...o,...r,ref:t})});j9.displayName=JA;function k9(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function N9(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function S9(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function C9(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const l=t[i],u=t[a],f=l.x,p=l.y,h=u.x,g=u.y;p>r!=g>r&&n<(h-f)*(r-p)/(g-p)+f&&(o=!o)}return o}function E9(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),T9(t)}function T9(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],a=t[t.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))n.pop();else break}n.push(o)}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 R9=KA,A9=qA,P9=GA,_9=YA,ZA=XA;const ga=R9,Lr=A9,Or=P9,br=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(_9,{children:s.jsx(ZA,{ref:r,sideOffset:t,className:be("z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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})}));br.displayName=ZA.displayName;function Xw({items:e,align:t="end"}){const[n,r]=m.useState(!1),[o,i]=m.useState(null),a=m.useRef(null);if(m.useEffect(()=>{if(!n){i(null);return}function u(p){a.current&&!a.current.contains(p.target)&&r(!1)}function f(p){p.key==="Escape"&&r(!1)}return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f)}},[n]),e.length===0)return null;function l(u,f){const p=u.icon,h=be("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",f&&"pl-8",u.disabled?"opacity-50 cursor-not-allowed":u.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),g=f?u.active?s.jsx(Nr,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):s.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):p?s.jsx(p,{className:"h-4 w-4 shrink-0"}):null,y=s.jsxs(s.Fragment,{children:[g,s.jsx("span",{className:"block min-w-0 truncate",children:u.label})]});if(u.disabled){const k=s.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:s.jsx("button",{type:"button",disabled:!0,className:h,children:y})});return u.disabledReason?s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:k}),s.jsx(br,{side:"left",children:u.disabledReason})]},u.key):s.jsx("div",{children:k},u.key)}return u.href?s.jsx(_e,{to:u.href,className:h,onClick:()=>r(!1),children:y},u.key):s.jsx("button",{type:"button",className:h,onClick:()=>{var k;(k=u.onSelect)==null||k.call(u),r(!1)},children:y},u.key)}return s.jsxs("div",{className:"relative",ref:a,children:[s.jsx("button",{type:"button",onClick:()=>r(u=>!u),className:"shell-action",title:"More actions","aria-label":"More actions","aria-haspopup":"true","aria-expanded":n,children:s.jsx(T5,{className:"h-4 w-4"})}),n&&s.jsx("div",{className:be("absolute top-full mt-1 z-30 min-w-[220px] rounded-md border border-border/70 bg-background shadow-lg py-1",t==="end"?"right-0":"left-0"),children:s.jsx(ga,{delayDuration:200,children:e.map(u=>{if(u.submenu&&u.submenu.length>0){const f=u.icon,p=o===u.key;return s.jsxs("div",{children:[s.jsxs("button",{type:"button",className:be("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition hover:bg-foreground/5"),"aria-expanded":p,onClick:()=>i(p?null:u.key),children:[f?s.jsx(f,{className:"h-4 w-4 shrink-0"}):null,s.jsx("span",{className:"block min-w-0 flex-1 truncate",children:u.label}),p?s.jsx(tr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):s.jsx(Gv,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),p?u.submenu.map(h=>l(h,!0)):null]},u.key)}return l(u,!1)})})})]})}function GN(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const D9={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function $9(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,0,0,0,0).getTime()}function I9(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,23,59,59,999).getTime()}function M9(e,t,n=Date.now()){if(!t)return!0;const r=t.field==="created"?e.created??e.updated:e.updated,o=Date.parse(r);if(Number.isNaN(o))return!1;if(t.preset){const l=D9[t.preset];return l===void 0?!0:t.preset.startsWith("older_")?n-o>l:o>=n-l&&o<=n}const i=t.from&&t.from.length>0?t.from:void 0,a=t.to&&t.to.length>0?t.to:void 0;return!i&&!a?!0:!(i&&o<$9(i)||a&&o>I9(a))}function L9(e,t,n={}){const{workspace:r,search:o,includeArchived:i}=n;if(e.archived===!0&&!i)return!1;const a=He(t.status),l=He(t.priority),u=He(t.type),f=He(t.assignee),p=He(t.project),h=He(t.tags),{activity:g}=t;if(r){if(r==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==r)return!1}if(a.length&&!a.includes(e.status)||l.length&&!l.includes(e.priority)||u.length&&!u.includes(e.type??"")||g==="stale"&&!GN(e.updated)||g==="fresh"&&GN(e.updated))return!1;if(f.length){const y=e.assignee??"__unassigned__";if(!f.includes(y))return!1}if(p.length&&!p.some(k=>k==="__standalone__"?e.projectSlug==null:e.projectSlug===k))return!1;if(h.length){const y=e.tags??[];if(!h.some(k=>y.includes(k)))return!1}if(!M9(e,t.dateRange))return!1;if(o){const y=o.trim().toLowerCase();if(y&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(y))return!1}return!0}function xd(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const YN={critical:0,high:1,medium:2,low:3};function bp(e){return Date.parse(e??"")||0}function Xd(e,t,n){return[...e].sort((o,i)=>{let a=0;switch(t){case"title":a=o.title.localeCompare(i.title);break;case"status":a=o.status.localeCompare(i.status);break;case"priority":a=(YN[o.priority]??99)-(YN[i.priority]??99);break;case"assignee":a=(o.assignee??"").localeCompare(i.assignee??"");break;case"dependencies":a=o.dependsOn.length-i.dependsOn.length;break;case"created":a=bp(o.created)-bp(i.created);break;case"updated":a=bp(o.updated)-bp(i.updated);break}return n==="asc"?a:-a})}function O9(e){const t=`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`;return{...e.facts??{},status:e.status,phase:e.phase,disposition:e.disposition,priority:e.priority,type:e.type,assignee:e.assignee,project:e.projectSlug,tags:e.tags,archived:e.archived,title:e.title,created:e.created,updated:e.updated,completedAt:e.completedAt,statusAge:e.statusAge,phaseAge:e.phaseAge,searchText:t}}function eP(e,t,n={}){const{workspace:r,includeArchived:o=!1,now:i=Date.now()}=n,a={now:i};return e.filter(l=>{if(l.archived===!0&&!o)return!1;if(r){if(r==="_ungrouped"){if(l.projectWorkspace!=null)return!1}else if(l.projectWorkspace!==r)return!1}if(!t)return!0;const u=O9(l);return t.predicate(u,a)})}const Bm={hasrealobjective:{kind:"bool",get:e=>e.hasRealObjective},acrealtotal:{kind:"number",get:e=>e.acRealTotal},acrealchecked:{kind:"number",get:e=>e.acRealChecked},acallchecked:{kind:"bool",get:e=>e.acAllChecked},planexists:{kind:"bool",get:e=>e.planExists},planapproved:{kind:"bool",get:e=>e.planApproved},workspaceset:{kind:"bool",get:e=>e.workspaceSet},implementationstarted:{kind:"bool",get:e=>e.implementationStarted},depssatisfied:{kind:"bool",get:e=>e.depsSatisfied},unresolvedquestions:{kind:"number",get:e=>e.unresolvedQuestions},blocked:{kind:"bool"},parked:{kind:"bool"},reviewrequested:{kind:"bool",get:e=>e.reviewRequested},reworkrequested:{kind:"bool",get:e=>e.reworkRequested},pinned:{kind:"bool"}};function Um(e){const t=e.name,n={fact:t,approved:`${t}Approved`,changesRequested:`${t}ChangesRequested`,by:`${t}By`,approvedBy:`${t}ApprovedBy`},r=e.type==="attestation"?[n.fact,n.approved,n.changesRequested,n.by,n.approvedBy].map(o=>o.toLowerCase()):[n.fact.toLowerCase()];return{storageKey:t,exports:n,registryKeys:r}}function F9(e){const t=[];for(const n of e??[]){if(!n||typeof n.name!="string")continue;const r=n.name.trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(r))continue;const o=(n.type??"").trim();if(o==="bool"||o==="number")t.push({name:r,type:o});else if(o==="attestation"){const i=(n.binds??"none").toString().trim()||"none";(i==="plan"||i==="commit"||i==="none")&&t.push({name:r,type:"attestation",binds:i})}}return t}function Jb(e){const t=[],n=new Map;for(const r of Object.keys(Bm))n.set(r,"built-in");for(const r of Object.keys(gm))n.set(r,"built-in");for(const r of e??[]){const o=((r==null?void 0:r.name)??"").trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(o)){t.push(`fact "${(r==null?void 0:r.name)??""}": invalid name — must match /^[a-z][a-zA-Z0-9]*$/`);continue}const i=(r.type??"").trim();if(i!=="bool"&&i!=="number"&&i!=="attestation"){t.push(`fact "${o}": invalid type "${r.type??""}" — expected bool, number, or attestation`);continue}if(i==="attestation"){const f=(r.binds??"none").toString().trim()||"none";if(f!=="plan"&&f!=="commit"&&f!=="none"){t.push(`fact "${o}": invalid binds "${r.binds}" — expected plan, commit, or none`);continue}}const l=Um(i==="attestation"?{name:o,type:i}:{name:o,type:i}).registryKeys,u=l.find(f=>n.has(f));if(u!==void 0){const f=n.get(u);f==="built-in"?t.push(`fact "${o}": exported field "${u}" collides with a built-in field`):f===o?t.push(`fact "${o}": duplicate declaration (a fact named "${o}" is already declared)`):t.push(`fact "${o}": exported field "${u}" collides with fact "${f}"`);continue}for(const f of l)n.set(f,o)}return t}function z9(e){const t=new Set([...Object.keys(Bm),...Object.keys(gm)]),n=[];for(const r of e){const o=Um(r).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(r)}}return n}function tP(e,t){const n=Um(t);t.type==="attestation"?(e[n.exports.fact.toLowerCase()]={kind:"bool",get:r=>r[n.exports.fact]},e[n.exports.approved.toLowerCase()]={kind:"bool",get:r=>r[n.exports.approved]},e[n.exports.changesRequested.toLowerCase()]={kind:"bool",get:r=>r[n.exports.changesRequested]},e[n.exports.by.toLowerCase()]={kind:"list",get:r=>r[n.exports.by]},e[n.exports.approvedBy.toLowerCase()]={kind:"list",get:r=>r[n.exports.approvedBy]}):e[n.exports.fact.toLowerCase()]={kind:t.type,get:r=>r[n.exports.fact]}}function Qw(e){const t={...Bm};for(const n of e)tP(t,n);return t}function nP(e){const t={...gm};for(const n of e)tP(t,n);return t}function rP(e){const t=["status","priority","type","assignee","project","tag","tags","archived","title","search","created","updated","completedAt","statusAge","phase","disposition","phaseAge","hasRealObjective","acRealTotal","acRealChecked","acAllChecked","planExists","planApproved","workspaceSet","implementationStarted","depsSatisfied","unresolvedQuestions","progressStaleDays","blocked","parked","reviewRequested","reworkRequested","pinned"],n=[];for(const r of e){const o=Um(r);r.type==="attestation"?n.push(o.exports.fact,o.exports.approved,o.exports.changesRequested,o.exports.by,o.exports.approvedBy):n.push(o.exports.fact)}return[...t,...n]}function Nt({title:e,description:t,actions:n}){return s.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:s.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[s.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?s.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const ic='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Hm({columns:e,items:t,getItemId:n,getColumnId:r,renderCard:o,canDrop:i,onMove:a,getExternalDragData:l,onCardContextMenu:u,emptyMessage:f="No cards in this column.",hiddenColumnIds:p,onHideColumn:h,compact:g=!1,dragDisabled:y=!1,boundedColumns:k=!1}){const v=k&&!g,b=m.useMemo(()=>new Set(p??[]),[p]),w=m.useMemo(()=>e.filter(U=>!b.has(U.id)),[e,b]),S=m.useMemo(()=>e.filter(U=>b.has(U.id)),[e,b]),[N,C]=m.useState(null),[R,T]=m.useState(null),A=m.useRef(null),I=m.useMemo(()=>new Map(t.map(U=>[n(U),U])),[n,t]),_=m.useMemo(()=>w.map(U=>({column:U,items:t.filter(K=>r(K)===U.id)})),[w,r,t]),z=N?I.get(N)??null:null;function O(U){if(!z)return{allowed:!1};const K=r(z);return(i==null?void 0:i({item:z,fromColumnId:K,toColumnId:U}))??{allowed:!0}}function B(){C(null),T(null)}function V(U,K,D){if(y)return;const W=(l==null?void 0:l(K))??null;!a&&!W||(U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("text/plain",D),W&&U.dataTransfer.setData("application/json",JSON.stringify(W)),a&&C(D))}function $(U,K,D){y||!a||!z||!O(K).allowed||(U.preventDefault(),U.dataTransfer.dropEffect="move",T(M=>(M==null?void 0:M.columnId)===K&&M.index===D?M:{columnId:K,index:D}))}async function L(U,K,D){var H;if(U.preventDefault(),y||!a||!z){B();return}const W=r(z),F=(((H=_.find(Q=>Q.column.id===W))==null?void 0:H.items)??[]).findIndex(Q=>n(Q)===n(z));if(!O(K).allowed||F<0){B();return}if(W===K&&(D===F||D===F+1)){B();return}try{await a({item:z,fromColumnId:W,toColumnId:K,fromIndex:F,toIndex:D})}finally{B()}}return s.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[S.length>0&&h?s.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{children:"Hidden:"}),S.map(U=>s.jsxs("button",{type:"button",onClick:()=>h(U.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${U.title}" column`,children:[U.title," ×"]},U.id))]}):null,s.jsx("div",{className:be("grid min-w-max grid-flow-col items-start gap-4",g?"auto-cols-[minmax(240px,280px)]":"auto-cols-[minmax(300px,360px)]"),children:_.map(({column:U,items:K})=>{const D=O(U.id),W=(R==null?void 0:R.columnId)===U.id;return s.jsxs("section",{className:be("flex flex-col rounded-lg border border-border/60 bg-card/85 shadow-sm",g?"min-h-[200px] p-2":"min-h-[320px] p-3",v?"max-h-[70vh]":"",z&&!D.allowed?"border-dashed opacity-65":"",z&&D.allowed?"border-primary/30 bg-accent/30":"",W?"ring-2 ring-ring/30":""),title:z&&!D.allowed?D.reason:void 0,children:[s.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h2",{className:be("font-semibold uppercase tracking-[0.16em] text-muted-foreground",g?"text-xs":"text-sm"),children:U.title}),U.description&&!g?s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:U.description}):null]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs font-semibold text-foreground",children:K.length}),h?s.jsx("button",{type:"button",onClick:()=>h(U.id),className:"rounded-full border border-transparent px-1.5 py-0.5 text-xs text-muted-foreground hover:border-border hover:text-foreground",title:`Hide "${U.title}" column`,"aria-label":`Hide column ${U.title}`,children:"×"}):null]})]}),s.jsxs("div",{className:be("flex flex-1 flex-col gap-3",v?"min-h-0 overflow-y-auto pr-1":""),onDragOver:M=>$(M,U.id,K.length),onDrop:M=>L(M,U.id,K.length),children:[K.length===0?y?s.jsx("div",{className:"flex min-h-[128px] items-center justify-center rounded-lg border border-border/60 bg-background/50 px-4 text-center text-sm text-muted-foreground",children:typeof f=="function"?f(U):f}):s.jsx(B9,{active:(R==null?void 0:R.columnId)===U.id&&R.index===0,disabled:!!z&&!D.allowed,children:typeof f=="function"?f(U):f}):null,K.map((M,F)=>{const Y=n(M),H=N===Y;return s.jsxs(m.Fragment,{children:[s.jsx("div",{className:be("h-2 rounded-full transition",(R==null?void 0:R.columnId)===U.id&&R.index===F?"bg-primary/70":"bg-transparent"),onDragOver:Q=>$(Q,U.id,F),onDrop:Q=>L(Q,U.id,F)}),s.jsx("div",{draggable:!y&&!!(a||l),onMouseDown:Q=>{A.current=Q.target},onDragStart:Q=>{const J=A.current;if(J!=null&&J.closest(ic)){Q.preventDefault();return}V(Q,M,Y)},onDragEnd:B,onContextMenu:Q=>{if(!u)return;const J=Q.target;J!=null&&J.closest(ic)||u(M,Q)},className:be("transition",!y&&(a||l)?"cursor-grab active:cursor-grabbing":"",H?"scale-[0.98] opacity-50":""),children:o(M,{dragging:H})})]},Y)}),K.length>0&&!y?s.jsx("div",{className:be("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(R==null?void 0:R.columnId)===U.id&&R.index===K.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",z&&!D.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},U.id)})})]})}function B9({active:e,disabled:t,children:n}){return s.jsx("div",{className:be("flex min-h-[128px] items-center justify-center rounded-lg border border-dashed px-4 text-center text-sm text-muted-foreground transition",e?"border-primary/60 bg-primary/10 text-foreground":"border-border/60 bg-background/50",t?"opacity-45":""),children:n})}const Ro="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Gl="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",sP="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",Zb="border-status-review-foreground/30 bg-status-review text-status-review-foreground",oP="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",iP="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",aP="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",Jp=Ro,U9={draft:Ro,pending:Ro,ready_for_planning:Ro,ready_to_implement:Gl,in_progress:Gl,blocked:sP,review:Zb,code_review:Zb,completed:oP,failed:iP,active:Gl,stopped:Ro,archived:aP};function H9(e){return U9[e]??Jp}const V9={slate:Jp,gray:Jp,grey:Jp};function lP(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function W9(e){let t=e.trim().replace(/^#/,"");return t.length===3&&(t=t.split("").map(n=>n+n).join("")),t.length!==6||/[^0-9a-fA-F]/.test(t)?null:{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function K9(e,t){const n=t==null?void 0:t.trim();if(n)if(n.startsWith("#")){const r=W9(n);if(r){const{r:o,g:i,b:a}=r;return{className:"",style:{backgroundColor:`rgba(${o}, ${i}, ${a}, 0.15)`,borderColor:`rgba(${o}, ${i}, ${a}, 0.4)`,color:n}}}}else{const r=V9[n.toLowerCase()];if(r)return{className:r}}return{className:H9(e)}}function yd(e,t){const n=e.find(i=>i.id===t),{className:r,style:o}=K9(t,n==null?void 0:n.color);return{label:(n==null?void 0:n.label)??lP(t),className:r,style:o,iconName:n==null?void 0:n.icon}}function _h(e){return e?!!e.terminal||e.id==="completed"||e.id==="failed":!1}function cP(e){const t=new Map(e.statuses.map(a=>[a.id,a])),n=e.order.length>0?e.order:e.statuses.map(a=>a.id),r=new Set,o=[],i=(a,l)=>{r.has(a)||(r.add(a),o.push({id:a,label:(l==null?void 0:l.label)??lP(a),terminal:_h(l??{id:a})}))};for(const a of n)i(a,t.get(a));for(const a of e.statuses)i(a.id,a);return o}function q9(e,t,n){return cP(e).map(r=>r.id===t?{id:r.id,label:r.label,disabled:!0,disabledReason:"Already in this status"}:r.terminal&&!(n??[]).find(i=>i.targetStatus===r.id&&!i.disabled)?{id:r.id,label:r.label,disabled:!0,disabledReason:`Reach ${r.label} via its transition when available`}:{id:r.id,label:r.label})}const uP={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:Ro,icon:jc},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:Ro,icon:j5},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:Ro,icon:R2},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Gl,icon:G5},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Gl,icon:Jv},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:sP,icon:ph},review:{label:"Review",description:"Ready for inspection or approval.",className:Zb,icon:J5},completed:{label:"Completed",description:"Finished successfully.",className:oP,icon:cm},failed:{label:"Failed",description:"Could not be completed as planned.",className:iP,icon:ph},active:{label:"Active",description:"The project has active or review work in flight.",className:Gl,icon:Cb},stopped:{label:"Stopped",description:"Session ended without completing.",className:Ro,icon:v5},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:aP,icon:Cb}},dP="inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-0.5 text-xs font-medium tracking-normal shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0)] dark:shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0.04)]";function ev(e){var t;return((t=uP[e])==null?void 0:t.icon)??Cb}function fP({progress:e,Icon:t}){const n=e&&e.total>0,r=n?Math.min(1,Math.max(0,e.checked/e.total)):0;return n?s.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:[s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[s.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),s.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:2*Math.PI*7,strokeDashoffset:2*Math.PI*7*(1-r)})]}),s.jsx(t,{className:"h-2.5 w-2.5"})]}):s.jsx(t,{className:"h-3.5 w-3.5 shrink-0"})}function ro({status:e,className:t,showIcon:n=!0,progress:r}){var g;const o=rs(),i=yd(o.statuses,e),a=ev(e),l=i.label,u=((g=o.statuses.find(y=>y.id===e))==null?void 0:g.description)??Qd(e),p=r&&r.total>0?`${l} — ${u} (${r.checked}/${r.total} criteria)`:`${l} — ${u}`,h=n?s.jsx(fP,{progress:r,Icon:a}):null;return s.jsxs("span",{title:p,className:be(dP,i.className,t),style:i.style,children:[h,s.jsx("span",{className:"min-w-0 truncate",children:l})]})}function Qd(e){var t;return((t=uP[e])==null?void 0:t.description)??`Status: ${e}`}function G9({currentStatus:e,availableTransitions:t,onSelect:n,overrideTargets:r,onOverride:o,progress:i,disabled:a=!1,className:l}){const[u,f]=m.useState(!1),[p,h]=m.useState(null),[g,y]=m.useState(0),k=m.useRef(null),v=m.useRef(null),b=m.useId(),w=rs(),S=yd(w.statuses,e),N=ev(e),C=r??[],R=t.length+C.length,T=m.useCallback(B=>{f(!1),B&&requestAnimationFrame(()=>{var V;(V=k.current)==null||V.focus()})},[]),A=m.useCallback(()=>{var V;const B=(V=k.current)==null?void 0:V.getBoundingClientRect();B&&h({top:B.top,left:B.left,width:B.width,bottom:B.bottom})},[]);m.useLayoutEffect(()=>{u&&A()},[u,A]),m.useEffect(()=>{if(!u)return;const B=()=>A();return window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),()=>{window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B)}},[u,A]),m.useEffect(()=>{if(!u)return;const B=V=>{var L,U;const $=V.target;$&&((L=v.current)!=null&&L.contains($)||(U=k.current)!=null&&U.contains($)||T(!1))};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[u,T]),m.useEffect(()=>{u&&y(0)},[u,R]);function I(B){return!B.disabled&&B.id!==e}function _(B){if(B<t.length){const $=t[B];$&&(n($),T(!0));return}const V=C[B-t.length];V&&I(V)&&(o==null||o(V.id),T(!0))}function z(B){(B.key==="Enter"||B.key===" "||B.key==="ArrowDown")&&(B.preventDefault(),f(!0))}function O(B){if(R===0){B.key==="Escape"&&(B.preventDefault(),T(!0));return}B.key==="ArrowDown"?(B.preventDefault(),y(V=>(V+1)%R)):B.key==="ArrowUp"?(B.preventDefault(),y(V=>(V-1+R)%R)):B.key==="Home"?(B.preventDefault(),y(0)):B.key==="End"?(B.preventDefault(),y(R-1)):B.key==="Enter"?(B.preventDefault(),_(g)):B.key==="Escape"&&(B.preventDefault(),T(!0))}return s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:k,type:"button","data-no-drag":!0,disabled:a,"aria-haspopup":"menu","aria-expanded":u,"aria-controls":u?b:void 0,onClick:()=>{a||f(B=>!B)},onKeyDown:z,title:`Status: ${S.label}. Click to change.`,style:S.style,className:be(dP,S.className,l,"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",a&&"cursor-not-allowed opacity-60"),children:[s.jsx(fP,{progress:i,Icon:N}),s.jsx("span",{className:"min-w-0 truncate",children:S.label})]}),u&&p&&typeof document<"u"?Xs.createPortal(s.jsx("div",{ref:v,id:b,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:O,style:{position:"fixed",top:p.bottom+6,left:p.left,minWidth:Math.max(p.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:R===0?s.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No status changes available from this status."}):s.jsxs(s.Fragment,{children:[t.map((B,V)=>{const $=ev(B.targetStatus),L=V===g;return s.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>y(V),onClick:()=>_(V),title:B.warning||B.description,className:be("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",L?"bg-foreground/5":"hover:bg-foreground/5"),children:[s.jsxs("span",{className:"flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx($,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate",children:B.label})]}),s.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:es(w,B.targetStatus)})]}),B.warning?s.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:B.warning}):null]},`${B.command}:${B.targetStatus}`)}),C.length>0&&t.length>0?s.jsx("div",{className:"my-1 border-t border-border/60",role:"separator"}):null,C.map((B,V)=>{const $=t.length+V,L=$===g,U=!I(B),K=yd(w.statuses,B.id);return s.jsx("button",{type:"button",role:"menuitem","data-no-drag":!0,disabled:U,onMouseEnter:()=>y($),onClick:()=>_($),title:U?B.disabledReason??(B.id===e?"Already in this status":void 0):`Set status to ${B.label}`,className:be("flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left text-sm transition",U?"cursor-not-allowed text-muted-foreground/60":L?"bg-foreground/5":"hover:bg-foreground/5"),children:s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{"aria-hidden":"true",className:be("h-2.5 w-2.5 flex-shrink-0 rounded-full border border-border/40",K.style?void 0:K.className),style:K.style?{backgroundColor:K.style.color}:void 0}),s.jsxs("span",{className:"truncate",children:["Override → ",B.label]})]})},`override-${B.id}`)})]})}),document.body):null]})}function Jw({open:e,action:t,assignmentTitle:n,loading:r=!1,onConfirm:o,onOpenChange:i}){const[a,l]=m.useState("");m.useEffect(()=>{e||l("")},[e,t==null?void 0:t.command]);const u=m.useMemo(()=>t&&t.command==="block"?"Blocked Reason":"Reason",[t]);if(!t)return null;const f=`${t.label} "${n}"`,p=r?"Applying...":t.label,h=a.trim()||void 0;return s.jsx(On,{open:e,onOpenChange:g=>r?void 0:i(g),children:s.jsx(Cn,{className:"max-w-xl",children:s.jsxs("form",{className:"space-y-5",onSubmit:g=>{g.preventDefault(),o(h)},children:[s.jsxs(sr,{children:[s.jsx(En,{children:f}),s.jsx(ns,{children:t.description})]}),t.warning?s.jsx("div",{className:"rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:t.warning}):null,s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:u}),s.jsx("textarea",{value:a,onChange:g=>l(g.target.value),autoFocus:!0,rows:4,disabled:r,placeholder:"Optional context for why this assignment is blocked.",className:"editor-textarea min-h-[120px] bg-background/95 font-sans"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave this blank to continue without a written reason."})]}),s.jsxs(Hr,{children:[s.jsx("button",{type:"button",onClick:()=>i(!1),disabled:r,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:r,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:p})]})]})})})}function na(e,t,n,r,o,i){let a=`syntaur://open?${e.kind}=${encodeURIComponent(e.id)}`;return e.kind==="session"&&t&&(a+=`&mode=${encodeURIComponent(t)}`),n&&(a+=`&terminal=${encodeURIComponent(n)}`),r&&e.kind==="assignment"&&(a+=`&agent=${encodeURIComponent(r)}`),o!==void 0&&(e.kind==="assignment"||e.kind==="standalone")&&(a+=`&prompt=${encodeURIComponent(o)}`),i&&e.kind==="assignment"&&(a+=`&agentName=${encodeURIComponent(i)}`),a}function Y9(e){return e.kind==="session"?{method:"POST",url:`/api/agent-sessions/${encodeURIComponent(e.id)}/worktree/recreate`}:e.projectSlug&&e.assignmentSlug?{method:"POST",url:`/api/projects/${encodeURIComponent(e.projectSlug)}/assignments/${encodeURIComponent(e.assignmentSlug)}/worktree/recreate`}:{method:"POST",url:`/api/assignments/${encodeURIComponent(e.id)}/worktree/recreate`}}function X9(e){if(!e.trim())return"Branch name is required.";if(/\s/.test(e))return"Branch name cannot contain whitespace.";if(/[\x00-\x1F\x7F~^:?*[\\]/.test(e))return"Branch name cannot contain any of: ~ ^ : ? * [ \\ or control characters.";if(e.startsWith("-"))return'Branch name cannot start with "-".';if(e.startsWith("/")||e.endsWith("/"))return'Branch name cannot start or end with "/".';if(e.endsWith("."))return'Branch name cannot end with ".".';if(e.includes(".."))return'Branch name cannot contain "..".';if(e.includes("@{"))return'Branch name cannot contain "@{".';if(e==="@")return'Branch name cannot be "@".';for(const t of e.split("/")){if(!t)return'Branch name cannot contain empty path segments (e.g. "a//b").';if(t.startsWith("."))return'Branch name segments cannot start with ".".';if(t.endsWith(".lock"))return'Branch name segments cannot end with ".lock".'}return null}async function Zw(e,t,n,r){const o=await fetch(`/api/projects/${e}/assignments/${t}/transitions/${n.command}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r?{reason:r}:{})}),i=await o.json().catch(()=>null);if(!o.ok)throw new Error((i==null?void 0:i.error)||`HTTP ${o.status}`);return i.assignment}async function e0(e,t,n){const r=await fetch(`/api/projects/${e}/assignments/${t}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:n})}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error((o==null?void 0:o.error)||`HTTP ${r.status}`);return o.assignment}async function Q9(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}`,{method:"DELETE"}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error((r==null?void 0:r.error)||`HTTP ${n.status}`)}function t0(e){return e.requiresReason||e.command==="block"}async function pP(e,t,n){const r=await fetch(`/api/assignments/${e}/transitions/${t.command}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n?{reason:n}:{})}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error((o==null?void 0:o.error)||`HTTP ${r.status}`);return o.assignment}async function hP(e,t){const n=await fetch(`/api/assignments/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t})}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error((r==null?void 0:r.error)||`HTTP ${n.status}`);return r.assignment}async function J9(e){const t=await fetch(`/api/projects/${e.projectSlug}/assignments/${e.assignmentSlug}/title`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title})}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.assignment}async function Z9(e){const t=await fetch(`/api/assignments/${e.id}/title`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title})}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.assignment}class n0 extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function r0(e){const t=await e.json().catch(()=>null);return new n0((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function eH(e){const t=await fetch(`/api/projects/${e}/repository-candidates`),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.candidates}async function tH(e){const t=await fetch(`/api/assignments/${e}/repository-candidates`),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.candidates}async function nH(e,t,n){const r=await fetch(`/api/projects/${e}/assignments/${t}/worktree`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw await r0(r);return(await r.json()).assignment}async function rH(e,t){const n=await fetch(`/api/assignments/${e}/worktree`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await r0(n);return(await n.json()).assignment}async function sH(e){const{url:t}=Y9(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await r0(n);return await n.json()}async function Vm(e){const t=await e.json().catch(()=>null);if(!e.ok)throw new Error((t==null?void 0:t.error)||`HTTP ${e.status}`);return t}async function oH(e,t,n){const r=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return Vm(r)}async function iH(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return Vm(n)}async function aH(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await Vm(n)).sourceAssignments}async function lH(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await Vm(t)).sourceAssignments}function Cs({id:e,slug:t,projectSlug:n,status:r,title:o,availableTransitions:i,progress:a,onChange:l,disabled:u,className:f,onSelectAction:p,onSelectOverride:h}){const g=rs(),{toast:y,showToast:k,dismissToast:v}=Tn(),[b,w]=m.useState(r);m.useEffect(()=>{w(r)},[r]);const[S,N]=m.useState(i??[]);m.useEffect(()=>{N(i??[])},[i]);const[C,R]=m.useState(!1),[T,A]=m.useState(null),I=!!(p&&h),_=q9(g,b,S);function z(){return n==null&&!e?(k("Cannot update status: assignment id is missing.","error"),!1):n!=null&&!t?(k("Cannot update status: assignment slug is missing.","error"),!1):!0}async function O(D,W){const M={status:b,transitions:S};w(D),R(!0);try{const F=await W();return w(F.status),N(F.availableTransitions),l==null||l(F),k(`Moved to ${es(g,F.status)}`,"success"),!0}catch(F){return w(M.status),N(M.transitions),k(F.message,"error"),!1}finally{R(!1)}}function B(D,W){return O(D.targetStatus,()=>n==null?pP(e,D,W):Zw(n,t,D,W))}function V(D){return O(D,()=>n==null?hP(e,D):e0(n,t,D))}function $(D){if(D.disabled){k(D.disabledReason||`Cannot move to ${es(g,D.targetStatus)}.`,"error");return}if(z()){if(t0(D)){A(D);return}B(D)}}function L(D){const W=S.find(F=>F.targetStatus===D&&!F.disabled);if(W){$(W);return}const M=g.statuses.find(F=>F.id===D);if(_h(M??{id:D})){k(`Reach “${es(g,D)}” through its complete/fail transition.`,"error");return}z()&&V(D)}const U=p&&h?p:$,K=p&&h?h:L;return s.jsxs(s.Fragment,{children:[s.jsx(G9,{currentStatus:b,availableTransitions:S,onSelect:U,overrideTargets:_,onOverride:K,progress:a,disabled:u||C,className:f}),I?null:s.jsxs(s.Fragment,{children:[s.jsx(Jw,{open:T!==null,action:T,assignmentTitle:o??t??b,loading:C,onConfirm:async D=>{if(!T)return;await B(T,D)&&A(null)},onOpenChange:D=>{D||A(null)}}),s.jsx(Nn,{toast:y,onDismiss:v})]})]})}function _a({type:e,className:t,compact:n=!1}){const r=Bd();if(!e)return null;const o=Oz(r,e),i=(o==null?void 0:o.label)??e.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase()),a=o!=null&&o.color?{backgroundColor:`color-mix(in oklch, ${o.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${o.color} 50%, transparent)`,color:o.color}:void 0;return s.jsx("span",{title:(o==null?void 0:o.description)??`Type: ${i}`,style:a,className:be("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!a&&"border-border/60 text-muted-foreground",t),children:i})}async function Jd(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return cH(e)}function cH(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),t.setSelectionRange(0,t.value.length);const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}function jr({value:e,label:t,disabled:n=!1,disabledReason:r,onError:o}){const[i,a]=m.useState(!1);async function l(){n||(await Jd(e)?(a(!0),setTimeout(()=>a(!1),1500)):o==null||o(new Error("Copy to clipboard failed in this context.")))}return n?s.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:r??"Copy unavailable","aria-label":t??"Copy",children:s.jsx(hh,{className:"h-3 w-3","aria-hidden":"true"})}):s.jsx("button",{type:"button",onClick:l,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded",title:i?"Copied!":t??`Copy: ${e}`,"aria-label":t??"Copy",children:i?s.jsx(Nr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):s.jsx(hh,{className:"h-3 w-3","aria-hidden":"true"})})}function uH(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function dH({items:e,statusOrder:t,sortField:n,sortDirection:r,listSectionVisibility:o,compact:i=!1}){const a=rs(),[l,u]=m.useState(()=>new Set(o.collapsed));m.useEffect(()=>{u(new Set(o.collapsed))},[o]);const f=p=>{u(h=>{const g=new Set(h);return g.has(p)?g.delete(p):g.add(p),g})};return s.jsx("div",{className:be("space-y-2",i?"space-y-1.5":"space-y-3"),children:t.map(p=>{const h=Xd(e.filter(k=>k.status===p),n,r);if(h.length===0)return null;const g=!l.has(p),y=es(a,p);return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[s.jsxs("button",{type:"button",onClick:()=>f(p),className:be("flex w-full items-center gap-2 text-left",i?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[s.jsx(tr,{className:be("text-muted-foreground transition-transform",i?"h-3.5 w-3.5":"h-4 w-4",g?"":"-rotate-90")}),s.jsx("span",{className:"font-semibold text-foreground",children:y}),s.jsx("span",{className:be("rounded-full border border-border/60 text-muted-foreground",i?"px-1.5 py-0 text-[10px]":"px-2 py-0.5 text-xs"),children:h.length})]}),g&&s.jsx("ul",{className:be("divide-y divide-border/40 border-t border-border/40",i?"text-xs":"text-sm"),children:h.map(k=>{const v=uH(k);return s.jsx("li",{children:s.jsxs(_e,{to:v,className:be("flex items-center gap-3 hover:bg-muted/40",i?"px-3 py-1.5":"px-4 py-2.5"),children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:k.title}),k.projectTitle?s.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:k.projectTitle}):null,s.jsx("span",{className:"shrink-0 text-muted-foreground",children:Xn(k.updated)})]})},`${k.projectSlug??"standalone"}:${k.id}`)})})]},p)})})}function fH(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function pH({items:e,sortField:t,sortDirection:n,tableColumnVisibility:r,compact:o=!1,onAssignmentChange:i}){const a=new Set(r.hidden);a.delete("title");const l=h=>!a.has(h),u=Xd(e,t,n),f=o?"py-2 pr-3":"py-3 pr-4",p=o?"text-xs":"text-sm";return s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:be("w-full text-left",p),children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[l("title")?s.jsx("th",{className:be("font-medium",f),children:"Assignment"}):null,l("status")?s.jsx("th",{className:be("font-medium",f),children:"Status"}):null,l("priority")?s.jsx("th",{className:be("font-medium",f),children:"Priority"}):null,l("assignee")?s.jsx("th",{className:be("font-medium",f),children:"Assignee"}):null,l("dependencies")?s.jsx("th",{className:be("font-medium",f),children:"Dependencies"}):null,l("created")?s.jsx("th",{className:be("font-medium",f),children:"Created"}):null,l("updated")?s.jsx("th",{className:be("font-medium",f),children:"Updated"}):null]})}),s.jsx("tbody",{children:u.map(h=>{const g=fH(h),y=`${h.projectSlug??"standalone"}:${h.id}`;return s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[l("title")?s.jsxs("td",{className:f,children:[s.jsx(_e,{to:g,className:"font-semibold text-foreground hover:text-primary",children:h.title}),h.projectTitle?s.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:h.projectTitle}):null]}):null,l("status")?s.jsx("td",{className:f,children:s.jsx(Cs,{id:h.id,slug:h.slug,projectSlug:h.projectSlug,status:h.status,title:h.title,availableTransitions:h.availableTransitions,className:"max-w-[150px]",onChange:i})}):null,l("priority")?s.jsx("td",{className:be("capitalize text-muted-foreground",f),children:h.priority}):null,l("assignee")?s.jsx("td",{className:be("text-muted-foreground",f),children:h.assignee??"Unassigned"}):null,l("dependencies")?s.jsx("td",{className:be("text-muted-foreground",f),children:h.dependsOn.length}):null,l("created")?s.jsx("td",{className:be("text-muted-foreground",f),children:Xn(h.created)}):null,l("updated")?s.jsx("td",{className:be("text-muted-foreground",f),children:Xn(h.updated)}):null]},y)})})]})})}function mP({view:e,compact:t,emptyDescription:n}){const{data:r,loading:o,error:i,refetch:a}=fm(),l=rs(),u=m.useMemo(()=>l.order.map(h=>({id:h,title:es(l,h),description:Qd(h)})),[l]),f=m.useMemo(()=>nP(l.factDeclarations),[l.factDeclarations]),p=m.useMemo(()=>{if(!r)return[];const h=e.config.filters.query??Wu(e.config.filters);let g=null;h.trim()!==""&&(g=nc(h,f).query);const y=eP(r.assignments,g,{workspace:e.workspace});return Xd(y,e.config.sortField,e.config.sortDirection)},[r,e,f]);if(o&&!r)return s.jsx(bt,{label:"Loading assignments…"});if(i)return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});if(p.length===0)return s.jsx(Nt,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return s.jsx(Hm,{compact:t,dragDisabled:!0,columns:u,items:p,getItemId:h=>h.slug||h.id,getColumnId:h=>h.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:h=>t?s.jsx(hH,{item:h,onAssignmentChange:a}):s.jsx(mH,{item:h,onAssignmentChange:a})});case"list":return s.jsx(dH,{items:p,statusOrder:l.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return s.jsx(pH,{items:p,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t,onAssignmentChange:a})}}function hH({item:e,onAssignmentChange:t}){const n=xd(e);return s.jsxs("div",{className:be("rounded-md border border-border/60 bg-background/85 p-2 shadow-sm"),children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(_e,{to:n,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),s.jsx(Cs,{id:e.id,slug:e.slug,projectSlug:e.projectSlug,status:e.status,title:e.title,availableTransitions:e.availableTransitions,className:"max-w-[150px]",onChange:t})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[s.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),s.jsx("span",{className:"shrink-0",children:Xn(e.updated)})]}),e.id?s.jsxs("p",{className:"mt-1 inline-flex items-center gap-1 font-mono text-[10px] text-muted-foreground/70",children:[e.id.slice(0,8),s.jsx(jr,{value:e.id})]}):null]})}function mH({item:e,onAssignmentChange:t}){const n=xd(e);return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(_e,{to:n,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),s.jsx(Cs,{id:e.id,slug:e.slug,projectSlug:e.projectSlug,status:e.status,title:e.title,availableTransitions:e.availableTransitions,className:"max-w-[150px]",onChange:t})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[s.jsx(_a,{type:e.type,compact:!0}),s.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:e.priority})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),s.jsx("span",{className:"shrink-0",children:Xn(e.updated)})]})]})}function gH({viewId:e,onPickAnother:t}){const{view:n,loading:r,error:o,refetch:i}=ki(e);return r?s.jsx(bt,{label:"Loading view…"}):o?s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o.message}),s.jsx("button",{type:"button",onClick:()=>i(),className:"shell-action mt-3",children:"Retry"})]}):n?s.jsx(mP,{view:n,compact:!0,emptyDescription:"Adjust the view's filters to surface different work, or pick another widget for this slot."}):s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"View no longer exists"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"The saved view this slot was bound to has been deleted."}),s.jsx("button",{type:"button",onClick:t,className:"shell-action mt-3",children:"Pick another widget"})]})}function gP({sessions:e}){return s.jsxs("aside",{"aria-labelledby":"overview-sessions-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsx("header",{className:"border-b border-border/40 px-4 py-3",children:s.jsx("h3",{id:"overview-sessions-title",className:"text-sm font-semibold text-foreground",children:"Recent Sessions"})}),e.length===0?s.jsxs("div",{className:"px-4 py-6 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:ma.recentSessionsEmptyTitle}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:ma.recentSessionsEmptyHint})]}):s.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>s.jsx("li",{children:s.jsx(xH,{session:t})},t.sessionId))})]})}function xH({session:e}){const t=xn(),[n,r]=m.useState(!1),o=yH(e,t),i=bH(e),a=!e.path;return s.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(_e,{to:o,className:"block text-sm font-medium text-foreground hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:e.agent}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[i," · ",Fu(e.started)]}),n&&e.path?s.jsxs("div",{className:"mt-1 space-y-0.5",children:[s.jsx("code",{className:"block w-full select-all rounded bg-muted/40 px-1.5 py-0.5 text-xs text-foreground",children:e.path}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:ma.recentSessionsCopyFallbackHint})]}):null]}),s.jsx(jr,{value:e.path,label:ma.recentSessionsCopyPathLabel,disabled:a,disabledReason:ma.recentSessionsCopyPathDisabled,onError:()=>r(!0)})]})}function yH(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function bH(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const vH={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function ra(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function wH(e,t,n=Date.now()){const r=ra(e);if(t.preset){const a=vH[t.preset];return a?t.preset.startsWith("older_")?r<n-a:r>=n-a:!0}const o=t.from?Date.parse(`${t.from}T00:00:00.000Z`):null,i=t.to?Date.parse(`${t.to}T23:59:59.999Z`):null;return!(o!==null&&Number.isFinite(o)&&r<o||i!==null&&Number.isFinite(i)&&r>i)}function jH(e,t,n=Date.now()){const{dateRange:r,project:o,agent:i,sessionStatus:a}=t,l=new Set(o??[]),u=new Set(i??[]),f=new Set(a??[]);return e.filter(p=>{if(r&&!wH(p.started,r,n))return!1;if(l.size>0){const h=p.projectSlug??"__standalone__";if(!l.has(h))return!1}if(u.size>0&&!Array.from(u).some(g=>g.toLowerCase()===p.agent.toLowerCase()))return!1;if(f.size>0){let h=!1;for(const g of f){switch(g){case"active":p.status==="active"&&(h=!0);break;case"ended":(p.status==="completed"||p.status==="stopped")&&(h=!0);break;case"tracked":h=!0;break}if(h)break}if(!h)return!1}return!0})}function kH(e,t,n){return[...e].sort((o,i)=>{let a=0;switch(t){case"started":a=ra(o.started)-ra(i.started);break;case"lastActivity":a=ra(o.updatedAt)-ra(i.updatedAt);break;case"projectName":{const l=o.projectSlug??"",u=i.projectSlug??"";a=l.localeCompare(u);break}case"agentName":a=o.agent.localeCompare(i.agent);break;default:a=ra(o.started)-ra(i.started);break}return n==="asc"?a:-a})}function NH(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function SH({view:e,emptyDescription:t}){const{data:n,loading:r,error:o}=pm(),i=m.useMemo(()=>{if(!n)return[];const a=n.sessions??[],{config:l}=e,u=l.filters,f={dateRange:u.dateRange?{...u.dateRange,field:"started"}:void 0,project:He(u.project),agent:He(u.agent),sessionStatus:He(u.sessionStatus),limit:l.limit};let p=jH(a,f);return p=kH(p,l.sortField,l.sortDirection),p=NH(p,l.limit),p},[n,e]);return r&&!n?s.jsx(bt,{label:"Loading sessions…"}):o?s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o})]}):i.length===0?s.jsx(Nt,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):s.jsx(gP,{sessions:i})}function CH({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:r,loading:o}=qd(),[i,a]=m.useState(!1),l=m.useRef(null),u=m.useMemo(()=>r.filter(h=>h.entityType==="session"),[r]);m.useEffect(()=>{if(!i)return;function h(y){l.current&&!l.current.contains(y.target)&&a(!1)}function g(y){y.key==="Escape"&&a(!1)}return document.addEventListener("mousedown",h),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",g)}},[i]);const f=e?r.find(h=>h.id===e)??null:null,p=o?"Session views…":f?f.name:"Session views";return s.jsxs("div",{className:"relative",ref:l,children:[s.jsxs("button",{type:"button",disabled:o,onClick:()=>a(h=>!h),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":i,title:"Session views",children:[s.jsx("span",{className:"max-w-[160px] truncate",children:p}),s.jsx(tr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),i&&s.jsxs("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:[s.jsxs("button",{type:"button",onClick:()=>{a(!1),t(null)},className:be("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",!e&&"font-semibold text-foreground"),children:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e?null:s.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),s.jsx("span",{children:"All sessions"})]}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"my-1 border-t border-border/40"}),u.map(h=>{const g=h.id===e;return s.jsxs("button",{type:"button",onClick:()=>{a(!1),t(h.id)},className:be("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",g&&"font-semibold text-foreground"),children:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:g?s.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),s.jsx("span",{className:"truncate",children:h.name})]},h.id)})]}),s.jsx("div",{className:"my-1 border-t border-border/40"}),s.jsxs("button",{type:"button",onClick:()=>{a(!1),n()},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5 text-muted-foreground",children:[s.jsx(Tt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:"Create new view…"})]})]})]})}const EH={__unassigned__:"Unassigned",__standalone__:"No project"};function kn({options:e,value:t,onChange:n,allLabel:r="Any",className:o,disabled:i,ariaLabel:a}){const[l,u]=m.useState(!1),f=m.useRef(null),p=m.useRef(null),h=m.useRef([]),g=m.useMemo(()=>{const S=new Set(e.map(C=>C.value)),N=t.filter(C=>!S.has(C)).map(C=>({value:C,label:EH[C]??C}));return[...e,...N]},[e,t]),y=m.useMemo(()=>new Set(t),[t]);m.useEffect(()=>{if(!l)return;function S(N){f.current&&!f.current.contains(N.target)&&u(!1)}return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),m.useEffect(()=>{var S;l&&((S=h.current[0])==null||S.focus())},[l]);const k=m.useMemo(()=>{if(t.length===0)return r;if(t.length===1){const S=g.find(N=>N.value===t[0]);return S?S.label:t[0]}return`${t.length} selected`},[t,g,r]);function v(S){n(y.has(S)?t.filter(N=>N!==S):[...t,S])}function b(S){var C;const N=Math.max(0,Math.min(S,g.length-1));(C=h.current[N])==null||C.focus()}function w(S){var T;const N=h.current,C=document.activeElement,R=N.findIndex(A=>A===C);S.key==="ArrowDown"?(S.preventDefault(),b(R<0?0:R+1)):S.key==="ArrowUp"?(S.preventDefault(),b(R<0?g.length-1:R-1)):S.key==="Home"?(S.preventDefault(),b(0)):S.key==="End"?(S.preventDefault(),b(g.length-1)):S.key==="Escape"&&(S.preventDefault(),u(!1),(T=p.current)==null||T.focus())}return s.jsxs("div",{className:"relative",ref:f,children:[s.jsxs("button",{type:"button",ref:p,disabled:i,"aria-haspopup":"menu","aria-expanded":l,"aria-label":a,onClick:()=>u(S=>!S),onKeyDown:S=>{!l&&(S.key==="ArrowDown"||S.key==="ArrowUp")&&(S.preventDefault(),u(!0))},className:be("editor-input inline-flex items-center justify-between gap-1.5 text-left",t.length>0&&"border-foreground/40 text-foreground",o),children:[s.jsx("span",{className:"truncate",children:k}),s.jsx(tr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),l?s.jsxs("div",{role:"menu","aria-label":a,onKeyDown:w,className:"absolute left-0 top-full z-30 mt-1 max-h-72 min-w-[200px] overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pb-1",children:[s.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===g.length,onClick:()=>n(g.map(S=>S.value)),children:"Select all"}),s.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===0,onClick:()=>n([]),children:"Clear"})]}),g.length===0?s.jsx("p",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"No options"}):g.map((S,N)=>{const C=y.has(S.value);return s.jsxs("button",{ref:R=>{h.current[N]=R},type:"button",role:"menuitemcheckbox","aria-checked":C,tabIndex:-1,onClick:()=>v(S.value),className:be("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",C?"text-foreground":"text-muted-foreground"),children:[s.jsx("span",{className:be("flex h-4 w-4 shrink-0 items-center justify-center rounded border",C?"border-foreground bg-foreground text-background":"border-border/70"),"aria-hidden":"true",children:C?s.jsx(Nr,{className:"h-3 w-3"}):null}),s.jsx("span",{className:"truncate",children:S.label})]},S.value)})]}):null]})}const XN={last_24h:"Last 24 hours",last_7d:"Last 7 days",last_30d:"Last 30 days",last_90d:"Last 90 days",older_7d:"Older than 7 days",older_30d:"Older than 30 days"},TH=["updated","created"];function Wm({value:e,onChange:t,className:n,ariaLabel:r="Date range filter"}){const[o,i]=m.useState(!1),a=m.useRef(null),l=(e==null?void 0:e.field)??"updated",u=!!(e&&!e.preset&&(e.from||e.to)),[f,p]=m.useState(u);m.useEffect(()=>p(u),[u]),m.useEffect(()=>{if(!o)return;function w(N){a.current&&!a.current.contains(N.target)&&i(!1)}function S(N){N.key==="Escape"&&i(!1)}return document.addEventListener("mousedown",w),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",S)}},[o]);const h=!!(e&&(e.preset||e.from||e.to)),g=m.useMemo(()=>!h||!e?"Any date":e.preset?`${l}: ${XN[e.preset]??e.preset}`:`${l}: ${e.from||"…"} → ${e.to||"…"}`,[h,e,l]);function y(w){t(e?{...e,field:w}:{field:w,preset:"",from:"",to:""})}function k(w){p(!1),t({field:l,preset:w,from:"",to:""})}function v(){p(!1),t(null)}function b(w,S){const N={field:l,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...N,[w]:S})}return s.jsxs("div",{className:"relative",ref:a,children:[s.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":o,"aria-label":r,onClick:()=>i(w=>!w),className:be("editor-input inline-flex items-center justify-between gap-1.5 text-left",h&&"border-foreground/40 text-foreground",n),children:[s.jsx("span",{className:"truncate",children:g}),s.jsx(tr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),o?s.jsxs("div",{className:"absolute left-0 top-full z-30 mt-1 w-64 rounded-md border border-border/70 bg-background p-2 shadow-lg",children:[s.jsx("div",{className:"mb-2 inline-flex rounded-md border border-border/60 bg-background/80 p-0.5",children:TH.map(w=>s.jsx("button",{type:"button","aria-pressed":l===w,onClick:()=>y(w),className:be("rounded-sm px-2.5 py-1 text-xs font-medium capitalize transition",l===w?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:w},w))}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(Ay,{label:"Any date",selected:!h,onClick:v}),lz.map(w=>s.jsx(Ay,{label:XN[w],selected:(e==null?void 0:e.preset)===w,onClick:()=>k(w)},w)),s.jsx(Ay,{label:"Custom range…",selected:f,onClick:()=>{p(!0),t({field:l,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""})}})]}),f?s.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/60 pt-2",children:[s.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["From",s.jsx("input",{type:"date",value:(e==null?void 0:e.from)??"",max:(e==null?void 0:e.to)||void 0,onChange:w=>b("from",w.target.value),className:"editor-input w-40"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["To",s.jsx("input",{type:"date",value:(e==null?void 0:e.to)??"",min:(e==null?void 0:e.from)||void 0,onChange:w=>b("to",w.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function Ay({label:e,selected:t,onClick:n}){return s.jsxs("button",{type:"button",onClick:n,className:be("flex w-full items-center justify-between gap-2 rounded px-2 py-1.5 text-left text-sm transition hover:bg-foreground/5",t?"text-foreground":"text-muted-foreground"),children:[s.jsx("span",{children:e}),t?s.jsx(Nr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const RH=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function AH(e,t){const n={};for(const[r,o]of Object.entries(e))RH.has(r)||(n[r]=o);return{...n,...t}}function Dh(e,t,n){return{...e,viewMode:t.viewMode,filters:AH(e.filters,t.filters),sortField:t.sortField,sortDirection:t.sortDirection,limit:t.limit,listSectionVisibility:{collapsed:[...n.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...n.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...n.tableColumnVisibility.hidden]}}}function PH(e,t){var g,y;const n={},r=He(e.status);r.length&&(n.status=r);const o=He(e.type);o.length&&(n.type=o);const i=He(e.priority);i.length&&(n.priority=i);const a=He(e.assignee);a.length&&(n.assignee=a);const l=He(e.tags);if(l.length&&(n.tags=l),t&&t!=="all")n.project=[t];else{const k=He(e.project);k.length&&(n.project=k)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const u=He(e.sessionStatus);u.length&&(n.sessionStatus=u);const f=He(e.agent);f.length&&(n.agent=f),e.dateRange&&(n.dateRange=e.dateRange);const p=(g=e.search)==null?void 0:g.trim();p&&(n.search=p);const h=(y=e.query)==null?void 0:y.trim();return h&&(n.query=h),n}function ac(e){const t={viewMode:e.state.viewMode,filters:PH(e.state.filters,e.context.projectSlug),sortField:e.state.sortField,sortDirection:e.state.sortDirection,listSectionVisibility:{collapsed:[...e.state.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...e.state.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...e.state.tableColumnVisibility.hidden]}};return{name:e.name.trim(),workspace:e.context.workspace,config:t}}const bl={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},vp={sortField:"started",sortDirection:"desc"};function xP(e,t){const{config:n}=ac({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:e.viewMode,filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),r={...n};return e.limit!==void 0&&e.limit>0&&(r.limit=e.limit),{workspace:t,config:r}}function s0(e,t){const{config:n}=ac({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:"list",filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),r={...n};return e.limit!==void 0&&e.limit>0&&(r.limit=e.limit),{workspace:t,config:r}}function xa(e){if(!e)return;if(e.preset)return{field:e.field,preset:e.preset};const t=e.from&&e.from.length>0?e.from:void 0,n=e.to&&e.to.length>0?e.to:void 0;if(!t&&!n)return;const r={field:e.field};return t&&(r.from=t),n&&(r.to=n),r}function Km(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function yP(e,t){var r,o,i,a,l,u,f,p,h,g,y,k,v,b,w;const{config:n}=e;if((r=t.setViewMode)==null||r.call(t,n.viewMode),(o=t.setStatusFilter)==null||o.call(t,He(n.filters.status)),(i=t.setTypeFilter)==null||i.call(t,He(n.filters.type)),(a=t.setPriorityFilter)==null||a.call(t,He(n.filters.priority)),(l=t.setAssigneeFilter)==null||l.call(t,He(n.filters.assignee)),(u=t.setProjectFilter)==null||u.call(t,He(n.filters.project)),(f=t.setTagsFilter)==null||f.call(t,He(n.filters.tags)),(p=t.setDateRange)==null||p.call(t,Km(n.filters.dateRange)),(h=t.setSearch)==null||h.call(t,n.filters.search??""),(g=t.setQuery)==null||g.call(t,n.filters.query??Wu(n.filters)),t.setActivityFilter){const S=n.filters.activity??"all";t.setActivityFilter(S==="fresh"||S==="stale"?S:"all")}(y=t.setSortField)==null||y.call(t,n.sortField),(k=t.setSortDirection)==null||k.call(t,n.sortDirection),(v=t.setListSectionVisibility)==null||v.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(b=t.setKanbanColumnVisibility)==null||b.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(w=t.setTableColumnVisibility)==null||w.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function Zp(e){return e?`/w/${e}/views`:"/views"}function bP(e){return`${Zp(e.workspace)}/${encodeURIComponent(e.id)}`}function vP(e){const t=e.workspace?`/w/${e.workspace}`:"",n=He(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&hA(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const _H=["critical","high","medium","low"],DH={last_24h:"last 24 hours",last_7d:"last 7 days",last_30d:"last 30 days",last_90d:"last 90 days",older_7d:"older than 7 days",older_30d:"older than 30 days"};function $H(e){if(e.preset)return`${e.field} ${DH[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function wP(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&Ku(t)===null)return`query: ${t}`;const n=[];for(const a of["status","priority","type","assignee","project","tags"]){const l=He(e[a]);l.length&&n.push(`${a}=${l.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push($H(e.dateRange));const r=(i=e.search)==null?void 0:i.trim();return r&&n.push(`search="${r}"`),n.join(" · ")||"no filters"}const QN=80,IH=["started","lastActivity","projectName","agentName"],MH={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},LH=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function jP({open:e,onOpenChange:t,initialView:n,onSubmit:r}){const o=!!n,{data:i}=oo(),{data:a}=pm(),[l,u]=m.useState(""),[f,p]=m.useState([]),[h,g]=m.useState([]),[y,k]=m.useState([]),[v,b]=m.useState(null),[w,S]=m.useState(vp.sortField),[N,C]=m.useState(vp.sortDirection),[R,T]=m.useState(""),[A,I]=m.useState(!1),[_,z]=m.useState(null);function O(){p([]),g([]),k([]),b(null),S(vp.sortField),C(vp.sortDirection),T("")}m.useEffect(()=>{if(e)if(z(null),I(!1),n){const D=n.config.filters;u(n.name),p(He(D.project)),g(He(D.agent)),k(He(D.sessionStatus)),b(Km(D.dateRange)),S(n.config.sortField),C(n.config.sortDirection),T(n.config.limit!==void 0?String(n.config.limit):"")}else u(""),O()},[e,n]);const B=m.useMemo(()=>[{value:"__standalone__",label:"No project"},...(i??[]).map(W=>({value:W.slug,label:W.title}))],[i]),V=m.useMemo(()=>{const D=new Set;for(const W of(a==null?void 0:a.sessions)??[])W.agent&&D.add(W.agent);return Array.from(D).sort().map(W=>({value:W,label:W}))},[a]),$=l.trim(),L=$.length>0&&$.length<=QN,U=R.trim()===""?void 0:parseInt(R.trim(),10),K=R.trim()===""||Number.isFinite(U)&&U!==void 0&&U>0&&U<=500;return s.jsx(On,{open:e,onOpenChange:t,children:s.jsx(Cn,{className:"max-w-lg",children:s.jsxs("form",{className:"space-y-4",onSubmit:async D=>{if(D.preventDefault(),!L||!K||A)return;I(!0),z(null);const W=xa(v),M=W?{...W,field:"started"}:void 0,F={filters:{project:f,agent:h,sessionStatus:y,dateRange:M},sortField:w,sortDirection:N,limit:U};try{await r($,F)}catch(Y){z(Y instanceof Error?Y.message:String(Y)),I(!1)}},children:[s.jsx(sr,{children:s.jsx(En,{children:o?"Edit session view":"Create session view"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-session-view-name",children:"Name"}),s.jsx("input",{id:"create-session-view-name",type:"text",value:l,autoFocus:!0,required:!0,maxLength:QN,onChange:D=>u(D.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(vl,{label:"Date range (session start)",children:s.jsx(Wm,{className:"w-full",value:v,onChange:b})}),s.jsx(vl,{label:"Project",children:s.jsx(kn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:B,value:f,onChange:p})}),s.jsx(vl,{label:"Agent",children:s.jsx(kn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:V,value:h,onChange:g})}),s.jsx(vl,{label:"Session status",children:s.jsx(kn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:LH,value:y,onChange:k})}),s.jsx(vl,{label:"Sort by",className:"sm:col-span-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{value:w,onChange:D=>S(D.target.value),className:"editor-input w-full",children:IH.map(D=>s.jsx("option",{value:D,children:MH[D]??D},D))}),s.jsx("button",{type:"button",onClick:()=>C(D=>D==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:N==="asc"?"Ascending":"Descending",children:N==="asc"?"Asc":"Desc"})]})}),s.jsxs(vl,{label:"Max results",className:"sm:col-span-2",children:[s.jsx("input",{type:"number",min:1,max:500,value:R,onChange:D=>T(D.target.value),placeholder:"No limit",className:"editor-input w-full"}),K?null:s.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:"Limit must be between 1 and 500"})]})]}),_?s.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:_}):null,s.jsxs(Hr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:O,className:"shell-action",disabled:A,children:"Clear all"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:A,children:"Cancel"}),s.jsx("button",{type:"submit",disabled:!L||!K||A,className:"shell-action shell-action--cta disabled:opacity-50",children:A?"Saving…":o?"Save changes":"Create view"})]})]})]})})})}function vl({label:e,className:t,children:n}){return s.jsxs("label",{className:`space-y-1 ${t??""}`,children:[s.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}function Py({title:e,message:t,onPickAnother:n}){return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:e}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t}),n?s.jsx("button",{type:"button",onClick:n,className:"shell-action mt-3",children:"Pick another widget"}):null]})}function OH({viewId:e,slotId:t,onPickAnother:n}){const{data:r,loading:o,error:i}=pm(),{view:a,loading:l,ready:u}=ki(e??null),{layout:f}=wA(),{showToast:p}=Tn(),[h,g]=m.useState(!1),y=m.useCallback(async b=>{if(!t)return;const w=f.slots.map(S=>S.id===t?{...S,widget:b?{kind:"agent-sessions",viewId:b}:{kind:"agent-sessions"}}:S);try{await Kb(w)}catch(S){p(S instanceof Error?S.message:"Failed to update widget")}},[f,t,p]);async function k(b,w){const{workspace:S,config:N}=s0(w,null);try{const R=(await rc({name:b,workspace:S,config:N,entityType:"session"})).views.find(T=>T.name===b&&T.entityType==="session");R&&await y(R.id),g(!1),p(`Created session view "${b}"`)}catch(C){throw p(C instanceof Error?C.message:"Failed to create session view"),C}}let v;return e?l&&!u?v=s.jsx(bt,{label:"Loading view…"}):a?a.entityType!=="session"?v=s.jsx(Py,{title:"Wrong view type",message:"This widget is bound to an assignment view. Choose a session view above, or pick a different widget.",onPickAnother:n}):v=s.jsx(SH,{view:a,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):v=s.jsx(Py,{title:"View no longer exists",message:"The saved view this widget was bound to has been deleted. Pick another session view above, or choose a different widget.",onPickAnother:n}):o&&!r?v=s.jsx(bt,{label:"Loading sessions…"}):i?v=s.jsx(Py,{title:"Couldn't load sessions",message:i}):v=s.jsx(gP,{sessions:(r==null?void 0:r.sessions)??[]}),s.jsxs("div",{className:"space-y-2",children:[t?s.jsx("div",{className:"flex items-center justify-between gap-2",children:s.jsx(CH,{activeViewId:e??null,onSelectView:b=>void y(b),onCreateNew:()=>g(!0)})}):null,v,s.jsx(jP,{open:h,onOpenChange:g,workspace:null,onSubmit:k})]})}const FH=5;function zH(){const{data:e,loading:t,error:n}=uT();if(t&&!e)return s.jsx(bt,{label:"Loading inventories…"});if(n)return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load inventories"}),s.jsx("p",{className:"mt-1 text-xs",children:n})]});const o=((e==null?void 0:e.inventories)??[]).slice(0,FH);return s.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[s.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),s.jsx(_e,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),o.length===0?s.jsxs("div",{className:"px-4 py-6 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):s.jsx("ul",{className:"divide-y divide-border/40",children:o.map(i=>{const a=i.inventory,l=i.active_leases.length,u=i.members.length,f=a.display_name??a.slug;return s.jsx("li",{children:s.jsxs(_e,{to:`/inventories/${encodeURIComponent(a.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:f}),s.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[l,"/",u," leased"]})]})},a.slug)})})]})}function BH(e){let t=0,n=0;for(const r of e.daily)t+=r.total_tokens,n+=r.total_cost;return{tokens:t,cost:n}}function JN({filters:e,metric:t}){const n=e??{},{data:r,loading:o,error:i}=xO(n),a=t==="cost"?"Spend":"Token Usage",l=`/usage?${_b(n).toString()}`;let u;if(o&&!r)u=s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"});else if(i&&!r)u=s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load usage"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});else if(!r||r.daily.length===0)u=s.jsx("p",{className:"text-sm text-muted-foreground",children:"No usage for these filters."});else{const{tokens:f,cost:p}=BH(r),h=t==="cost"?{label:"Total spend",value:tc(p)}:{label:"Total tokens",value:ec(f)},g=t==="cost"?{label:"Tokens",value:ec(f)}:{label:"Spend",value:tc(p)};u=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ZN,{label:h.label,value:h.value,emphasize:!0}),s.jsx(ZN,{label:g.label,value:g.value})]})}return s.jsxs("aside",{className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsxs("header",{className:"flex items-center justify-between gap-2 border-b border-border/40 px-4 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:a}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",title:Y1(n),children:Y1(n)})]}),s.jsx(_e,{to:l,className:"shrink-0 text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),s.jsx("div",{className:"px-4 py-4",children:u})]})}function ZN({label:e,value:t,emphasize:n}){return s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),s.jsx("p",{className:n?"text-2xl font-semibold tabular-nums text-foreground":"text-lg font-semibold tabular-nums text-foreground",children:t})]})}const UH={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"};function HH(e){return e.kind==="token-usage"||e.kind==="spend"?e.filters??{}:{}}const wl="bg-background border border-border rounded px-2 py-1 text-sm text-foreground";function eS({config:e,open:t,onSave:n,onCancel:r}){const o=e.kind==="spend"?"Configure Spend":"Configure Token Usage",{data:i}=oo(),{data:a}=Ra(),{data:l}=dT(t),[u,f]=m.useState("30d"),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,v]=m.useState(""),[b,w]=m.useState(""),[S,N]=m.useState(""),[C,R]=m.useState(""),[T,A]=m.useState(!1),[I,_]=m.useState(null);m.useEffect(()=>{if(!t)return;const L=HH(e);f(L.window??"30d"),h(L.since??""),y(L.until??""),v(L.project??""),w(L.workspace??""),N(L.model??""),R(L.tool??""),A(!1),_(null)},[t,e]);function z(){return zd({window:u,since:u==="custom"?p:void 0,until:u==="custom"?g:void 0,project:k||void 0,workspace:b||void 0,model:S||void 0,tool:C||void 0})}async function O(L){if(L.preventDefault(),T)return;const U=z(),K=iO(U);if(!K.ok){_(K.errors.join("; "));return}A(!0),_(null);const D=e.kind==="token-usage"?{kind:"token-usage",filters:U}:e.kind==="spend"?{kind:"spend",filters:U}:e;try{await n(D)}catch(W){_(W instanceof Error?W.message:String(W)),A(!1)}}const B=(i==null?void 0:i.map(L=>L.slug))??[],V=(a==null?void 0:a.workspaces)??[],$=(a==null?void 0:a.hasUngrouped)??!1;return s.jsx(On,{open:t,onOpenChange:L=>{L||r()},children:s.jsx(Cn,{className:"max-w-md",children:s.jsxs("form",{onSubmit:O,children:[s.jsx(sr,{children:s.jsx(En,{children:o})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Window"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:dm.map(L=>s.jsx("button",{type:"button",onClick:()=>f(L),className:"rounded px-2.5 py-1 text-sm border "+(L===u?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:UH[L]},L))})]}),u==="custom"?s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Since"}),s.jsx("input",{type:"date",value:p,onChange:L=>h(L.target.value),className:wl})]}),s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Until"}),s.jsx("input",{type:"date",value:g,onChange:L=>y(L.target.value),className:wl})]})]}):null,s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),s.jsxs("select",{value:b,onChange:L=>{w(L.target.value),L.target.value&&v("")},className:wl,children:[s.jsx("option",{value:"",children:"All workspaces"}),$?s.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,V.map(L=>s.jsx("option",{value:L,children:L},L))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Project"}),s.jsxs("select",{value:k,onChange:L=>{v(L.target.value),L.target.value&&w("")},className:wl,children:[s.jsx("option",{value:"",children:"All projects"}),B.map(L=>s.jsx("option",{value:L,children:L},L))]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Model"}),s.jsxs("select",{value:S,onChange:L=>N(L.target.value),className:wl,children:[s.jsx("option",{value:"",children:"All models"}),((l==null?void 0:l.models)??[]).map(L=>s.jsx("option",{value:L,children:L},L))]})]}),s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Tool"}),s.jsxs("select",{value:C,onChange:L=>R(L.target.value),className:wl,children:[s.jsx("option",{value:"",children:"All tools"}),((l==null?void 0:l.tools)??[]).map(L=>s.jsx("option",{value:L,children:L},L))]})]})]}),I?s.jsx("p",{className:"text-xs text-destructive",role:"alert",children:I}):null]}),s.jsxs(Hr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:r,disabled:T,className:"shell-action",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:T,className:"shell-action shell-action--cta",children:T?"Saving…":"Save"})]})]})})})}const o0={"saved-view":{title:"Saved view",icon:_2,render:(e,t)=>e.kind!=="saved-view"?null:m.createElement(gH,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:om,render:(e,t)=>e.kind!=="agent-sessions"?null:m.createElement(OH,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:qv,render:()=>m.createElement(zH)},"token-usage":{title:"Token Usage",icon:O5,render:e=>e.kind!=="token-usage"?null:m.createElement(JN,{filters:e.filters,metric:"tokens"}),ConfigEditor:eS},spend:{title:"Spend",icon:um,render:e=>e.kind!=="spend"?null:m.createElement(JN,{filters:e.filters,metric:"cost"}),ConfigEditor:eS}},kP=50,tv=16,VH=2,da=6,$h=11,nv={w:6,h:2};function eh(e,t,n){return Math.min(Math.max(e,t),n)}const WH=[{minWidth:1280,columns:24},{minWidth:1024,columns:16},{minWidth:768,columns:12},{minWidth:640,columns:6},{minWidth:0,columns:1}];function KH(e){if(!Number.isFinite(e)||e<0)return 1;for(const t of WH)if(e>=t.minWidth)return t.columns;return 1}function th(e,t){return t<=0?1:eh(Math.round(e/hd*t),1,t)}function rv(e){if(F7(e))return e;switch(e){case"small":return{w:8,h:da};case"wide":return{w:16,h:da};case"tall":return{w:8,h:$h};case"large":return{w:16,h:$h};default:return{w:8,h:da}}}function qH(e,t){return t>0?Math.round(e/t):0}function GH(e,t=kP){return Math.round(e/t)}const YH=[{label:"Third",w:8,h:da},{label:"Half",w:12,h:da},{label:"Two-thirds",w:16,h:da},{label:"Full",w:24,h:da},{label:"Half tall",w:12,h:$h},{label:"Full tall",w:24,h:$h}];function XH({slot:e,activeColumns:t,colWidthPx:n,onReplace:r,onRemove:o,onRemoveSlot:i,onResize:a,onConfigChange:l}){const[u,f]=m.useState(!1),[p,h]=m.useState(null),g=m.useRef(null),{attributes:y,listeners:k,setNodeRef:v,setActivatorNodeRef:b,transform:w,transition:S,isDragging:N}=Dm({id:e.id}),C=rv(e.size),R=p?p.renderW:th(C.w,t),T=p?p.h:C.h,A={transform:js.Translate.toString(w),transition:S,zIndex:N?50:void 0,position:N?"relative":void 0,gridColumn:`span ${R}`,gridRow:`span ${T}`};function I(U){g.current=null;try{U.currentTarget.releasePointerCapture(U.pointerId)}catch{}h(null)}function _(U){return{onPointerDown:K=>{if(g.current)return;K.preventDefault(),K.stopPropagation(),K.currentTarget.setPointerCapture(K.pointerId);const D=th(C.w,t);g.current={pointerId:K.pointerId,startX:K.clientX,startY:K.clientY,startRenderW:D,startH:C.h,axis:U,lastRenderW:D,lastH:C.h},h({renderW:D,h:C.h})},onPointerMove:K=>{const D=g.current;if(!D||K.pointerId!==D.pointerId)return;let W=D.startRenderW,M=D.startH;(D.axis==="w"||D.axis==="both")&&(W=eh(D.startRenderW+qH(K.clientX-D.startX,n),1,t)),(D.axis==="h"||D.axis==="both")&&(M=eh(D.startH+GH(K.clientY-D.startY),VH,pA)),D.lastRenderW=W,D.lastH=M,h({renderW:W,h:M})},onPointerUp:K=>{const D=g.current;if(!D||K.pointerId!==D.pointerId)return;const W=rv(e.size),F={w:D.axis==="h"?W.w:eh(Math.round(D.lastRenderW/t*hd),1,hd),h:D.lastH};I(K),(F.w!==W.w||F.h!==W.h)&&a(F)},onPointerCancel:K=>{const D=g.current;D&&K.pointerId===D.pointerId&&I(K)},onLostPointerCapture:K=>{const D=g.current;D&&K.pointerId===D.pointerId&&I(K)}}}const z="absolute z-10 touch-none rounded-sm bg-transparent transition hover:bg-primary/30",O=s.jsxs(s.Fragment,{children:[t>1?s.jsx("div",{"aria-hidden":"true",className:be(z,"right-0 top-0 h-full w-1.5 cursor-ew-resize"),..._("w")}):null,s.jsx("div",{"aria-hidden":"true",className:be(z,"bottom-0 left-0 h-1.5 w-full cursor-ns-resize"),..._("h")}),t>1?s.jsx("div",{"aria-hidden":"true",className:be(z,"bottom-0 right-0 h-3 w-3 cursor-nwse-resize"),..._("both")}):null]}),B=s.jsx("button",{ref:b,...y,...k,type:"button","aria-label":"Drag to reorder widget",className:"touch-none cursor-grab text-muted-foreground/40 transition hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:cursor-grabbing",children:s.jsx(wc,{className:"h-4 w-4","aria-hidden":"true"})});if(e.widget===null)return s.jsxs("div",{ref:v,style:{...A,gridColumn:`span ${th(nv.w,t)}`,gridRow:`span ${nv.h}`},className:be("relative flex items-center justify-center rounded-lg border border-dashed border-border bg-card/40 p-3 shadow-sm transition-colors hover:border-primary/40 hover:bg-card/60",N&&"opacity-0"),children:[s.jsx("div",{className:"absolute left-2 top-2",children:B}),s.jsx("button",{type:"button","aria-label":"Remove slot",onClick:i,onPointerDown:U=>U.stopPropagation(),className:"absolute right-2 top-2 z-10 text-muted-foreground/50 transition hover:text-destructive",children:s.jsx(fn,{className:"h-4 w-4"})}),s.jsxs("button",{type:"button",onClick:r,className:"shell-action inline-flex items-center gap-2",children:[s.jsx(Tt,{className:"h-4 w-4"}),"Add widget"]})]});const V=o0[e.widget.kind];if(!V)return s.jsxs("div",{ref:v,style:A,className:be("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",N&&"opacity-0"),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[B,s.jsxs("div",{className:"flex-1 rounded-md border border-border/60 bg-background/60 px-3 py-2 text-sm text-muted-foreground",children:["Unknown widget kind: ",e.widget.kind]})]}),O]});const $=V.icon,L=V.ConfigEditor;return s.jsxs("div",{ref:v,style:A,className:be("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",N&&"opacity-0"),children:[s.jsxs("header",{className:"mb-2 flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[B,s.jsx($,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:s.jsx(JH,{slot:e,fallback:V.title})})]}),s.jsx(Xw,{items:[{key:"replace",label:"Replace…",icon:Y5,onSelect:r},...V.ConfigEditor?[{key:"configure",label:"Configure…",icon:t4,onSelect:()=>f(!0)}]:[],{key:"size",label:"Size",icon:D2,submenu:YH.map(U=>({key:`size-${U.label}`,label:U.label,active:C.w===U.w&&C.h===U.h,onSelect:()=>a({w:U.w,h:U.h})}))},{key:"remove",label:"Remove",icon:fn,destructive:!0,onSelect:o}]})]}),s.jsx("div",{children:V.render(e.widget,{slotId:e.id,onPickAnother:r})}),L?s.jsx(L,{config:e.widget,open:u,onSave:async U=>{await l(U),f(!1)},onCancel:()=>f(!1)}):null,O]})}function QH({slot:e,activeColumns:t,colWidthPx:n}){const r=e.widget?o0[e.widget.kind]:null,o=r==null?void 0:r.icon,i=e.widget===null?"Empty widget slot":(r==null?void 0:r.title)??`Unknown widget kind: ${e.widget.kind}`,a=e.widget===null?nv:rv(e.size),l=th(a.w,t),u=n>0?l*n+(l-1)*tv:void 0;return s.jsx("div",{"aria-hidden":"true",className:"min-w-[200px] rounded-lg border border-border/70 bg-card/95 p-3 shadow-xl ring-1 ring-foreground/10",style:{width:u?`${Math.max(u,200)}px`:void 0},children:s.jsxs("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[s.jsx(wc,{className:"h-4 w-4","aria-hidden":"true"}),o?s.jsx(o,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null,s.jsx("span",{className:"min-w-0 flex-1 truncate",children:i})]})})}function JH({slot:e,fallback:t}){var o,i;const n=((o=e.widget)==null?void 0:o.kind)==="saved-view"?e.widget.viewId:null,{view:r}=ki(n);return((i=e.widget)==null?void 0:i.kind)==="saved-view"&&r?s.jsx(s.Fragment,{children:r.name}):s.jsx(s.Fragment,{children:t})}const ZH=["agent-sessions","inventories","token-usage","spend"];function eV({open:e,onOpenChange:t,onSelect:n}){const{views:r,loading:o}=qd();function i(a){n(a),t(!1)}return s.jsx(On,{open:e,onOpenChange:t,children:s.jsxs(Cn,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsx(En,{children:"Add a widget"}),s.jsx(ns,{children:"Choose a built-in widget, an assignment view, or a session view."})]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:ZH.map(a=>{const l=o0[a],u=l.icon;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:a}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx(u,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),s.jsx("span",{className:"font-medium text-foreground",children:l.title})]})},a)})})]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),o?s.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):r.length===0?s.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",s.jsx(_e,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):s.jsxs("div",{className:"space-y-3",children:[r.some(a=>a.entityType!=="session")&&s.jsxs("div",{children:[s.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Assignments"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:r.filter(a=>a.entityType!=="session").map(a=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:"saved-view",viewId:a.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:a.name}),a.workspace!==null?s.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${a.workspace}`,children:a.workspace}):null,s.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:a.config.viewMode})]})},a.id))})]}),r.some(a=>a.entityType==="session")&&s.jsxs("div",{children:[s.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Sessions"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:r.filter(a=>a.entityType==="session").map(a=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:"agent-sessions",viewId:a.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:a.name}),a.workspace!==null?s.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${a.workspace}`,children:a.workspace}):null]})},a.id))})]})]}),!o&&r.some(a=>a.workspace!==null)?s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}const tV=(e,{currentCoordinates:t,context:n})=>{var h;const r=e.code==="ArrowRight"||e.code==="ArrowDown"?1:e.code==="ArrowLeft"||e.code==="ArrowUp"?-1:0;if(r===0)return;e.preventDefault();const o=n.over??n.active,i=(h=o==null?void 0:o.data.current)==null?void 0:h.sortable,a=i==null?void 0:i.items;if(!o||!a)return t;const l=a.indexOf(o.id);if(l===-1)return t;const u=a[l+r],f=u===void 0?null:n.droppableRects.get(u),p=n.collisionRect;return!f||!p?t:{x:f.left+(f.width-p.width)/2,y:f.top+(f.height-p.height)/2}};function nV(e){const t=new Set(e.map(o=>o.id));let n=-1;for(const o of t){const i=/^slot-(\d+)$/.exec(o);if(i){const a=parseInt(i[1],10);a>n&&(n=a)}}let r=n+1;for(;t.has(`slot-${r}`);)r++;return`slot-${r}`}function rV(e,t){const n={id:nV(e),widget:null};return[...e,n]}function sV(e,t){return e.filter(n=>n.id!==t)}function oV(){const{data:e,error:t,refetch:n}=cO(),{data:r}=aT(),{layout:o}=wA(),[i,a]=m.useState(!1),[l,u]=m.useState(null),[f,p]=m.useState(null),[h,g]=m.useState(o.slots),[y,k]=m.useState(null),v=m.useRef(null),[b,w]=m.useState(hd),[S,N]=m.useState(0);m.useEffect(()=>{const K=v.current;if(!K)return;const D=new ResizeObserver(W=>{for(const M of W){const F=M.contentRect.width,Y=KH(F),H=Y>0?(F-(Y-1)*tv)/Y:0;w(Y),N(H)}});return D.observe(K),()=>D.disconnect()},[]),m.useEffect(()=>{g(o.slots)},[o.slots]);const C=Cm(ji(Ac,{activationConstraint:{distance:8}}),ji(Rc,{coordinateGetter:tV}));Ai("list:overview"),en({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const R=m.useCallback(K=>{u(K),a(!0)},[]),T=m.useCallback(async(K,D)=>{p(null),g(K);try{await Kb(K)}catch(W){g(D),p(W instanceof Error?W.message:String(W))}},[]),A=m.useCallback(K=>{if(l===null)return;const D=h.map((W,M)=>M===l?{...W,widget:K}:W);u(null),T(D,h)},[h,l,T]),I=m.useCallback(K=>{const D=h.map((W,M)=>M===K?{...W,widget:null,size:void 0}:W);T(D,h)},[h,T]),_=m.useCallback(K=>{const D=sV(h,K);T(D,h)},[h,T]),z=m.useCallback(()=>{const K=rV(h);T(K,h)},[h,T]),O=m.useCallback((K,D)=>{const W=h.map((M,F)=>F===K?{...M,size:D}:M);T(W,h)},[h,T]),B=m.useCallback(K=>{const{active:D,over:W}=K;if(k(null),!W||D.id===W.id)return;const M=h.findIndex(H=>H.id===D.id),F=h.findIndex(H=>H.id===W.id);if(M===-1||F===-1)return;const Y=Pc(h,M,F);T(Y,h)},[h,T]),V=m.useCallback(K=>{k(String(K.active.id))},[]),$=h.find(K=>K.id===y)??null,L=m.useCallback(async(K,D)=>{const W=h,M=h.map((F,Y)=>Y===K?{...F,widget:D}:F);p(null),g(M);try{await Kb(M)}catch(F){g(W);const Y=F instanceof Error?F.message:String(F);throw p(Y),F instanceof Error?F:new Error(Y)}},[h]),U={};if(e)for(const K of Object.keys(e.segments))for(const D of e.segments[K].items)U[D.id]=D;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("header",{className:"space-y-2",children:[s.jsx("p",{className:"eyebrow",children:"Workspace Overview"}),s.jsx("h1",{className:"text-4xl font-semibold tracking-display text-foreground md:text-5xl",children:"What needs you today"})]}),e?s.jsx(L7,{hero:e.hero,itemsById:U}):t?s.jsx(Rt,{error:t,onRetry:n}):s.jsx(bt,{label:"Loading overview…"}),e!=null&&e.firstRun?s.jsx(I7,{help:r}):null,f?s.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Couldn't save dashboard layout: ",f]}):null,s.jsxs(Pm,{sensors:C,collisionDetection:Em,onDragStart:V,onDragCancel:()=>k(null),onDragEnd:B,children:[s.jsx(_m,{items:h.map(K=>K.id),strategy:Mw,children:s.jsx("div",{ref:v,style:{display:"grid",gridTemplateColumns:`repeat(${b}, minmax(0, 1fr))`,gridAutoRows:`${kP}px`,gridAutoFlow:"dense",gap:`${tv}px`},children:h.map((K,D)=>s.jsx(XH,{slot:K,index:D,activeColumns:b,colWidthPx:S,onReplace:()=>R(D),onRemove:()=>I(D),onRemoveSlot:()=>_(K.id),onResize:W=>O(D,W),onConfigChange:W=>L(D,W)},K.id))})}),s.jsx(w7,{dropAnimation:null,children:$?s.jsx(QH,{slot:$,activeColumns:b,colWidthPx:S}):null})]}),s.jsxs("button",{type:"button",onClick:z,className:"shell-action inline-flex items-center gap-2",children:[s.jsx(Tt,{className:"h-4 w-4"}),"Add slot"]}),e!=null&&e.serverStats?s.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(Zv,{className:"h-3 w-3","aria-hidden":"true"}),s.jsxs("span",{children:["● ",e.serverStats.totalPorts," ports ·"," ",e.serverStats.deadSessions>0?`${e.serverStats.deadSessions} dead`:"all healthy"]})]}):null,s.jsx(eV,{open:i,onOpenChange:K=>{a(K),K||u(null)},onSelect:A})]})}const iV=["review","blocked","question","plan-approval"],aV={review:"Review",blocked:"Blocked",question:"Questions","plan-approval":"Plan approval"};function lV(e){const t=[];for(const n of iV){const r=e.filter(o=>o.category===n).sort((o,i)=>i.ageMs-o.ageMs);r.length!==0&&t.push({category:n,label:aV[n],count:r.length,items:r})}return t}function cV(e){if(!Number.isFinite(e)||e<0)return"just now";const t=Math.floor(e/1e3);if(t<60)return"just now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function NP(e,t){const n=encodeURIComponent(t);return e.project===null?{method:"POST",url:`/api/assignments/${encodeURIComponent(e.assignmentId)}/transitions/${n}`}:{method:"POST",url:`/api/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}/transitions/${n}`}}function uV(e){return e.project===null?{method:"POST",url:`/api/assignments/${encodeURIComponent(e.assignmentId)}/comments`}:{method:"POST",url:`/api/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}/comments`}}function dV(e,t){const n=encodeURIComponent(t);return e.project===null?{method:"PATCH",url:`/api/assignments/${encodeURIComponent(e.assignmentId)}/comments/${n}/resolved`}:{method:"PATCH",url:`/api/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}/comments/${n}/resolved`}}function i0(e,t){const n=t?`?tab=${t}`:"";return e.project===null?`/assignments/${encodeURIComponent(e.assignmentId)}${n}`:`/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}${n}`}function fV(){const{items:e,total:t,loading:n,error:r,refetch:o}=gR(),{toast:i,showToast:a,dismissToast:l}=Tn();if(n&&e.length===0)return s.jsx(bt,{label:"Loading your inbox…"});if(r&&e.length===0)return s.jsx(Rt,{title:"Inbox unavailable",error:r,action:s.jsx("button",{type:"button",className:"shell-action",onClick:o,children:"Retry"})});const u=lV(e);return u.length===0?s.jsxs("div",{className:"space-y-4",children:[s.jsx(Nn,{toast:i,onDismiss:l}),s.jsx(tS,{total:0}),s.jsx(Nt,{title:"Nothing needs you right now",description:"No reviews, blocks, open questions, or plans awaiting approval across your projects. New items appear here the moment something needs a human decision."})]}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(Nn,{toast:i,onDismiss:l}),s.jsx(tS,{total:t}),u.map(f=>s.jsx(Ve,{title:f.label,actions:s.jsx("span",{className:"rounded-full bg-foreground px-2.5 py-0.5 text-xs font-semibold text-background",children:f.count}),children:s.jsx("ul",{className:"space-y-3",children:f.items.map(p=>s.jsx(pV,{item:p,onMutated:o,onError:h=>a(h,"error"),onSuccess:h=>a(h,"success")},`${p.category}:${p.assignmentId}:${p.since}`))})},f.category))]})}function tS({total:e}){return s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("span",{className:"inline-flex h-9 w-9 items-center justify-center rounded-lg bg-card text-foreground shadow-sm ring-1 ring-border/60",children:s.jsx(P2,{className:"h-4 w-4"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Needs me"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e===0?"Everything is handled.":`${e} ${e===1?"item":"items"} awaiting your decision.`})]})]})}async function Ih(e,t,n,r){try{const o=await fetch(e.url,{method:e.method,headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const i=await o.json().catch(()=>null);throw new Error((i==null?void 0:i.error)||`HTTP ${o.status}`)}return n.onSuccess(r),n.onMutated(),!0}catch(o){return n.onError(o instanceof Error?o.message:String(o)),!1}}function pV({item:e,onMutated:t,onError:n,onSuccess:r}){return s.jsxs("li",{className:"flex flex-col gap-2 rounded-lg border border-border/70 bg-background/40 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[s.jsx(_e,{to:i0(e),className:"text-sm font-semibold text-foreground hover:underline",children:e.title}),s.jsx("span",{className:"text-xs text-muted-foreground",children:e.project?e.project:"standalone"}),s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",title:e.since,children:cV(e.ageMs)})]}),e.summary?s.jsx("p",{className:"text-sm text-muted-foreground",children:e.summary}):null,s.jsx(hV,{item:e,onMutated:t,onError:n,onSuccess:r}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-muted/60 px-2 py-1 font-mono text-[11px] text-muted-foreground",children:e.action.command}),s.jsx(jr,{value:e.action.command,label:"Copy",onError:o=>n(o.message)})]})]})}function hV(e){switch(e.item.category){case"review":return s.jsx(mV,{...e});case"blocked":return s.jsx(gV,{...e});case"question":return s.jsx(xV,{...e});case"plan-approval":return s.jsx(yV,{...e});default:return null}}const ya="shell-action inline-flex items-center gap-1.5";function mV({item:e,onMutated:t,onError:n,onSuccess:r}){const[o,i]=m.useState(null),{acceptCommand:a,reopenCommand:l}=e;async function u(f,p){i(f),await Ih(NP(e,f),void 0,{onMutated:t,onError:n,onSuccess:r},`${p} — ${e.title}`),i(null)}return s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a?s.jsxs("button",{type:"button",className:ya,disabled:o!==null,onClick:()=>u(a,"Accepted"),children:[s.jsx(Nr,{className:"h-3.5 w-3.5"}),o===a?"Accepting…":"Accept"]}):null,l?s.jsxs("button",{type:"button",className:ya,disabled:o!==null,onClick:()=>u(l,"Reopened"),children:[s.jsx(vs,{className:"h-3.5 w-3.5"}),o===l?"Reopening…":"Reopen"]}):null]})}function gV({item:e,onMutated:t,onError:n,onSuccess:r}){const[o,i]=m.useState(""),[a,l]=m.useState(!1);async function u(){l(!0);const f=await Ih(NP(e,"unblock"),o.trim()?{reason:o.trim()}:void 0,{onMutated:t,onError:n,onSuccess:r},`Unblocked — ${e.title}`);l(!1),f&&i("")}return s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("input",{type:"text",value:o,onChange:f=>i(f.target.value),placeholder:"Reason (optional)",className:"min-w-[12rem] flex-1 rounded border border-border bg-background px-2 py-1 text-sm"}),s.jsxs("button",{type:"button",className:ya,disabled:a,onClick:u,children:[s.jsx(W5,{className:"h-3.5 w-3.5"}),a?"Unblocking…":"Unblock"]})]})}function xV({item:e,onMutated:t,onError:n,onSuccess:r}){const[o,i]=m.useState(""),[a,l]=m.useState(!1),u=e.commentId;async function f(){if(!o.trim())return;l(!0);const h=await Ih(uV(e),{body:o.trim(),type:"note",author:"human",...u?{replyTo:u}:{}},{onMutated:t,onError:n,onSuccess:r},`Replied — ${e.title}`);l(!1),h&&i("")}async function p(){if(!u){n("Could not determine which question to resolve — open the assignment to resolve it.");return}l(!0),await Ih({...dV(e,u)},{resolved:!0},{onMutated:t,onError:n,onSuccess:r},`Resolved — ${e.title}`),l(!1)}return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(_e,{to:i0(e,"comments"),className:ya,children:[s.jsx(lm,{className:"h-3.5 w-3.5"}),"Open to answer"]}),s.jsxs("button",{type:"button",className:ya,disabled:a||!u,title:u?void 0:"Open the assignment to resolve this question.",onClick:p,children:[s.jsx(cm,{className:"h-3.5 w-3.5"}),"Resolve"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("input",{type:"text",value:o,onChange:h=>i(h.target.value),placeholder:"Reply inline…",className:"min-w-[12rem] flex-1 rounded border border-border bg-background px-2 py-1 text-sm"}),s.jsxs("button",{type:"button",className:ya,disabled:a||!o.trim(),onClick:f,children:[s.jsx(T2,{className:"h-3.5 w-3.5"}),a?"Posting…":"Reply"]})]})]})}function yV({item:e}){return s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.jsxs(_e,{to:i0(e,"plan"),className:ya,children:[s.jsx(lm,{className:"h-3.5 w-3.5"}),"Review plan"]})})}function bV({term:e,description:t}){return s.jsx("span",{title:t,className:"cursor-help rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-foreground underline decoration-dotted underline-offset-4",children:e})}function vV(){const{data:e,loading:t,error:n}=aT(),{openCheatsheet:r}=Ri();return t?s.jsx(bt,{label:"Loading help…"}):n||!e?s.jsx(Rt,{error:n||"Help content is unavailable."}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(Ve,{title:"Keyboard Shortcuts",description:"Navigate the dashboard without reaching for the mouse.",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center gap-2 rounded-md border border-border/70 bg-background/80 px-3 py-1.5 text-sm font-medium text-foreground hover:bg-accent",children:"Open shortcuts cheatsheet"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["or press ",s.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"?"})," ","anywhere. ",eo("Mod+k")," opens the command palette."]})]})}),s.jsx(Ve,{title:"What Syntaur Is",description:e.whatIsSyntaur.summary,children:s.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:e.whatIsSyntaur.bullets.map(o=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:o},o))})}),s.jsx(Ve,{title:"Getting Started",children:s.jsx("div",{className:"space-y-3",children:e.workflow.map((o,i)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?s.jsx(Xp,{command:o.command.command,description:o.command.description,example:o.command.example}):null,o.href?s.jsx(_e,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsxs(Ve,{title:"Core Concepts",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(o=>s.jsx(bV,{term:o.term,description:o.description},o.term))}),s.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.term}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.term))})]}),s.jsx(Ve,{title:"Status Guide",children:s.jsx("div",{className:"space-y-3",children:e.statusGuide.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(ro,{status:o.status}),s.jsx("p",{className:"font-semibold text-foreground",children:o.meaning})]}),s.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:o.useWhen})]},o.status))})})]}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsx(Ve,{title:"Ownership And File Rules",children:s.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.files.map(i=>s.jsx("span",{className:"rounded-full border border-border/60 bg-card/90 px-2.5 py-1 font-mono text-xs text-foreground",children:i},i))})]},o.label))})}),s.jsx(Ve,{title:"How To Navigate The Dashboard",children:s.jsx("div",{className:"space-y-3",children:e.navigation.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),s.jsx(_e,{className:"text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open"})]}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.label))})})]}),s.jsx(Ve,{title:"CLI Quick Reference",children:s.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(o=>s.jsx(Xp,{command:o.command,description:o.description,example:o.example},o.command))})}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsx(Ve,{title:"FAQ",children:s.jsx("div",{className:"space-y-3",children:e.faq.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.question}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.answer})]},o.question))})}),s.jsx(Ve,{title:"First Project Checklist",children:s.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((o,i)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?s.jsx(Xp,{command:o.command.command,example:o.command.example}):null,o.href?s.jsx(_e,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})})]})]})}function a0({children:e}){return s.jsx("div",{className:"chrome-card flex flex-col gap-2 !p-2.5 md:flex-row md:flex-wrap md:items-center",children:e})}const qm=m.forwardRef(({value:e,onChange:t,placeholder:n="Search"},r)=>s.jsxs("label",{className:"relative flex min-w-[220px] flex-1 items-center",children:[s.jsx(Ci,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),s.jsx("input",{ref:r,value:e,onChange:o=>t(o.target.value),placeholder:n,className:"h-9 w-full rounded-md border border-border/60 bg-background/90 pl-9 pr-3 text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30"})]}));qm.displayName="SearchInput";function Gm({value:e,options:t,onChange:n}){return s.jsx("div",{className:"inline-flex rounded-md border border-border/60 bg-background/80 p-1",children:t.map(r=>s.jsx("button",{type:"button","aria-pressed":e===r.value,onClick:()=>n(r.value),className:be("rounded-sm px-2.5 py-1.5 text-sm font-medium transition",e===r.value?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:r.label},r.value))})}const wV={completed:"bg-status-completed-foreground",in_progress:"bg-status-in-progress-foreground",review:"bg-status-review-foreground",blocked:"bg-status-blocked-foreground",failed:"bg-status-failed-foreground",pending:"bg-status-pending-foreground"},nS=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function Mh({progress:e,className:t,showLegend:n=!1}){const r=rs(),i=m.useMemo(()=>{let a=0;const l=Object.keys(e).filter(f=>f!=="total");return(r.order.length>0?[...r.order,...l.filter(f=>!r.order.includes(f))]:l).map(f=>({key:f,className:wV[f]??nS[a++%nS.length]}))},[r.order,e]).filter(a=>(e[a.key]??0)>0);return s.jsxs("div",{className:be("space-y-2",t),children:[s.jsx("div",{className:"flex h-1.5 w-full overflow-hidden rounded-lg border border-border/70 bg-muted/60",children:e.total===0?s.jsx("div",{className:"h-full w-full bg-muted"}):i.map(a=>s.jsx("div",{className:a.className,style:{width:`${(e[a.key]??0)/e.total*100}%`},title:`${gn(a.key)}: ${e[a.key]??0}`},a.key))}),n?i.length>0?s.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:i.map(a=>s.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/80 px-2 py-1",children:[s.jsx("span",{className:be("h-2 w-2 rounded-full",a.className)}),s.jsx("span",{children:gn(a.key)}),s.jsx("span",{className:"font-medium text-foreground",children:e[a.key]??0})]},a.key))}):s.jsx("p",{className:"text-xs text-muted-foreground/70",children:"No assignments yet"}):null]})}const jV=["pending","active","blocked","failed","completed"],l0=jV,kV=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function SP(e){return e&&e.length>0?e:[...kV]}function NV(e,t,n){if(t<0||t>=e.length)return e;const r=[...e],[o]=r.splice(t,1),i=t<n?n-1:n;return r.splice(Math.max(0,Math.min(i,r.length)),0,o),r}const SV=220,wp=8;function CP({anchor:e,items:t,onClose:n}){const r=m.useRef(null),[o,i]=m.useState(null);return m.useLayoutEffect(()=>{if(!e){i(null);return}const a=r.current,l=(a==null?void 0:a.offsetWidth)??SV,u=(a==null?void 0:a.offsetHeight)??0,f=Math.max(wp,window.innerWidth-l-wp),p=Math.max(wp,window.innerHeight-u-wp);i({left:Math.min(e.x,f),top:Math.min(e.y,p)})},[e]),m.useEffect(()=>{if(!e)return;function a(f){r.current&&!r.current.contains(f.target)&&n()}function l(f){f.key==="Escape"&&n()}function u(){n()}return document.addEventListener("mousedown",a),document.addEventListener("keydown",l),document.addEventListener("contextmenu",a),window.addEventListener("scroll",u,!0),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",l),document.removeEventListener("contextmenu",a),window.removeEventListener("scroll",u,!0)}},[e,n]),!e||t.length===0?null:s.jsx("div",{ref:r,role:"menu",className:"fixed z-50 min-w-[220px] rounded-md border border-border/70 bg-background py-1 shadow-lg",style:{left:(o==null?void 0:o.left)??e.x,top:(o==null?void 0:o.top)??e.y,visibility:o?"visible":"hidden"},children:s.jsx(ga,{delayDuration:200,children:t.map(a=>{const l=a.icon,u=be("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",a.disabled?"cursor-not-allowed opacity-50":a.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),f=s.jsxs(s.Fragment,{children:[l?s.jsx(l,{className:"h-4 w-4 shrink-0"}):null,s.jsx("span",{className:"block min-w-0 truncate",children:a.label})]});if(a.disabled){const p=s.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:s.jsx("button",{type:"button",disabled:!0,className:u,children:f})});return a.disabledReason?s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:p}),s.jsx(br,{side:"left",children:a.disabledReason})]},a.key):s.jsx("div",{children:p},a.key)}return a.href?s.jsx(_e,{to:a.href,className:u,onClick:()=>n(),children:f},a.key):s.jsx("button",{type:"button",className:u,onClick:()=>{var p;(p=a.onSelect)==null||p.call(a),n()},children:f},a.key)})})})}const CV="__ungrouped__";function c0({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:r,title:o="Move to workspace",description:i="Pick the workspace this item should belong to."}){const{data:a,loading:l}=Ra(),[u,f]=m.useState(n),[p,h]=m.useState(!1),[g,y]=m.useState(null);m.useEffect(()=>{e&&(f(n),y(null))},[e,n]);const k=m.useMemo(()=>[...((a==null?void 0:a.workspaces)??[]).map(S=>({key:S,label:S,value:S})),{key:CV,label:"Ungrouped",value:null}],[a]),v=!p&&u!==n;async function b(){if(v){h(!0),y(null);try{await r(u),t(!1)}catch(w){y(w instanceof Error?w.message:"Failed to move item")}finally{h(!1)}}}return s.jsx(On,{open:e,onOpenChange:w=>p?void 0:t(w),children:s.jsxs(Cn,{children:[s.jsxs(sr,{children:[s.jsx(En,{children:o}),s.jsx(ns,{children:i})]}),s.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:l&&k.length===0?s.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[s.jsx(Jv,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):k.map(w=>{const S=w.value===n,N=w.value===u;return s.jsxs("button",{type:"button",disabled:S||p,onClick:()=>f(w.value),className:be("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",S?"cursor-not-allowed bg-foreground/5 text-muted-foreground":N?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[s.jsxs("span",{className:be("block min-w-0 truncate",w.value===null?"italic text-muted-foreground":""),children:[w.label,S?s.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),N?s.jsx(Nr,{className:"h-4 w-4 text-foreground"}):null]},w.key)})}),g?s.jsx("p",{className:"text-sm text-destructive",role:"alert",children:g}):null,s.jsxs(Hr,{children:[s.jsx("button",{type:"button",onClick:()=>t(!1),disabled:p,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",onClick:b,disabled:!v,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:p?"Moving…":"Move"})]})]})})}function rS(){const{workspace:e}=Kt(),t=xn(),n=Wt(),{data:r,loading:o,error:i,refetch:a}=oo(),{toast:l,showToast:u,dismissToast:f}=Tn(),p=m.useRef(null);Ai("list:projects");const[h,g]=m.useState(""),[y,k]=m.useState("all"),[v,b]=m.useState("all"),[w,S]=m.useState("updated"),[N,C]=Rs(),R=N.get("view"),T=R==="table"||R==="kanban"?R:"cards",A=F=>{C(Y=>{const H=new URLSearchParams(Y);return F==="cards"?H.delete("view"):H.set("view",F),H})},[I,_]=m.useState({}),[z,O]=m.useState(null),[B,V]=m.useState(null),$=m.useMemo(()=>r?r.filter(F=>{if(e){if(e==="_ungrouped"){if(F.workspace!==null)return!1}else if(F.workspace!==e)return!1}return y!=="all"&&F.status!==y||v!=="all"&&!F.tags.includes(v)?!1:h.trim()?`${F.title} ${F.tags.join(" ")} ${F.slug}`.toLowerCase().includes(h.toLowerCase()):!0}).sort((F,Y)=>TV(F,Y,w)):[],[r,h,y,v,w,e]),L=$.map(F=>`${F.slug}:${F.status}`).join("|");m.useEffect(()=>{_(RV($))},[L,w]);const U=m.useMemo(()=>{const F=new Map($.map(Y=>[Y.slug,Y]));return l0.flatMap(Y=>(I[Y]??$.filter(Q=>Q.status===Y).map(Q=>Q.slug)).map(Q=>F.get(Q)).filter(Q=>!!Q))},[$,I]),{visibleItems:K,visibleIndexByKey:D}=m.useMemo(()=>{const F=T==="kanban"?U:$,Y=new Map;return F.forEach((H,Q)=>Y.set(H.slug,Q)),{visibleItems:F,visibleIndexByKey:Y}},[T,$,U]),{hotkeyRowProps:W}=Ud(K,{scope:"list:projects",onOpen:F=>n(`${t}/projects/${F.slug}`)});if(en({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var F;return(F=p.current)==null?void 0:F.focus()}}),en({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>a()}),o)return s.jsx(bt,{label:"Loading projects…"});if(i||!r)return s.jsx(Rt,{error:i||"Project list is unavailable.",onRetry:a});const M=Array.from(new Set(r.flatMap(F=>F.tags))).sort();return s.jsxs("div",{className:"space-y-5",children:[s.jsx(Nn,{toast:l,onDismiss:f}),s.jsxs(a0,{children:[s.jsx(qm,{ref:p,value:h,onChange:g,placeholder:"Search by project title or tag"}),s.jsxs("select",{value:y,onChange:F=>k(F.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"all",children:"All statuses"}),s.jsx("option",{value:"pending",children:"Pending"}),s.jsx("option",{value:"active",children:"Active"}),s.jsx("option",{value:"blocked",children:"Blocked"}),s.jsx("option",{value:"failed",children:"Failed"}),s.jsx("option",{value:"completed",children:"Completed"})]}),s.jsxs("select",{value:v,onChange:F=>b(F.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"all",children:"All tags"}),M.map(F=>s.jsx("option",{value:F,children:F},F))]}),s.jsxs("select",{value:w,onChange:F=>S(F.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"updated",children:"Sort: Updated"}),s.jsx("option",{value:"created",children:"Sort: Created"}),s.jsx("option",{value:"title",children:"Sort: Title"}),s.jsx("option",{value:"attention",children:"Sort: Attention"})]}),s.jsx(Gm,{value:T,onChange:F=>A(F),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),$.length===0?r.length===0?s.jsxs("div",{className:"rounded-frame border border-border/60 bg-card px-6 py-16 text-center",children:[s.jsx("p",{className:"eyebrow mx-auto justify-center",children:"Start here"}),s.jsx("h2",{className:"mx-auto mt-4 max-w-2xl text-3xl font-semibold tracking-display text-foreground md:text-4xl",children:"The task manager built for agents, by agents"}),s.jsx("p",{className:"mx-auto mt-3 max-w-xl text-sm leading-6 text-muted-foreground",children:"A project groups assignments, resources, and memories under one objective. Markdown stays authoritative — the dashboard is just a view."}),s.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3",children:[s.jsx(_e,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),s.jsx(_e,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):s.jsx(Nt,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:s.jsx(_e,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):T==="cards"?s.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:$.map((F,Y)=>s.jsxs(_e,{to:`${t}/projects/${F.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...W(Y),children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:F.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Xn(F.updated)]})]}),s.jsx(ro,{status:F.status})]}),s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsx(Mh,{progress:F.progress,showLegend:!0}),s.jsx("div",{className:"flex flex-wrap gap-2",children:F.tags.map(H=>s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:H},H))}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("p",{className:"text-muted-foreground",children:"Needs attention"}),s.jsx("p",{className:"mt-1 font-semibold text-foreground",children:F.needsAttention.blockedCount+F.needsAttention.failedCount})]}),s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("p",{className:"text-muted-foreground",children:"Assignments"}),s.jsx("p",{className:"mt-1 font-semibold text-foreground",children:F.progress.total})]})]})]})]},F.slug))}):T==="table"?s.jsx(Ve,{title:`${$.length} project${$.length===1?"":"s"}`,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[s.jsx("th",{className:"pb-3 font-medium",children:"Project"}),s.jsx("th",{className:"pb-3 font-medium",children:"Status"}),s.jsx("th",{className:"pb-3 font-medium",children:"Progress"}),s.jsx("th",{className:"pb-3 font-medium",children:"Attention"}),s.jsx("th",{className:"pb-3 font-medium",children:"Updated"})]})}),s.jsx("tbody",{children:$.map((F,Y)=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",...W(Y),children:[s.jsxs("td",{className:"py-4 pr-4",children:[s.jsx(_e,{to:`${t}/projects/${F.slug}`,className:"font-semibold text-foreground hover:text-primary",children:F.title}),s.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:F.tags.map(H=>s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:H},H))})]}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx(ro,{status:F.status})}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx("div",{className:"min-w-[220px]",children:s.jsx(Mh,{progress:F.progress})})}),s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:F.needsAttention.blockedCount+F.needsAttention.failedCount}),s.jsx("td",{className:"py-4 text-muted-foreground",children:Xn(F.updated)})]},F.slug))})]})})}):s.jsx(Hm,{columns:sS,items:U,getItemId:F=>F.slug,getColumnId:F=>F.status,canDrop:({fromColumnId:F,toColumnId:Y})=>({allowed:!0,reason:F===Y?void 0:"This will set a manual status override on the project."}),onMove:async({item:F,fromColumnId:Y,toColumnId:H,fromIndex:Q,toIndex:J})=>{var Z;if(Y===H){const oe=I[Y]??$.filter(te=>te.status===Y).map(te=>te.slug);_(te=>({...te,[Y]:NV(oe,Q,J)}));return}try{const oe=await fetch(`/api/projects/${F.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:H})});if(!oe.ok){const ue=await oe.json().catch(()=>null);u((ue==null?void 0:ue.error)||`HTTP ${oe.status}`,"error");return}a();const te=((Z=sS.find(ue=>ue.id===H))==null?void 0:Z.title)??H;u(`Moved "${F.title}" to ${te}`,"success")}catch(oe){u(oe instanceof Error?oe.message:"Failed to move project","error")}},getExternalDragData:F=>({type:"project",id:F.slug}),onCardContextMenu:(F,Y)=>{Y.preventDefault(),O({project:F,anchor:{x:Y.clientX,y:Y.clientY}})},emptyMessage:F=>`No ${F.title.toLowerCase()} projects.`,renderCard:(F,{dragging:Y})=>{const H=D.get(F.slug)??-1;return s.jsx("div",{...H>=0?W(H):{},children:s.jsx(AV,{project:F,dragging:Y})})}}),s.jsx(CP,{anchor:(z==null?void 0:z.anchor)??null,items:z?[{key:"edit",label:"Edit",icon:jc,onSelect:()=>n(`${t}/projects/${z.project.slug}`)},{key:"move",label:"Move to workspace…",icon:am,onSelect:()=>V(z.project)}]:[],onClose:()=>O(null)}),s.jsx(c0,{open:B!==null,onOpenChange:F=>{F||V(null)},currentWorkspace:(B==null?void 0:B.workspace)??null,title:"Move project to workspace",onSubmit:async F=>{if(!B)return;const Y=await fetch(`/api/projects/${encodeURIComponent(B.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:F})});if(!Y.ok){const H=await Y.json().catch(()=>({}));throw new Error(H.error||"Failed to move project")}a()}}),s.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Qv,{className:"mt-0.5 h-4 w-4"}),s.jsxs("p",{children:["Project status is derived from assignment state by default.",T==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const EV={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},sS=l0.map(e=>({id:e,title:EV[e],description:Qd(e)}));function TV(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return oS(t)-oS(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function oS(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function RV(e){return Object.fromEntries(l0.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function AV({project:e,dragging:t}){const n=xn();return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(_e,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Xn(e.updated)]})]}),s.jsx(ro,{status:e.status})]}),s.jsx("div",{className:"mt-4",children:s.jsx(Mh,{progress:e.progress})}),s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.tags.map(r=>s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:r},r)),s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.progress.total," assignments"]}),s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.needsAttention.blockedCount+e.needsAttention.failedCount," needs attention"]})]}),s.jsx("div",{className:"mt-4 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:t?"Reordering within status":"Derived project lane"})]})}function Lh({title:e,description:t,actions:n,className:r}){return s.jsxs("div",{className:be("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",r),children:[s.jsxs("div",{className:"space-y-1",children:[e?s.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?s.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?s.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}function PV(){return s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-status-archived-foreground/30 bg-status-archived px-2 py-0.5 text-xs font-medium text-status-archived-foreground",children:[s.jsx(im,{className:"h-3 w-3"}),"Archived"]})}function iS(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function _V(){const{data:e,loading:t,error:n,refetch:r}=uO(),[o,i]=m.useState(null),[a,l]=m.useState(null),[u,f]=m.useState({}),{toast:p,showToast:h,dismissToast:g}=Tn();async function y(N,C,R){i(C),l(null);try{const T=await fetch(N,{method:"POST",headers:{"Content-Type":"application/json"}});if(!T.ok){const A=await T.json().catch(()=>null);throw new Error((A==null?void 0:A.error)||`HTTP ${T.status}`)}r(),h(R,"success")}catch(T){l(T instanceof Error?T.message:"Restore failed")}finally{i(null)}}function k(N){return y(`/api/projects/${N.slug}/unarchive`,`project:${N.slug}`,"Project restored")}function v(N){const C=N.projectSlug?`/api/projects/${N.projectSlug}/assignments/${N.slug}/unarchive`:`/api/assignments/${N.id}/unarchive`;return y(C,`assignment:${N.id}`,"Assignment restored")}if(t)return s.jsx(bt,{label:"Loading archived content…"});if(n)return s.jsx(Rt,{error:n});const b=(e==null?void 0:e.projects)??[],w=(e==null?void 0:e.assignments)??[],S=b.length===0&&w.length===0;return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Nn,{toast:p,onDismiss:g}),s.jsx(Lh,{title:"Archive",description:"Archived projects and individually-archived assignments. Restoring a project also brings back its cascade-hidden assignments; assignments archived on their own stay archived until restored here."}),a?s.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:a}):null,S?s.jsx(Nt,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):s.jsxs(s.Fragment,{children:[b.length>0&&s.jsx(Ve,{title:"Archived Projects",description:"Restoring a project unhides every cascade-hidden assignment; individually-archived children stay archived.",children:s.jsx("ul",{className:"divide-y divide-border",children:b.map(N=>{const C=u[N.slug]??!1;return s.jsxs("li",{className:"py-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs("button",{type:"button",onClick:()=>f(R=>({...R,[N.slug]:!C})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":C,children:[C?s.jsx(tr,{className:"h-4 w-4"}):s.jsx(Gv,{className:"h-4 w-4"}),s.jsx(Yv,{className:"h-4 w-4 text-muted-foreground"}),N.title,s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",N.assignments.length," assignment",N.assignments.length===1?"":"s",")"]})]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",N.archivedAt?Sr(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx(_e,{to:`/projects/${N.slug}`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Open"}),s.jsxs("button",{type:"button",onClick:()=>k(N),disabled:o===`project:${N.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[s.jsx(uh,{className:"h-3 w-3"}),"Restore"]})]})]}),C&&N.assignments.length>0&&s.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:N.assignments.map(R=>s.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx(_e,{to:iS(R),className:"text-foreground hover:text-foreground/80",children:R.title}),s.jsx(ro,{status:R.status,showIcon:!1}),s.jsx("span",{className:"text-xs text-muted-foreground",children:R.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},R.id))})]},N.slug)})})}),w.length>0&&s.jsx(Ve,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:s.jsx("ul",{className:"divide-y divide-border",children:w.map(N=>s.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[s.jsx(_e,{to:iS(N),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:N.title}),s.jsx(ro,{status:N.status,showIcon:!1}),s.jsx(PV,{}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.projectTitle??"Standalone"," · Archived"," ",N.archivedAt?Sr(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),s.jsxs("button",{type:"button",onClick:()=>v(N),disabled:o===`assignment:${N.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[s.jsx(uh,{className:"h-3 w-3"}),"Restore"]})]},N.id))})})]})]})}const aS="inline-flex max-w-[14rem] items-center gap-1 whitespace-nowrap rounded-full border px-2 py-0.5 text-[11px] font-semibold tracking-wide border-border/60 text-muted-foreground",lS="block min-w-0 truncate";function EP({externalIds:e,className:t}){return e.length===0?null:s.jsx("span",{className:be("flex flex-wrap items-center gap-1.5",t),children:e.map((n,r)=>{const o=`${n.system}:${n.id}`,i=`${n.system}:${n.id}:${r}`;return n.url!=null&&n.url.length>0?s.jsxs("a",{href:n.url??void 0,target:"_blank",rel:"noopener noreferrer",className:be(aS,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[s.jsx("span",{className:lS,children:o}),s.jsx(vc,{className:"h-2.5 w-2.5 shrink-0"})]},i):s.jsx("span",{className:aS,title:o,children:s.jsx("span",{className:lS,children:o})},i)})})}const DV={default:"chrome-card",info:"rounded-lg border border-primary/30 bg-primary/5 p-3 dark:border-primary/40 dark:bg-primary/10",warn:"rounded-lg border border-warning-foreground/30 bg-warning p-3",danger:"rounded-lg border border-error-foreground/30 bg-error p-3",success:"rounded-lg border border-success-foreground/30 bg-success p-3"};function Yn({label:e,value:t,description:n,icon:r,tone:o="default",to:i}){const a=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),s.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),r?s.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:s.jsx(r,{className:"h-5 w-5"})}):null]}),n?s.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),f=be(DV[(t===0||t==="0")&&(o==="warn"||o==="danger")?"default":o],i?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return i?s.jsx(_e,{to:i,className:f,children:a}):s.jsx("article",{className:f,children:a})}function cS(e){const t=$V(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),u=l.find(MV);if(u){const f=u.props.children,p=l.map(h=>h===u?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return s.jsx(t,{...a,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,p):null})}return s.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function $V(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=OV(o),l=LV(i,o.props);return o.type!==m.Fragment&&(l.ref=r?bm(r,a):a),m.cloneElement(o,l)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var IV=Symbol("radix.slottable");function MV(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===IV}function LV(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const u=i(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function OV(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function FV(e){const t=e+"CollectionProvider",[n,r]=Aa(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:b,children:w}=v,S=Ot.useRef(null),N=Ot.useRef(new Map).current;return s.jsx(o,{scope:b,itemMap:N,collectionRef:S,children:w})};a.displayName=t;const l=e+"CollectionSlot",u=cS(l),f=Ot.forwardRef((v,b)=>{const{scope:w,children:S}=v,N=i(l,w),C=nr(b,N.collectionRef);return s.jsx(u,{ref:C,children:S})});f.displayName=l;const p=e+"CollectionItemSlot",h="data-radix-collection-item",g=cS(p),y=Ot.forwardRef((v,b)=>{const{scope:w,children:S,...N}=v,C=Ot.useRef(null),R=nr(b,C),T=i(p,w);return Ot.useEffect(()=>(T.itemMap.set(C,{ref:C,...N}),()=>void T.itemMap.delete(C))),s.jsx(g,{[h]:"",ref:R,children:S})});y.displayName=p;function k(v){const b=i(e+"CollectionConsumer",v);return Ot.useCallback(()=>{const S=b.collectionRef.current;if(!S)return[];const N=Array.from(S.querySelectorAll(`[${h}]`));return Array.from(b.itemMap.values()).sort((T,A)=>N.indexOf(T.ref.current)-N.indexOf(A.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:f,ItemSlot:y},k,r]}var zV=m.createContext(void 0);function TP(e){const t=m.useContext(zV);return e||t||"ltr"}var _y="rovingFocusGroup.onEntryFocus",BV={bubbles:!1,cancelable:!0},Zd="RovingFocusGroup",[sv,RP,UV]=FV(Zd),[HV,AP]=Aa(Zd,[UV]),[VV,WV]=HV(Zd),PP=m.forwardRef((e,t)=>s.jsx(sv.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(sv.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(KV,{...e,ref:t})})}));PP.displayName=Zd;var KV=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...h}=e,g=m.useRef(null),y=nr(t,g),k=TP(i),[v,b]=vm({prop:a,defaultProp:l??null,onChange:u,caller:Zd}),[w,S]=m.useState(!1),N=wa(f),C=RP(n),R=m.useRef(!1),[T,A]=m.useState(0);return m.useEffect(()=>{const I=g.current;if(I)return I.addEventListener(_y,N),()=>I.removeEventListener(_y,N)},[N]),s.jsx(VV,{scope:n,orientation:r,dir:k,loop:o,currentTabStopId:v,onItemFocus:m.useCallback(I=>b(I),[b]),onItemShiftTab:m.useCallback(()=>S(!0),[]),onFocusableItemAdd:m.useCallback(()=>A(I=>I+1),[]),onFocusableItemRemove:m.useCallback(()=>A(I=>I-1),[]),children:s.jsx(Sn.div,{tabIndex:w||T===0?-1:0,"data-orientation":r,...h,ref:y,style:{outline:"none",...e.style},onMouseDown:sn(e.onMouseDown,()=>{R.current=!0}),onFocus:sn(e.onFocus,I=>{const _=!R.current;if(I.target===I.currentTarget&&_&&!w){const z=new CustomEvent(_y,BV);if(I.currentTarget.dispatchEvent(z),!z.defaultPrevented){const O=C().filter(U=>U.focusable),B=O.find(U=>U.active),V=O.find(U=>U.id===v),L=[B,V,...O].filter(Boolean).map(U=>U.ref.current);$P(L,p)}}R.current=!1}),onBlur:sn(e.onBlur,()=>S(!1))})})}),_P="RovingFocusGroupItem",DP=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:a,...l}=e,u=Bl(),f=i||u,p=WV(_P,n),h=p.currentTabStopId===f,g=RP(n),{onFocusableItemAdd:y,onFocusableItemRemove:k,currentTabStopId:v}=p;return m.useEffect(()=>{if(r)return y(),()=>k()},[r,y,k]),s.jsx(sv.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:s.jsx(Sn.span,{tabIndex:h?0:-1,"data-orientation":p.orientation,...l,ref:t,onMouseDown:sn(e.onMouseDown,b=>{r?p.onItemFocus(f):b.preventDefault()}),onFocus:sn(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:sn(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){p.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const w=YV(b,p.orientation,p.dir);if(w!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let N=g().filter(C=>C.focusable).map(C=>C.ref.current);if(w==="last")N.reverse();else if(w==="prev"||w==="next"){w==="prev"&&N.reverse();const C=N.indexOf(b.currentTarget);N=p.loop?XV(N,C+1):N.slice(C+1)}setTimeout(()=>$P(N))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:v!=null}):a})})});DP.displayName=_P;var qV={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function GV(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function YV(e,t,n){const r=GV(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return qV[r]}function $P(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function XV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var QV=PP,JV=DP,Ym="Tabs",[ZV]=Aa(Ym,[AP]),IP=AP(),[eW,u0]=ZV(Ym),MP=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:u="automatic",...f}=e,p=TP(l),[h,g]=vm({prop:r,onChange:o,defaultProp:i??"",caller:Ym});return s.jsx(eW,{scope:n,baseId:Bl(),value:h,onValueChange:g,orientation:a,dir:p,activationMode:u,children:s.jsx(Sn.div,{dir:p,"data-orientation":a,...f,ref:t})})});MP.displayName=Ym;var LP="TabsList",OP=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=u0(LP,n),a=IP(n);return s.jsx(QV,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Sn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});OP.displayName=LP;var FP="TabsTrigger",zP=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,a=u0(FP,n),l=IP(n),u=HP(a.baseId,r),f=VP(a.baseId,r),p=r===a.value;return s.jsx(JV,{asChild:!0,...l,focusable:!o,active:p,children:s.jsx(Sn.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...i,ref:t,onMouseDown:sn(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?a.onValueChange(r):h.preventDefault()}),onKeyDown:sn(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&a.onValueChange(r)}),onFocus:sn(e.onFocus,()=>{const h=a.activationMode!=="manual";!p&&!o&&h&&a.onValueChange(r)})})})});zP.displayName=FP;var BP="TabsContent",UP=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...a}=e,l=u0(BP,n),u=HP(l.baseId,r),f=VP(l.baseId,r),p=r===l.value,h=m.useRef(p);return m.useEffect(()=>{const g=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(Pa,{present:o||p,children:({present:g})=>s.jsx(Sn.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:f,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:g&&i})})});UP.displayName=BP;function HP(e,t){return`${e}-trigger-${t}`}function VP(e,t){return`${e}-content-${t}`}var WP=MP,KP=OP,ov=zP,iv=UP;function Xm({value:e,onValueChange:t,items:n,className:r}){const o=m.useRef(null),[i,a]=m.useState(!1),l=m.useCallback(()=>{const u=o.current;u&&a(u.scrollLeft+u.clientWidth<u.scrollWidth-1)},[]);return m.useEffect(()=>{const u=o.current;if(!u)return;l(),u.addEventListener("scroll",l,{passive:!0});const f=new ResizeObserver(l);return f.observe(u),()=>{u.removeEventListener("scroll",l),f.disconnect()}},[l,n.length]),s.jsxs(WP,{value:e,onValueChange:t,className:r,children:[s.jsxs("div",{className:"relative",children:[s.jsx(KP,{ref:o,className:"flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(u=>s.jsxs(ov,{value:u.value,className:be("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:[s.jsx("span",{children:u.label}),typeof u.count=="number"?s.jsx("span",{className:"rounded-full bg-background/20 px-2 py-0.5 text-xs data-[state=active]:bg-background/20",children:u.count}):null,u.problemCount&&u.problemCount>0?s.jsx("span",{className:"rounded-full bg-destructive/15 px-2 py-0.5 text-xs text-destructive","aria-label":`${u.problemCount} ${u.problemCount===1?"error":"errors"}`,title:`${u.problemCount} ${u.problemCount===1?"error":"errors"}`,children:u.problemCount}):null]},u.value))}),i?s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 w-8 rounded-r-md bg-gradient-to-l from-card to-transparent"}):null]}),n.map(u=>s.jsx(iv,{value:u.value,className:"pt-3",children:u.content},u.value))]})}const tW="modulepreload",nW=function(e){return"/"+e},uS={},rW=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let a=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=a(n.map(f=>{if(f=nW(f),f in uS)return;uS[f]=!0;const p=f.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${h}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":tW,p||(g.as="script"),g.crossOrigin="",g.href=f,u&&g.setAttribute("nonce",u),document.head.appendChild(g),p)return new Promise((y,k)=>{g.addEventListener("load",y),g.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return o.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function sW({definition:e,className:t,nodeRoutes:n={}}){const r=m.useRef(null),[o,i]=m.useState(null),[a,l]=m.useState(!0),u=Wt(),f=document.documentElement.classList.contains("dark")?"dark":"default";return m.useEffect(()=>{let p=!1;async function h(){if(r.current)try{const g=(await rW(async()=>{const{default:v}=await import("./mermaid.core-B_8IjgQO.js").then(b=>b.bs);return{default:v}},[])).default;if(g.initialize({startOnLoad:!1,theme:"base",themeVariables:oW(f==="dark")}),p)return;const y=`mermaid-${Date.now()}`,{svg:k}=await g.render(y,e);if(p||!r.current)return;r.current.innerHTML=k,iW(r.current,n,u),l(!1)}catch(g){p||(i(g instanceof Error?g.message:"Failed to render graph"),l(!1))}}return l(!0),i(null),h(),()=>{p=!0}},[e,u,n,f]),o?s.jsxs("div",{className:be("rounded-lg border border-border bg-card p-4",t),children:[s.jsxs("p",{className:"text-sm text-error-foreground",children:["Failed to render dependency graph: ",o]}),s.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):s.jsxs("div",{className:be("rounded-lg border border-border bg-card p-4",t),children:[a&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),s.jsx("div",{ref:r,className:"overflow-auto"})]})}function oW(e){const t=document.documentElement,n=h=>{const g=getComputedStyle(t).getPropertyValue(h).trim();return g?`oklch(${g})`:""},r=n("--card"),o=n("--card-foreground"),i=n("--border"),a=n("--primary"),l=n("--primary-foreground"),u=n("--muted"),f=n("--muted-foreground"),p=n("--secondary");return{background:r,primaryColor:r,primaryTextColor:o,primaryBorderColor:i,secondaryColor:u,secondaryTextColor:o,secondaryBorderColor:i,tertiaryColor:u,tertiaryTextColor:f,tertiaryBorderColor:i,lineColor:e?f:i,textColor:o,mainBkg:r,nodeBkg:r,nodeTextColor:o,nodeBorder:i,clusterBkg:u,clusterBorder:i,edgeLabelBackground:r,titleColor:o,activeTaskBkgColor:a,activeTaskBorderColor:a,altBackground:u,labelColor:o,errorBkgColor:p,errorTextColor:l}}function iW(e,t,n){var r;for(const o of e.querySelectorAll(".node")){const i=((r=o.textContent)==null?void 0:r.replace(/\s+/g," ").trim())??"",a=t[i];if(!a)continue;o.style.cursor="pointer",o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",`Open ${i}`);const l=()=>n(a);o.addEventListener("click",l),o.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),l())})}}function aW(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const lW=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cW=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uW={};function dS(e,t){return(uW.jsx?cW:lW).test(e)}const dW=/[ \t\n\f\r]/g;function fW(e){return typeof e=="object"?e.type==="text"?fS(e.value):!1:fS(e)}function fS(e){return e.replace(dW,"")===""}class ef{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ef.prototype.normal={};ef.prototype.property={};ef.prototype.space=void 0;function qP(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new ef(n,r,t)}function av(e){return e.toLowerCase()}class Cr{constructor(t,n){this.attribute=n,this.property=t}}Cr.prototype.attribute="";Cr.prototype.booleanish=!1;Cr.prototype.boolean=!1;Cr.prototype.commaOrSpaceSeparated=!1;Cr.prototype.commaSeparated=!1;Cr.prototype.defined=!1;Cr.prototype.mustUseProperty=!1;Cr.prototype.number=!1;Cr.prototype.overloadedBoolean=!1;Cr.prototype.property="";Cr.prototype.spaceSeparated=!1;Cr.prototype.space=void 0;let pW=0;const kt=Da(),wn=Da(),lv=Da(),Me=Da(),Gt=Da(),Yl=Da(),Dr=Da();function Da(){return 2**++pW}const cv=Object.freeze(Object.defineProperty({__proto__:null,boolean:kt,booleanish:wn,commaOrSpaceSeparated:Dr,commaSeparated:Yl,number:Me,overloadedBoolean:lv,spaceSeparated:Gt},Symbol.toStringTag,{value:"Module"})),Dy=Object.keys(cv);class d0 extends Cr{constructor(t,n,r,o){let i=-1;if(super(t,n),pS(this,"space",o),typeof r=="number")for(;++i<Dy.length;){const a=Dy[i];pS(this,Dy[i],(r&cv[a])===cv[a])}}}d0.prototype.defined=!0;function pS(e,t,n){n&&(e[t]=n)}function $c(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new d0(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[av(r)]=r,n[av(i.attribute)]=r}return new ef(t,n,e.space)}const GP=$c({properties:{ariaActiveDescendant:null,ariaAtomic:wn,ariaAutoComplete:null,ariaBusy:wn,ariaChecked:wn,ariaColCount:Me,ariaColIndex:Me,ariaColSpan:Me,ariaControls:Gt,ariaCurrent:null,ariaDescribedBy:Gt,ariaDetails:null,ariaDisabled:wn,ariaDropEffect:Gt,ariaErrorMessage:null,ariaExpanded:wn,ariaFlowTo:Gt,ariaGrabbed:wn,ariaHasPopup:null,ariaHidden:wn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Gt,ariaLevel:Me,ariaLive:null,ariaModal:wn,ariaMultiLine:wn,ariaMultiSelectable:wn,ariaOrientation:null,ariaOwns:Gt,ariaPlaceholder:null,ariaPosInSet:Me,ariaPressed:wn,ariaReadOnly:wn,ariaRelevant:null,ariaRequired:wn,ariaRoleDescription:Gt,ariaRowCount:Me,ariaRowIndex:Me,ariaRowSpan:Me,ariaSelected:wn,ariaSetSize:Me,ariaSort:null,ariaValueMax:Me,ariaValueMin:Me,ariaValueNow:Me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function YP(e,t){return t in e?e[t]:t}function XP(e,t){return YP(e,t.toLowerCase())}const hW=$c({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Yl,acceptCharset:Gt,accessKey:Gt,action:null,allow:null,allowFullScreen:kt,allowPaymentRequest:kt,allowUserMedia:kt,alt:null,as:null,async:kt,autoCapitalize:null,autoComplete:Gt,autoFocus:kt,autoPlay:kt,blocking:Gt,capture:null,charSet:null,checked:kt,cite:null,className:Gt,cols:Me,colSpan:null,content:null,contentEditable:wn,controls:kt,controlsList:Gt,coords:Me|Yl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kt,defer:kt,dir:null,dirName:null,disabled:kt,download:lv,draggable:wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kt,formTarget:null,headers:Gt,height:Me,hidden:lv,high:Me,href:null,hrefLang:null,htmlFor:Gt,httpEquiv:Gt,id:null,imageSizes:null,imageSrcSet:null,inert:kt,inputMode:null,integrity:null,is:null,isMap:kt,itemId:null,itemProp:Gt,itemRef:Gt,itemScope:kt,itemType:Gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kt,low:Me,manifest:null,max:null,maxLength:Me,media:null,method:null,min:null,minLength:Me,multiple:kt,muted:kt,name:null,nonce:null,noModule:kt,noValidate:kt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:kt,optimum:Me,pattern:null,ping:Gt,placeholder:null,playsInline:kt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kt,referrerPolicy:null,rel:Gt,required:kt,reversed:kt,rows:Me,rowSpan:Me,sandbox:Gt,scope:null,scoped:kt,seamless:kt,selected:kt,shadowRootClonable:kt,shadowRootDelegatesFocus:kt,shadowRootMode:null,shape:null,size:Me,sizes:null,slot:null,span:Me,spellCheck:wn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Me,step:null,style:null,tabIndex:Me,target:null,title:null,translate:null,type:null,typeMustMatch:kt,useMap:null,value:wn,width:Me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Gt,axis:null,background:null,bgColor:null,border:Me,borderColor:null,bottomMargin:Me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kt,declare:kt,event:null,face:null,frame:null,frameBorder:null,hSpace:Me,leftMargin:Me,link:null,longDesc:null,lowSrc:null,marginHeight:Me,marginWidth:Me,noResize:kt,noHref:kt,noShade:kt,noWrap:kt,object:null,profile:null,prompt:null,rev:null,rightMargin:Me,rules:null,scheme:null,scrolling:wn,standby:null,summary:null,text:null,topMargin:Me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kt,disableRemotePlayback:kt,prefix:null,property:null,results:Me,security:null,unselectable:null},space:"html",transform:XP}),mW=$c({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Dr,accentHeight:Me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Me,amplitude:Me,arabicForm:null,ascent:Me,attributeName:null,attributeType:null,azimuth:Me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Me,by:null,calcMode:null,capHeight:Me,className:Gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Me,diffuseConstant:Me,direction:null,display:null,dur:null,divisor:Me,dominantBaseline:null,download:kt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Me,enableBackground:null,end:null,event:null,exponent:Me,externalResourcesRequired:null,fill:null,fillOpacity:Me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Yl,g2:Yl,glyphName:Yl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Me,horizOriginX:Me,horizOriginY:Me,id:null,ideographic:Me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Me,k:Me,k1:Me,k2:Me,k3:Me,k4:Me,kernelMatrix:Dr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Me,overlineThickness:Me,paintOrder:null,panose1:null,path:null,pathLength:Me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Me,pointsAtY:Me,pointsAtZ:Me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Dr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Dr,rev:Dr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Dr,requiredFeatures:Dr,requiredFonts:Dr,requiredFormats:Dr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Me,specularExponent:Me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Me,strikethroughThickness:Me,string:null,stroke:null,strokeDashArray:Dr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Me,strokeOpacity:Me,strokeWidth:null,style:null,surfaceScale:Me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Dr,tabIndex:Me,tableValues:null,target:null,targetX:Me,targetY:Me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Dr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Me,underlineThickness:Me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Me,values:null,vAlphabetic:Me,vMathematical:Me,vectorEffect:null,vHanging:Me,vIdeographic:Me,version:null,vertAdvY:Me,vertOriginX:Me,vertOriginY:Me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:YP}),QP=$c({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),JP=$c({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:XP}),ZP=$c({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),gW={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},xW=/[A-Z]/g,hS=/-[a-z]/g,yW=/^data[-\w.:]+$/i;function bW(e,t){const n=av(t);let r=t,o=Cr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&yW.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(hS,wW);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!hS.test(i)){let a=i.replace(xW,vW);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}o=d0}return new o(r,t)}function vW(e){return"-"+e.toLowerCase()}function wW(e){return e.charAt(1).toUpperCase()}const jW=qP([GP,hW,QP,JP,ZP],"html"),f0=qP([GP,mW,QP,JP,ZP],"svg");function kW(e){return e.join(" ").trim()}var jl={},$y,mS;function NW(){if(mS)return $y;mS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
636
|
+
`,f="/",p="*",h="",g="comment",y="declaration";function k(b,w){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];w=w||{};var S=1,N=1;function C($){var L=$.match(t);L&&(S+=L.length);var U=$.lastIndexOf(u);N=~U?$.length-U:N+$.length}function R(){var $={line:S,column:N};return function(L){return L.position=new T($),_(),L}}function T($){this.start=$,this.end={line:S,column:N},this.source=w.source}T.prototype.content=b;function A($){var L=new Error(w.source+":"+S+":"+N+": "+$);if(L.reason=$,L.filename=w.source,L.line=S,L.column=N,L.source=b,!w.silent)throw L}function I($){var L=$.exec(b);if(L){var U=L[0];return C(U),b=b.slice(U.length),L}}function _(){I(n)}function z($){var L;for($=$||[];L=O();)L!==!1&&$.push(L);return $}function O(){var $=R();if(!(f!=b.charAt(0)||p!=b.charAt(1))){for(var L=2;h!=b.charAt(L)&&(p!=b.charAt(L)||f!=b.charAt(L+1));)++L;if(L+=2,h===b.charAt(L-1))return A("End of comment missing");var U=b.slice(2,L-2);return N+=2,C(U),b=b.slice(L),N+=2,$({type:g,comment:U})}}function B(){var $=R(),L=I(r);if(L){if(O(),!I(o))return A("property missing ':'");var U=I(i),K=$({type:y,property:v(L[0].replace(e,h)),value:U?v(U[0].replace(e,h)):h});return I(a),K}}function V(){var $=[];z($);for(var L;L=B();)L!==!1&&($.push(L),z($));return $}return _(),V()}function v(b){return b?b.replace(l,h):h}return $y=k,$y}var gS;function SW(){if(gS)return jl;gS=1;var e=jl&&jl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(jl,"__esModule",{value:!0}),jl.default=n;const t=e(NW());function n(r,o){let i=null;if(!r||typeof r!="string")return i;const a=(0,t.default)(r),l=typeof o=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:p}=u;l?o(f,p,u):p&&(i=i||{},i[f]=p)}),i}return jl}var Nu={},xS;function CW(){if(xS)return Nu;xS=1,Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(f){return!f||n.test(f)||e.test(f)},a=function(f,p){return p.toUpperCase()},l=function(f,p){return"".concat(p,"-")},u=function(f,p){return p===void 0&&(p={}),i(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(o,l):f=f.replace(r,l),f.replace(t,a))};return Nu.camelCase=u,Nu}var Su,yS;function EW(){if(yS)return Su;yS=1;var e=Su&&Su.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(SW()),n=CW();function r(o,i){var a={};return!o||typeof o!="string"||(0,t.default)(o,function(l,u){l&&u&&(a[(0,n.camelCase)(l,i)]=u)}),a}return r.default=r,Su=r,Su}var TW=EW();const RW=Dd(TW),e3=t3("end"),p0=t3("start");function t3(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function AW(e){const t=p0(e),n=e3(e);if(t&&n)return{start:t,end:n}}function Ju(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?bS(e.position):"start"in e||"end"in e?bS(e):"line"in e||"column"in e?uv(e):""}function uv(e){return vS(e&&e.line)+":"+vS(e&&e.column)}function bS(e){return uv(e&&e.start)+"-"+uv(e&&e.end)}function vS(e){return e&&typeof e=="number"?e:1}class or extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(a=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?i.ruleId=r:(i.source=r.slice(0,u),i.ruleId=r.slice(u+1))}if(!i.place&&i.ancestors&&i.ancestors){const u=i.ancestors[i.ancestors.length-1];u&&(i.place=u.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=l?l.line:void 0,this.name=Ju(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}or.prototype.file="";or.prototype.name="";or.prototype.reason="";or.prototype.message="";or.prototype.stack="";or.prototype.column=void 0;or.prototype.line=void 0;or.prototype.ancestors=void 0;or.prototype.cause=void 0;or.prototype.fatal=void 0;or.prototype.place=void 0;or.prototype.ruleId=void 0;or.prototype.source=void 0;const h0={}.hasOwnProperty,PW=new Map,_W=/[A-Z]/g,DW=new Set(["table","tbody","thead","tfoot","tr"]),$W=new Set(["td","th"]),n3="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function IW(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=HW(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=UW(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?f0:jW,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=r3(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function r3(e,t,n){if(t.type==="element")return MW(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return LW(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return FW(e,t,n);if(t.type==="mdxjsEsm")return OW(e,t);if(t.type==="root")return zW(e,t,n);if(t.type==="text")return BW(e,t)}function MW(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=f0,e.schema=o),e.ancestors.push(t);const i=o3(e,t.tagName,!1),a=VW(e,t);let l=g0(e,t);return DW.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!fW(u):!0})),s3(e,a,i,t),m0(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function LW(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}bd(e,t.position)}function OW(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);bd(e,t.position)}function FW(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=f0,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:o3(e,t.name,!0),a=WW(e,t),l=g0(e,t);return s3(e,a,i,t),m0(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function zW(e,t,n){const r={};return m0(r,g0(e,t)),e.create(t,e.Fragment,r,n)}function BW(e,t){return t.value}function s3(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function m0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function UW(e,t,n){return r;function r(o,i,a,l){const f=Array.isArray(a.children)?n:t;return l?f(i,a,l):f(i,a)}}function HW(e,t){return n;function n(r,o,i,a){const l=Array.isArray(i.children),u=p0(r);return t(o,i,a,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function VW(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&h0.call(t.properties,o)){const i=KW(e,o,t.properties[o]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&$W.has(t.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function WW(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else bd(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else bd(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function g0(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:PW;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const u=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(u){const f=o.get(u)||0;a=u+"-"+f,o.set(u,f+1)}}const l=r3(e,i,a);l!==void 0&&n.push(l)}return n}function KW(e,t,n){const r=bW(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?aW(n):kW(n)),r.property==="style"){let o=typeof n=="object"?n:qW(e,String(n));return e.stylePropertyNameCase==="css"&&(o=GW(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?gW[r.property]||r.property:r.attribute,n]}}function qW(e,t){try{return RW(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new or("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=n3+"#cannot-parse-style-attribute",o}}function o3(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,a;for(;++i<o.length;){const l=dS(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=dS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return h0.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);bd(e)}function bd(e,t){const n=new or("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=n3+"#cannot-handle-mdx-estrees-without-createevaluater",n}function GW(e){const t={};let n;for(n in e)h0.call(e,n)&&(t[YW(n)]=e[n]);return t}function YW(e){let t=e.replace(_W,XW);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function XW(e){return"-"+e.toLowerCase()}const Iy={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},QW={};function JW(e,t){const n=QW,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return i3(e,r,o)}function i3(e,t,n){if(ZW(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return wS(e.children,t,n)}return Array.isArray(e)?wS(e,t,n):""}function wS(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=i3(e[o],t,n);return r.join("")}function ZW(e){return!!(e&&typeof e=="object")}const jS=document.createElement("i");function x0(e){const t="&"+e+";";jS.innerHTML=t;const n=jS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function so(e,t,n,r){const o=e.length;let i=0,a;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function Zr(e,t){return e.length>0?(so(e,e.length,0,t),e):t}const kS={}.hasOwnProperty;function eK(e){const t={};let n=-1;for(;++n<e.length;)tK(t,e[n]);return t}function tK(e,t){let n;for(n in t){const o=(kS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){kS.call(o,a)||(o[a]=[]);const l=i[a];nK(o[a],Array.isArray(l)?l:l?[l]:[])}}}function nK(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);so(e,0,0,r)}function a3(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Xl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ys=Pi(/[A-Za-z]/),zr=Pi(/[\dA-Za-z]/),rK=Pi(/[#-'*+\--9=?A-Z^-~]/);function dv(e){return e!==null&&(e<32||e===127)}const fv=Pi(/\d/),sK=Pi(/[\dA-Fa-f]/),oK=Pi(/[!-/:-@[-`{-~]/);function xt(e){return e!==null&&e<-2}function kr(e){return e!==null&&(e<0||e===32)}function zt(e){return e===-2||e===-1||e===32}const iK=Pi(new RegExp("\\p{P}|\\p{S}","u")),aK=Pi(/\s/);function Pi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ic(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&zr(e.charCodeAt(n+1))&&zr(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),o=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+o+1,a=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Yt(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(u){return zt(u)?(e.enter(n),l(u)):t(u)}function l(u){return zt(u)&&i++<o?(e.consume(u),l):(e.exit(n),t(u))}}const lK={tokenize:cK};function cK(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Yt(e,t,"linePrefix")}function o(l){return e.enter("paragraph"),i(l)}function i(l){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return xt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const uK={tokenize:dK},NS={tokenize:fK};function dK(e){const t=this,n=[];let r=0,o,i,a;return l;function l(N){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,u,f)(N)}return f(N)}function u(N){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&S();const C=t.events.length;let R=C,T;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){T=t.events[R][1].end;break}w(r);let A=C;for(;A<t.events.length;)t.events[A][1].end={...T},A++;return so(t.events,R+1,0,t.events.slice(C)),t.events.length=A,f(N)}return l(N)}function f(N){if(r===n.length){if(!o)return g(N);if(o.currentConstruct&&o.currentConstruct.concrete)return k(N);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(NS,p,h)(N)}function p(N){return o&&S(),w(r),g(N)}function h(N){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,k(N)}function g(N){return t.containerState={},e.attempt(NS,y,k)(N)}function y(N){return r++,n.push([t.currentConstruct,t.containerState]),g(N)}function k(N){if(N===null){o&&S(),w(0),e.consume(N);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),v(N)}function v(N){if(N===null){b(e.exit("chunkFlow"),!0),w(0),e.consume(N);return}return xt(N)?(e.consume(N),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(N),v)}function b(N,C){const R=t.sliceStream(N);if(C&&R.push(null),N.previous=i,i&&(i.next=N),i=N,o.defineSkip(N.start),o.write(R),t.parser.lazy[N.start.line]){let T=o.events.length;for(;T--;)if(o.events[T][1].start.offset<a&&(!o.events[T][1].end||o.events[T][1].end.offset>a))return;const A=t.events.length;let I=A,_,z;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(_){z=t.events[I][1].end;break}_=!0}for(w(r),T=A;T<t.events.length;)t.events[T][1].end={...z},T++;so(t.events,I+1,0,t.events.slice(A)),t.events.length=T}}function w(N){let C=n.length;for(;C-- >N;){const R=n[C];t.containerState=R[1],R[0].exit.call(t,e)}n.length=N}function S(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function fK(e,t,n){return Yt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function SS(e){if(e===null||kr(e)||aK(e))return 1;if(iK(e))return 2}function y0(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const pv={name:"attention",resolveAll:pK,tokenize:hK};function pK(e,t){let n=-1,r,o,i,a,l,u,f,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},g={...e[n][1].start};CS(h,-u),CS(g,u),a={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},i={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:u>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Zr(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Zr(f,[["enter",o,t],["enter",a,t],["exit",a,t],["enter",i,t]]),f=Zr(f,y0(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=Zr(f,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=Zr(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,so(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function hK(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=SS(r);let i;return a;function a(u){return i=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===i)return e.consume(u),l;const f=e.exit("attentionSequence"),p=SS(u),h=!p||p===2&&o||n.includes(u),g=!o||o===2&&p||n.includes(r);return f._open=!!(i===42?h:h&&(o||!g)),f._close=!!(i===42?g:g&&(p||!h)),t(u)}}function CS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const mK={name:"autolink",tokenize:gK};function gK(e,t,n){let r=0;return o;function o(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(y){return Ys(y)?(e.consume(y),a):y===64?n(y):f(y)}function a(y){return y===43||y===45||y===46||zr(y)?(r=1,l(y)):f(y)}function l(y){return y===58?(e.consume(y),r=0,u):(y===43||y===45||y===46||zr(y))&&r++<32?(e.consume(y),l):(r=0,f(y))}function u(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||dv(y)?n(y):(e.consume(y),u)}function f(y){return y===64?(e.consume(y),p):rK(y)?(e.consume(y),f):n(y)}function p(y){return zr(y)?h(y):n(y)}function h(y){return y===46?(e.consume(y),r=0,p):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):g(y)}function g(y){if((y===45||zr(y))&&r++<63){const k=y===45?g:h;return e.consume(y),k}return n(y)}}const Qm={partial:!0,tokenize:xK};function xK(e,t,n){return r;function r(i){return zt(i)?Yt(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||xt(i)?t(i):n(i)}}const l3={continuation:{tokenize:bK},exit:vK,name:"blockQuote",tokenize:yK};function yK(e,t,n){const r=this;return o;function o(a){if(a===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return zt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function bK(e,t,n){const r=this;return o;function o(a){return zt(a)?Yt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(l3,t,n)(a)}}function vK(e){e.exit("blockQuote")}const c3={name:"characterEscape",tokenize:wK};function wK(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return oK(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const u3={name:"characterReference",tokenize:jK};function jK(e,t,n){const r=this;let o=0,i,a;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),u}function u(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),i=31,a=zr,p(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=sK,p):(e.enter("characterReferenceValue"),i=7,a=fv,p(h))}function p(h){if(h===59&&o){const g=e.exit("characterReferenceValue");return a===zr&&!x0(r.sliceSerialize(g))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(h)&&o++<i?(e.consume(h),p):n(h)}}const ES={partial:!0,tokenize:NK},TS={concrete:!0,name:"codeFenced",tokenize:kK};function kK(e,t,n){const r=this,o={partial:!0,tokenize:R};let i=0,a=0,l;return u;function u(T){return f(T)}function f(T){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(T)}function p(T){return T===l?(a++,e.consume(T),p):a<3?n(T):(e.exit("codeFencedFenceSequence"),zt(T)?Yt(e,h,"whitespace")(T):h(T))}function h(T){return T===null||xt(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(ES,v,C)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||xt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):zt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Yt(e,y,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),g)}function y(T){return T===null||xt(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(T))}function k(T){return T===null||xt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===l?n(T):(e.consume(T),k)}function v(T){return e.attempt(o,C,b)(T)}function b(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),w}function w(T){return i>0&&zt(T)?Yt(e,S,"linePrefix",i+1)(T):S(T)}function S(T){return T===null||xt(T)?e.check(ES,v,C)(T):(e.enter("codeFlowValue"),N(T))}function N(T){return T===null||xt(T)?(e.exit("codeFlowValue"),S(T)):(e.consume(T),N)}function C(T){return e.exit("codeFenced"),t(T)}function R(T,A,I){let _=0;return z;function z(L){return T.enter("lineEnding"),T.consume(L),T.exit("lineEnding"),O}function O(L){return T.enter("codeFencedFence"),zt(L)?Yt(T,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):B(L)}function B(L){return L===l?(T.enter("codeFencedFenceSequence"),V(L)):I(L)}function V(L){return L===l?(_++,T.consume(L),V):_>=a?(T.exit("codeFencedFenceSequence"),zt(L)?Yt(T,$,"whitespace")(L):$(L)):I(L)}function $(L){return L===null||xt(L)?(T.exit("codeFencedFence"),A(L)):I(L)}}}function NK(e,t,n){const r=this;return o;function o(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const My={name:"codeIndented",tokenize:CK},SK={partial:!0,tokenize:EK};function CK(e,t,n){const r=this;return o;function o(f){return e.enter("codeIndented"),Yt(e,i,"linePrefix",5)(f)}function i(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(f):n(f)}function a(f){return f===null?u(f):xt(f)?e.attempt(SK,a,u)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||xt(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),l)}function u(f){return e.exit("codeIndented"),t(f)}}function EK(e,t,n){const r=this;return o;function o(a){return r.parser.lazy[r.now().line]?n(a):xt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):Yt(e,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):xt(a)?o(a):n(a)}}const TK={name:"codeText",previous:AK,resolve:RK,tokenize:PK};function RK(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function AK(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function PK(e,t,n){let r=0,o,i;return a;function a(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),r++,l):(e.exit("codeTextSequence"),u(h))}function u(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),u):h===96?(i=e.enter("codeTextSequence"),o=0,p(h)):xt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||xt(h)?(e.exit("codeTextData"),u(h)):(e.consume(h),f)}function p(h){return h===96?(e.consume(h),o++,p):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",f(h))}}class _K{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&Cu(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Cu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Cu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Cu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Cu(this.left,n.reverse())}}}function Cu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function d3(e){const t={};let n=-1,r,o,i,a,l,u,f;const p=new _K(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,i=0,i<u.length&&u[i][1].type==="lineEndingBlank"&&(i+=2),i<u.length&&u[i][1].type==="content"))for(;++i<u.length&&u[i][1].type!=="content";)u[i][1].type==="chunkText"&&(u[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,DK(p,n)),n=t[n],f=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(a=p.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(o&&(p.get(o)[1].type="lineEndingBlank"),a[1].type="lineEnding",o=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;o&&(r[1].end={...p.get(o)[1].start},l=p.slice(o,n),l.unshift(r),p.splice(o,n-o+1,l))}}return so(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function DK(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,u=[],f={};let p,h,g=-1,y=n,k=0,v=0;const b=[v];for(;y;){for(;e.get(++o)[1]!==y;);i.push(o),y._tokenizer||(p=r.sliceStream(y),y.next||p.push(null),h&&a.defineSkip(y.start),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=y,y=y.next}for(y=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(v=g+1,b.push(v),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(a.events=[],y?(y._tokenizer=void 0,y.previous=void 0):b.pop(),g=b.length;g--;){const w=l.slice(b[g],b[g+1]),S=i.pop();u.push([S,S+w.length-1]),e.splice(S,2,w)}for(u.reverse(),g=-1;++g<u.length;)f[k+u[g][0]]=k+u[g][1],k+=u[g][1]-u[g][0]-1;return f}const $K={resolve:MK,tokenize:LK},IK={partial:!0,tokenize:OK};function MK(e){return d3(e),e}function LK(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(l)}function o(l){return l===null?i(l):xt(l)?e.check(IK,a,i)(l):(e.consume(l),o)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function OK(e,t,n){const r=this;return o;function o(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Yt(e,i,"linePrefix")}function i(a){if(a===null||xt(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function f3(e,t,n,r,o,i,a,l,u){const f=u||Number.POSITIVE_INFINITY;let p=0;return h;function h(w){return w===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(w),e.exit(i),g):w===null||w===32||w===41||dv(w)?n(w):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(w))}function g(w){return w===62?(e.enter(i),e.consume(w),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===62?(e.exit("chunkString"),e.exit(l),g(w)):w===null||w===60||xt(w)?n(w):(e.consume(w),w===92?k:y)}function k(w){return w===60||w===62||w===92?(e.consume(w),y):y(w)}function v(w){return!p&&(w===null||w===41||kr(w))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(w)):p<f&&w===40?(e.consume(w),p++,v):w===41?(e.consume(w),p--,v):w===null||w===32||w===40||dv(w)?n(w):(e.consume(w),w===92?b:v)}function b(w){return w===40||w===41||w===92?(e.consume(w),v):v(w)}}function p3(e,t,n,r,o,i){const a=this;let l=0,u;return f;function f(y){return e.enter(r),e.enter(o),e.consume(y),e.exit(o),e.enter(i),p}function p(y){return l>999||y===null||y===91||y===93&&!u||y===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(y):y===93?(e.exit(i),e.enter(o),e.consume(y),e.exit(o),e.exit(r),t):xt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===null||y===91||y===93||xt(y)||l++>999?(e.exit("chunkString"),p(y)):(e.consume(y),u||(u=!zt(y)),y===92?g:h)}function g(y){return y===91||y===92||y===93?(e.consume(y),l++,h):h(y)}}function h3(e,t,n,r,o,i){let a;return l;function l(g){return g===34||g===39||g===40?(e.enter(r),e.enter(o),e.consume(g),e.exit(o),a=g===40?41:g,u):n(g)}function u(g){return g===a?(e.enter(o),e.consume(g),e.exit(o),e.exit(r),t):(e.enter(i),f(g))}function f(g){return g===a?(e.exit(i),u(a)):g===null?n(g):xt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Yt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===a||g===null||xt(g)?(e.exit("chunkString"),f(g)):(e.consume(g),g===92?h:p)}function h(g){return g===a||g===92?(e.consume(g),p):p(g)}}function Zu(e,t){let n;return r;function r(o){return xt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):zt(o)?Yt(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const FK={name:"definition",tokenize:BK},zK={partial:!0,tokenize:UK};function BK(e,t,n){const r=this;let o;return i;function i(y){return e.enter("definition"),a(y)}function a(y){return p3.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function l(y){return o=Xl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),u):n(y)}function u(y){return kr(y)?Zu(e,f)(y):f(y)}function f(y){return f3(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function p(y){return e.attempt(zK,h,h)(y)}function h(y){return zt(y)?Yt(e,g,"whitespace")(y):g(y)}function g(y){return y===null||xt(y)?(e.exit("definition"),r.parser.defined.push(o),t(y)):n(y)}}function UK(e,t,n){return r;function r(l){return kr(l)?Zu(e,o)(l):n(l)}function o(l){return h3(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return zt(l)?Yt(e,a,"whitespace")(l):a(l)}function a(l){return l===null||xt(l)?t(l):n(l)}}const HK={name:"hardBreakEscape",tokenize:VK};function VK(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return xt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const WK={name:"headingAtx",resolve:KK,tokenize:qK};function KK(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},so(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function qK(e,t,n){let r=0;return o;function o(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||kr(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),u(p)):p===null||xt(p)?(e.exit("atxHeading"),t(p)):zt(p)?Yt(e,l,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function u(p){return p===35?(e.consume(p),u):(e.exit("atxHeadingSequence"),l(p))}function f(p){return p===null||p===35||kr(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),f)}}const GK=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],RS=["pre","script","style","textarea"],YK={concrete:!0,name:"htmlFlow",resolveTo:JK,tokenize:ZK},XK={partial:!0,tokenize:tq},QK={partial:!0,tokenize:eq};function JK(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function ZK(e,t,n){const r=this;let o,i,a,l,u;return f;function f(H){return p(H)}function p(H){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(H),h}function h(H){return H===33?(e.consume(H),g):H===47?(e.consume(H),i=!0,v):H===63?(e.consume(H),o=3,r.interrupt?t:M):Ys(H)?(e.consume(H),a=String.fromCharCode(H),b):n(H)}function g(H){return H===45?(e.consume(H),o=2,y):H===91?(e.consume(H),o=5,l=0,k):Ys(H)?(e.consume(H),o=4,r.interrupt?t:M):n(H)}function y(H){return H===45?(e.consume(H),r.interrupt?t:M):n(H)}function k(H){const Q="CDATA[";return H===Q.charCodeAt(l++)?(e.consume(H),l===Q.length?r.interrupt?t:B:k):n(H)}function v(H){return Ys(H)?(e.consume(H),a=String.fromCharCode(H),b):n(H)}function b(H){if(H===null||H===47||H===62||kr(H)){const Q=H===47,J=a.toLowerCase();return!Q&&!i&&RS.includes(J)?(o=1,r.interrupt?t(H):B(H)):GK.includes(a.toLowerCase())?(o=6,Q?(e.consume(H),w):r.interrupt?t(H):B(H)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(H):i?S(H):N(H))}return H===45||zr(H)?(e.consume(H),a+=String.fromCharCode(H),b):n(H)}function w(H){return H===62?(e.consume(H),r.interrupt?t:B):n(H)}function S(H){return zt(H)?(e.consume(H),S):z(H)}function N(H){return H===47?(e.consume(H),z):H===58||H===95||Ys(H)?(e.consume(H),C):zt(H)?(e.consume(H),N):z(H)}function C(H){return H===45||H===46||H===58||H===95||zr(H)?(e.consume(H),C):R(H)}function R(H){return H===61?(e.consume(H),T):zt(H)?(e.consume(H),R):N(H)}function T(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(e.consume(H),u=H,A):zt(H)?(e.consume(H),T):I(H)}function A(H){return H===u?(e.consume(H),u=null,_):H===null||xt(H)?n(H):(e.consume(H),A)}function I(H){return H===null||H===34||H===39||H===47||H===60||H===61||H===62||H===96||kr(H)?R(H):(e.consume(H),I)}function _(H){return H===47||H===62||zt(H)?N(H):n(H)}function z(H){return H===62?(e.consume(H),O):n(H)}function O(H){return H===null||xt(H)?B(H):zt(H)?(e.consume(H),O):n(H)}function B(H){return H===45&&o===2?(e.consume(H),U):H===60&&o===1?(e.consume(H),K):H===62&&o===4?(e.consume(H),F):H===63&&o===3?(e.consume(H),M):H===93&&o===5?(e.consume(H),W):xt(H)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(XK,Y,V)(H)):H===null||xt(H)?(e.exit("htmlFlowData"),V(H)):(e.consume(H),B)}function V(H){return e.check(QK,$,Y)(H)}function $(H){return e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),L}function L(H){return H===null||xt(H)?V(H):(e.enter("htmlFlowData"),B(H))}function U(H){return H===45?(e.consume(H),M):B(H)}function K(H){return H===47?(e.consume(H),a="",D):B(H)}function D(H){if(H===62){const Q=a.toLowerCase();return RS.includes(Q)?(e.consume(H),F):B(H)}return Ys(H)&&a.length<8?(e.consume(H),a+=String.fromCharCode(H),D):B(H)}function W(H){return H===93?(e.consume(H),M):B(H)}function M(H){return H===62?(e.consume(H),F):H===45&&o===2?(e.consume(H),M):B(H)}function F(H){return H===null||xt(H)?(e.exit("htmlFlowData"),Y(H)):(e.consume(H),F)}function Y(H){return e.exit("htmlFlow"),t(H)}}function eq(e,t,n){const r=this;return o;function o(a){return xt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function tq(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Qm,t,n)}}const nq={name:"htmlText",tokenize:rq};function rq(e,t,n){const r=this;let o,i,a;return l;function l(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),u}function u(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),R):M===63?(e.consume(M),N):Ys(M)?(e.consume(M),I):n(M)}function f(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),i=0,k):Ys(M)?(e.consume(M),S):n(M)}function p(M){return M===45?(e.consume(M),y):n(M)}function h(M){return M===null?n(M):M===45?(e.consume(M),g):xt(M)?(a=h,K(M)):(e.consume(M),h)}function g(M){return M===45?(e.consume(M),y):h(M)}function y(M){return M===62?U(M):M===45?g(M):h(M)}function k(M){const F="CDATA[";return M===F.charCodeAt(i++)?(e.consume(M),i===F.length?v:k):n(M)}function v(M){return M===null?n(M):M===93?(e.consume(M),b):xt(M)?(a=v,K(M)):(e.consume(M),v)}function b(M){return M===93?(e.consume(M),w):v(M)}function w(M){return M===62?U(M):M===93?(e.consume(M),w):v(M)}function S(M){return M===null||M===62?U(M):xt(M)?(a=S,K(M)):(e.consume(M),S)}function N(M){return M===null?n(M):M===63?(e.consume(M),C):xt(M)?(a=N,K(M)):(e.consume(M),N)}function C(M){return M===62?U(M):N(M)}function R(M){return Ys(M)?(e.consume(M),T):n(M)}function T(M){return M===45||zr(M)?(e.consume(M),T):A(M)}function A(M){return xt(M)?(a=A,K(M)):zt(M)?(e.consume(M),A):U(M)}function I(M){return M===45||zr(M)?(e.consume(M),I):M===47||M===62||kr(M)?_(M):n(M)}function _(M){return M===47?(e.consume(M),U):M===58||M===95||Ys(M)?(e.consume(M),z):xt(M)?(a=_,K(M)):zt(M)?(e.consume(M),_):U(M)}function z(M){return M===45||M===46||M===58||M===95||zr(M)?(e.consume(M),z):O(M)}function O(M){return M===61?(e.consume(M),B):xt(M)?(a=O,K(M)):zt(M)?(e.consume(M),O):_(M)}function B(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),o=M,V):xt(M)?(a=B,K(M)):zt(M)?(e.consume(M),B):(e.consume(M),$)}function V(M){return M===o?(e.consume(M),o=void 0,L):M===null?n(M):xt(M)?(a=V,K(M)):(e.consume(M),V)}function $(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||kr(M)?_(M):(e.consume(M),$)}function L(M){return M===47||M===62||kr(M)?_(M):n(M)}function U(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function K(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),D}function D(M){return zt(M)?Yt(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):W(M)}function W(M){return e.enter("htmlTextData"),a(M)}}const b0={name:"labelEnd",resolveAll:aq,resolveTo:lq,tokenize:cq},sq={tokenize:uq},oq={tokenize:dq},iq={tokenize:fq};function aq(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&so(e,0,e.length,n),e}function lq(e,t){let n=e.length,r=0,o,i,a,l;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(a=n);const u={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},p={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",u,t],["enter",f,t]],l=Zr(l,e.slice(i+1,i+r+3)),l=Zr(l,[["enter",p,t]]),l=Zr(l,y0(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Zr(l,[["exit",p,t],e[a-2],e[a-1],["exit",f,t]]),l=Zr(l,e.slice(a+1)),l=Zr(l,[["exit",u,t]]),so(e,i,e.length,l),e}function cq(e,t,n){const r=this;let o=r.events.length,i,a;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return l;function l(g){return i?i._inactive?h(g):(a=r.parser.defined.includes(Xl(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),u):n(g)}function u(g){return g===40?e.attempt(sq,p,a?p:h)(g):g===91?e.attempt(oq,p,a?f:h)(g):a?p(g):h(g)}function f(g){return e.attempt(iq,p,h)(g)}function p(g){return t(g)}function h(g){return i._balanced=!0,n(g)}}function uq(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),o}function o(h){return kr(h)?Zu(e,i)(h):i(h)}function i(h){return h===41?p(h):f3(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return kr(h)?Zu(e,u)(h):p(h)}function l(h){return n(h)}function u(h){return h===34||h===39||h===40?h3(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):p(h)}function f(h){return kr(h)?Zu(e,p)(h):p(h)}function p(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function dq(e,t,n){const r=this;return o;function o(l){return p3.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Xl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function fq(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const pq={name:"labelStartImage",resolveAll:b0.resolveAll,tokenize:hq};function hq(e,t,n){const r=this;return o;function o(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const mq={name:"labelStartLink",resolveAll:b0.resolveAll,tokenize:gq};function gq(e,t,n){const r=this;return o;function o(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Ly={name:"lineEnding",tokenize:xq};function xq(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Yt(e,t,"linePrefix")}}const nh={name:"thematicBreak",tokenize:yq};function yq(e,t,n){let r=0,o;return i;function i(f){return e.enter("thematicBreak"),a(f)}function a(f){return o=f,l(f)}function l(f){return f===o?(e.enter("thematicBreakSequence"),u(f)):r>=3&&(f===null||xt(f))?(e.exit("thematicBreak"),t(f)):n(f)}function u(f){return f===o?(e.consume(f),r++,u):(e.exit("thematicBreakSequence"),zt(f)?Yt(e,l,"whitespace")(f):l(f))}}const xr={continuation:{tokenize:jq},exit:Nq,name:"list",tokenize:wq},bq={partial:!0,tokenize:Sq},vq={partial:!0,tokenize:kq};function wq(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,a=0;return l;function l(y){const k=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:fv(y)){if(r.containerState.type||(r.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(nh,n,f)(y):f(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(y)}return n(y)}function u(y){return fv(y)&&++a<10?(e.consume(y),u):(!r.interrupt||a<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),f(y)):n(y)}function f(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(Qm,r.interrupt?n:p,e.attempt(bq,g,h))}function p(y){return r.containerState.initialBlankLine=!0,i++,g(y)}function h(y){return zt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),g):n(y)}function g(y){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function jq(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Qm,o,i);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Yt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!zt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(vq,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Yt(e,e.attempt(xr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function kq(e,t,n){const r=this;return Yt(e,o,"listItemIndent",r.containerState.size+1);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function Nq(e){e.exit(this.containerState.type)}function Sq(e,t,n){const r=this;return Yt(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const a=r.events[r.events.length-1];return!zt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const AS={name:"setextUnderline",resolveTo:Cq,tokenize:Eq};function Cq(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function Eq(e,t,n){const r=this;let o;return i;function i(f){let p=r.events.length,h;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){h=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),o=f,a(f)):n(f)}function a(f){return e.enter("setextHeadingLineSequence"),l(f)}function l(f){return f===o?(e.consume(f),l):(e.exit("setextHeadingLineSequence"),zt(f)?Yt(e,u,"lineSuffix")(f):u(f))}function u(f){return f===null||xt(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const Tq={tokenize:Rq};function Rq(e){const t=this,n=e.attempt(Qm,r,e.attempt(this.parser.constructs.flowInitial,o,Yt(e,e.attempt(this.parser.constructs.flow,o,e.attempt($K,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Aq={resolveAll:g3()},Pq=m3("string"),_q=m3("text");function m3(e){return{resolveAll:g3(e==="text"?Dq:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,a,l);return a;function a(p){return f(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),u}function u(p){return f(p)?(n.exit("data"),i(p)):(n.consume(p),u)}function f(p){if(p===null)return!0;const h=o[p];let g=-1;if(h)for(;++g<h.length;){const y=h[g];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function g3(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function Dq(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let i=o.length,a=-1,l=0,u;for(;i--;){const f=o[i];if(typeof f=="string"){for(a=f.length;f.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(f===-2)u=!0,l++;else if(f!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const f={type:n===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const $q={42:xr,43:xr,45:xr,48:xr,49:xr,50:xr,51:xr,52:xr,53:xr,54:xr,55:xr,56:xr,57:xr,62:l3},Iq={91:FK},Mq={[-2]:My,[-1]:My,32:My},Lq={35:WK,42:nh,45:[AS,nh],60:YK,61:AS,95:nh,96:TS,126:TS},Oq={38:u3,92:c3},Fq={[-5]:Ly,[-4]:Ly,[-3]:Ly,33:pq,38:u3,42:pv,60:[mK,nq],91:mq,92:[HK,c3],93:b0,95:pv,96:TK},zq={null:[pv,Aq]},Bq={null:[42,95]},Uq={null:[]},Hq=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Bq,contentInitial:Iq,disable:Uq,document:$q,flow:Lq,flowInitial:Mq,insideSpan:zq,string:Oq,text:Fq},Symbol.toStringTag,{value:"Module"}));function Vq(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let a=[],l=[];const u={attempt:A(R),check:A(T),consume:S,enter:N,exit:C,interrupt:A(T,{interrupt:!0})},f={code:null,containerState:{},defineSkip:v,events:[],now:k,parser:e,previous:null,sliceSerialize:g,sliceStream:y,write:h};let p=t.tokenize.call(f,u);return t.resolveAll&&i.push(t),f;function h(O){return a=Zr(a,O),b(),a[a.length-1]!==null?[]:(I(t,0),f.events=y0(i,f.events,f),f.events)}function g(O,B){return Kq(y(O),B)}function y(O){return Wq(a,O)}function k(){const{_bufferIndex:O,_index:B,line:V,column:$,offset:L}=r;return{_bufferIndex:O,_index:B,line:V,column:$,offset:L}}function v(O){o[O.line]=O.column,z()}function b(){let O;for(;r._index<a.length;){const B=a[r._index];if(typeof B=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<B.length;)w(B.charCodeAt(r._bufferIndex));else w(B)}}function w(O){p=p(O)}function S(O){xt(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,z()):O!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=O}function N(O,B){const V=B||{};return V.type=O,V.start=k(),f.events.push(["enter",V,f]),l.push(V),V}function C(O){const B=l.pop();return B.end=k(),f.events.push(["exit",B,f]),B}function R(O,B){I(O,B.from)}function T(O,B){B.restore()}function A(O,B){return V;function V($,L,U){let K,D,W,M;return Array.isArray($)?Y($):"tokenize"in $?Y([$]):F($);function F(Z){return oe;function oe(te){const ue=te!==null&&Z[te],ge=te!==null&&Z.null,Ce=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return Y(Ce)(te)}}function Y(Z){return K=Z,D=0,Z.length===0?U:H(Z[D])}function H(Z){return oe;function oe(te){return M=_(),W=Z,Z.partial||(f.currentConstruct=Z),Z.name&&f.parser.constructs.disable.null.includes(Z.name)?J():Z.tokenize.call(B?Object.assign(Object.create(f),B):f,u,Q,J)(te)}}function Q(Z){return O(W,M),L}function J(Z){return M.restore(),++D<K.length?H(K[D]):U}}}function I(O,B){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&so(f.events,B,f.events.length-B,O.resolve(f.events.slice(B),f)),O.resolveTo&&(f.events=O.resolveTo(f.events,f))}function _(){const O=k(),B=f.previous,V=f.currentConstruct,$=f.events.length,L=Array.from(l);return{from:$,restore:U};function U(){r=O,f.previous=B,f.currentConstruct=V,f.events.length=$,l=L,z()}}function z(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function Wq(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let a;if(n===o)a=[e[n].slice(r,i)];else{if(a=e.slice(n,o),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(e[o].slice(0,i))}return a}function Kq(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
637
|
+
`;break}case-3:{a=`\r
|
|
638
|
+
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&o)continue;a=" ";break}default:a=String.fromCharCode(i)}o=i===-2,r.push(a)}return r.join("")}function qq(e){const r={constructs:eK([Hq,...(e||{}).extensions||[]]),content:o(lK),defined:[],document:o(uK),flow:o(Tq),lazy:{},string:o(Pq),text:o(_q)};return r;function o(i){return a;function a(l){return Vq(r,i,l)}}}function Gq(e){for(;!d3(e););return e}const PS=/[\0\t\n\r]/g;function Yq(){let e=1,t="",n=!0,r;return o;function o(i,a,l){const u=[];let f,p,h,g,y;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(PS.lastIndex=h,f=PS.exec(i),g=f&&f.index!==void 0?f.index:i.length,y=i.charCodeAt(g),!f){t=i.slice(h);break}if(y===10&&h===g&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),h<g&&(u.push(i.slice(h,g)),e+=g-h),y){case 0:{u.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,u.push(-2);e++<p;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}h=g+1}return l&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const Xq=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qq(e){return e.replace(Xq,Jq)}function Jq(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return a3(n.slice(i?2:1),i?16:10)}return x0(n)||e}const x3={}.hasOwnProperty;function Zq(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),eG(n)(Gq(qq(n).document().write(Yq()(e,t,!0))))}function eG(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ue),autolinkProtocol:_,autolinkEmail:_,atxHeading:i(ie),blockQuote:i(ge),characterEscape:_,characterReference:_,codeFenced:i(Ce),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Ce,a),codeText:i(Se,a),codeTextData:_,data:_,codeFlowValue:_,definition:i(ke),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Be),hardBreakEscape:i(ve),hardBreakTrailing:i(ve),htmlFlow:i(ye,a),htmlFlowData:_,htmlText:i(ye,a),htmlTextData:_,image:i(Ae),label:a,link:i(Ue),listItem:i(Oe),listItemValue:g,listOrdered:i(rt,h),listUnordered:i(rt),paragraph:i(ot),reference:H,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(ie),strong:i(St),thematicBreak:i(it)},exit:{atxHeading:u(),atxHeadingSequence:R,autolink:u(),autolinkEmail:ue,autolinkProtocol:te,blockQuote:u(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:Z,characterReference:oe,codeFenced:u(b),codeFencedFence:v,codeFencedFenceInfo:y,codeFencedFenceMeta:k,codeFlowValue:z,codeIndented:u(w),codeText:u(L),codeTextData:z,data:z,definition:u(),definitionDestinationString:C,definitionLabelString:S,definitionTitleString:N,emphasis:u(),hardBreakEscape:u(B),hardBreakTrailing:u(B),htmlFlow:u(V),htmlFlowData:z,htmlText:u($),htmlTextData:z,image:u(K),label:W,labelText:D,lineEnding:O,link:u(U),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:Q,resourceDestinationString:M,resourceTitleString:F,resource:Y,setextHeading:u(I),setextHeadingLineSequence:A,setextHeadingText:T,strong:u(),thematicBreak:u()}};y3(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ce){let me={type:"root",children:[]};const Ie={stack:[me],tokenStack:[],config:t,enter:l,exit:f,buffer:a,resume:p,data:n},Pe=[];let We=-1;for(;++We<ce.length;)if(ce[We][1].type==="listOrdered"||ce[We][1].type==="listUnordered")if(ce[We][0]==="enter")Pe.push(We);else{const pt=Pe.pop();We=o(ce,pt,We)}for(We=-1;++We<ce.length;){const pt=t[ce[We][0]];x3.call(pt,ce[We][1].type)&&pt[ce[We][1].type].call(Object.assign({sliceSerialize:ce[We][2].sliceSerialize},Ie),ce[We][1])}if(Ie.tokenStack.length>0){const pt=Ie.tokenStack[Ie.tokenStack.length-1];(pt[1]||_S).call(Ie,void 0,pt[0])}for(me.position={start:ui(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:ui(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},We=-1;++We<t.transforms.length;)me=t.transforms[We](me)||me;return me}function o(ce,me,Ie){let Pe=me-1,We=-1,pt=!1,De,Qe,Je,ut;for(;++Pe<=Ie;){const fe=ce[Pe];switch(fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{fe[0]==="enter"?We++:We--,ut=void 0;break}case"lineEndingBlank":{fe[0]==="enter"&&(De&&!ut&&!We&&!Je&&(Je=Pe),ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ut=void 0}if(!We&&fe[0]==="enter"&&fe[1].type==="listItemPrefix"||We===-1&&fe[0]==="exit"&&(fe[1].type==="listUnordered"||fe[1].type==="listOrdered")){if(De){let q=Pe;for(Qe=void 0;q--;){const ne=ce[q];if(ne[1].type==="lineEnding"||ne[1].type==="lineEndingBlank"){if(ne[0]==="exit")continue;Qe&&(ce[Qe][1].type="lineEndingBlank",pt=!0),ne[1].type="lineEnding",Qe=q}else if(!(ne[1].type==="linePrefix"||ne[1].type==="blockQuotePrefix"||ne[1].type==="blockQuotePrefixWhitespace"||ne[1].type==="blockQuoteMarker"||ne[1].type==="listItemIndent"))break}Je&&(!Qe||Je<Qe)&&(De._spread=!0),De.end=Object.assign({},Qe?ce[Qe][1].start:fe[1].end),ce.splice(Qe||Pe,0,["exit",De,fe[2]]),Pe++,Ie++}if(fe[1].type==="listItemPrefix"){const q={type:"listItem",_spread:!1,start:Object.assign({},fe[1].start),end:void 0};De=q,ce.splice(Pe,0,["enter",q,fe[2]]),Pe++,Ie++,Je=void 0,ut=!0}}}return ce[me][1]._spread=pt,Ie}function i(ce,me){return Ie;function Ie(Pe){l.call(this,ce(Pe),Pe),me&&me.call(this,Pe)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(ce,me,Ie){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([me,Ie||void 0]),ce.position={start:ui(me.start),end:void 0}}function u(ce){return me;function me(Ie){ce&&ce.call(this,Ie),f.call(this,Ie)}}function f(ce,me){const Ie=this.stack.pop(),Pe=this.tokenStack.pop();if(Pe)Pe[0].type!==ce.type&&(me?me.call(this,ce,Pe[0]):(Pe[1]||_S).call(this,ce,Pe[0]));else throw new Error("Cannot close `"+ce.type+"` ("+Ju({start:ce.start,end:ce.end})+"): it’s not open");Ie.position.end=ui(ce.end)}function p(){return JW(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(ce){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.lang=ce}function k(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.meta=ce}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce.replace(/(\r?\n|\r)$/g,"")}function S(ce){const me=this.resume(),Ie=this.stack[this.stack.length-1];Ie.label=me,Ie.identifier=Xl(this.sliceSerialize(ce)).toLowerCase()}function N(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.title=ce}function C(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.url=ce}function R(ce){const me=this.stack[this.stack.length-1];if(!me.depth){const Ie=this.sliceSerialize(ce).length;me.depth=Ie}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function A(ce){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function _(ce){const Ie=this.stack[this.stack.length-1].children;let Pe=Ie[Ie.length-1];(!Pe||Pe.type!=="text")&&(Pe=ht(),Pe.position={start:ui(ce.start),end:void 0},Ie.push(Pe)),this.stack.push(Pe)}function z(ce){const me=this.stack.pop();me.value+=this.sliceSerialize(ce),me.position.end=ui(ce.end)}function O(ce){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ie=me.children[me.children.length-1];Ie.position.end=ui(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(me.type)&&(_.call(this,ce),z.call(this,ce))}function B(){this.data.atHardBreak=!0}function V(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce}function $(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce}function L(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce}function U(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=me,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function K(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=me,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function D(ce){const me=this.sliceSerialize(ce),Ie=this.stack[this.stack.length-2];Ie.label=Qq(me),Ie.identifier=Xl(me).toLowerCase()}function W(){const ce=this.stack[this.stack.length-1],me=this.resume(),Ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ie.type==="link"){const Pe=ce.children;Ie.children=Pe}else Ie.alt=me}function M(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.url=ce}function F(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.title=ce}function Y(){this.data.inReference=void 0}function H(){this.data.referenceType="collapsed"}function Q(ce){const me=this.resume(),Ie=this.stack[this.stack.length-1];Ie.label=me,Ie.identifier=Xl(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function J(ce){this.data.characterReferenceType=ce.type}function Z(ce){const me=this.sliceSerialize(ce),Ie=this.data.characterReferenceType;let Pe;Ie?(Pe=a3(me,Ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Pe=x0(me);const We=this.stack[this.stack.length-1];We.value+=Pe}function oe(ce){const me=this.stack.pop();me.position.end=ui(ce.end)}function te(ce){z.call(this,ce);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(ce)}function ue(ce){z.call(this,ce);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(ce)}function ge(){return{type:"blockquote",children:[]}}function Ce(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Be(){return{type:"emphasis",children:[]}}function ie(){return{type:"heading",depth:0,children:[]}}function ve(){return{type:"break"}}function ye(){return{type:"html",value:""}}function Ae(){return{type:"image",title:null,url:"",alt:null}}function Ue(){return{type:"link",title:null,url:"",children:[]}}function rt(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function Oe(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function ot(){return{type:"paragraph",children:[]}}function St(){return{type:"strong",children:[]}}function ht(){return{type:"text",value:""}}function it(){return{type:"thematicBreak"}}}function ui(e){return{line:e.line,column:e.column,offset:e.offset}}function y3(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?y3(e,r):tG(e,r)}}function tG(e,t){let n;for(n in t)if(x3.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function _S(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ju({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ju({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ju({start:t.start,end:t.end})+") is still open")}function nG(e){const t=this;t.parser=n;function n(r){return Zq(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rG(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function sG(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
639
|
+
`}]}function oG(e,t){const n=t.value?t.value+`
|
|
640
|
+
`:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function iG(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aG(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lG(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=Ic(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,l+=1,e.footnoteCounts.set(r,l);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,u);const f={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,f),e.applyData(t,f)}function cG(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uG(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function b3(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const a=o[o.length-1];return a&&a.type==="text"?a.value+=r:o.push({type:"text",value:r}),o}function dG(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return b3(e,t);const o={src:Ic(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function fG(e,t){const n={src:Ic(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function pG(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function hG(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return b3(e,t);const o={href:Ic(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function mG(e,t){const n={href:Ic(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function gG(e,t,n){const r=e.all(t),o=n?xG(n):v3(t),i={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let h;p&&p.type==="element"&&p.tagName==="p"?h=p:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const p=r[l];(o||l!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
|
|
641
|
+
`}),p.type==="element"&&p.tagName==="p"&&!o?a.push(...p.children):a.push(p)}const u=r[r.length-1];u&&(o||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
|
|
642
|
+
`});const f={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,f),e.applyData(t,f)}function xG(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=v3(n[r])}return t}function v3(e){const t=e.spread;return t??e.children.length>1}function yG(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const a=r[o];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function bG(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vG(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function wG(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jG(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),o.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=p0(t.children[1]),u=e3(t.children[t.children.length-1]);l&&u&&(a.position={start:l,end:u}),o.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function kG(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let u=-1;const f=[];for(;++u<l;){const h=t.children[u],g={},y=a?a[u]:void 0;y&&(g.align=y);let k={type:"element",tagName:i,properties:g,children:[]};h&&(k.children=e.all(h),e.patch(h,k),k=e.applyData(h,k)),f.push(k)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,p),e.applyData(t,p)}function NG(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const DS=9,$S=32;function SG(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const i=[];for(;r;)i.push(IS(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(IS(t.slice(o),o>0,!1)),i.join("")}function IS(e,t,n){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===DS||i===$S;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(o-1);for(;i===DS||i===$S;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function CG(e,t){const n={type:"text",value:SG(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function EG(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const TG={blockquote:rG,break:sG,code:oG,delete:iG,emphasis:aG,footnoteReference:lG,heading:cG,html:uG,imageReference:dG,image:fG,inlineCode:pG,linkReference:hG,link:mG,listItem:gG,list:yG,paragraph:bG,root:vG,strong:wG,table:jG,tableCell:NG,tableRow:kG,text:CG,thematicBreak:EG,toml:jp,yaml:jp,definition:jp,footnoteDefinition:jp};function jp(){}const w3=-1,Jm=0,ed=1,Oh=2,v0=3,w0=4,j0=5,k0=6,j3=7,k3=8,MS=typeof self=="object"?self:globalThis,RG=(e,t)=>{const n=(o,i)=>(e.set(i,o),o),r=o=>{if(e.has(o))return e.get(o);const[i,a]=t[o];switch(i){case Jm:case w3:return n(a,o);case ed:{const l=n([],o);for(const u of a)l.push(r(u));return l}case Oh:{const l=n({},o);for(const[u,f]of a)l[r(u)]=r(f);return l}case v0:return n(new Date(a),o);case w0:{const{source:l,flags:u}=a;return n(new RegExp(l,u),o)}case j0:{const l=n(new Map,o);for(const[u,f]of a)l.set(r(u),r(f));return l}case k0:{const l=n(new Set,o);for(const u of a)l.add(r(u));return l}case j3:{const{name:l,message:u}=a;return n(new MS[l](u),o)}case k3:return n(BigInt(a),o);case"BigInt":return n(Object(BigInt(a)),o);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new MS[i](a),o)};return r},LS=e=>RG(new Map,e)(0),kl="",{toString:AG}={},{keys:PG}=Object,Eu=e=>{const t=typeof e;if(t!=="object"||!e)return[Jm,t];const n=AG.call(e).slice(8,-1);switch(n){case"Array":return[ed,kl];case"Object":return[Oh,kl];case"Date":return[v0,kl];case"RegExp":return[w0,kl];case"Map":return[j0,kl];case"Set":return[k0,kl];case"DataView":return[ed,n]}return n.includes("Array")?[ed,n]:n.includes("Error")?[j3,n]:[Oh,n]},kp=([e,t])=>e===Jm&&(t==="function"||t==="symbol"),_G=(e,t,n,r)=>{const o=(a,l)=>{const u=r.push(a)-1;return n.set(l,u),u},i=a=>{if(n.has(a))return n.get(a);let[l,u]=Eu(a);switch(l){case Jm:{let p=a;switch(u){case"bigint":l=k3,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);p=null;break;case"undefined":return o([w3],a)}return o([l,p],a)}case ed:{if(u){let g=a;return u==="DataView"?g=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(a)),o([u,[...g]],a)}const p=[],h=o([l,p],a);for(const g of a)p.push(i(g));return h}case Oh:{if(u)switch(u){case"BigInt":return o([u,a.toString()],a);case"Boolean":case"Number":case"String":return o([u,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const p=[],h=o([l,p],a);for(const g of PG(a))(e||!kp(Eu(a[g])))&&p.push([i(g),i(a[g])]);return h}case v0:return o([l,a.toISOString()],a);case w0:{const{source:p,flags:h}=a;return o([l,{source:p,flags:h}],a)}case j0:{const p=[],h=o([l,p],a);for(const[g,y]of a)(e||!(kp(Eu(g))||kp(Eu(y))))&&p.push([i(g),i(y)]);return h}case k0:{const p=[],h=o([l,p],a);for(const g of a)(e||!kp(Eu(g)))&&p.push(i(g));return h}}const{message:f}=a;return o([l,{name:u,message:f}],a)};return i},OS=(e,{json:t,lossy:n}={})=>{const r=[];return _G(!(t||n),!!t,new Map,r)(e),r},Fh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?LS(OS(e,t)):structuredClone(e):(e,t)=>LS(OS(e,t));function DG(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function $G(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function IG(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||DG,r=e.options.footnoteBackLabel||$G,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[u]);if(!f)continue;const p=e.all(f),h=String(f.identifier).toUpperCase(),g=Ic(h.toLowerCase());let y=0;const k=[],v=e.footnoteCounts.get(h);for(;v!==void 0&&++y<=v;){k.length>0&&k.push({type:"text",value:" "});let S=typeof n=="string"?n:n(u,y);typeof S=="string"&&(S={type:"text",value:S}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+g+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,y),className:["data-footnote-backref"]},children:Array.isArray(S)?S:[S]})}const b=p[p.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const S=b.children[b.children.length-1];S&&S.type==="text"?S.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...k)}else p.push(...k);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+g},children:e.wrap(p,!0)};e.patch(f,w),l.push(w)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Fh(a),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
643
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
644
|
+
`}]}}const N3=(function(e){if(e==null)return FG;if(typeof e=="function")return Zm(e);if(typeof e=="object")return Array.isArray(e)?MG(e):LG(e);if(typeof e=="string")return OG(e);throw new Error("Expected function, string, or object as test")});function MG(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=N3(e[n]);return Zm(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function LG(e){const t=e;return Zm(n);function n(r){const o=r;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function OG(e){return Zm(t);function t(n){return n&&n.type===e}}function Zm(e){return t;function t(n,r,o){return!!(zG(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function FG(){return!0}function zG(e){return e!==null&&typeof e=="object"&&"type"in e}const S3=[],BG=!0,FS=!1,UG="skip";function HG(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const i=N3(o),a=r?-1:1;l(e,void 0,[])();function l(u,f,p){const h=u&&typeof u=="object"?u:{};if(typeof h.type=="string"){const y=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(u.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=S3,k,v,b;if((!t||i(u,f,p[p.length-1]||void 0))&&(y=VG(n(u,p)),y[0]===FS))return y;if("children"in u&&u.children){const w=u;if(w.children&&y[0]!==UG)for(v=(r?w.children.length:-1)+a,b=p.concat(w);v>-1&&v<w.children.length;){const S=w.children[v];if(k=l(S,v,b)(),k[0]===FS)return k;v=typeof k[1]=="number"?k[1]:v+a}}return y}}}function VG(e){return Array.isArray(e)?e:typeof e=="number"?[BG,e]:e==null?S3:[e]}function C3(e,t,n,r){let o,i,a;typeof t=="function"&&typeof n!="function"?(i=void 0,a=t,o=n):(i=t,a=n,o=r),HG(e,i,l,o);function l(u,f){const p=f[f.length-1],h=p?p.children.indexOf(u):void 0;return a(u,h,p)}}const hv={}.hasOwnProperty,WG={};function KG(e,t){const n=t||WG,r=new Map,o=new Map,i=new Map,a={...TG,...n.handlers},l={all:f,applyData:GG,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:a,one:u,options:n,patch:qG,wrap:XG};return C3(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const h=p.type==="definition"?r:o,g=String(p.identifier).toUpperCase();h.has(g)||h.set(g,p)}}),l;function u(p,h){const g=p.type,y=l.handlers[g];if(hv.call(l.handlers,g)&&y)return y(l,p,h);if(l.options.passThrough&&l.options.passThrough.includes(g)){if("children"in p){const{children:v,...b}=p,w=Fh(b);return w.children=l.all(p),w}return Fh(p)}return(l.options.unknownHandler||YG)(l,p,h)}function f(p){const h=[];if("children"in p){const g=p.children;let y=-1;for(;++y<g.length;){const k=l.one(g[y],p);if(k){if(y&&g[y-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=zS(k.value)),!Array.isArray(k)&&k.type==="element")){const v=k.children[0];v&&v.type==="text"&&(v.value=zS(v.value))}Array.isArray(k)?h.push(...k):h.push(k)}}}return h}}function qG(e,t){e.position&&(t.position=AW(e))}function GG(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,Fh(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function YG(e,t){const n=t.data||{},r="value"in t&&!(hv.call(n,"hProperties")||hv.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function XG(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
645
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
646
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
647
|
+
`}),n}function zS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function BS(e,t){const n=KG(e,t),r=n.one(e,void 0),o=IG(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
|
|
648
|
+
`},o),i}function QG(e,t){return e&&"run"in e?async function(n,r){const o=BS(n,{file:r,...t});await e.run(o,r)}:function(n,r){return BS(n,{file:r,...e||t})}}function US(e){if(e)throw e}var Oy,HS;function JG(){if(HS)return Oy;HS=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},i=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!h)return!1;var g;for(g in f);return typeof g>"u"||e.call(f,g)},a=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},l=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return Oy=function u(){var f,p,h,g,y,k,v=arguments[0],b=1,w=arguments.length,S=!1;for(typeof v=="boolean"&&(S=v,v=arguments[1]||{},b=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});b<w;++b)if(f=arguments[b],f!=null)for(p in f)h=l(v,p),g=l(f,p),v!==g&&(S&&g&&(i(g)||(y=o(g)))?(y?(y=!1,k=h&&o(h)?h:[]):k=h&&i(h)?h:{},a(v,{name:p,newValue:u(S,k,g)})):typeof g<"u"&&a(v,{name:p,newValue:g}));return v},Oy}var ZG=JG();const Fy=Dd(ZG);function mv(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function eY(){const e=[],t={run:n,use:r};return t;function n(...o){let i=-1;const a=o.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...o);function l(u,...f){const p=e[++i];let h=-1;if(u){a(u);return}for(;++h<o.length;)(f[h]===null||f[h]===void 0)&&(f[h]=o[h]);o=f,p?tY(p,l)(...f):a(null,...f)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function tY(e,t){let n;return r;function r(...a){const l=e.length>a.length;let u;l&&a.push(o);try{u=e.apply(this,a)}catch(f){const p=f;if(l&&n)throw p;return o(p)}l||(u&&u.then&&typeof u.then=="function"?u.then(i,o):u instanceof Error?o(u):i(u))}function o(a,...l){n||(n=!0,t(a,...l))}function i(a){o(null,a)}}const Ks={basename:nY,dirname:rY,extname:sY,join:oY,sep:"/"};function nY(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');tf(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else a<0&&(i=!0,a=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(r=o):(l=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function rY(e){if(tf(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function sY(e){tf(e);let t=e.length,n=-1,r=0,o=-1,i=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function oY(...e){let t=-1,n;for(;++t<e.length;)tf(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":iY(n)}function iY(e){tf(e);const t=e.codePointAt(0)===47;let n=aY(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function aY(e,t){let n="",r=0,o=-1,i=0,a=-1,l,u;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(o===a-1||i===1))if(o!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),o=a,i=0;continue}}else if(n.length>0){n="",r=0,o=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,a):n=e.slice(o+1,a),r=a-o-1;o=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function tf(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const lY={cwd:cY};function cY(){return"/"}function gv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function uY(e){if(typeof e=="string")e=new URL(e);else if(!gv(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return dY(e)}function dY(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const zy=["history","path","basename","stem","extname","dirname"];class E3{constructor(t){let n;t?gv(t)?n={path:t}:typeof t=="string"||fY(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":lY.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<zy.length;){const i=zy[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)zy.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Ks.basename(this.path):void 0}set basename(t){Uy(t,"basename"),By(t,"basename"),this.path=Ks.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ks.dirname(this.path):void 0}set dirname(t){VS(this.basename,"dirname"),this.path=Ks.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ks.extname(this.path):void 0}set extname(t){if(By(t,"extname"),VS(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ks.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){gv(t)&&(t=uY(t)),Uy(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ks.basename(this.path,this.extname):void 0}set stem(t){Uy(t,"stem"),By(t,"stem"),this.path=Ks.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new or(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function By(e,t){if(e&&e.includes(Ks.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ks.sep+"`")}function Uy(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function VS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function fY(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pY=(function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),hY={}.hasOwnProperty;class N0 extends pY{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=eY()}copy(){const t=new N0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Fy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Wy("data",this.frozen),this.namespace[t]=n,this):hY.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Wy("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Np(t),r=this.parser||this.Parser;return Hy("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Hy("process",this.parser||this.Parser),Vy("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,a){const l=Np(t),u=r.parse(l);r.run(u,l,function(p,h,g){if(p||!h||!g)return f(p);const y=h,k=r.stringify(y,g);xY(k)?g.value=k:g.result=k,f(p,g)});function f(p,h){p||!h?a(p):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Hy("processSync",this.parser||this.Parser),Vy("processSync",this.compiler||this.Compiler),this.process(t,o),KS("processSync","process",n),r;function o(i,a){n=!0,US(i),r=a}}run(t,n,r){WS(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const u=Np(n);o.run(t,u,f);function f(p,h,g){const y=h||t;p?l(p):a?a(y):r(void 0,y,g)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),KS("runSync","run",r),o;function i(a,l){US(a),o=l,r=!0}}stringify(t,n){this.freeze();const r=Np(n),o=this.compiler||this.Compiler;return Vy("stringify",o),WS(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Wy("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(f){if(typeof f=="function")u(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...h]=f;u(p,h)}else a(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function a(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(f.plugins),f.settings&&(o.settings=Fy(!0,o.settings,f.settings))}function l(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const h=f[p];i(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function u(f,p){let h=-1,g=-1;for(;++h<r.length;)if(r[h][0]===f){g=h;break}if(g===-1)r.push([f,...p]);else if(p.length>0){let[y,...k]=p;const v=r[g][1];mv(v)&&mv(y)&&(y=Fy(!0,v,y)),r[g]=[f,y,...k]}}}}const mY=new N0().freeze();function Hy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Wy(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function WS(e){if(!mv(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function KS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Np(e){return gY(e)?e:new E3(e)}function gY(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function xY(e){return typeof e=="string"||yY(e)}function yY(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const bY="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",qS=[],GS={allowDangerousHtml:!0},vY=/^(https?|ircs?|mailto|xmpp)$/i,wY=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function jY(e){const t=kY(e),n=NY(e);return SY(t.runSync(t.parse(n),n),e)}function kY(e){const t=e.rehypePlugins||qS,n=e.remarkPlugins||qS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...GS}:GS;return mY().use(nG).use(n).use(QG,r).use(t)}function NY(e){const t=e.children||"",n=new E3;return typeof t=="string"&&(n.value=t),n}function SY(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||CY;for(const p of wY)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+bY+p.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),C3(e,f),IW(e,{Fragment:s.Fragment,components:o,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function f(p,h,g){if(p.type==="raw"&&g&&typeof h=="number")return a?g.children.splice(h,1):g.children[h]={type:"text",value:p.value},h;if(p.type==="element"){let y;for(y in Iy)if(Object.hasOwn(Iy,y)&&Object.hasOwn(p.properties,y)){const k=p.properties[y],v=Iy[y];(v===null||v.includes(p.tagName))&&(p.properties[y]=u(String(k||""),y,p))}}if(p.type==="element"){let y=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!y&&r&&typeof h=="number"&&(y=!r(p,h,g)),y&&g&&typeof h=="number")return l&&p.children?g.children.splice(h,1,...p.children):g.children.splice(h,1),h}}}function CY(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||vY.test(e.slice(0,t))?e:""}function Nl(e){return e.trim().toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Eo(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Eo).join(""):m.isValidElement(e)?Eo(e.props.children):m.Children.toArray(e).map(Eo).join("")}const EY={h1:({children:e,...t})=>s.jsx("h1",{id:Nl(Eo(e)),...t,children:e}),h2:({children:e,...t})=>s.jsx("h2",{id:Nl(Eo(e)),...t,children:e}),h3:({children:e,...t})=>s.jsx("h3",{id:Nl(Eo(e)),...t,children:e}),h4:({children:e,...t})=>s.jsx("h4",{id:Nl(Eo(e)),...t,children:e}),h5:({children:e,...t})=>s.jsx("h5",{id:Nl(Eo(e)),...t,children:e}),h6:({children:e,...t})=>s.jsx("h6",{id:Nl(Eo(e)),...t,children:e})};function jn({content:e,className:t,emptyState:n="No markdown content yet."}){const r=e.replace(/<!--[\s\S]*?-->/g,"");return r.trim()?s.jsx("div",{className:be("prose-syntaur max-w-none",t),children:s.jsx(jY,{components:EY,children:r})}):s.jsx("div",{className:"rounded-md border border-dashed border-border/80 bg-muted/30 px-3 py-4 text-sm text-muted-foreground",children:n})}function ss(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function TY(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{if(e)try{const u=await fetch(ss(e));if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),Ei(u=>{u.type==="todos-updated"&&u.projectSlug===e&&l()}),{data:t,loading:r,error:i,refetch:l}}async function RY(e,t,n){await $a(ss(e),{description:t,tags:n})}async function AY(e,t,n){await $a(`${ss(e)}/${t}/complete`,{summary:"Completed."})}async function PY(e,t,n){await $a(`${ss(e)}/${t}/block`,{reason:n})}async function _Y(e,t,n){await $a(`${ss(e)}/${t}/start`,{session:n})}async function DY(e,t){await $a(`${ss(e)}/${t}/reopen`,{})}async function $Y(e,t){await OY(`${ss(e)}/${t}`)}async function IY(e,t,n){const r=await fetch(`${ss(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}function T3(e,t,n){return`${ss(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function MY(e,t,n){for(const r of n){const o=await fetch(`${ss(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(r.name||"file"),"x-attachment-mime":r.type||"application/octet-stream"},body:r});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function LY(e,t,n){const r=await fetch(T3(e,t,n),{method:"DELETE"});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}async function $a(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.text().catch(()=>"");let o=null;try{o=r?JSON.parse(r):null}catch{}const i=(o==null?void 0:o.error)||r||`HTTP ${n.status}`,a=new Error(i);throw a.status=n.status,a}return n.json().catch(()=>({}))}async function OY(e){const t=await fetch(e,{method:"DELETE"});if(!t.ok){const n=await t.text().catch(()=>"");let r=null;try{r=n?JSON.parse(n):null}catch{}const o=(r==null?void 0:r.error)||n||`HTTP ${t.status}`,i=new Error(o);throw i.status=t.status,i}}async function FY(e,t){return await $a(`${ss(e)}/promote`,t)}async function zY(e,t,n){await $a(`${ss(e)}/${t}/move`,{to:n})}function os({open:e,title:t,description:n,confirmLabel:r,cancelLabel:o="Cancel",loading:i=!1,destructive:a=!1,onConfirm:l,onOpenChange:u}){return s.jsx(_l,{open:e,onOpenChange:f=>i?void 0:u(f),children:s.jsxs(la,{children:[s.jsxs(Dl,{children:[s.jsx(ca,{children:t}),s.jsx(ua,{children:n})]}),s.jsxs($l,{children:[s.jsx(ud,{disabled:i,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:o}),s.jsx(yi,{disabled:i,className:`shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50 ${a?"border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90":"shell-action--cta"}`,onClick:f=>{f.preventDefault(),l()},children:i?"Working...":r})]})]})})}const YS=[{value:"open",icon:"○",label:"Open",color:"text-muted-foreground"},{value:"in_progress",icon:"◉",label:"In Progress",color:"text-status-in-progress-foreground"},{value:"completed",icon:"✓",label:"Completed",color:"text-status-completed-foreground"},{value:"blocked",icon:"✕",label:"Blocked",color:"text-status-blocked-foreground"}];function R3({status:e,onChange:t}){const[n,r]=m.useState(!1),o=m.useRef(null);m.useEffect(()=>{if(!n)return;function a(l){o.current&&!o.current.contains(l.target)&&r(!1)}return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[n]);const i=YS.find(a=>a.value===e);return s.jsxs("div",{className:"relative",ref:o,onClick:a=>a.stopPropagation(),children:[s.jsx("button",{onClick:()=>r(!n),className:`text-lg leading-none ${i.color} hover:opacity-70 transition`,title:i.label,children:i.icon}),n&&s.jsx("div",{className:"absolute left-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:YS.filter(a=>a.value!==e).map(a=>s.jsxs("button",{onClick:()=>{t(a.value),r(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-sm hover:bg-foreground/5 transition ${a.color}`,children:[s.jsx("span",{className:"text-base leading-none",children:a.icon}),s.jsx("span",{children:a.label})]},a.value))})]})}function A3({item:e,copiedId:t,selected:n,editing:r,onBeginEdit:o,onEndEdit:i,onPatchDescription:a,onAddAttachments:l,onDeleteAttachment:u,attachmentUrl:f,onToggleSelected:p,onMoveOne:h,onStatusChange:g,onCopyId:y,onDelete:k,hotkeyRowProps:v,onDragOrigin:b,onDragStart:w,onDragEnd:S,isDragging:N}){return s.jsxs("div",{draggable:!0,"data-todo-id":e.id,...v??{},onMouseDown:b,onDragStart:C=>w(C,e.id),onDragEnd:S,className:`surface-panel flex items-start gap-3 px-3 py-2 cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${N?"opacity-50 shadow-lg":""}`,children:[s.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${e.id}`,title:"Select",checked:n,onChange:C=>p(e.id,C),onClick:C=>C.stopPropagation(),className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),s.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(R3,{status:e.status,onChange:C=>g(e.id,C)})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[s.jsx(P3,{description:e.description,status:e.status,editing:r,onBeginEdit:()=>o(e.id),onEndEdit:i,onSave:C=>a(e.id,C)}),e.tags.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:e.tags.map(C=>`#${C}`).join(" ")}),e.session&&s.jsxs("span",{className:"text-xs text-info-foreground/70 font-mono",children:["session:",e.session.slice(0,8)]}),s.jsx(WY,{item:e})]}),s.jsx(_3,{item:e,attachmentUrl:f,onAdd:C=>l(e.id,C),onDelete:C=>u(e.id,C)})]}),t===e.id?s.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[s.jsx(Nr,{className:"h-3 w-3"})," Copied to clipboard"]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-no-drag":!0,className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:C=>y(C,e.id),children:["t:",e.id]}),s.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:C=>y(C,e.id),children:s.jsx(hh,{className:"h-3 w-3"})}),s.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Move to...",onClick:C=>h(e.id,C),children:s.jsx(am,{className:"h-3 w-3"})}),s.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-destructive transition",title:"Delete todo",onClick:C=>k(C,e.id,e.description),children:s.jsx(fn,{className:"h-3 w-3"})})]})]})}function P3({description:e,status:t,editing:n,onBeginEdit:r,onEndEdit:o,onSave:i}){return n?s.jsx(BY,{initialValue:e,onSave:i,onExit:o}):s.jsx("button",{type:"button","data-no-drag":!0,onClick:a=>{a.stopPropagation(),r()},title:"Click to edit",className:be("text-left text-sm rounded-sm transition hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",t==="completed"?"line-through text-muted-foreground":"text-foreground"),children:e})}function BY({initialValue:e,onSave:t,onExit:n}){const r=m.useRef(e),[o,i]=m.useState(e),[a,l]=m.useState(!1),[u,f]=m.useState(!1),p=m.useRef(null),h=m.useRef(!1);m.useEffect(()=>{const v=p.current;v&&(v.focus(),v.select())},[]);const g=m.useCallback(()=>{var v;f(!0),window.setTimeout(()=>f(!1),260),(v=p.current)==null||v.focus()},[]),y=m.useCallback(async()=>{var b;if(h.current)return;const v=o.trim();if(v.length===0){g();return}if(v===r.current){n();return}h.current=!0,l(!0);try{await t(v),n()}catch{l(!1),h.current=!1,(b=p.current)==null||b.focus()}},[o,n,t,g]);function k(v){v.key==="Enter"?(v.preventDefault(),y()):v.key==="Escape"&&(v.preventDefault(),h.current=!0,n())}return s.jsx("input",{ref:p,type:"text","data-no-drag":!0,disabled:a,value:o,onClick:v=>v.stopPropagation(),onChange:v=>i(v.target.value),onKeyDown:k,onBlur:()=>void y(),className:be("w-full rounded-sm border border-border bg-background px-1.5 py-0.5 text-sm text-foreground outline-none transition focus:border-ring focus:ring-1 focus:ring-ring",u&&"syntaur-input-shake",a&&"opacity-70")})}function UY(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function HY(e){const t=e.clipboardData,n=[];if(t.files&&t.files.length&&n.push(...Array.from(t.files)),!n.length&&t.items){for(const r of Array.from(t.items))if(r.kind==="file"){const o=r.getAsFile();o&&n.push(o)}}return n}function _3({item:e,attachmentUrl:t,onAdd:n,onDelete:r}){const o=e.attachments??[],[i,a]=m.useState(!1),[l,u]=m.useState(!1),f=m.useRef(null),p=m.useRef(null);m.useEffect(()=>{var g;i&&((g=p.current)==null||g.focus())},[i]);const h=m.useCallback(async g=>{if(g.length){u(!0);try{await n(g),a(!1)}finally{u(!1)}}},[n]);return s.jsxs("div",{className:"mt-1","data-no-drag":!0,onClick:g=>g.stopPropagation(),children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.map(g=>s.jsx(VY,{att:g,url:t(e.id,g.id),onDelete:()=>void r(g.id)},g.id)),s.jsxs("button",{type:"button","data-no-drag":!0,title:"Attach files",onClick:()=>a(g=>!g),className:"inline-flex items-center gap-1 rounded-md border border-border/60 px-1.5 py-0.5 text-xs text-muted-foreground hover:text-foreground hover:border-border transition",children:[s.jsx($2,{className:"h-3 w-3"}),o.length===0?"Attach":""]})]}),i&&s.jsxs("div",{ref:p,"data-no-drag":!0,tabIndex:0,role:"button","aria-label":"Add attachments: drop, paste, or click",onPaste:g=>{const y=HY(g);y.length&&(g.preventDefault(),h(y))},onDragOver:g=>{Array.from(g.dataTransfer.types).includes("Files")&&g.preventDefault()},onDrop:g=>{const y=Array.from(g.dataTransfer.files);y.length&&(g.preventDefault(),h(y))},onClick:()=>{var g;return(g=f.current)==null?void 0:g.click()},className:"mt-1 cursor-pointer rounded-md border border-dashed border-border/70 px-3 py-2 text-xs text-muted-foreground hover:border-border focus:outline-none focus:ring-2 focus:ring-ring/40",children:[l?"Uploading…":"Drop, paste (⌘V / Ctrl+V), or click to add files",s.jsx("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:g=>{const y=Array.from(g.target.files??[]);g.target.value="",h(y)}})]})]})}function VY({att:e,url:t,onDelete:n}){return s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-border/60 bg-background px-1.5 py-0.5 text-xs",children:[UY(e.mime)?s.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",title:e.filename,children:s.jsx("img",{src:t,alt:e.filename,className:"h-6 w-6 rounded object-cover"})}):s.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-foreground hover:text-primary",children:[s.jsx($2,{className:"h-3 w-3"}),s.jsx("span",{className:"block max-w-[160px] truncate",children:e.filename})]}),s.jsx("button",{type:"button",title:"Remove attachment",onClick:n,className:"text-muted-foreground/60 hover:text-destructive transition",children:s.jsx(Nc,{className:"h-3 w-3"})})]})}function WY({item:e}){return!(e.branch||e.planDir||e.worktreePath||e.createdAt||e.updatedAt)?null:s.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[e.branch?s.jsx(ga,{delayDuration:120,children:s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-info-foreground/30 bg-info/30 px-1.5 py-0.5 text-[10px] font-mono text-info-foreground",children:[s.jsx(Xv,{className:"h-2.5 w-2.5"}),s.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),s.jsx(br,{children:e.branch})]})}):null,e.planDir?s.jsx(ga,{delayDuration:120,children:s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),Jd(e.planDir)},className:"inline-flex items-center rounded-full border border-status-completed-foreground/40 bg-status-completed/30 p-1 text-status-completed-foreground hover:bg-status-completed/50","aria-label":"Copy plan directory path",children:s.jsx(A2,{className:"h-2.5 w-2.5"})})}),s.jsxs(br,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?s.jsx(ga,{delayDuration:120,children:s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),s.jsx(br,{children:s.jsxs("div",{className:"space-y-0.5 text-xs font-mono",children:[e.worktreePath?s.jsxs("div",{children:["worktree: ",e.worktreePath]}):null,e.createdAt?s.jsxs("div",{children:["created: ",e.createdAt]}):null,e.updatedAt?s.jsxs("div",{children:["updated: ",e.updatedAt]}):null]})})]})}):null]})}const D3="__one_off__";function S0({open:e,selectedIds:t,scope:n,onOpenChange:r,onDone:o,defaultProject:i,defaultTitle:a,allowOneOff:l=!0}){const[u,f]=m.useState("new"),[p,h]=m.useState(!1),[g,y]=m.useState(null),[k,v]=m.useState(null),[b,w]=m.useState(null),[S,N]=m.useState(""),[C,R]=m.useState(""),[T,A]=m.useState(""),[I,_]=m.useState(""),[z,O]=m.useState(""),[B,V]=m.useState(""),[$,L]=m.useState(null),[U,K]=m.useState(!1),D=t.length>1;m.useEffect(()=>{if(!e){f("new"),y(null),N(""),R(""),A(""),_(""),O(""),V(""),L(null);return}N(i??""),R(a??"");let Q=!1;return(async()=>{try{const J=await fetch("/api/projects");if(!J.ok)throw new Error(`HTTP ${J.status}`);const Z=await J.json();Q||v(Z.filter(oe=>!oe.archived))}catch(J){Q||w(J instanceof Error?J.message:String(J))}})(),()=>{Q=!0}},[e,i,a]),m.useEffect(()=>{if(!z){L(null);return}let Q=!1;return K(!0),(async()=>{try{const J=await fetch(`/api/projects/${encodeURIComponent(z)}/assignments`);if(!J.ok)throw new Error(`HTTP ${J.status}`);const Z=await J.json();Q||L(Z)}catch{Q||L([])}finally{Q||K(!1)}})(),()=>{Q=!0}},[z]);const W=m.useMemo(()=>k??[],[k]);async function M(Q){if(Q.preventDefault(),!S){y('Pick a target project (or "One-off").');return}if(D&&!C.trim()){y("Title is required when promoting multiple todos.");return}const J=S===D3?{oneOff:!0}:{project:S};if(n.kind==="aggregate"){const oe={groups:n.groups,mode:"new-assignment",target:J,title:C.trim()||void 0,type:T.trim()||void 0,priority:I||void 0};await H(oe);return}const Z={todoIds:t,mode:"new-assignment",target:J,title:C.trim()||void 0,type:T.trim()||void 0,priority:I||void 0};await Y(Z)}async function F(Q){if(Q.preventDefault(),n.kind==="aggregate"){y("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!z||!B){y("Pick both project and assignment.");return}const J={todoIds:t,mode:"to-assignment",target:{assignment:`${z}/${B}`}};await Y(J)}async function Y(Q){h(!0),y(null);try{let J;if(n.kind==="workspace")J=await _O(n.workspace,Q);else if(n.kind==="project")J=await FY(n.projectId,Q);else throw new Error("Aggregate scope requires runBulkMutation.");o(J),r(!1)}catch(J){y(J instanceof Error?J.message:String(J))}finally{h(!1)}}async function H(Q){h(!0),y(null);try{const J=await DO(Q);o(J),r(!1)}catch(J){y(J instanceof Error?J.message:String(J))}finally{h(!1)}}return s.jsx(On,{open:e,onOpenChange:Q=>p?void 0:r(Q),children:s.jsxs(Cn,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsxs(En,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),s.jsxs(ns,{children:["Convert the selected todo",t.length===1?"":"s"," to a new or existing assignment. Source todo",t.length===1?"":"s"," will be marked ",s.jsx("strong",{children:"in progress"})," and linked to the new assignment (auto-completed when the assignment closes)."]})]}),s.jsxs(WP,{value:u,onValueChange:Q=>f(Q),children:[s.jsxs(KP,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[s.jsx(ov,{value:"new",className:be("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:"New assignment"}),s.jsx(ov,{value:"existing",className:be("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:"Existing assignment"})]}),s.jsx(iv,{value:"new",children:s.jsxs("form",{onSubmit:M,className:"space-y-4",children:[s.jsx(Sl,{label:"Target project",children:s.jsx(XS,{value:S,onChange:N,projects:W,error:b,disabled:p,allowOneOff:l})}),s.jsx(Sl,{label:D?"Title (required)":"Title (defaults to first todo)",children:s.jsx("input",{type:"text",value:C,onChange:Q=>R(Q.target.value),disabled:p,className:"editor-input bg-background/95 font-sans"})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(Sl,{label:"Type",children:s.jsx("input",{type:"text",value:T,onChange:Q=>A(Q.target.value),placeholder:"feature",disabled:p,className:"editor-input bg-background/95 font-sans"})}),s.jsx(Sl,{label:"Priority",children:s.jsxs("select",{value:I,onChange:Q=>_(Q.target.value),disabled:p,className:"editor-input bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:"—"}),s.jsx("option",{value:"low",children:"low"}),s.jsx("option",{value:"medium",children:"medium"}),s.jsx("option",{value:"high",children:"high"}),s.jsx("option",{value:"critical",children:"critical"})]})})]}),g?s.jsx(QS,{message:g}):null,s.jsx(JS,{onCancel:()=>r(!1),submitting:p,submitLabel:"Promote"})]})}),s.jsx(iv,{value:"existing",children:s.jsxs("form",{onSubmit:F,className:"space-y-4",children:[s.jsx(Sl,{label:"Project",children:s.jsx(XS,{value:z,onChange:Q=>{O(Q),V("")},projects:W,error:b,disabled:p})}),s.jsx(Sl,{label:U?"Assignment (loading...)":"Assignment",children:s.jsxs("select",{value:B,onChange:Q=>V(Q.target.value),disabled:p||!z||U,className:"editor-input bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:z?"Select assignment...":"Pick a project first"}),($??[]).map(Q=>s.jsxs("option",{value:Q.slug,children:[Q.title," (",Q.status,")"]},Q.slug))]})}),g?s.jsx(QS,{message:g}):null,s.jsx(JS,{onCancel:()=>r(!1),submitting:p,submitLabel:"Promote"})]})})]})]})})}function Sl({label:e,children:t}){return s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),t]})}function XS({value:e,onChange:t,projects:n,error:r,disabled:o,allowOneOff:i}){return r?s.jsxs("div",{className:"text-sm text-destructive",children:["Failed to load projects: ",r]}):s.jsxs("select",{value:e,onChange:a=>t(a.target.value),disabled:o,className:"editor-input bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:"Select project..."}),i?s.jsx("option",{value:D3,children:"One-off (no project)"}):null,n.map(a=>s.jsxs("option",{value:a.slug,children:[a.title," (",a.slug,")"]},a.slug))]})}function QS({message:e}){return s.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:e})}function JS({onCancel:e,submitting:t,submitLabel:n}){return s.jsxs(Hr,{children:[s.jsx("button",{type:"button",onClick:e,disabled:t,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:t,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:t?"Submitting...":n})]})}function $3({open:e,selectedIds:t,scope:n,onOpenChange:r,onDone:o}){const[i,a]=m.useState("project"),[l,u]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState(!1),[y,k]=m.useState(null),[v,b]=m.useState(null),[w,S]=m.useState(null);m.useEffect(()=>{if(!e){a("project"),u(""),p(""),k(null),b(null);return}let A=!1;return(async()=>{try{const I=await fetch("/api/projects");if(!I.ok)throw new Error(`HTTP ${I.status}`);const _=await I.json();A||S(_.filter(z=>!z.archived))}catch(I){A||b(I instanceof Error?I.message:String(I))}})(),()=>{A=!0}},[e]);const N=m.useMemo(()=>w?n.kind==="project"?w.filter(A=>A.slug!==n.projectId):w:[],[w,n]);function C(){if(i==="global")return{global:!0};if(i==="workspace"){const A=l.trim();return A?{workspace:A}:"Workspace name is required."}return f?{project:f}:"Pick a target project."}async function R(A,I){try{return n.kind==="workspace"?await $O(n.workspace,A,I):await zY(n.projectId,A,I),{ok:!0}}catch(_){return{ok:!1,error:_ instanceof Error?_.message:String(_)}}}async function T(A){A.preventDefault(),b(null);const I=C();if(typeof I=="string"){b(I);return}g(!0),k(null);const _=[],z=[];for(const O of t){const B=await R(O,I);B.ok?_.push(O):z.push({id:O,error:B.error})}g(!1),o(),z.length===0?r(!1):k({succeeded:_,failed:z})}return s.jsx(On,{open:e,onOpenChange:A=>h?void 0:r(A),children:s.jsx(Cn,{className:"max-w-xl",children:s.jsxs("form",{onSubmit:T,className:"space-y-4",children:[s.jsxs(sr,{children:[s.jsxs(En,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),s.jsxs(ns,{children:["Move the selected todo",t.length===1?"":"s"," to a different scope. id, tags, branch, timestamps, and plan dir are preserved."]})]}),s.jsxs("fieldset",{className:"space-y-2",disabled:h,children:[s.jsx("legend",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground mb-1",children:"Target scope"}),s.jsx(Ky,{kind:"project",checked:i==="project",onChange:()=>a("project"),label:"Project"}),s.jsx(Ky,{kind:"workspace",checked:i==="workspace",onChange:()=>a("workspace"),label:"Workspace"}),s.jsx(Ky,{kind:"global",checked:i==="global",onChange:()=>a("global"),label:"Global"})]}),i==="project"?s.jsx(ZS,{label:"Target project",children:s.jsxs("select",{value:f,onChange:A=>p(A.target.value),disabled:h,className:"editor-textarea w-full bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:"Select project..."}),N.map(A=>s.jsxs("option",{value:A.slug,children:[A.title," (",A.slug,")"]},A.slug))]})}):null,i==="workspace"?s.jsx(ZS,{label:"Target workspace name",children:s.jsx("input",{type:"text",value:l,onChange:A=>u(A.target.value),disabled:h,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,v?s.jsx(KY,{message:v}):null,y?s.jsxs("div",{className:"rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground space-y-1",children:[s.jsxs("div",{className:"font-medium",children:["Moved ",y.succeeded.length," of ",t.length,"; ",y.failed.length," failed."]}),s.jsx("ul",{className:"text-xs space-y-0.5",children:y.failed.map(A=>s.jsxs("li",{children:["[t:",A.id,"] ",A.error]},A.id))})]}):null,s.jsxs(Hr,{children:[s.jsx("button",{type:"button",onClick:()=>r(!1),disabled:h,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:y?"Close":"Cancel"}),y===null?s.jsx("button",{type:"submit",disabled:h,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving...":"Move"}):null]})]})})})}function ZS({label:e,children:t}){return s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),t]})}function Ky({kind:e,checked:t,onChange:n,label:r}){return s.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[s.jsx("input",{type:"radio",name:"move-target-kind",value:e,checked:t,onChange:n}),s.jsx("span",{children:r})]})}function KY({message:e}){return s.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:e})}function C0({label:e,count:t,expanded:n,onToggle:r,isDropTarget:o=!1,onDragOver:i,onDragLeave:a,onDrop:l,children:u}){return s.jsxs("div",{className:be("rounded-lg border border-border/60 bg-card/40 transition",o&&"ring-2 ring-ring/30"),onDragOver:i,onDragLeave:a,onDrop:l,children:[s.jsxs("button",{type:"button",onClick:r,"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2.5 text-left",children:[s.jsx(tr,{className:be("h-4 w-4 text-muted-foreground transition-transform",!n&&"-rotate-90")}),s.jsx("span",{className:"font-semibold text-foreground",children:e}),s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:t})]}),n&&s.jsx("div",{className:"space-y-1 px-2 pb-2",children:u})]})}const I3=[{id:"open-blocked",label:"Open / Blocked",statuses:["open","blocked"],dropStatus:"open",defaultCollapsed:!1},{id:"in-progress",label:"In Progress",statuses:["in_progress"],dropStatus:"in_progress",defaultCollapsed:!1},{id:"done",label:"Done",statuses:["completed"],dropStatus:"completed",defaultCollapsed:!0}];function eg(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function E0(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[eg(n.status)].push(n);return I3.map(n=>({config:n,items:t[n.id]}))}const M3="syntaur.todos.sections.collapsed.v1",eC=Object.fromEntries(I3.map(e=>[e.id,e.defaultCollapsed]));function qy(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(M3);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function qY(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(M3,JSON.stringify(e))}catch{}}function T0(e){const[t,n]=m.useState(()=>qy()[e]??{});m.useEffect(()=>{n(qy()[e]??{})},[e]);const r=m.useCallback(i=>t[i]??eC[i],[t]),o=m.useCallback(i=>{const a=qy(),l=a[e]??{},u=l[i]??eC[i],f={...l,[i]:!u};a[e]=f,qY(a),n(f)},[e]);return{isCollapsed:r,toggle:o}}function GY({projectId:e}){var ut;const{data:t,loading:n,error:r,refetch:o}=TY(e),{toast:i,showToast:a,dismissToast:l}=Tn(),[u,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,v]=m.useState(""),[b,w]=m.useState(null),[S,N]=m.useState(!1),[C,R]=m.useState(null),[T,A]=m.useState(null),[I,_]=m.useState(new Set),[z,O]=m.useState(!1),[B,V]=m.useState(!1),[$,L]=m.useState(null),U=m.useRef(null);Ai("list:todos");const K=T0("project:"+e),[D,W]=m.useState(null),[M,F]=m.useState(null),Y=m.useRef(null);async function H(fe,q){fe.stopPropagation(),await Jd(q)&&(R(q),setTimeout(()=>R(ne=>ne===q?null:ne),1500))}const Q=m.useMemo(()=>{if(!(t!=null&&t.items))return[];const fe=new Set;for(const q of t.items)for(const ne of q.tags)fe.add(ne);return Array.from(fe).sort()},[t]),J=m.useMemo(()=>{if(!(t!=null&&t.items))return[];let fe=t.items;if(u.trim()){const q=u.toLowerCase();fe=fe.filter(ne=>ne.description.toLowerCase().includes(q)||ne.tags.some(xe=>xe.toLowerCase().includes(q))||ne.id.includes(q))}return p&&(fe=fe.filter(q=>q.status===p)),g&&(fe=fe.filter(q=>q.tags.includes(g))),fe},[t,u,p,g]);m.useEffect(()=>{_(new Set)},[u,p,g,e]);const Z=m.useMemo(()=>J.filter(fe=>I.has(fe.id)).length,[J,I]),oe=J.length>0&&Z===J.length,te=Z>0&&!oe;function ue(fe){_(q=>{const ne=new Set(q);return ne.has(fe)?ne.delete(fe):ne.add(fe),ne})}function ge(){_(fe=>{const q=new Set(fe);if(oe)for(const ne of J)q.delete(ne.id);else for(const ne of J)q.add(ne.id);return q})}function Ce(){_(new Set)}const Se=$?[$]:Array.from(I);function ke(){_(new Set),L(null),o()}function Be(){_(new Set),o()}function ie(fe){a(fe instanceof Error?fe.message:"Action failed","error")}async function ve(){if(k.trim())try{await RY(e,k.trim()),v(""),o()}catch(fe){ie(fe)}}function ye(fe,q,ne){fe.stopPropagation(),w({id:q,description:ne})}async function Ae(fe,q){try{switch(q){case"open":await DY(e,fe);break;case"in_progress":await _Y(e,fe);break;case"completed":await AY(e,fe);break;case"blocked":await PY(e,fe);break}o()}catch(ne){ie(ne)}}async function Ue(fe,q){try{await IY(e,fe,q),o()}catch(ne){throw ie(ne),ne}}async function rt(fe,q){try{await MY(e,fe,q),o()}catch(ne){ie(ne)}}async function Oe(fe,q){try{await LY(e,fe,q),o()}catch(ne){ie(ne)}}const ot=E0(J),St=ot.filter(fe=>!K.isCollapsed(fe.config.id)).flatMap(fe=>fe.items),{hotkeyRowProps:ht}=Ud(St,{scope:"list:todos",bindO:!1,onOpen:fe=>A(fe.id)});en({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var fe;return(fe=U.current)==null?void 0:fe.focus()}}),en({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>o()});const[it,ce]=Rs(),me=it.get("focus");m.useEffect(()=>{if(!me||!(t!=null&&t.items))return;const fe=t.items.find(ne=>ne.id===me);if(!fe)return;const q=eg(fe.status);K.isCollapsed(q)&&K.toggle(q)},[me,t==null?void 0:t.items]),m.useEffect(()=>{if(!me)return;const fe=document.querySelector(`[data-todo-id="${window.CSS.escape(me)}"]`);if(!fe)return;fe.scrollIntoView({block:"nearest"}),fe.classList.add("ring-2","ring-primary/60");const q=window.setTimeout(()=>{fe.classList.remove("ring-2","ring-primary/60"),ce(ne=>{const xe=new URLSearchParams(ne);return xe.delete("focus"),xe},{replace:!0})},1500);return()=>window.clearTimeout(q)},[me,St.length,ce]);const Ie=D?(t==null?void 0:t.items.find(fe=>fe.id===D))??null:null;function Pe(fe,q){const ne=Y.current;if(ne!=null&&ne.closest(ic)){fe.preventDefault();return}fe.dataTransfer.effectAllowed="move",fe.dataTransfer.setData("text/plain",q),W(q)}function We(){W(null),F(null)}function pt(fe,q){!Ie||q.statuses.includes(Ie.status)||(fe.preventDefault(),fe.dataTransfer.dropEffect="move",F(q.id))}function De(fe,q){M===q.id&&!fe.currentTarget.contains(fe.relatedTarget)&&F(null)}function Qe(fe,q){fe.preventDefault();const ne=Ie;We(),!(!ne||q.statuses.includes(ne.status))&&Ae(ne.id,q.dropStatus)}if(n)return s.jsx(bt,{label:"Loading todos..."});if(r)return s.jsx(Rt,{error:r});const Je=(t==null?void 0:t.counts)||{open:0,in_progress:0,blocked:0,total:0};return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Nn,{toast:i,onDismiss:l}),s.jsx(os,{open:b!==null,title:"Delete todo?",description:`Delete "${(b==null?void 0:b.description)??""}"? This can't be undone.`,confirmLabel:"Delete",destructive:!0,loading:S,onOpenChange:fe=>{!fe&&!S&&w(null)},onConfirm:async()=>{if(b){N(!0);try{await $Y(e,b.id),o(),w(null)}catch(fe){ie(fe)}finally{N(!1)}}}}),s.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(Yn,{label:"Open",value:Je.open,icon:ys}),s.jsx(Yn,{label:"In Progress",value:Je.in_progress,icon:ys,tone:"info"}),s.jsx(Yn,{label:"Blocked",value:Je.blocked,icon:kc,tone:"warn"}),s.jsx(Yn,{label:"Total",value:Je.total,icon:ys})]}),s.jsx("div",{className:"surface-panel p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text","aria-label":"New todo description",placeholder:"Add a todo...",value:k,onChange:fe=>v(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"&&k.trim()&&ve()},className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/80 focus:border-foreground/30 focus:outline-none"}),s.jsxs("button",{onClick:ve,disabled:!k.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[s.jsx(Tt,{className:"h-4 w-4"}),"Add"]})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative flex-1 max-w-sm",children:[s.jsx(Ci,{"aria-hidden":"true",className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:U,type:"text","aria-label":"Search todos",placeholder:"Search...",value:u,onChange:fe=>f(fe.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/80 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs("select",{"aria-label":"Filter by status",value:p,onChange:fe=>h(fe.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All statuses"}),s.jsx("option",{value:"open",children:"Open"}),s.jsx("option",{value:"in_progress",children:"In Progress"}),s.jsx("option",{value:"completed",children:"Completed"}),s.jsx("option",{value:"blocked",children:"Blocked"})]}),Q.length>0&&s.jsxs("select",{"aria-label":"Filter by tag",value:g,onChange:fe=>y(fe.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All tags"}),Q.map(fe=>s.jsxs("option",{value:fe,children:["#",fe]},fe))]})]}),I.size>0?s.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[s.jsxs("span",{className:"text-sm font-medium",children:[I.size," selected"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>O(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),s.jsx("button",{type:"button",onClick:()=>{L(null),V(!0)},className:"shell-action",children:"Move to…"}),s.jsx("button",{type:"button",onClick:Ce,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,J.length>0&&s.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:oe,ref:fe=>{fe&&(fe.indeterminate=te)},onChange:ge,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",J.length,")"]})]}),J.length===0?(((ut=t==null?void 0:t.items)==null?void 0:ut.length)??0)===0?s.jsx(Nt,{title:"No todos yet",description:"Add your first todo using the field above to start tracking work for this project."}):s.jsx(Nt,{title:"No todos match your filters",description:"No todos match the current search, status, or tag filters. Try clearing or adjusting them."}):s.jsx("div",{className:"space-y-3",children:(()=>{let fe=-1;return ot.map(({config:q,items:ne})=>{const xe=!K.isCollapsed(q.id);return s.jsx(C0,{label:q.label,count:ne.length,expanded:xe,onToggle:()=>K.toggle(q.id),isDropTarget:M===q.id,onDragOver:qe=>pt(qe,q),onDragLeave:qe=>De(qe,q),onDrop:qe=>Qe(qe,q),children:xe&&ne.map(qe=>(fe+=1,s.jsx(A3,{item:qe,copiedId:C,selected:I.has(qe.id),editing:T===qe.id,onBeginEdit:Fe=>A(Fe),onEndEdit:()=>A(null),onPatchDescription:Ue,onAddAttachments:rt,onDeleteAttachment:Oe,attachmentUrl:(Fe,lt)=>T3(e,Fe,lt),onToggleSelected:Fe=>ue(Fe),onMoveOne:(Fe,lt)=>{lt.stopPropagation(),L(Fe),V(!0)},onStatusChange:Ae,onCopyId:H,onDelete:ye,hotkeyRowProps:ht(fe),onDragOrigin:Fe=>{Y.current=Fe.target},onDragStart:Pe,onDragEnd:We,isDragging:D===qe.id},qe.id)))},q.id)})})()}),s.jsx(S0,{open:z,selectedIds:Array.from(I),scope:{kind:"project",projectId:e},onOpenChange:O,onDone:Be}),s.jsx($3,{open:B,selectedIds:Se,scope:{kind:"project",projectId:e},onOpenChange:fe=>{V(fe),fe||L(null)},onDone:ke})]})}const YY={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},tC=new Set(["title"]);function L3({visibility:e,onChange:t}){const[n,r]=m.useState(!1);function o(a){if(tC.has(a))return;const u=e.hidden.includes(a)?e.hidden.filter(f=>f!==a):[...e.hidden,a];t({hidden:u})}const i=e.hidden.length;return s.jsxs(On,{open:n,onOpenChange:r,children:[s.jsx(K6,{asChild:!0,children:s.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Show or hide table columns",children:[s.jsx(C5,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsxs("span",{children:["Columns",i>0?` (${Sy.length-i}/${Sy.length})`:""]})]})}),s.jsxs(Cn,{className:"max-w-sm",children:[s.jsx(sr,{children:s.jsx(En,{children:"Columns"})}),s.jsx("div",{className:"space-y-2",children:Sy.map(a=>{const l=e.hidden.includes(a),u=tC.has(a);return s.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${u?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[s.jsx("input",{type:"checkbox",checked:!l,onChange:()=>o(a),disabled:u,className:"h-4 w-4 rounded border-border accent-foreground"}),s.jsx("span",{children:YY[a]}),u?s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},a)})})]})]})}const Ql={...ld,custom:!1},O3=`view-prefs.cache.v${ld.version}`;let vd=XY(),Cl=null;const wd=new Set;let F3=0;function R0(){return++F3}function A0(e){return e===F3}function XY(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(O3);if(!e)return null;const t=JSON.parse(e);return t.version!==ld.version?null:t}catch{return null}}function QY(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(O3,JSON.stringify(e))}catch{}}function P0(e){vd=e,QY(e);for(const t of wd)t(e)}function _0(e){if(!e||typeof e!="object")return Ql;const t=e;return t.version!==ld.version||!t.global||!t.projects?Ql:{version:ld.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function D0(){if(Cl)return Cl;const e=R0();return Cl=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=_0(t);return A0(e)&&P0(n),Cl=null,vd??n}).catch(()=>(Cl=null,vd??Ql)),Cl}function z3(e){const[t,n]=m.useState(()=>vd??Ql);return m.useEffect(()=>{let r=!1;return D0().then(o=>{r||n(o)}),wd.add(n),()=>{r=!0,wd.delete(n)}},[]),lR(t,e??null)}function JY(){const[e,t]=m.useState(()=>vd??Ql);return m.useEffect(()=>{let n=!1;return D0().then(r=>{n||t(r)}),wd.add(t),()=>{n=!0,wd.delete(t)}},[]),e}async function B3(e){const t=R0(),n=await fetch("/api/view-prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const o=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(o.error??"Failed to save view-prefs")}const r=_0(await n.json());return A0(t)&&P0(r),r}function U3(e){return B3({global:e})}function H3(e,t){return B3({projects:{[e]:t}})}async function ZY(){const e=R0(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=_0(await t.json());return A0(e)&&P0(n),n}const nC=80;function V3({open:e,onOpenChange:t,initialName:n="",onSubmit:r,title:o="Save view"}){const[i,a]=m.useState(n),[l,u]=m.useState(!1),[f,p]=m.useState(null);m.useEffect(()=>{e&&(a(n),p(null),u(!1))},[e,n]);const h=i.trim(),g=h.length>0&&h.length<=nC;return s.jsx(On,{open:e,onOpenChange:t,children:s.jsx(Cn,{className:"max-w-md",children:s.jsxs("form",{className:"space-y-4",onSubmit:async y=>{if(y.preventDefault(),!(!g||l)){u(!0),p(null);try{await r(h)}catch(k){p(k instanceof Error?k.message:String(k)),u(!1)}}},children:[s.jsx(sr,{children:s.jsx(En,{children:o})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{type:"text",value:i,autoFocus:!0,required:!0,maxLength:nC,onChange:y=>a(y.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),f?s.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:f}):null]}),s.jsxs(Hr,{children:[s.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:l,children:"Cancel"}),s.jsx("button",{type:"submit",disabled:!g||l,className:"shell-action shell-action--cta disabled:opacity-50",children:l?"Saving…":"Save"})]})]})})})}function W3({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:r}){const{views:o,loading:i}=qd(),[a,l]=m.useState(!1),u=m.useRef(null);m.useEffect(()=>{if(!a)return;function g(k){u.current&&!u.current.contains(k.target)&&l(!1)}function y(k){k.key==="Escape"&&l(!1)}return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y)}},[a]);const f=m.useMemo(()=>o.filter(g=>mA(g,e)),[o,e]),p=t?o.find(g=>g.id===t)??null:null,h=i?"Saved views…":p?p.name:"Saved views";return s.jsxs("div",{className:"relative",ref:u,children:[s.jsxs("button",{type:"button",disabled:i,onClick:()=>l(g=>!g),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":a,title:h,children:[s.jsx("span",{className:"max-w-[160px] truncate",children:h}),s.jsx(tr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),a&&s.jsx("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:f.length===0?s.jsxs("div",{className:"px-3 py-3 text-sm text-muted-foreground",children:[s.jsx("p",{className:"mb-2",children:"No saved views yet — Save the current view to start."}),s.jsx("button",{type:"button",onClick:()=>{l(!1),r()},className:"shell-action w-full justify-center",children:"Save current view"})]}):f.map(g=>{const y=g.id===t;return s.jsxs("button",{type:"button",onClick:()=>{l(!1),n(g)},className:be("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",y&&"font-semibold text-foreground"),children:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:y?s.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),s.jsx("span",{className:"truncate",children:g.name})]},g.id)})})]})}const eX=new Set(["overview","assignments","todos","dependencies","knowledge"]),rC="__unknown_type__";function sC(){const{slug:e,workspace:t}=Kt(),n=xn(),r=Wt();Ai("project"),en({keys:"a",scope:"project",description:"Create assignment",handler:()=>r(`${n}/projects/${e}/create/assignment`)}),en({keys:"e",scope:"project",description:"Edit project",handler:()=>r(`${n}/projects/${e}/edit`)});const{data:o,loading:i,error:a,refetch:l}=lT(e),u=rs(),f=Bd(),{data:p}=Ra(),[h,g]=Rs(),y=h.get("tab"),k=y&&eX.has(y)?y:"overview";function v(le){g(Ne=>{const et=new URLSearchParams(Ne);return le==="overview"?et.delete("tab"):et.set("tab",le),et},{replace:!0})}const b=e?`p:${e}`:null,w=z3(b),[S,N]=m.useState(()=>yy(w.defaultView)),[C,R]=m.useState(()=>He(w.filters.status)),[T,A]=m.useState(()=>He(w.filters.assignee)),[I,_]=m.useState(()=>He(w.filters.priority)),[z,O]=m.useState(()=>He(w.filters.type)),[B,V]=m.useState(()=>He(w.filters.tags)),[$,L]=m.useState(null),[U,K]=m.useState(()=>w.grouping),[D,W]=m.useState(()=>w.sortField),[M,F]=m.useState(()=>w.sortDirection),[Y,H]=m.useState(()=>({collapsed:[]})),[Q,J]=m.useState(()=>({hidden:[]})),[Z,oe]=m.useState(()=>({hidden:[]})),[te,ue]=m.useState(null),[ge,Ce]=m.useState(!1),[Se,ke]=m.useState(!1),{toast:Be,showToast:ie,dismissToast:ve}=Tn(),ye={kind:"project",slug:e??"",workspace:t??null},Ae=h.get("loadView"),{view:Ue,loading:rt,error:Oe}=ki(Ae),{view:ot,loading:St,error:ht}=ki(te),it=m.useRef(null);m.useEffect(()=>{te&&!St&&!ht&&!ot&&ue(null)},[ot,ht,te,St]),m.useEffect(()=>{ue(null),it.current=null,L(null)},[e,t]),m.useEffect(()=>{N(yy(w.defaultView)),R(He(w.filters.status)),A(He(w.filters.assignee)),_(He(w.filters.priority)),O(He(w.filters.type)),V(He(w.filters.tags)),K(w.grouping),W(w.sortField),F(w.sortDirection)},[e,w.defaultView,w.filters.status,w.filters.assignee,w.filters.priority,w.filters.type,w.filters.tags,w.grouping,w.sortField,w.sortDirection]);const ce=m.useCallback(le=>{b&&H3(b,le).catch(Ne=>{console.warn("Failed to persist project view prefs:",Ne)})},[b]),me=m.useCallback(le=>{N(le),ce({defaultView:le})},[ce]),Ie=m.useCallback(le=>{R(le),ce({filters:{status:le}})},[ce]),Pe=m.useCallback(le=>{A(le),ce({filters:{assignee:le}})},[ce]),We=m.useCallback(le=>{_(le),ce({filters:{priority:le}})},[ce]),pt=m.useCallback(le=>{O(le),ce({filters:{type:le}})},[ce]),De=m.useCallback(le=>{V(le),ce({filters:{tags:le}})},[ce]),Qe=m.useCallback(le=>{K(le),ce({grouping:le})},[ce]),Je=m.useCallback(le=>{W(le),ce({sortField:le})},[ce]),ut=m.useCallback(le=>{F(le),ce({sortDirection:le})},[ce]),fe=m.useCallback(()=>({viewMode:S,filters:{status:C,priority:I,type:z,assignee:T,tags:B,project:"all",activity:"all",dateRange:xa($)},sortField:D,sortDirection:M,listSectionVisibility:Y,kanbanColumnVisibility:Q,tableColumnVisibility:Z}),[S,C,I,z,T,B,$,D,M,Y,Q,Z]),q=m.useCallback(le=>{yP(le,{setViewMode:Ne=>N(yy(Ne)),setStatusFilter:Ie,setPriorityFilter:We,setTypeFilter:pt,setAssigneeFilter:Pe,setTagsFilter:De,setDateRange:L,setSortField:Je,setSortDirection:ut,setListSectionVisibility:H,setKanbanColumnVisibility:J,setTableColumnVisibility:oe}),ue(le.id)},[Ie,We,pt,Pe,De,Je,ut]),ne=m.useCallback(le=>{q(le),it.current=le.id,g(Ne=>{const et=new URLSearchParams(Ne);return et.set("loadView",le.id),et},{replace:!0})},[q,g]),xe=m.useCallback(async le=>{try{const Ne=ac({name:le,context:{workspace:t??null,projectSlug:e??null},state:fe()}),et=await rc(Ne),Pn=et.views[et.views.length-1];ue((Pn==null?void 0:Pn.id)??null),Pn&&(it.current=Pn.id,g(Er=>{const lo=new URLSearchParams(Er);return lo.set("loadView",Pn.id),lo},{replace:!0})),Ce(!1),ke(!1),ie(`Saved view "${le}"`,"success")}catch(Ne){throw ie(Ne instanceof Error?Ne.message:"Failed to save view","error"),Ne}},[fe,g,ie,e,t]),qe=m.useCallback(async()=>{if(!(!te||!ot))try{const le=He(ot.config.filters.project)[0]??null,Ne=ac({name:ot.name,context:{workspace:t??null,projectSlug:le},state:fe()}),et=Dh(ot.config,Ne.config,Ne.config);await Eh(te,{config:et}),ie("View updated","success")}catch(le){ie(le instanceof Error?le.message:"Failed to update view","error")}},[fe,ot,te,ie,t]);m.useEffect(()=>{if(!Ae){it.current=null;return}if(it.current!==Ae&&(te&&te!==Ae&&ue(null),!rt)){if(Oe){ie("Couldn't load saved view — try again","error");return}if(Ue){if(it.current=Ae,!mA(Ue,{kind:"project",slug:e??"",workspace:t??null})){r(vP(Ue),{replace:!0});return}q(Ue),g(le=>{const Ne=new URLSearchParams(le);return Ne.delete("loadView"),Ne},{replace:!0});return}it.current=Ae,ie("Saved view no longer exists","error"),g(le=>{const Ne=new URLSearchParams(le);return Ne.delete("loadView"),Ne},{replace:!0})}},[Ae,Ue,rt,Oe,te,q,g,ie,r,e,t]);function Fe(le){D===le?ut(M==="asc"?"desc":"asc"):(Je(le),ut("asc"))}const lt=m.useMemo(()=>o?Object.fromEntries(o.assignments.flatMap(le=>{const Ne=`${n}/projects/${o.slug}/assignments/${le.slug}`;return[[le.slug,Ne],[le.title,Ne]]})):{},[o]),[mt,vt]=m.useState(!1);async function nt(le){vt(!0);try{const Ne=await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:le})});if(!Ne.ok){const et=await Ne.json().catch(()=>null);ie((et==null?void 0:et.error)||`HTTP ${Ne.status}`,"error");return}l(),ie(le?"Status override set":"Status override cleared","success")}catch(Ne){ie(Ne instanceof Error?Ne.message:"Failed to update status","error")}finally{vt(!1)}}async function _t(le){vt(!0);try{const Ne=await fetch(`/api/projects/${e}/${le?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Ne.ok){const et=await Ne.json().catch(()=>null);ie((et==null?void 0:et.error)||`HTTP ${Ne.status}`,"error");return}l(),ie(le?"Project archived":"Project restored","success")}catch(Ne){ie(Ne instanceof Error?Ne.message:"Failed to update archive state","error")}finally{vt(!1)}}async function Bt(le){vt(!0);try{const Ne=await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:le})});if(!Ne.ok){const et=await Ne.json().catch(()=>null);ie((et==null?void 0:et.error)||`HTTP ${Ne.status}`,"error");return}l(),ie(le?`Moved to "${le}"`:"Moved to ungrouped","success")}catch(Ne){ie(Ne instanceof Error?Ne.message:"Failed to move workspace","error")}finally{vt(!1)}}if(i)return s.jsx(bt,{label:"Loading project workspace…"});if(a||!o)return s.jsx(Rt,{error:a||"Project not found."});const Ut=(()=>{const le=new Set;for(const et of o.assignments)et.assignee&&le.add(et.assignee);const Ne=[{value:"__unassigned__",label:"Unassigned"}];for(const et of Array.from(le).sort())Ne.push({value:et,label:et});return Ne})(),An=Array.from(new Set(o.assignments.flatMap(le=>le.tags??[]))).sort().map(le=>({value:le,label:le})),Ct=o.assignments.filter(le=>L9(le,{status:C,priority:I,type:z,assignee:T,tags:B,dateRange:xa($)})),je=Xd(Ct,D,M),Ye=new Set(f.definitions.map(le=>le.id)),at=U==="type"?[...f.definitions.map(le=>({id:le.id,title:Hl(f,le.id),description:le.description})),...Ct.some(le=>!le.type||!Ye.has(le.type))?[{id:rC,title:"Other",description:"Assignments with no recognized type."}]:[]]:SP(u.order).map(le=>({id:le,title:es(u,le),description:Qd(le)}));function Mt({field:le,children:Ne}){const et=D===le;return s.jsx("th",{className:"pb-3 font-medium",children:s.jsxs("button",{type:"button",onClick:()=>Fe(le),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Ne,et?M==="asc"?s.jsx(E2,{className:"h-3 w-3"}):s.jsx(tr,{className:"h-3 w-3"}):null]})})}return s.jsxs("div",{className:"space-y-5","data-density":w.density,children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(ro,{status:o.status}),o.statusOverride&&s.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>nt(null),disabled:mt,title:"Clear manual status override and return to derived status",children:"Clear Override"}),s.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm disabled:cursor-not-allowed disabled:opacity-50",value:"",disabled:mt,onChange:le=>{le.target.value&&nt(le.target.value)},title:"Override project status",children:[s.jsx("option",{value:"",children:"Set Status…"}),u.statuses.map(le=>s.jsx("option",{value:le.id,children:le.label},le.id)),s.jsx("option",{value:"active",children:"Active"})]}),s.jsx("button",{type:"button",className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>_t(!o.archived),disabled:mt,title:o.archived?"Restore this project and its cascade-hidden assignments":"Archive this project (hides it and its assignments from normal views)",children:o.archived?"Restore":"Archive"}),p&&p.workspaces.length>0&&s.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm disabled:cursor-not-allowed disabled:opacity-50",value:"",disabled:mt,onChange:le=>{le.target.value==="_ungrouped"?Bt(null):le.target.value&&Bt(le.target.value)},title:"Move project to a different workspace",children:[s.jsx("option",{value:"",children:"Move to Workspace…"}),p.workspaces.filter(le=>le!==o.workspace).map(le=>s.jsx("option",{value:le,children:le},le)),o.workspace&&s.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),s.jsxs(_e,{className:"shell-action",to:`${n}/projects/${o.slug}/edit`,children:[s.jsx(oy,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Project"})]}),s.jsx(EP,{externalIds:o.externalIds}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",Xn(o.created),". Last source update ",Sr(o.updated),"."]})]}),s.jsxs("div",{className:"grid gap-3 grid-cols-2 sm:grid-cols-3 xl:grid-cols-5",children:[s.jsx(Yn,{label:"Assignments",value:o.progress.total}),s.jsx(Yn,{label:"In Progress",value:o.progress.in_progress??0,tone:"info"}),s.jsx(Yn,{label:"Review",value:o.progress.review??0,tone:"info"}),s.jsx(Yn,{label:"Blocked",value:o.progress.blocked??0,tone:"warn"}),s.jsx(Yn,{label:"Completed",value:o.progress.completed??0,tone:"success"})]}),s.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_300px]",children:[s.jsx("div",{className:"space-y-4",children:s.jsx(Xm,{value:k,onValueChange:v,items:[{value:"overview",label:"Overview",content:s.jsx("div",{className:"space-y-5",children:s.jsx(Ve,{title:"Project Overview",children:o.body&&o.body.trim()?s.jsx(jn,{content:o.body}):s.jsx(Nt,{title:"No overview yet",description:"Add a short summary so collaborators and agents know what this project is about.",actions:s.jsxs(_e,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/edit`,children:[s.jsx(oy,{className:"h-4 w-4"}),s.jsx("span",{children:"Add overview"})]})})})})},{value:"assignments",label:"Assignments",count:o.assignments.filter(le=>!le.archived).length,content:s.jsx("div",{className:"space-y-5",children:s.jsx(Ve,{title:"Assignment Queue",description:"Board and table views over the source assignment files.",actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(kn,{ariaLabel:"Status filter",className:"max-w-[170px]",allLabel:"All statuses",options:u.statuses.map(le=>({value:le.id,label:le.label})),value:C,onChange:Ie}),s.jsx(kn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:Ut,value:T,onChange:Pe}),s.jsx(kn,{ariaLabel:"Priority filter",className:"max-w-[170px]",allLabel:"All priorities",options:[{value:"critical",label:"Critical"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],value:I,onChange:We}),s.jsx(kn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:f.definitions.map(le=>({value:le.id,label:Hl(f,le.id)})),value:z,onChange:pt}),s.jsx(kn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:An,value:B,onChange:De}),s.jsx(Wm,{className:"max-w-[190px]",value:$,onChange:L}),S==="kanban"&&s.jsxs("select",{value:U==="type"?"type":"status",onChange:le=>Qe(le.target.value),className:"editor-input max-w-[170px]",title:"Group kanban by",children:[s.jsx("option",{value:"status",children:"Group: Status"}),s.jsx("option",{value:"type",children:"Group: Type"})]}),s.jsx(Gm,{value:S,onChange:le=>me(le),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),s.jsx(W3,{scope:ye,loadedViewId:te,onApply:ne,onOpenSaveDialog:()=>{ke(!1),Ce(!0)}}),s.jsx("button",{type:"button",onClick:()=>{ot?qe():(ke(!1),Ce(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:ot?`Update ${ot.name}`:"Save current view",children:ot?`Update '${ot.name}'`:"Save view"}),ot?s.jsx("button",{type:"button",onClick:()=>{ke(!0),Ce(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),children:Ct.length===0?s.jsx(Nt,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:s.jsx(_e,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:"Create Assignment"})}):S==="kanban"?s.jsx(Hm,{columns:at,items:je,getItemId:le=>le.slug,getColumnId:le=>U==="type"?le.type&&Ye.has(le.type)?le.type:rC:le.status,dragDisabled:!0,boundedColumns:!0,renderCard:le=>s.jsx(tX,{projectSlug:o.slug,assignment:le,onAssignmentChange:()=>l()}),emptyMessage:le=>`No ${le.title.toLowerCase()} assignments.`,hiddenColumnIds:Q.hidden,onHideColumn:le=>J(Ne=>({hidden:Ne.hidden.includes(le)?Ne.hidden.filter(Pn=>Pn!==le):[...Ne.hidden,le]}))}):(()=>{const le=new Set(Z.hidden),Ne=et=>et==="title"||!le.has(et);return s.jsxs("div",{className:"overflow-x-auto",children:[s.jsx("div",{className:"mb-3 flex items-center justify-end",children:s.jsx(L3,{visibility:Z,onChange:oe})}),s.jsxs("table",{className:"w-full min-w-[720px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[Ne("title")?s.jsx(Mt,{field:"title",children:"Assignment"}):null,Ne("status")?s.jsx(Mt,{field:"status",children:"Status"}):null,s.jsx("th",{className:"pb-3 font-medium",children:"Type"}),Ne("priority")?s.jsx(Mt,{field:"priority",children:"Priority"}):null,Ne("assignee")?s.jsx(Mt,{field:"assignee",children:"Assignee"}):null,Ne("dependencies")?s.jsx(Mt,{field:"dependencies",children:"Dependencies"}):null,Ne("created")?s.jsx(Mt,{field:"created",children:"Created"}):null,Ne("updated")?s.jsx(Mt,{field:"updated",children:"Updated"}):null]})}),s.jsx("tbody",{children:je.map(et=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[Ne("title")?s.jsx("td",{className:"py-4",children:s.jsx(_e,{to:`${n}/projects/${o.slug}/assignments/${et.slug}`,className:"font-semibold text-foreground hover:text-primary",children:et.title})}):null,Ne("status")?s.jsx("td",{className:"py-4",children:s.jsx(Cs,{projectSlug:o.slug,slug:et.slug,status:et.status,title:et.title,className:"max-w-[150px]",onChange:()=>l()})}):null,s.jsx("td",{className:"py-4",children:s.jsx(_a,{type:et.type,compact:!0})}),Ne("priority")?s.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:et.priority}):null,Ne("assignee")?s.jsx("td",{className:"py-4 text-muted-foreground",children:et.assignee??"—"}):null,Ne("dependencies")?s.jsx("td",{className:"py-4 text-muted-foreground",children:et.dependsOn.length}):null,Ne("created")?s.jsx("td",{className:"py-4 text-muted-foreground",children:Xn(et.created)}):null,Ne("updated")?s.jsx("td",{className:"py-4 text-muted-foreground",children:Xn(et.updated)}):null]},et.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:s.jsx(GY,{projectId:o.slug})},{value:"dependencies",label:"Dependencies",content:o.dependencyGraph?s.jsx(Ve,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:s.jsx(sW,{definition:o.dependencyGraph,nodeRoutes:lt})}):s.jsx(Nt,{title:"No dependency graph yet",description:"Dependencies appear here once assignments declare dependsOn relationships."})},{value:"knowledge",label:"Knowledge",content:s.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[s.jsx(Ve,{title:"Resources",description:"Shared project references.",actions:s.jsxs(_e,{className:"shell-action",to:`/resources/new?project=${o.slug}`,children:[s.jsx(Tt,{className:"h-4 w-4"}),s.jsx("span",{children:"New Resource"})]}),children:o.resources.length===0?s.jsx(Nt,{title:"No resources yet",description:"Resources live at the project level and stay available to every assignment."}):s.jsx("div",{className:"space-y-3",children:o.resources.map(le=>s.jsxs(_e,{to:`/projects/${o.slug}/resources/${le.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:le.name}),s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[le.category," · ",le.source]})]},le.slug))})}),s.jsx(Ve,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:s.jsxs(_e,{className:"shell-action",to:`/memories/new?project=${o.slug}`,children:[s.jsx(Tt,{className:"h-4 w-4"}),s.jsx("span",{children:"New Memory"})]}),children:o.memories.length===0?s.jsx(Nt,{title:"No memories yet",description:"Memories capture patterns discovered during execution so later assignments can reuse them."}):s.jsx("div",{className:"space-y-3",children:o.memories.map(le=>s.jsxs(_e,{to:`/projects/${o.slug}/memories/${le.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:le.name}),s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[le.scope," · ",le.source]})]},le.slug))})})]})}]})}),s.jsxs("div",{className:"space-y-5",children:[s.jsx(Ve,{title:"Progress Summary",children:s.jsx(Mh,{progress:o.progress,showLegend:!0})}),s.jsx(Ve,{title:"Attention",children:(()=>{const le=[{label:"Blocked",count:o.needsAttention.blockedCount,alert:!0},{label:"Failed",count:o.needsAttention.failedCount,alert:!0},{label:"Unanswered questions",count:o.needsAttention.openQuestions,alert:!1}].filter(Ne=>Ne.count>0);return le.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing needs attention."}):s.jsx("dl",{className:"space-y-3 text-sm",children:le.map(Ne=>s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("dt",{className:"text-muted-foreground",children:Ne.label}),s.jsx("dd",{className:`font-semibold ${Ne.alert?"text-warning-foreground":"text-foreground"}`,children:Ne.count})]},Ne.label))})})()}),s.jsx(Ve,{title:"Quick Links",children:s.jsxs("div",{className:"space-y-2 text-sm",children:[s.jsxs(_e,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/edit`,children:[s.jsx(oy,{className:"h-4 w-4"}),"Edit project source"]}),s.jsxs(_e,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/create/assignment`,children:[s.jsx(Tt,{className:"h-4 w-4"}),"Create assignment"]}),s.jsxs(_e,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[s.jsx(x5,{className:"h-4 w-4"}),"Review project rules"]}),s.jsxs("button",{type:"button",onClick:()=>v("dependencies"),className:"flex items-center gap-2 text-primary hover:underline",children:[s.jsx(Xv,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),o.archived?s.jsxs(Ve,{title:"Archive Metadata",children:[s.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["Archived ",o.archivedAt?Sr(o.archivedAt):"with no timestamp recorded","."]}),o.archivedReason?s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.archivedReason}):null]}):null]})]}),s.jsx(Nn,{toast:Be,onDismiss:ve}),s.jsx(V3,{open:ge,onOpenChange:le=>{Ce(le),le||ke(!1)},initialName:Se&&ot?`${ot.name} (copy)`:"",title:Se?"Save as new view":"Save view",onSubmit:xe})]})}function tX({projectSlug:e,assignment:t,onAssignmentChange:n}){const r=xn();return s.jsxs(_e,{to:`${r}/projects/${e}/assignments/${t.slug}`,className:"vp-card block rounded-lg border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:t.title}),s.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:t.id,children:[t.id.slice(0,8),s.jsx("span",{onClick:o=>{o.preventDefault(),o.stopPropagation()},children:s.jsx(jr,{value:t.id})})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Xn(t.updated)]})]}),s.jsx("span",{onClick:o=>{o.preventDefault(),o.stopPropagation()},onPointerDown:o=>o.stopPropagation(),children:s.jsx(Cs,{projectSlug:e,slug:t.slug,status:t.status,title:t.title,className:"max-w-[150px]",onChange:n})})]}),s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[s.jsx(_a,{type:t.type}),s.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:t.priority}),s.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:t.assignee??"Unassigned"}),s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[t.dependsOn.length," dependencies"]})]})]})}function K3(e,t=!0){const[n,r]=m.useState([]),[o,i]=m.useState(!0),[a,l]=m.useState(null),[u,f]=m.useState(0),p=t?e:null,h=m.useCallback(()=>{f(y=>y+1)},[]),g=m.useRef(p);return g.current!==p&&(g.current=p,r([]),l(null)),m.useEffect(()=>{if(!p){i(!1),r([]);return}let y=!1;return i(!0),l(null),fetch(p).then(async k=>{if(!k.ok){const v=await k.json().catch(()=>null);throw new Error((v==null?void 0:v.error)||`HTTP ${k.status}`)}return k.json()}).then(k=>{y||(r(Array.isArray(k.events)?k.events:[]),i(!1))}).catch(k=>{y||(l(k.message),i(!1))}),()=>{y=!0}},[p,u]),Ei(y=>{p&&(y.type==="assignment-updated"||y.type==="project-updated")&&h()}),{events:n,loading:o,error:a,refetch:h}}function q3({sessionId:e,disabled:t=!1,disabledReason:n,onError:r,onNotice:o}){const[i,a]=m.useState(!1),[l,u]=m.useState(!1);async function f(){var h;if(t||l)return;u(!0);const p=(async()=>{const g=await fetch(`/api/launch/command?session=${encodeURIComponent(e)}&mode=resume`);if(!g.ok){const k=await g.json().catch(()=>null);throw new Error((k==null?void 0:k.error)??`HTTP ${g.status}`)}const y=await g.json().catch(()=>null);if(!y||typeof y.command!="string")throw new Error("Malformed response from launch command endpoint");return{command:y.command,fallbackWarning:typeof y.fallbackWarning=="string"&&y.fallbackWarning?y.fallbackWarning:void 0}})();try{const g=typeof((h=navigator.clipboard)==null?void 0:h.write)=="function"&&typeof ClipboardItem<"u";let y;if(g)await navigator.clipboard.write([new ClipboardItem({"text/plain":p.then(k=>new Blob([k.command],{type:"text/plain"}))})]),y=(await p).fallbackWarning;else{const k=await p;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(k.command),y=k.fallbackWarning}a(!0),setTimeout(()=>a(!1),1500),y&&(o==null||o(y))}catch(g){let y=g instanceof Error?g:new Error(String(g));try{await p}catch(k){y=k instanceof Error?k:new Error(String(k))}r==null||r(y)}finally{u(!1)}}return t?s.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:n??"Copy launch command unavailable","aria-label":"Copy launch command",children:s.jsx(H1,{className:"h-3 w-3","aria-hidden":"true"})}):s.jsx("button",{type:"button",onClick:f,disabled:l,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded disabled:cursor-wait",title:i?"Copied!":"Copy launch command (cd + resume)","aria-label":"Copy launch command",children:i?s.jsx(Nr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):s.jsx(H1,{className:"h-3 w-3","aria-hidden":"true"})})}function G3(){const[e,t]=m.useState(!1),[n,r]=m.useState(null),[o,i]=m.useState(null),[a,l]=m.useState(null),[u,f]=m.useState(null),[p,h]=m.useState(null),[g,y]=m.useState(!1),[k,v]=m.useState(null),[b,w]=m.useState(null);async function S(T,A,I,_,z){if(!e){if(T.kind==="standalone"){window.location.href=na(T,A,void 0,I,_,z);return}t(!0);try{const O=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:T.kind,id:T.id}})});if(!O.ok){window.location.href=na(T,A,void 0,I,_,z);return}const B=await O.json();if(B.ok){window.location.href=na(T,A,void 0,I,_,z);return}if(B.reason==="workspace-path-invalid"){B.recreate?(f(B.recreate),h({target:T,mode:A,agentId:I,prompt:_,agentName:z})):l(B.message);return}r(B),i({target:T,mode:A,agentId:I,prompt:_,agentName:z})}catch(O){console.warn("preflight failed, firing without override:",O),window.location.href=na(T,A,void 0,I,_,z)}finally{t(!1)}}}function N(){!n||!o||(window.location.href=na(o.target,o.mode,n.suggestedFallback,o.agentId,o.prompt,o.agentName),r(null),i(null))}async function C(){if(!(!u||!p||g)){y(!0),v(null);try{const T=await sH({kind:u.kind,id:u.id,projectSlug:u.projectSlug,assignmentSlug:u.assignmentSlug}),{target:A,mode:I,agentId:_,prompt:z,agentName:O}=p;f(null),h(null),window.location.href=na(A,I,void 0,_,z,O),!T.exact&&!T.alreadyExisted&&w(`Recreated from ${T.baseUsed} — the original branch couldn't be restored exactly, but the directory is back and your agent is opening.`)}catch(T){v(T instanceof n0&&T.stderr?`${T.message}
|
|
649
|
+
${T.stderr}`:T instanceof Error?T.message:String(T))}finally{y(!1)}}}const R=s.jsxs(s.Fragment,{children:[s.jsx(_l,{open:n!==null,onOpenChange:T=>!T&&(r(null),i(null)),children:s.jsxs(la,{children:[s.jsxs(Dl,{children:[s.jsxs(ca,{children:[n==null?void 0:n.terminal," is not installed"]}),s.jsxs(ua,{children:[(n==null?void 0:n.terminal)==="cmux"?s.jsxs(s.Fragment,{children:["To use cmux, install ",s.jsx("strong",{children:"cmux.app"})," into"," ",s.jsx("code",{children:"/Applications"}),"."," "]}):null,"Open in ",s.jsx("strong",{children:n==null?void 0:n.suggestedFallback})," instead? You can change the default in"," ",s.jsx(_e,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{r(null),i(null)},children:"Settings"}),"."]})]}),s.jsxs($l,{children:[s.jsx(ud,{className:"shell-action mt-0",children:"Cancel"}),s.jsxs(yi,{className:"shell-action mt-0 shell-action--cta",onClick:T=>{T.preventDefault(),N()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),s.jsx(_l,{open:a!==null,onOpenChange:T=>!T&&l(null),children:s.jsxs(la,{children:[s.jsxs(Dl,{children:[s.jsx(ca,{children:"Can't open in agent"}),s.jsxs(ua,{children:[a," Set a valid worktree or repository, then try again."]})]}),s.jsx($l,{children:s.jsx(yi,{className:"shell-action mt-0 shell-action--cta",onClick:()=>l(null),children:"OK"})})]})}),s.jsx(_l,{open:u!==null,onOpenChange:T=>{!T&&!g&&(f(null),h(null),v(null))},children:s.jsxs(la,{children:[s.jsxs(Dl,{children:[s.jsx(ca,{children:"Worktree was deleted"}),s.jsxs(ua,{children:["The worktree at ",s.jsx("code",{children:u==null?void 0:u.deletedPath})," no longer exists. Recreate it",u!=null&&u.branch?s.jsxs(s.Fragment,{children:[" ","on branch ",s.jsx("code",{children:u.branch})]}):null," ","so this can open?"]})]}),k&&s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:k}),s.jsxs($l,{children:[s.jsx(ud,{className:"shell-action mt-0",disabled:g,children:"No"}),s.jsx(yi,{className:"shell-action mt-0 shell-action--cta",disabled:g,onClick:T=>{T.preventDefault(),C()},children:g?"Recreating…":"Yes, recreate"})]})]})}),s.jsx(_l,{open:b!==null,onOpenChange:T=>!T&&w(null),children:s.jsxs(la,{children:[s.jsxs(Dl,{children:[s.jsx(ca,{children:"Worktree recreated"}),s.jsx(ua,{children:b})]}),s.jsx($l,{children:s.jsx(yi,{className:"shell-action mt-0 shell-action--cta",onClick:()=>w(null),children:"OK"})})]})})]});return{open:S,pending:e,dialogs:R}}function Y3({session:e,onMarkStopped:t}){const n=G3(),r={kind:"session",id:e.sessionId},o="size-3.5",i=be("shell-action","inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50"),a="inline-flex outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm",l=!e.resumeSupported&&!e.forkSupported;return s.jsxs(s.Fragment,{children:[s.jsx(ga,{delayDuration:200,children:s.jsxs("div",{className:"inline-flex items-center gap-1",children:[l&&s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsx("span",{tabIndex:0,className:a,children:s.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:i,children:[s.jsx(pa,{className:o}),s.jsx("span",{children:"Reopen"})]})})}),s.jsx(br,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsx("span",{tabIndex:0,className:a,children:s.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:i,children:[s.jsx(pa,{className:o}),s.jsx("span",{children:"Resume"})]})})}),s.jsx(br,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(r,"resume"),children:[s.jsx(pa,{className:o}),s.jsx("span",{children:"Resume"})]})}),s.jsx(br,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(r,"fork"),children:[s.jsx(M5,{className:o}),s.jsx("span",{children:"Fork"})]})}),s.jsx(br,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>t(e.sessionId),children:[s.jsx(tw,{className:o}),s.jsx("span",{children:"Mark stopped"})]})}),s.jsx(br,{side:"top",children:e.resumeSupported?"Tell the dashboard this session has ended so Resume re-enables":"Tell the dashboard this session has ended"})]})]})}),n.dialogs]})}async function nX(e){const t=await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!t.ok)throw new Error(await t.text().catch(()=>"")||`HTTP ${t.status}`)}function X3({sessions:e,loading:t,error:n,onError:r,onNotice:o}){return t&&!e?null:n&&!e?s.jsx(Ve,{title:"Agent Sessions",children:s.jsx(Nt,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?s.jsx(Ve,{title:"Agent Sessions",children:s.jsx(Nt,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):s.jsx(Ve,{title:"Agent Sessions",children:s.jsx("div",{className:"space-y-2",children:e.map(i=>s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(om,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"font-medium text-foreground",children:i.agent}),s.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground",title:i.sessionId,children:[i.sessionId.slice(0,8),s.jsx(jr,{value:i.sessionId,onError:r}),s.jsx(q3,{sessionId:i.sessionId,disabled:!i.resumeSupported,disabledReason:"Resume not supported for this agent",onError:r,onNotice:o})]})]}),s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(ro,{status:i.status}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Sr(i.started)})]}),s.jsx(Y3,{session:i,onMarkStopped:a=>nX(a).catch(l=>r==null?void 0:r(l instanceof Error?l:new Error(String(l))))})]},i.sessionId))})})}const Gy="Cost / Usage";function Q3({summary:e,error:t}){return t&&!e?s.jsx(Ve,{title:Gy,children:s.jsx(Nt,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?s.jsx(Ve,{title:Gy,children:s.jsx(Nt,{title:"No usage recorded yet",description:"Cost and token totals appear here once the usage collector records activity for this assignment."})}):s.jsx(Ve,{title:Gy,children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(oC,{label:"Total cost",value:tc(e.totalCost)}),s.jsx(oC,{label:"Total tokens",value:ec(e.totalTokens)})]}),e.byModel.length>1?s.jsxs("div",{className:"space-y-1.5 border-t border-border pt-3",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"By model"}),s.jsx("div",{className:"space-y-1",children:e.byModel.map(n=>s.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(um,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate font-mono text-xs text-foreground",title:n.model,children:n.model})]}),s.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[ec(n.totalTokens)," · ",tc(n.totalCost)]})]},n.model))})]}):null,s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",B4(e.lastEventDay)]})]})}):null}function oC({label:e,value:t}){return s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),s.jsx("p",{className:"text-lg font-semibold tabular-nums text-foreground",children:t})]})}const rX=/^[a-z0-9][a-z0-9_-]*$/,J3=["first","last","none"];function sX(e){if(e.runner)return e.runner;if(e.agentName&&e.agentName.trim()!=="")return"claude";const t=e.command??"";return/claude/i.test(t)||e.id==="claude"?"claude":/codex/i.test(t)||e.id==="codex"?"codex":"pi"}class Z3 extends Error{constructor(n,r){super(n);Yx(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=r}}const $0={agents:[],custom:!1};let Il=null,El=null,jd=0;const xv=new Set;function I0(e){Il=e;for(const t of xv)t(e)}function oX(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(typeof t.id!="string"||t.id.length===0||typeof t.label!="string"||typeof t.command!="string")return null;const n={id:t.id,label:t.label,command:t.command};return Array.isArray(t.args)&&t.args.every(r=>typeof r=="string")&&(n.args=t.args),typeof t.promptArgPosition=="string"&&J3.includes(t.promptArgPosition)&&(n.promptArgPosition=t.promptArgPosition),typeof t.resolveFromShellAliases=="boolean"&&(n.resolveFromShellAliases=t.resolveFromShellAliases),typeof t.default=="boolean"&&(n.default=t.default),typeof t.model=="string"&&(n.model=t.model),typeof t.playbook=="string"&&(n.playbook=t.playbook),typeof t.launchPrompt=="string"&&(n.launchPrompt=t.launchPrompt),typeof t.agentName=="string"&&(n.agentName=t.agentName),typeof t.workdir=="string"&&(n.workdir=t.workdir),(t.runner==="claude"||t.runner==="pi"||t.runner==="codex")&&(n.runner=t.runner),typeof t.sourceKind=="string"&&(n.sourceKind=t.sourceKind),typeof t.sourcePath=="string"&&(n.sourcePath=t.sourcePath),typeof t.sourceRepo=="string"&&(n.sourceRepo=t.sourceRepo),n}function tg(e){if(!e||typeof e!="object")return $0;const t=e,n=Array.isArray(t.agents)?t.agents:[],r=[];for(const o of n){const i=oX(o);i&&r.push(i)}return{agents:r,custom:t.custom===!0}}function iX(){if(Il)return Promise.resolve(Il);if(El)return El;const e=++jd;return El=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{El=null;const n=tg(t);return e!==jd?Il??n:(Il=n,n)}).catch(()=>(El=null,$0)),El}function M0(){const[e,t]=m.useState(()=>Il??$0);return m.useEffect(()=>{let n=!1;return iX().then(r=>{n||t(r)}),xv.add(t),()=>{n=!0,xv.delete(t)}},[]),e}async function L0(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new Z3(n,t==null?void 0:t.fieldErrors)}async function e_(e){++jd;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await L0(t);const n=tg(await t.json());return I0(n),n}async function aX(){++jd;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await L0(e);const t=tg(await e.json());return I0(t),t}async function lX(e){const n=await fetch("/api/config/agents/discovered");if(!n.ok)return[];const r=await n.json().catch(()=>null);return Array.isArray(r==null?void 0:r.candidates)?r.candidates:[]}function cX(e){const[t,n]=m.useState([]),[r,o]=m.useState(!0),[i,a]=m.useState(0);return m.useEffect(()=>{let l=!1;return o(!0),lX().then(u=>{l||(n(u),o(!1))}).catch(()=>{l||(n([]),o(!1))}),()=>{l=!0}},[e,i]),{candidates:t,loading:r,reload:()=>a(l=>l+1)}}async function O0(e,t){++jd;const n=await fetch(`/api/config/agents/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await L0(n);const r=tg(await n.json());return I0(r),r}const uX=e=>O0("register",e),dX=e=>O0("manual-add",{path:e}),fX=e=>O0("create",e),pX={claude:"#8b5cf6",pi:"#14b8a6",codex:"#f59e0b"};function yv({agent:e,runner:t,className:n}){const r=t??(e?sX(e):"pi");return s.jsxs("span",{className:be("inline-flex items-center gap-1 rounded border border-border/60 bg-foreground/[0.04] px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",n),children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:pX[r]}}),r]})}const iC=/[A-Za-z0-9_-]/,hX=/^[a-z0-9]+(-[a-z0-9]+)*$/,aC=/(^|\s)@([A-Za-z0-9_-]+)/g,t_=["assignment","worktree"];function n_(e,t){const n=Math.max(0,Math.min(t,e.length));let r=n;for(;r>0&&iC.test(e[r-1]);)r--;const o=r-1;if(o<0||e[o]!=="@"||o>0&&!/\s/.test(e[o-1]))return null;let i=n;for(;i<e.length&&iC.test(e[i]);)i++;return{start:o,end:i,partial:e.slice(o+1,n)}}function r_(e,t){const n=t_,r=[...n,...t.filter(l=>!n.includes(l))],o=e.toLowerCase();if(o==="")return r;const i=[],a=[];for(const l of r){const u=l.toLowerCase();u.startsWith(o)?i.push(l):u.includes(o)&&a.push(l)}return[...i,...a]}function s_(e,t,n){const r=`@${n}`;return{text:e.slice(0,t.start)+r+e.slice(t.end),caret:t.start+r.length}}function o_(e,t){const n=t instanceof Set?t:new Set(t),r=t_,o=[];aC.lastIndex=0;let i;for(;(i=aC.exec(e))!==null;){const a=i[2];r.includes(a)||(hX.test(a)?n.has(a)||o.push(`Playbook "${a}" is not installed — "@${a}" will be left as literal text.`):o.push(`"@${a}" is not a valid playbook token — it will be left as literal text.`))}return o}const lC=2e3;function mX({open:e,assignmentId:t,agentId:n,onConfirm:r,onOpenChange:o}){const[i,a]=m.useState(""),[l,u]=m.useState([]),[f,p]=m.useState(!1),[h,g]=m.useState(null),[y,k]=m.useState(0),[v,b]=m.useState(0),[w,S]=m.useState(!1),N=m.useRef(null);m.useEffect(()=>{if(!e)return;let $=!1;p(!0),g(null),S(!1);const L=new URLSearchParams({assignment:t});return n&&L.set("agent",n),fetch(`/api/launch/prompt?${L.toString()}`).then(async U=>{if(!U.ok){const K=await U.json().catch(()=>null);throw new Error((K==null?void 0:K.error)??`HTTP ${U.status}`)}return await U.json()}).then(U=>{$||(a(U.template??""),u(U.knownPlaybookSlugs??[]),k((U.template??"").length))}).catch(U=>{$||g(U instanceof Error?U.message:String(U))}).finally(()=>{$||p(!1)}),()=>{$=!0}},[e,t,n]);const C=n_(i,y),R=C?r_(C.partial,l):[],T=e&&!f&&!w&&R.length>0,A=o_(i,l),I=i.length>lC;function _($){a($.target.value),k($.target.selectionStart??$.target.value.length),b(0),S(!1)}function z($){k($.currentTarget.selectionStart??i.length),b(0)}function O($){if(!C||!$)return;const L=s_(i,C,$);a(L.text),k(L.caret),b(0),S(!0),requestAnimationFrame(()=>{const U=N.current;U&&(U.focus(),U.setSelectionRange(L.caret,L.caret))})}function B($){T&&($.key==="ArrowDown"?($.preventDefault(),b(L=>Math.min(L+1,R.length-1))):$.key==="ArrowUp"?($.preventDefault(),b(L=>Math.max(L-1,0))):($.key==="Enter"||$.key==="Tab")&&($.preventDefault(),O(R[v])))}function V(){I||f||(r(i),o(!1))}return s.jsx(On,{open:e,onOpenChange:o,children:s.jsxs(Cn,{onEscapeKeyDown:$=>{T&&($.preventDefault(),S(!0))},children:[s.jsxs(sr,{children:[s.jsx(En,{children:"Edit launch prompt"}),s.jsxs(ns,{children:["The first message the agent starts with. ",s.jsx("code",{children:"@assignment"})," and"," ",s.jsx("code",{children:"@<playbook>"})," tokens resolve at launch. This edit applies to this launch only."]})]}),h?s.jsxs("p",{className:"text-sm text-error-foreground",children:["Couldn't load the prompt: ",h]}):s.jsxs("div",{className:"relative",children:[s.jsx("textarea",{ref:N,value:i,disabled:f,rows:4,spellCheck:!1,placeholder:f?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:_,onKeyDown:B,onKeyUp:z,onClick:z,className:be("w-full rounded-md border border-border/60 bg-background/90 p-3 font-mono text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30 min-h-[80px] resize-y",I&&"border-error-foreground")}),T&&s.jsx("ul",{role:"listbox",className:"absolute left-0 right-0 top-full z-30 mt-1 max-h-48 overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:R.map(($,L)=>s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":L===v,onMouseDown:U=>{U.preventDefault(),O($)},className:be("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",L===v&&"bg-accent"),children:[s.jsx("span",{className:"text-muted-foreground",children:"@"}),s.jsx("span",{className:"truncate",children:$})]})},$))})]}),A.length>0&&!h&&s.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:A.map($=>s.jsx("li",{children:$},$))}),I&&s.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",lC," characters (",i.length,")."]}),s.jsxs(Hr,{children:[s.jsx("button",{type:"button",className:"shell-action mt-0",onClick:()=>o(!1),children:"Cancel"}),s.jsx("button",{type:"button",className:"shell-action mt-0 shell-action--cta",disabled:f||I||h!==null,onClick:V,children:"Launch"})]})]})})}function i_({target:e,worktreePath:t=null,repository:n=null,size:r="default",title:o}){const i=e.kind==="assignment"&&!t&&!n,a=G3(),[l,u]=m.useState(null),p=M0().agents,[h,g]=m.useState(null);m.useEffect(()=>{p.length!==0&&g(A=>A&&p.some(_=>_.id===A)?A:(p.find(_=>_.default)??p[0]).id)},[p]);const y=e.kind==="assignment"&&p.length>1,k=p.find(A=>A.id===h)??null,v=m.useRef(null),[b,w]=m.useState(!1);m.useEffect(()=>{if(!b)return;function A(_){v.current&&!v.current.contains(_.target)&&w(!1)}function I(_){_.key==="Escape"&&w(!1)}return document.addEventListener("mousedown",A),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",I)}},[b]);function S(A){var I,_;if(e.kind==="assignment"){const z=p.find(B=>B.id===A)??p.find(B=>B.default)??p[0];!!((I=z==null?void 0:z.launchPrompt)!=null&&I.trim())||!!((_=z==null?void 0:z.playbook)!=null&&_.trim())?a.open(e,void 0,A):u({agentId:A})}else a.open(e,void 0,A)}const N=e.kind==="assignment"?"Open this assignment in your configured terminal + agent":"Resume this session in its agent",C="Set a workspace path first — see the Workspace Before Code playbook",R=be("shell-action",r==="compact"&&"inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50");if(i)return s.jsxs("button",{type:"button",disabled:!0,title:C,className:R,"aria-disabled":!0,children:[s.jsx(pa,{className:"size-3.5"}),s.jsx("span",{children:"Open in agent"})]});const T=e.kind==="session"?"Open":"Open in agent";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative inline-flex",ref:v,children:[s.jsxs("div",{className:"inline-flex items-stretch",children:[s.jsxs("button",{type:"button",onClick:()=>S(h??void 0),disabled:a.pending,title:(o??N)+(y&&k?` (${k.label})`:""),className:be(R,y&&"rounded-r-none"),children:[s.jsx(pa,{className:"size-3.5"}),s.jsx("span",{children:T})]}),y&&s.jsx("button",{type:"button",onClick:()=>w(A=>!A),disabled:a.pending,"aria-haspopup":"menu","aria-expanded":b,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:be(R,"-ml-px rounded-l-none",r==="compact"?"px-1":"px-1.5"),children:s.jsx(tr,{className:be("size-3.5 opacity-70 transition-transform",b&&"rotate-180")})})]}),b&&y&&s.jsxs("div",{role:"menu","aria-label":"Open with agent",className:"absolute right-0 top-full z-30 mt-1 min-w-[180px] overflow-hidden rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[s.jsx("div",{className:"px-2.5 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70",children:"Open with agent"}),p.map(A=>s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":A.id===h,onClick:()=>{g(A.id),w(!1),S(A.id)},className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent",children:[s.jsx(Nr,{className:be("size-3.5 shrink-0",A.id===h?"opacity-100":"opacity-0")}),s.jsx("span",{className:"truncate",children:A.label}),s.jsx(yv,{agent:A,className:"ml-auto"}),A.default&&s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"default"})]},A.id))]})]}),a.dialogs,e.kind==="assignment"&&l&&s.jsx(mX,{open:!0,assignmentId:e.id,agentId:l.agentId,onConfirm:A=>{a.open(e,void 0,l.agentId,A)},onOpenChange:A=>{A||u(null)}})]})}const Yy="w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";function a_({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:r,defaultParentBranch:o="main",onCreated:i}){const a=e&&t?{kind:"project-nested",projectSlug:e,assignmentSlug:t}:{kind:"standalone",assignmentId:n},[l,u]=m.useState(!1),[f,p]=m.useState("new-branch"),[h,g]=m.useState(null),[y,k]=m.useState(null),[v,b]=m.useState(""),[w,S]=m.useState(!1),[N,C]=m.useState(""),[R,T]=m.useState([]),[A,I]=m.useState(!1),[_,z]=m.useState(null),[O,B]=m.useState(""),[V,$]=m.useState(null),[L,U]=m.useState(null),[K,D]=m.useState(""),[W,M]=m.useState(r),[F,Y]=m.useState(!1),[H,Q]=m.useState(null);m.useEffect(()=>{if(!l)return;let ie=!1;return p("new-branch"),g(null),k(null),b(""),S(!1),C(""),T([]),I(!1),z(null),B(""),$(null),U(null),D(""),M(r),Q(null),(a.kind==="project-nested"?eH(a.projectSlug):tH(a.assignmentId)).then(Ae=>{if(!ie)if(g(Ae),Ae.length===0)S(!0);else{const Ue=Ae.find(Oe=>Oe.source==="project"),rt=Ae.find(Oe=>Oe.source==="sibling");b((Ue==null?void 0:Ue.path)??(rt==null?void 0:rt.path)??Ae[0].path)}}).catch(Ae=>{ie||(k(Ae.message),g([]),S(!0))}),(a.kind==="project-nested"?aH(a.projectSlug,a.assignmentSlug):lH(a.assignmentId)).then(Ae=>{ie||$(Ae)}).catch(Ae=>{ie||(U(Ae.message),$([]))}),()=>{ie=!0}},[l,r,o,e,t,n]);const J=f==="branch-off"?(V??[]).find(ie=>ie.id===K)??null:null,Z=f==="branch-off"?(J==null?void 0:J.repository)??"":w?N.trim():v;m.useEffect(()=>{if(!l||f!=="new-branch")return;if(!Z){T([]),z(null),I(!1),B("");return}let ie=!1;return I(!0),z(null),B(""),(a.kind==="project-nested"?oH(a.projectSlug,a.assignmentSlug,Z):iH(a.assignmentId,Z)).then(ye=>{if(ie)return;T(ye.branches);const Ae=(ye.defaultBranch&&ye.branches.includes(ye.defaultBranch)?ye.defaultBranch:ye.branches.includes(o)?o:ye.branches[0])??"";B(Ae),I(!1)}).catch(ye=>{ie||(T([]),z(ye.message),I(!1))}),()=>{ie=!0}},[l,f,Z,o,e,t,n]);const oe=X9(W.trim()),te=m.useMemo(()=>!Z||!W.trim()?"":`${Z.replace(/\/+$/,"")}/.worktrees/${W.trim()}`,[Z,W]),ue=h!==null&&h.length===0,ge=V!==null&&V.length===0,Ce=ie=>{ie!==f&&(p(ie),D(""),Q(null),ie==="branch-off"&&(B(""),T([]),z(null),I(!1)))},Se=ie=>{D(ie);const ve=(V??[]).find(ye=>ye.id===ie);B((ve==null?void 0:ve.branch)??"")},ke=F||oe!==null||!Z||!O.trim()||(f==="new-branch"?h===null||A:V===null||!K),Be=async()=>{Y(!0),Q(null);try{const ie={repository:Z,branch:W.trim(),parentBranch:O.trim()};a.kind==="project-nested"?await nH(a.projectSlug,a.assignmentSlug,ie):await rH(a.assignmentId,ie),u(!1),i()}catch(ie){ie instanceof n0?Q({message:ie.message,stderr:ie.stderr}):ie instanceof Error?Q({message:ie.message}):Q({message:String(ie)})}finally{Y(!1)}};return s.jsxs(On,{open:l,onOpenChange:ie=>F?void 0:u(ie),children:[s.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>u(!0),children:[s.jsx(I5,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{children:"Create worktree"})]}),s.jsxs(Cn,{children:[s.jsxs(sr,{children:[s.jsx(En,{children:"Create worktree"}),s.jsxs(ns,{children:["Creates a git worktree at ",s.jsx("code",{children:"<repo>/.worktrees/<branch>"})," and records the workspace fields on this assignment's frontmatter."]})]}),s.jsxs("div",{className:"grid gap-4 text-sm",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-md border border-border/70 p-1",children:[s.jsx("button",{type:"button",disabled:F,onClick:()=>Ce("new-branch"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${f==="new-branch"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"New branch from repo"}),s.jsx("button",{type:"button",disabled:F,onClick:()=>Ce("branch-off"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${f==="branch-off"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"Branch off another assignment"})]}),f==="new-branch"?s.jsxs(s.Fragment,{children:[ue?s.jsxs("div",{className:"rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-xs text-warning-foreground",children:["No repositories configured for this project. Enter a repo path below, or add a"," ",s.jsx("code",{children:"repositories:"})," list to ",s.jsx("code",{children:"project.md"}),"."]}):null,y?s.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:["Could not load repository candidates: ",y]}):null,s.jsxs("label",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Repository"}),s.jsx("select",{className:Yy,value:v,onChange:ie=>b(ie.target.value),disabled:F||h===null||w,children:(h??[]).map(ie=>s.jsxs("option",{value:ie.path,children:[ie.path,ie.source==="project"?" (project)":ie.sourceAssignmentSlug?` (sibling — ${ie.sourceAssignmentSlug})`:" (sibling)"]},`${ie.source}:${ie.path}`))}),ue?null:s.jsx("button",{type:"button",className:"justify-self-start text-[11px] text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:F,onClick:()=>S(ie=>!ie),children:w?"Use a listed repository":"Enter a custom repository path (advanced)"}),w?s.jsx("input",{className:"mt-1 w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",placeholder:"/absolute/path/to/repo",value:N,onChange:ie=>C(ie.target.value),disabled:F}):null]}),s.jsxs("label",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Parent branch"}),s.jsx("select",{className:Yy,value:O,onChange:ie=>B(ie.target.value),disabled:F||A||R.length===0,children:A?s.jsx("option",{value:"",children:"Loading branches…"}):R.length===0?s.jsx("option",{value:"",children:_?"Could not load branches":Z?"No branches found":"— pick a repository —"}):R.map(ie=>s.jsx("option",{value:ie,children:ie},ie))}),_?s.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",_]}):null]})]}):s.jsxs(s.Fragment,{children:[L?s.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:["Could not load assignments: ",L]}):null,ge?s.jsx("div",{className:"rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-xs text-warning-foreground",children:"No other assignments with a configured workspace to branch off. Create a worktree for one first, or use “New branch from repo”."}):s.jsxs("label",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Source assignment"}),s.jsxs("select",{className:Yy,value:K,onChange:ie=>Se(ie.target.value),disabled:F||V===null,children:[s.jsx("option",{value:"",children:"— select an assignment —"}),(V??[]).map(ie=>s.jsxs("option",{value:ie.id,children:[ie.title," (",ie.branch,")"]},ie.id))]})]}),J?s.jsxs("div",{className:"grid gap-2 rounded-md border border-border/70 bg-muted/40 px-3 py-2 text-xs",children:[s.jsxs("div",{className:"grid gap-0.5",children:[s.jsx("span",{className:"font-medium text-muted-foreground",children:"Repository (from source)"}),s.jsx("code",{className:"break-all",children:J.repository})]}),s.jsxs("div",{className:"grid gap-0.5",children:[s.jsx("span",{className:"font-medium text-muted-foreground",children:"Parent branch (from source)"}),s.jsx("code",{children:J.branch})]})]}):null]}),s.jsxs("label",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"New branch name"}),s.jsx("input",{className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",value:W,onChange:ie=>M(ie.target.value),disabled:F}),oe?s.jsx("span",{className:"text-[11px] text-error-foreground",children:oe}):null]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Worktree path"}),s.jsx("code",{className:"rounded-md border border-border bg-muted px-2 py-1 text-xs break-all",children:te||s.jsx("span",{className:"opacity-60",children:"— pick a repo & branch —"})})]}),H?s.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:[s.jsx("div",{className:"font-medium",children:H.message}),H.stderr?s.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:H.stderr}):null]}):null]}),s.jsxs(Hr,{children:[s.jsx(oR,{disabled:F,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",disabled:ke,onClick:()=>void Be(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:F?"Working…":"Create worktree"})]})]})]})}function gX(e){const t=e.split(`
|
|
650
|
+
`),n=t.findIndex(a=>/^##\s+Acceptance Criteria\s*$/i.test(a.trim()));if(n===-1)return{acceptanceCriteria:[],summaryBody:e};let r=t.length;for(let a=n+1;a<t.length;a+=1)if(/^#{1,2}\s+\S/.test(t[a].trim())){r=a;break}const o=t.slice(n+1,r).map(a=>a.match(/^\s*[-*]\s+\[( |x|X)\]\s+(.*)$/)).filter(a=>!!a).map(a=>({checked:a[1].toLowerCase()==="x",text:a[2].trim()})),i=[...t.slice(0,n),...t.slice(r)].join(`
|
|
651
|
+
`).replace(/\n{3,}/g,`
|
|
652
|
+
|
|
653
|
+
`).trim();return{acceptanceCriteria:o,summaryBody:i}}function xX(e){const t=e.split(`
|
|
654
|
+
`),n=t.findIndex(a=>/^##\s+Todos\s*$/i.test(a.trim()));if(n===-1)return{hasSection:!1,todosMarkdown:"",remaining:e};let r=t.length;for(let a=n+1;a<t.length;a+=1)if(/^#{1,2}\s+\S/.test(t[a].trim())){r=a;break}const o=t.slice(n+1,r).join(`
|
|
655
|
+
`).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
|
|
656
|
+
|
|
657
|
+
`).trim(),i=[...t.slice(0,n),...t.slice(r)].join(`
|
|
658
|
+
`).replace(/\n{3,}/g,`
|
|
659
|
+
|
|
660
|
+
`).trim();return{hasSection:!0,todosMarkdown:o,remaining:i}}function yX({projectSlug:e,dependencies:t,blockedReason:n,onAssignmentChange:r}){const[o,i]=m.useState(!1);if(t.length===0)return null;const a=t.filter(u=>u.status!=="completed"&&u.status!=="review"),l=a.length===0;return l&&!o?s.jsxs("button",{type:"button",onClick:()=>i(!0),className:"flex w-full items-center gap-2 rounded-lg border border-success-foreground/30 bg-success/70 px-4 py-2.5 text-left transition hover:bg-success",children:[s.jsx(cm,{className:"h-4 w-4 shrink-0 text-success-foreground"}),s.jsxs("span",{className:"text-sm font-medium text-success-foreground",children:["All ",t.length," ",t.length===1?"dependency":"dependencies"," resolved"]}),s.jsx(tr,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):s.jsxs("div",{className:"space-y-3",children:[a.length>0&&s.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3",children:[s.jsx(ph,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning-foreground"}),s.jsxs("div",{className:"text-sm text-warning-foreground",children:[s.jsxs("strong",{children:[a.length," ",a.length===1?"dependency is":"dependencies are"," not yet completed."]}),n&&s.jsxs("p",{className:"mt-1 text-warning-foreground/80",children:["Blocked reason: ",n]})]})]}),s.jsx(Ve,{title:"Dependencies",description:`${t.length-a.length} of ${t.length} resolved`,actions:l?s.jsx("button",{type:"button",onClick:()=>i(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Collapse"}):void 0,children:s.jsx("div",{className:"divide-y divide-border/40",children:t.map(u=>s.jsxs(_e,{to:`/projects/${e}/assignments/${u.slug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[s.jsx("span",{onClick:f=>{f.preventDefault(),f.stopPropagation()},onPointerDown:f=>f.stopPropagation(),children:s.jsx(Cs,{projectSlug:e,slug:u.slug,status:u.status,title:u.title,onChange:r})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:u.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u.slug})]}),u.assignee&&s.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:u.assignee}),s.jsx(fh,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function bX({customFacts:e,attestations:t}){const n=e??{},r=t??[];return Object.keys(n).length===0&&r.length===0?null:s.jsx(Ve,{title:"Facts",description:"Custom asserted facts and review attestations, materialized server-side.",children:s.jsxs("div",{className:"space-y-3",children:[Object.keys(n).length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries(n).map(([o,i])=>s.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",children:[o,": ",s.jsx("span",{className:"font-medium text-foreground",children:String(i)})]},o))}),r.map(o=>s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-[11px] font-medium text-foreground",children:o.fact}),s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",o.binds,")"]}),o.records.length===0?s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"— no attestations yet"}):o.records.map(i=>s.jsxs("span",{title:`${i.verdict}${i.note?` — ${i.note}`:""}${i.stale?" (stale — revision moved)":""} · ${i.at}`,className:be("rounded-full border px-2 py-0.5 text-[11px]",i.stale?"border-border/40 text-muted-foreground line-through":i.verdict==="approved"?"border-success-foreground/40 text-success-foreground":"border-warning-foreground/40 text-warning-foreground"),children:[i.actor,": ",i.verdict==="approved"?"approved":"changes",i.stale?" (stale)":""]},i.actor))]},o.fact))]})})}function vX({links:e,onAssignmentChange:t}){const n=xn();if(e.length===0)return null;const r=e.filter(i=>!i.isReverse),o=e.filter(i=>i.isReverse);return s.jsx(Ve,{title:"Linked Assignments",description:`${e.length} ${e.length===1?"link":"links"}`,children:s.jsxs("div",{className:"divide-y divide-border/40",children:[r.map(i=>s.jsxs(_e,{to:`${n}/projects/${i.projectSlug}/assignments/${i.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[s.jsx(lm,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{onClick:a=>{a.preventDefault(),a.stopPropagation()},onPointerDown:a=>a.stopPropagation(),children:s.jsx(Cs,{projectSlug:i.projectSlug,slug:i.assignmentSlug,status:i.status,title:i.title,onChange:t})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:i.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:i.slug})]}),s.jsx(fh,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${i.slug}`)),o.map(i=>s.jsxs(_e,{to:`${n}/projects/${i.projectSlug}/assignments/${i.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[s.jsx(dh,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{onClick:a=>{a.preventDefault(),a.stopPropagation()},onPointerDown:a=>a.stopPropagation(),children:s.jsx(Cs,{projectSlug:i.projectSlug,slug:i.assignmentSlug,status:i.status,title:i.title,onChange:t})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:i.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:i.slug})]}),s.jsx(fh,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${i.slug}`))]})})}function wX(e){const t=new Map;for(const r of e)t.set(r.id,{entry:r,replies:[]});const n=[];for(const r of e){const o=t.get(r.id);r.replyTo&&t.has(r.replyTo)?t.get(r.replyTo).replies.push(o):n.push(o)}return n}function jX(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function l_({projectSlug:e,assignmentSlug:t,entries:n}){const[r,o]=m.useState(n);m.useEffect(()=>{o(n)},[n]);const i=m.useMemo(()=>wX(r),[r]),[a,l]=m.useState(""),[u,f]=m.useState("note"),[p,h]=m.useState(!1),[g,y]=m.useState(null);async function k(b){var N;if(b.preventDefault(),!a.trim())return;h(!0),y(null);const w=`tmp-${Date.now()}`,S={id:w,timestamp:new Date().toISOString(),author:"human",type:u,body:a,resolved:u==="question"?!1:void 0};o(C=>[...C,S]);try{const C=await fetch(jX(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:a,type:u})});if(!C.ok){const A=await C.text();throw new Error(A||`HTTP ${C.status}`)}const R=await C.json().catch(()=>null),T=(N=R==null?void 0:R.comment)==null?void 0:N.id;o(A=>A.map(I=>I.id===w?{...I,id:T??I.id}:I)),l(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(C){y(C instanceof Error?C.message:String(C)),o(R=>R.filter(T=>T.id!==w))}finally{h(!1)}}async function v(b,w){o(S=>S.map(N=>N.id===b?{...N,resolved:w}:N));try{const S=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(b)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(b)}/resolved`,N=await fetch(S,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:w})});if(!N.ok)throw new Error(`HTTP ${N.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(S){y(S instanceof Error?S.message:String(S)),o(N=>N.map(C=>C.id===b?{...C,resolved:!w}:C))}}return s.jsx(Ve,{title:"Comments",description:"Threaded questions, notes, and feedback. Questions can be resolved once answered.",children:s.jsxs("div",{className:"space-y-4",children:[i.map(b=>s.jsx(c_,{node:b,onToggleResolved:v,depth:0},b.entry.id)),s.jsxs("form",{onSubmit:k,className:"mt-6 space-y-2 border-t border-border pt-4",children:[s.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),s.jsx("textarea",{value:a,onChange:b=>l(b.target.value),className:"w-full rounded border border-border bg-background p-2 text-sm",rows:3,placeholder:"Ask a question, leave a note, or give feedback…"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:u,onChange:b=>f(b.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs",children:[s.jsx("option",{value:"note",children:"note"}),s.jsx("option",{value:"question",children:"question"}),s.jsx("option",{value:"feedback",children:"feedback"})]}),s.jsx("button",{type:"submit",disabled:p||!a.trim(),className:"shell-action",children:p?"Posting…":"Post comment"}),g?s.jsx("span",{className:"text-xs text-error-foreground",children:g}):null]})]})]})})}function c_({node:e,depth:t,onToggleResolved:n}){const{entry:r,replies:o}=e,i=r.type==="question";return s.jsxs("div",{className:be("space-y-2",t>0&&"ml-4 border-l border-border pl-4"),children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-mono",children:r.id}),s.jsx("span",{children:"·"}),s.jsx("span",{children:r.timestamp}),s.jsx("span",{children:"·"}),s.jsx("span",{className:"font-medium text-foreground",children:r.author}),s.jsx("span",{children:"·"}),s.jsx("span",{className:be("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase",i&&"bg-warning text-warning-foreground",r.type==="feedback"&&"bg-info text-info-foreground",r.type==="note"&&"bg-muted text-muted-foreground"),children:r.type}),i?s.jsxs("button",{type:"button",onClick:()=>n(r.id,!r.resolved),className:be("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium",r.resolved?"bg-success text-success-foreground hover:bg-success/80":"bg-muted text-muted-foreground hover:bg-muted/80"),title:r.resolved?"Mark unresolved":"Mark resolved",children:[r.resolved?s.jsx(cm,{className:"h-3 w-3"}):s.jsx(w5,{className:"h-3 w-3"}),r.resolved?"resolved":"open"]}):null,r.replyTo?s.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[s.jsx(X5,{className:"h-3 w-3"}),r.replyTo]}):null]}),s.jsx(jn,{content:r.body}),o.length>0?s.jsx("div",{className:"space-y-2",children:o.map(a=>s.jsx(c_,{node:a,depth:t+1,onToggleResolved:n},a.entry.id))}):null]})}const kX={"status-change":"Status changed","assignee-change":"Assignee changed","priority-change":"Priority changed",archived:"Archived",restored:"Restored","plan-approval":"Plan approved","fact-set":"Fact set","fact-clear":"Fact cleared",attestation:"Attestation","comment-added":"Comment added","comment-resolved":"Comment resolved"};function NX(e){return kX[e]??gn(e)}function Tl(e,t){if(!e)return null;const n=e[t];return n==null?null:typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):null}function SX({event:e}){const{details:t}=e;if(!t)return null;const n=Tl(t,"from"),r=Tl(t,"to");if(n!==null||r!==null)return s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5 text-xs",children:[n!==null?s.jsx("code",{className:"rounded bg-muted/60 px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:n}):null,s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),r!==null?s.jsx("code",{className:"rounded bg-muted/60 px-1.5 py-0.5 font-mono text-[11px] text-foreground",children:r}):s.jsx("span",{className:"text-muted-foreground",children:"(none)"})]});const o=Tl(t,"name"),i=Tl(t,"value");if(o!==null)return s.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:o}),i!==null?s.jsxs(s.Fragment,{children:[": ",i]}):null]});const a=Tl(t,"reason");if(a!==null)return s.jsx("span",{className:"text-xs text-muted-foreground",children:a});const l=Tl(t,"author");if(l!==null)return s.jsxs("span",{className:"text-xs text-muted-foreground",children:["by ",s.jsx("span",{className:"font-medium text-foreground",children:l})]});const u=Object.keys(t);return u.length===0?null:s.jsx("span",{className:"text-xs text-muted-foreground",children:u.join(", ")})}function u_({events:e,loading:t,error:n}){return t&&e.length===0?s.jsx(bt,{label:"Loading activity…"}):n&&e.length===0?s.jsx(Nt,{title:"Activity unavailable",description:"The event log could not be loaded. The rest of this page is unaffected."}):e.length===0?s.jsx(Nt,{title:"No activity yet",description:"Status changes, approvals, comments, and other tracked mutations appear here as a chronological audit trail."}):s.jsx(Ve,{title:"Activity",description:"Reverse-chronological audit trail of tracked changes to this assignment — who changed what, when.",children:s.jsx("ol",{className:"space-y-3",children:e.map(r=>s.jsxs("li",{className:"flex flex-col gap-1 border-l-2 border-border pl-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] font-medium text-foreground",children:NX(r.type)}),s.jsx("span",{className:"text-xs text-muted-foreground",children:r.actor}),s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",title:zl(r.at),children:Fu(r.at)})]}),s.jsx(SX,{event:r})]},r.event_id))})})}function CX({engagements:e}){return e.length===0?s.jsx(Nt,{title:"No session activity",description:"When an agent session works this assignment in a plan, implement, or review stage, each interval appears here as a chronological attribution trail."}):s.jsx(Ve,{title:"Session Activity",description:"Per-session stage attribution — which agent session worked this assignment, in which stage, and when.",children:s.jsx("ol",{className:"space-y-3",children:e.map(t=>{const n=t.endedAt===null,r=t.sessionId.slice(0,8);return s.jsxs("li",{className:"flex flex-col gap-1 border-l-2 border-border pl-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] font-medium text-foreground",children:gn(t.stage)}),s.jsx("span",{className:"text-xs text-muted-foreground",children:t.agent??"—"}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("code",{className:"rounded bg-muted/60 px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",title:t.sessionId,children:r}),s.jsx(jr,{value:t.sessionId,label:`Copy session id ${t.sessionId}`})]}),n?s.jsx("span",{className:"ml-auto rounded-full border border-border/60 bg-muted/40 px-2 py-0.5 text-[11px] font-medium text-foreground",children:"In progress"}):s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",title:zl(t.startedAt),children:Fu(t.startedAt)})]}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:["Started"," ",s.jsx("span",{title:Fu(t.startedAt),children:zl(t.startedAt)})," ","· Ended"," ",t.endedAt?s.jsx("span",{title:Fu(t.endedAt),children:zl(t.endedAt)}):"in progress"," ","· ",U4(t.startedAt,t.endedAt)]})]},t.id)})})})}function d_(e){const t=rr();m.useEffect(()=>{const n=t.hash.slice(1);if(!n)return;let r=0,o;const i=()=>{const a=document.getElementById(n);return a?(a.scrollIntoView({block:"start"}),!0):!1};return r=requestAnimationFrame(()=>{i()||(o=setTimeout(i,80))}),()=>{cancelAnimationFrame(r),o&&clearTimeout(o)}},[t.hash,t.pathname,e])}const EX=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function cC(){var xe,qe,Fe,lt,mt,vt,nt,_t,Bt,Ut,An,Ct;const{slug:e,aslug:t}=Kt(),n=Wt(),r=xn(),[o,i]=Rs(),[a,l]=m.useState(null),{toast:u,showToast:f,dismissToast:p}=Tn(),[h,g]=m.useState(null),[y,k]=m.useState(null),[v,b]=m.useState(null),[w,S]=m.useState(null),[N,C]=m.useState({}),[R,T]=m.useState(!1),[A,I]=m.useState(!1),[_,z]=m.useState(0),O=o.get("tab")??"summary";d_(O);const B=rs(),{data:V,loading:$,error:L,refetch:U}=dO(e,t),{data:K}=lT(e),{data:D}=ow(),{data:W,loading:M,error:F}=pO(e,t),{data:Y,loading:H,error:Q}=mO(e,t),J=e&&t?`/api/projects/${e}/assignments/${t}/events`:null,{events:Z,loading:oe,error:te,refetch:ue}=K3(J),ge=m.useMemo(()=>{if(!V||!K)return[];const je=new Map(K.assignments.map(Ye=>[Ye.slug,Ye]));return V.dependsOn.map(Ye=>{const at=je.get(Ye);return{slug:Ye,title:(at==null?void 0:at.title)??Ye,status:(at==null?void 0:at.status)??"pending",priority:(at==null?void 0:at.priority)??"medium",assignee:(at==null?void 0:at.assignee)??null}})},[V,K]),Ce=ge.filter(je=>je.status!=="completed"&&je.status!=="review");Ai("assignment");const Se=m.useMemo(()=>((K==null?void 0:K.assignments)??[]).map(je=>je.slug),[K]),ke=t?Se.indexOf(t):-1,Be=ke>0?Se[ke-1]:null,ie=ke>=0&&ke<Se.length-1?Se[ke+1]:null,ve=`${r}/projects/${e}/assignments/${t}`;en({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${ve}/edit`)}),en({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${ve}/plan/edit`)}),en({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${ve}/handoff/edit`)}),en({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${ve}/decision-record/edit`)}),en({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${ve}/scratchpad/edit`)}),en({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!Be,handler:()=>Be&&n(`${r}/projects/${e}/assignments/${Be}`)}),en({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!ie,handler:()=>ie&&n(`${r}/projects/${e}/assignments/${ie}`)});const ye=m.useMemo(()=>V?gX(V.body):{acceptanceCriteria:[],summaryBody:""},[V]);m.useEffect(()=>{C({})},[V]);const Ae=m.useMemo(()=>xX(ye.summaryBody),[ye.summaryBody]),Ue=ye.acceptanceCriteria,rt=Ue.filter(je=>je.checked).length,Oe=Ue.length>0&&rt===Ue.length,ot=m.useRef(Oe),St=m.useRef(!1);if(m.useEffect(()=>{if(V){if(!St.current){ot.current=Oe,St.current=!0;return}Oe&&!ot.current&&z(je=>je+1),ot.current=Oe}},[Oe,V]),$)return s.jsx(bt,{label:"Loading assignment workspace…"});if(L||!V||!e||!t)return s.jsx(Rt,{error:L||"Assignment not found.",onRetry:U});const ht=e,it=t,ce=Ue.length>0?{checked:rt,total:Ue.length}:void 0,me=V.availableTransitions??[],Ie=me.filter(je=>!je.disabled&&je.targetStatus!==V.status),Pe=EX.map(je=>Ie.find(Ye=>Ye.command===je)).find(Boolean)??Ie[0]??null,We=[];if(D!=null&&D.sessions)for(const je of D.sessions)for(const Ye of je.windows)for(const at of Ye.panes)((xe=at.assignment)==null?void 0:xe.project)===e&&((qe=at.assignment)==null?void 0:qe.slug)===t&&We.push({sessionName:je.name,command:at.command,urls:at.urls});async function pt(je){l(null);try{await e0(ht,it,je),U(),ue()}catch(Ye){l(Ye.message)}}async function De(je){l(null);try{const Ye=await fetch(`/api/projects/${ht}/assignments/${it}/${je?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Ye.ok){const at=await Ye.json().catch(()=>null);throw new Error((at==null?void 0:at.error)||`HTTP ${Ye.status}`)}U(),ue(),f(je?"Assignment archived":"Assignment restored","success")}catch(Ye){l(Ye.message)}}async function Qe(){I(!0);try{await Q9(ht,it),n(`${r}/projects/${ht}`)}catch(je){l(je.message),I(!1),T(!1)}}async function Je(je,Ye){l(null),g(je.command);try{return await Zw(ht,it,je,Ye),U(),ue(),!0}catch(at){return l(at.message),!1}finally{g(null)}}function ut(je){if(t0(je)){k(je);return}Je(je)}async function fe(je,Ye){b(null),S(je),C(at=>({...at,[je]:Ye}));try{const at=await fetch(`/api/projects/${ht}/assignments/${it}/acceptance-criteria/${je}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:Ye})}),Mt=await at.json();if(!at.ok)throw new Error(Mt.error||`HTTP ${at.status}`);U()}catch(at){C(le=>{const Ne={...le};return delete Ne[je],Ne});const Mt=at.message;b(Mt),f(Mt||"Failed to update acceptance criterion","error")}finally{S(null)}}const q=[...Ie.filter(je=>je!==Pe).map(je=>({key:`transition-${je.command}`,label:je.label,onSelect:()=>ut(je),disabled:h===je.command})),...me.filter(je=>je.disabled||je.targetStatus===V.status).map(je=>({key:`transition-${je.command}`,label:je.label,disabled:!0,disabledReason:je.targetStatus===V.status?`Already ${V.status.replace(/_/g," ")}`:je.disabledReason??je.warning??je.description})),...B.statuses.map(je=>({key:`override-${je.id}`,label:`Override → ${je.label}`,onSelect:()=>pt(je.id),disabled:je.id===V.status,disabledReason:je.id===V.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:A5,href:`${r}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:Z5,href:`${r}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:sy,href:`${r}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:fh,href:`${r}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:L5,href:`${r}/projects/${e}/assignments/${t}/decision-record/edit`},{key:V.archived?"unarchive":"archive",label:V.archived?"Restore assignment":"Archive assignment",icon:V.archived?uh:im,onSelect:()=>De(!V.archived)},{key:"delete",label:"Delete assignment",icon:fn,destructive:!0,onSelect:()=>T(!0)}],ne=(Pe==null?void 0:Pe.command)==="review";return s.jsxs("div",{className:"space-y-5",children:[s.jsx(Nn,{toast:u,onDismiss:p}),s.jsxs("div",{className:"sticky top-12 z-20 rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm backdrop-blur",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Cs,{id:V.id,slug:it,projectSlug:ht,status:V.status,title:V.title,availableTransitions:V.availableTransitions,progress:ce,onChange:()=>U()}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-lg font-semibold text-foreground",title:V.title,children:V.title}),Ce.length>0&&s.jsxs("span",{className:"shrink-0 whitespace-nowrap text-xs text-warning-foreground",title:`Unmet dependencies: ${Ce.map(je=>je.title).join(", ")}`,children:["⚠ ",Ce.length," unmet dep",Ce.length===1?"":"s"]}),s.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[s.jsx(i_,{target:{kind:"assignment",id:V.id},worktreePath:((Fe=V.workspace)==null?void 0:Fe.worktreePath)??null,repository:((lt=V.workspace)==null?void 0:lt.repository)??null}),!((mt=V.workspace)!=null&&mt.worktreePath)&&e&&t&&s.jsx(a_,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>U()}),Pe&&s.jsx("button",{type:"button",title:Pe.warning||Pe.description,disabled:h===Pe.command,onClick:()=>ut(Pe),className:be("shell-action disabled:cursor-not-allowed disabled:opacity-50",Pe.warning&&"border-warning-foreground/40",ne&&_>0&&"send-to-review-glow"),children:s.jsx("span",{children:h===Pe.command?"Working…":Pe.label})},ne?`review-${_}`:Pe.command),s.jsx(Xw,{items:q,align:"end"})]})]}),a?s.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:a}):null,V.blockedReason?s.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[s.jsx("strong",{children:"Blocked reason:"})," ",V.blockedReason]}):null,V.override&&V.derived&&V.derived.derivedStatus!==V.status?s.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[s.jsxs("strong",{children:["Pinned to ",V.status]})," by ",V.override.source,V.override.reason?s.jsxs(s.Fragment,{children:[" — “",V.override.reason,"”"]}):null," · ","would otherwise be ",s.jsx("strong",{children:V.derived.derivedStatus})]}):null,(vt=V.derived)!=null&&vt.nextAction?s.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Next:"})," ",V.derived.nextAction]}):null]}),ge.length>0&&s.jsx(yX,{projectSlug:e,dependencies:ge,blockedReason:V.blockedReason,onAssignmentChange:()=>U()}),V.enrichedLinks&&V.enrichedLinks.length>0&&s.jsx(vX,{links:V.enrichedLinks,onAssignmentChange:()=>U()}),V.referencedBy&&V.referencedBy.length>0&&s.jsx(Ve,{title:"Referenced by",description:"Other assignments whose Todos, progress, comments, or handoffs link to this one.",children:s.jsx("ul",{className:"space-y-2",children:V.referencedBy.map(je=>{const Ye=je.sourceProjectSlug===null?`/assignments/${je.sourceId}`:`${r}/projects/${je.sourceProjectSlug}/assignments/${je.sourceSlug}`;return s.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[s.jsx(_e,{to:Ye,className:"text-foreground hover:text-primary",children:je.sourceTitle}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",je.mentions," mention",je.mentions===1?"":"s",")"]}),je.sourceProjectSlug===null?s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"}):null]},je.sourceId)})})}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[s.jsx("div",{className:"space-y-4",children:s.jsx(Xm,{value:O,onValueChange:je=>i({tab:je}),items:[{value:"summary",label:"Summary",content:s.jsxs("div",{className:"space-y-5",children:[ye.acceptanceCriteria.length>0?s.jsx(Ve,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:s.jsxs("div",{className:"space-y-3",children:[v?s.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:v}):null,ye.acceptanceCriteria.map((je,Ye)=>{const at=w!==null,Mt=Ye in N?N[Ye]:je.checked;return s.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-border/60 bg-background/80 px-3 py-3",children:[s.jsx("input",{type:"checkbox",checked:Mt,disabled:at,onChange:le=>fe(Ye,le.target.checked),className:"mt-1 h-4 w-4 rounded border-border text-primary"}),s.jsx("span",{className:"criterion-label text-sm leading-6","data-checked":Mt,children:je.text})]},`${Ye}-${je.text}`)})]})}):null,Ae.hasSection?s.jsx(Ve,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:s.jsx(jn,{content:Ae.todosMarkdown,emptyState:"No todos yet."})}):null,s.jsx(Ve,{title:"Assignment Summary",children:s.jsx(jn,{content:Ae.remaining,emptyState:ye.acceptanceCriteria.length>0||Ae.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:V.plan?1:0,content:V.plan?s.jsx("div",{className:"space-y-5",children:s.jsxs(Ve,{title:"Plan",description:"Shows plan.md only. Versioned plans (plan-v2.md, ...) linked from the Todos section are not yet rendered here — open them from the filesystem.",actions:s.jsxs(_e,{className:"shell-action",to:`${r}/projects/${e}/assignments/${t}/plan/edit`,children:[s.jsx(sy,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Plan"})]}),children:[s.jsx("div",{className:"mb-4",children:s.jsx(ro,{status:V.plan.status})}),s.jsx(jn,{content:V.plan.body,emptyState:"No plan content yet."})]})}):s.jsx(Nt,{title:"No plan yet",description:"Plan files are optional and versioned. Run /plan-assignment to create plan.md (or plan-v2.md, ...) and link it from the Todos section."})},{value:"scratchpad",label:"Scratchpad",count:V.scratchpad?1:0,content:V.scratchpad?s.jsx(Ve,{title:"Scratchpad",actions:s.jsxs(_e,{className:"shell-action",to:`${r}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[s.jsx(sy,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Scratchpad"})]}),children:s.jsx(jn,{content:V.scratchpad.body,emptyState:"Scratchpad is empty."})}):s.jsx(Nt,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((nt=V.handoff)==null?void 0:nt.handoffCount)??0,content:s.jsx("div",{className:"space-y-5",children:V.handoff?s.jsx(Ve,{children:s.jsx(jn,{content:V.handoff.body,emptyState:"No handoff history yet."})}):s.jsx(Nt,{title:"No handoff log yet",description:"Handoffs appear here when an agent runs /complete-assignment or you append one manually."})})},{value:"progress",label:"Progress",count:((_t=V.progress)==null?void 0:_t.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:V.progress&&V.progress.entries.length>0?s.jsx(Ve,{title:"Progress",description:"Reverse-chronological log of work done on this assignment. Agents append entries via progress.md.",children:s.jsx("ol",{className:"space-y-4",children:V.progress.entries.map((je,Ye)=>s.jsxs("li",{className:"border-l-2 border-border pl-3",children:[s.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:je.timestamp}),s.jsx(jn,{content:je.body})]},`${je.timestamp}-${Ye}`))})}):s.jsx(Nt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((Bt=V.comments)==null?void 0:Bt.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:V.comments&&V.comments.entries.length>0?s.jsx(l_,{projectSlug:e,assignmentSlug:t,entries:V.comments.entries}):s.jsx(Nt,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((Ut=V.decisionRecord)==null?void 0:Ut.decisionCount)??0,content:s.jsx("div",{className:"space-y-5",children:V.decisionRecord?s.jsx(Ve,{children:s.jsx(jn,{content:V.decisionRecord.body,emptyState:"No decision history yet."})}):s.jsx(Nt,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})},{value:"activity",label:"Activity",count:Z.length,content:s.jsxs("div",{className:"space-y-5",children:[s.jsx(bX,{customFacts:(An=V.derived)==null?void 0:An.customFacts,attestations:(Ct=V.derived)==null?void 0:Ct.attestations}),s.jsx(u_,{events:Z,loading:oe,error:te})]})},{value:"session-activity",label:"Session Activity",count:V.engagements.length,content:s.jsx(CX,{engagements:V.engagements})}]})}),s.jsxs("div",{className:"min-w-0 space-y-5",children:[s.jsx(Ve,{title:"Details",children:s.jsxs("dl",{className:"space-y-3 text-sm",children:[s.jsx(No,{label:"ID",value:V.id,copyable:!0}),s.jsx(No,{label:"Priority",value:V.priority}),V.assignee&&s.jsx(No,{label:"Assignee",value:V.assignee}),V.type&&s.jsx(uC,{label:"Type",children:s.jsx(_a,{type:V.type,compact:!0})}),V.phase&&V.phase!==V.status&&s.jsx(No,{label:"Phase",value:V.phase}),V.disposition&&V.disposition!=="active"&&s.jsx(uC,{label:"Disposition",children:s.jsx("span",{className:"rounded-full border border-warning-foreground/40 px-2 py-0.5 text-[11px] text-warning-foreground",title:"Disposition dimension — orthogonal to phase",children:V.disposition})}),s.jsx(No,{label:"Updated",value:`${zl(V.updated)} · Created ${V2(V.created)}`}),V.workspace.repository&&s.jsx(No,{label:"Repository",value:V.workspace.repository,copyable:!0}),V.workspace.worktreePath&&s.jsx(No,{label:"Worktree",value:V.workspace.worktreePath,copyable:!0}),V.workspace.branch&&s.jsx(No,{label:"Branch",value:V.workspace.branch,copyable:!0}),V.workspace.parentBranch&&s.jsx(No,{label:"Parent branch",value:V.workspace.parentBranch,copyable:!0}),V.externalIds.map((je,Ye)=>s.jsx(TX,{entry:je},`${je.system}:${je.id}:${Ye}`))]})}),We.length>0&&s.jsx(Ve,{title:"Servers",children:s.jsx("div",{className:"space-y-2",children:We.map((je,Ye)=>s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm",children:[s.jsx("span",{className:"min-w-0 max-w-full truncate rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",title:je.command,children:je.command}),s.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:je.sessionName,children:je.sessionName}),je.urls.map(at=>s.jsxs("a",{href:at,target:"_blank",rel:"noopener noreferrer",title:at,className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded border border-primary/30 bg-primary/5 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 dark:border-primary/40 dark:bg-primary/10 dark:hover:bg-primary/20",children:[s.jsx("span",{className:"min-w-0 truncate",children:at.replace("http://localhost:",":")}),s.jsx(vc,{className:"h-2.5 w-2.5 shrink-0"})]},at))]},Ye))})}),s.jsx(X3,{sessions:W==null?void 0:W.sessions,loading:M,error:F,onError:je=>f(je.message,"error"),onNotice:je=>f(je,"success")}),s.jsx(Q3,{summary:Y==null?void 0:Y.summary,loading:H,error:Q})]})]}),s.jsx(Jw,{open:y!==null,action:y,assignmentTitle:V.title,loading:h===(y==null?void 0:y.command),onOpenChange:je=>{je||k(null)},onConfirm:async je=>{if(!y)return;await Je(y,je)&&k(null)}}),s.jsx(os,{open:R,title:"Delete assignment?",description:`This will permanently delete "${V.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:A,onOpenChange:je=>{je||T(!1)},onConfirm:Qe})]})}function No({label:e,value:t,copyable:n}){return s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("dt",{className:"text-muted-foreground",children:e}),s.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[s.jsx("span",{className:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&s.jsx(jr,{value:t})]})]})}function uC({label:e,children:t}){return s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("dt",{className:"text-muted-foreground",children:e}),s.jsx("dd",{className:"flex max-w-[60%] items-center justify-end gap-1.5 text-right text-foreground",children:t})]})}function TX({entry:e}){const t=e.url!=null&&e.url.length>0;return s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("dt",{className:"text-muted-foreground",children:e.system}),s.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?s.jsxs("a",{href:e.url??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${e.system}:${e.id} in ${e.system}`,className:"flex items-center gap-1.5 min-w-0 text-primary hover:underline",children:[s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),s.jsx(vc,{className:"h-2.5 w-2.5 shrink-0"})]}):s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function RX(){var O,B,V,$,L,U,K,D;const{id:e}=Kt(),[t,n]=Rs(),r=t.get("tab")??"summary";d_(r);const{data:o,loading:i,error:a,refetch:l}=fO(e),{data:u,loading:f,error:p}=hO(e),{data:h,loading:g,error:y}=gO(o==null?void 0:o.slug),k=e?`/api/standalone/assignments/${e}/events`:null,{events:v,loading:b,error:w,refetch:S}=K3(k),[N,C]=m.useState(!1),[R,T]=m.useState(null),{toast:A,showToast:I,dismissToast:_}=Tn();async function z(W){if(e){T(null);try{const M=await fetch(`/api/assignments/${e}/${W?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!M.ok){const F=await M.json().catch(()=>null);throw new Error((F==null?void 0:F.error)||`HTTP ${M.status}`)}l(),S(),I(W?"Assignment archived":"Assignment restored","success")}catch(M){T(M instanceof Error?M.message:"Archive failed")}}}return i?s.jsx(bt,{}):a?s.jsx(Rt,{error:a}):o?s.jsxs("div",{className:"space-y-6",children:[s.jsx(Nn,{toast:A,onDismiss:_}),s.jsxs("header",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(Cs,{id:o.id,status:o.status,title:o.title,availableTransitions:o.availableTransitions,onChange:()=>l()}),s.jsx(_a,{type:o.type}),s.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:o.id}),s.jsx(EP,{externalIds:o.externalIds}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx(i_,{target:{kind:"assignment",id:o.id},worktreePath:((O=o.workspace)==null?void 0:O.worktreePath)??null,repository:((B=o.workspace)==null?void 0:B.repository)??null,size:"compact"}),!((V=o.workspace)!=null&&V.worktreePath)&&s.jsx(a_,{assignmentId:o.id,defaultBranch:`syntaur/${o.slug}`,onCreated:()=>l()}),s.jsxs("button",{type:"button",onClick:()=>C(!0),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:[s.jsx(am,{className:"h-3 w-3"}),"Move to workspace…"]}),s.jsx(_e,{to:`/assignments/${o.id}/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit"}),s.jsxs("button",{type:"button",onClick:()=>z(!o.archived),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:o.archived?"Restore this assignment":"Archive this assignment",children:[o.archived?s.jsx(uh,{className:"h-3 w-3"}):s.jsx(im,{className:"h-3 w-3"}),o.archived?"Restore":"Archive"]})]})]}),s.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:o.title}),o.blockedReason?s.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",o.blockedReason]}):null,R?s.jsx("p",{className:"text-sm text-status-failed-foreground",children:R}):null]}),o.referencedBy&&o.referencedBy.length>0?s.jsx(Ve,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:s.jsx("ul",{className:"space-y-2",children:o.referencedBy.map(W=>s.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[s.jsx(_e,{to:W.sourceProjectSlug===null?`/assignments/${W.sourceId}`:`/projects/${W.sourceProjectSlug}/assignments/${W.sourceSlug}`,className:"text-foreground hover:text-primary",children:W.sourceTitle}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",W.mentions," mention",W.mentions===1?"":"s",")"]})]},W.sourceId))})}):null,s.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[s.jsx("div",{className:"space-y-4",children:s.jsx(Xm,{value:r,onValueChange:W=>n({tab:W}),items:[{value:"summary",label:"Summary",content:s.jsx("div",{className:"space-y-5",children:s.jsx(Ve,{title:"Assignment",children:s.jsx(jn,{content:o.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:(($=o.progress)==null?void 0:$.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:o.progress&&o.progress.entries.length>0?s.jsx(Ve,{title:"Progress",description:"Reverse-chronological log of work done on this assignment.",children:s.jsx("ol",{className:"space-y-4",children:o.progress.entries.map((W,M)=>s.jsxs("li",{className:"border-l-2 border-border pl-3",children:[s.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:W.timestamp}),s.jsx(jn,{content:W.body})]},`${W.timestamp}-${M}`))})}):s.jsx(Nt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((L=o.comments)==null?void 0:L.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:s.jsx(l_,{projectSlug:null,assignmentSlug:o.id,entries:((U=o.comments)==null?void 0:U.entries)??[]})})},{value:"plan",label:"Plan",content:s.jsx("div",{className:"space-y-5",children:o.plan?s.jsxs(Ve,{children:[s.jsx(jn,{content:o.plan.body,emptyState:"Plan file exists but is empty."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(_e,{to:`/assignments/${o.id}/plan/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit plan"})})]}):s.jsx(Nt,{title:"No plan file yet",description:"Create one via the CLI or `/plan-assignment`."})})},{value:"scratchpad",label:"Scratchpad",content:s.jsx("div",{className:"space-y-5",children:o.scratchpad?s.jsxs(Ve,{children:[s.jsx(jn,{content:o.scratchpad.body,emptyState:"Scratchpad is empty."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(_e,{to:`/assignments/${o.id}/scratchpad/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit scratchpad"})})]}):s.jsx(Nt,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((K=o.handoff)==null?void 0:K.handoffCount)??0,content:s.jsx("div",{className:"space-y-5",children:o.handoff?s.jsxs(Ve,{children:[s.jsx(jn,{content:o.handoff.body,emptyState:"No handoff history yet."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(_e,{to:`/assignments/${o.id}/handoff/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append handoff"})})]}):s.jsx(Nt,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((D=o.decisionRecord)==null?void 0:D.decisionCount)??0,content:s.jsx("div",{className:"space-y-5",children:o.decisionRecord?s.jsxs(Ve,{children:[s.jsx(jn,{content:o.decisionRecord.body,emptyState:"No decision history yet."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(_e,{to:`/assignments/${o.id}/decision-record/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append decision"})})]}):s.jsx(Nt,{title:"No decision record yet",description:"Decision records appear here once appended."})})},{value:"activity",label:"Activity",count:v.length,content:s.jsx(u_,{events:v,loading:b,error:w})}]})}),s.jsxs("div",{className:"min-w-0 space-y-5",children:[s.jsx(Ve,{title:"Details",children:s.jsxs("dl",{className:"space-y-3 text-sm",children:[s.jsx(di,{label:"ID",value:o.id,copyable:!0}),s.jsx(di,{label:"Priority",value:o.priority}),o.assignee&&s.jsx(di,{label:"Assignee",value:o.assignee}),s.jsx(di,{label:"Updated",value:`${zl(o.updated)} · Created ${V2(o.created)}`}),o.workspace.repository&&s.jsx(di,{label:"Repository",value:o.workspace.repository,copyable:!0}),o.workspace.worktreePath&&s.jsx(di,{label:"Worktree",value:o.workspace.worktreePath,copyable:!0}),o.workspace.branch&&s.jsx(di,{label:"Branch",value:o.workspace.branch,copyable:!0}),o.workspace.parentBranch&&s.jsx(di,{label:"Parent branch",value:o.workspace.parentBranch,copyable:!0}),o.externalIds.map((W,M)=>s.jsx(AX,{entry:W},`${W.system}:${W.id}:${M}`))]})}),s.jsx(X3,{sessions:u==null?void 0:u.sessions,loading:f,error:p,onError:W=>I(W.message,"error"),onNotice:W=>I(W,"success")}),s.jsx(Q3,{summary:h==null?void 0:h.summary,loading:g,error:y})]})]}),s.jsx(c0,{open:N,onOpenChange:C,currentWorkspace:o.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async W=>{const M=await fetch(`/api/assignments/${encodeURIComponent(o.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:W})});if(!M.ok){const F=await M.json().catch(()=>({}));throw new Error(F.error||"Failed to move assignment")}l()}})]}):s.jsx(Rt,{error:"Assignment not found"})}function di({label:e,value:t,copyable:n}){return s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("dt",{className:"text-muted-foreground",children:e}),s.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[s.jsx("span",{className:"truncate",title:t,children:t}),n&&t!=="—"&&s.jsx(jr,{value:t})]})]})}function AX({entry:e}){const t=e.url!=null&&e.url.length>0;return s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("dt",{className:"text-muted-foreground",children:e.system}),s.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?s.jsxs("a",{href:e.url??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${e.system}:${e.id} in ${e.system}`,className:"flex items-center gap-1.5 min-w-0 text-primary hover:underline",children:[s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),s.jsx(vc,{className:"h-2.5 w-2.5 shrink-0"})]}):s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function f_({title:e,detailHref:t,onSave:n,disabled:r=!1}){const[o,i]=m.useState(!1);return o?s.jsx(PX,{initialTitle:e,disabled:r,onSave:n,onExit:()=>i(!1)}):s.jsxs("div",{className:"group flex items-baseline gap-1.5",children:[s.jsx("button",{type:"button","data-no-drag":!0,disabled:r,onClick:()=>{r||i(!0)},className:be("text-left text-base font-semibold text-foreground transition hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 rounded-sm",r&&"cursor-not-allowed opacity-60"),title:"Click to rename",children:e}),s.jsx(_e,{to:t,"data-no-drag":!0,"aria-label":"Open detail page",title:"Open detail page",onClick:a=>a.stopPropagation(),className:"text-muted-foreground opacity-0 transition group-hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 rounded-sm",children:s.jsx(vc,{className:"h-3.5 w-3.5"})})]})}function PX({initialTitle:e,disabled:t,onSave:n,onExit:r}){const o=m.useRef(e),[i,a]=m.useState(e),[l,u]=m.useState(!1),[f,p]=m.useState(!1),h=m.useRef(null),g=m.useRef(!1);m.useEffect(()=>{const b=h.current;b&&(b.focus(),b.select())},[]);const y=m.useCallback(()=>{var b;p(!0),window.setTimeout(()=>p(!1),260),(b=h.current)==null||b.focus()},[]),k=m.useCallback(async()=>{if(g.current)return;const b=i.trim();if(b.length===0){y();return}if(b===o.current){r();return}g.current=!0,u(!0);try{await n(b)}catch{}finally{u(!1),r()}},[i,r,n,y]);function v(b){b.key==="Enter"?(b.preventDefault(),k()):b.key==="Escape"&&(b.preventDefault(),g.current=!0,r())}return s.jsx("input",{ref:h,type:"text","data-no-drag":!0,disabled:t||l,value:i,onChange:b=>a(b.target.value),onKeyDown:v,onBlur:()=>void k(),className:be("w-full rounded-sm border border-border bg-background px-1.5 py-0.5 text-base font-semibold text-foreground outline-none transition focus:border-ring focus:ring-1 focus:ring-ring",f&&"syntaur-input-shake",l&&"opacity-70")})}function p_(e){const t=Wt(),n=m.useRef(null),r=m.useRef(!1),o=m.useCallback(()=>{const a=n.current,l=!!(a!=null&&a.querySelector('[aria-expanded="true"]')),u=!!document.querySelector('[role="menu"]'),f=document.activeElement,p=!!(f&&(a!=null&&a.contains(f))&&(f.tagName==="INPUT"||f.tagName==="TEXTAREA"));r.current=l||u||p},[]),i=m.useCallback(a=>{if(r.current)return;const l=a.target;!l||l.closest(ic)||t(e)},[t,e]);return{containerRef:n,onMouseDown:o,onClick:i}}const dC=/[A-Za-z0-9_-]/;function fC(e,t){const n=Math.max(0,Math.min(t,e.length)),r=_X(e,n);if(r)return r;let o=n;for(;o>0&&dC.test(e[o-1]);)o--;let i=n;for(;i<e.length&&dC.test(e[i]);)i++;const a=e.slice(o,n),l=e.slice(0,o),u=l.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(u)return{kind:"value",field:u[1].toLowerCase(),partial:a,tokenStart:o,tokenEnd:i};const f=l.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*\([^)]*,\s*$/);return f?{kind:"value",field:f[1].toLowerCase(),partial:a,tokenStart:o,tokenEnd:i}:{kind:"field",partial:a,tokenStart:o,tokenEnd:i}}function _X(e,t){let n=-1;for(let u=t-1;u>=0;u--)if(e[u]==='"'&&(u===0||e[u-1]!=="\\")){n=u;break}if(n<0)return null;for(let u=n+1;u<t;u++)if(e[u]==='"'&&e[u-1]!=="\\")return null;let r=t;for(;r<e.length&&!(e[r]==='"'&&e[r-1]!=="\\");)r++;const o=e.slice(n+1,t),a=e.slice(0,n).match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);return{kind:"value",field:a?a[1].toLowerCase():"",partial:o,tokenStart:n,tokenEnd:r<e.length?r+1:r}}function DX(e,t){const n=rP(t),r=e.toLowerCase();if(r==="")return n;const o=[],i=[];for(const a of n){const l=a.toLowerCase();l.startsWith(r)?o.push(a):l.includes(r)&&i.push(a)}return[...o,...i]}function $X(e,t,n,r){const o=e.toLowerCase();let i=[];switch(o){case"status":i=[...n.statuses];break;case"priority":i=[...n.priorities];break;case"type":i=[...n.types];break;case"assignee":i=["none",...n.assignees];break;case"project":i=["none",...n.projects];break;case"tag":case"tags":i=[...n.tags];break;case"archived":case"pinned":case"blocked":case"parked":i=["true","false"];break;default:{const l=r[o];(l==null?void 0:l.kind)==="bool"&&(i=["true","false"]);break}}if(!i.length)return[];const a=t.toLowerCase();return a===""?i:i.filter(l=>l.toLowerCase().startsWith(a))}function IX(e,t,n){let r;return t.kind==="field"?r=`${n}:`:r=Sw(n),{text:e.slice(0,t.tokenStart)+r+e.slice(t.tokenEnd),caret:t.tokenStart+r.length}}const MX=180;function LX(e,t){const[n,r]=m.useState(e);return m.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),n}function OX({value:e,onChange:t,onCompiled:n,registry:r,declarations:o,valueSources:i,placeholder:a="AQL query (e.g. status:active AND priority:high)",className:l}){const u=m.useRef(null),f=m.useRef(null),p=LX(e,MX),[h,g]=m.useState([]),[y,k]=m.useState([]),[v,b]=m.useState("field"),[w,S]=m.useState(-1),[N,C]=m.useState(!1),R=m.useRef(e.length);m.useEffect(()=>{if(p.trim()===""){g([]),n==null||n(null);return}const $=nc(p,r);$.errors.length>0?(g($.errors),n==null||n(null)):(g([]),n==null||n($.query))},[p,r,n]);const T=m.useCallback(($,L)=>{const U=fC($,L);if(!U){k([]),C(!1);return}if(U.kind==="field"){const K=DX(U.partial,o);k(K),b("field"),C(K.length>0)}else{const K=$X(U.field,U.partial,i,r);k(K),b("value"),C(K.length>0)}S(-1)},[o,i,r]),A=m.useCallback($=>{const L=$.target.value,U=$.target.selectionStart??L.length;R.current=U,t(L),T(L,U)},[t,T]),I=m.useCallback($=>{const L=u.current,U=(L==null?void 0:L.selectionStart)??R.current,K=fC(e,U);if(!K)return;const{text:D,caret:W}=IX(e,K,$);t(D),C(!1),k([]),requestAnimationFrame(()=>{u.current&&(u.current.focus(),u.current.setSelectionRange(W,W),R.current=W)})},[e,t]),_=m.useCallback($=>{if(!(!N||y.length===0))switch($.key){case"ArrowDown":$.preventDefault(),S(L=>Math.min(L+1,y.length-1));break;case"ArrowUp":$.preventDefault(),S(L=>Math.max(L-1,-1));break;case"Enter":case"Tab":w>=0&&($.preventDefault(),I(y[w]));break;case"Escape":C(!1),k([]);break}},[N,y,w,I]),z=m.useRef(null),O=m.useCallback(()=>{z.current=setTimeout(()=>C(!1),120)},[]);m.useEffect(()=>()=>{z.current!==null&&clearTimeout(z.current)},[]);const B=m.useCallback(()=>{var L;const $=((L=u.current)==null?void 0:L.selectionStart)??e.length;T(e,$)},[e,T]);m.useEffect(()=>{var $,L;N&&((L=($=f.current)==null?void 0:$.querySelector('[aria-selected="true"]'))==null||L.scrollIntoView({block:"nearest"}))},[w,N]);const V=h.length>0&&p.trim()!=="";return s.jsxs("div",{className:`relative flex flex-col gap-1 ${l??""}`,children:[s.jsx("input",{ref:u,type:"text",value:e,onChange:A,onKeyDown:_,onBlur:O,onFocus:B,placeholder:a,"aria-label":"AQL query input","aria-expanded":N,"aria-haspopup":"listbox","aria-autocomplete":"list",autoComplete:"off",spellCheck:!1,className:["h-9 w-full rounded-md border bg-background px-3 py-1.5 font-mono text-sm text-foreground outline-none transition",V?"border-destructive focus:border-destructive focus:ring-2 focus:ring-destructive/30":"border-border/60 focus:border-primary focus:ring-2 focus:ring-ring/30"].join(" ")}),N&&y.length>0&&s.jsx("ul",{ref:f,role:"listbox","aria-label":v==="field"?"Field suggestions":"Value suggestions",className:"absolute top-full z-50 mt-1 max-h-56 w-full overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-md",children:y.map(($,L)=>s.jsx("li",{role:"option","aria-selected":L===w,onMouseDown:U=>{U.preventDefault(),I($)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",L===w?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:$},$))}),V&&s.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:h.map(($,L)=>s.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",$.pos,": ",$.message]},L))})]})}const pC=Nw;function Sp(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function FX(e,t){return e.toString()===t.toString()}function hC(){const{workspace:e}=Kt(),t=xn(),n=Wt(),r=m.useRef(null);Ai("list:assignments");const{data:o,loading:i,error:a,refetch:l}=fm(),u=rs(),f=Bd(),[p,h]=Rs(),g=e?`w:${e}`:null,y=z3(g),k=m.useRef(void 0),v=m.useMemo(()=>SP(u.order),[u]),b=m.useMemo(()=>{const X={};for(const re of v)X[re]=es(u,re);return X},[v,u]),w=m.useMemo(()=>v.map(X=>({id:X,title:b[X]??X,description:Qd(X)})),[v,b]),S=m.useMemo(()=>f.definitions.map(X=>({id:X.id,title:Hl(f,X.id),description:X.description})),[f]),N="__unknown_type__",C=m.useMemo(()=>new Set(["all",...v]),[v]),R=p.get("view"),T=p.get("status"),A=p.get("stale"),I=R&&pC.includes(R)?R:"kanban";function _(X){if(!X)return[];const re=[];for(const we of X.split(",")){const ze=we.trim();!ze||ze==="all"||!C.has(ze)||re.includes(ze)||re.push(ze)}return re}const z=m.useCallback(X=>{h(re=>{const we=new URLSearchParams(re);return X==="kanban"?we.delete("view"):we.set("view",X),we})},[h]),[O,B]=m.useState(""),[V,$]=m.useState(()=>_(T)),[L,U]=m.useState(()=>He(y.filters.priority)),[K,D]=m.useState(()=>He(y.filters.type)),[W,M]=m.useState(()=>He(y.filters.assignee)),[F,Y]=m.useState(()=>He(y.filters.project)),[H,Q]=m.useState(()=>He(y.filters.tags)),[J,Z]=m.useState(null),[oe,te]=m.useState(()=>Sp(A)),[ue,ge]=m.useState(()=>Wu({status:_(T),priority:He(y.filters.priority),type:He(y.filters.type),assignee:He(y.filters.assignee),project:He(y.filters.project),tags:He(y.filters.tags),activity:Sp(A)})),[Ce,Se]=m.useState(()=>y.sortField),[ke,Be]=m.useState(()=>y.sortDirection),[ie,ve]=m.useState(()=>({hidden:[]})),[ye,Ae]=m.useState(()=>({hidden:[]})),[Ue,rt]=m.useState(()=>y.grouping),Oe=Ue==="type"?"type":"status",[ot,St]=m.useState(()=>new Set),[ht,it]=m.useState([]),{toast:ce,showToast:me,dismissToast:Ie}=Tn(),[Pe,We]=m.useState(null),[pt,De]=m.useState(null),[Qe,Je]=m.useState(null),[ut,fe]=m.useState(null),[q,ne]=m.useState(null),[xe,qe]=m.useState(null),[Fe,lt]=m.useState(null),[mt,vt]=m.useState(null),[nt,_t]=m.useState(null),[Bt,Ut]=m.useState(!1),[An,Ct]=m.useState(!1),je=e?{kind:"workspace",workspace:e}:{kind:"global"},Ye=p.get("loadView"),{view:at,loading:Mt,error:le}=ki(Ye),{view:Ne,loading:et,error:Pn}=ki(nt),Er=m.useRef(null);m.useEffect(()=>{it((o==null?void 0:o.assignments)??[])},[o]),m.useEffect(()=>{nt&&!et&&!Pn&&!Ne&&_t(null)},[Ne,Pn,nt,et]),m.useEffect(()=>{_t(null),Er.current=null,Z(null),B("")},[e]);const lo=m.useRef({status:T,stale:A});m.useEffect(()=>{const X=_(T),re=Sp(A);cz(X,V)||$(X),re!==oe&&te(re);const we=lo.current,ze=we.status!==T||we.stale!==A;lo.current={status:T,stale:A},ze&&nn({status:X,activity:re})},[oe,A,V,T]),m.useEffect(()=>{k.current===g&&h(X=>{const re=new URLSearchParams(X);return V.length===0?re.delete("status"):re.set("status",V.join(",")),oe==="all"?re.delete("stale"):oe==="stale"?re.set("stale","1"):re.set("stale","0"),FX(X,re)?X:re})},[oe,g,h,V]),m.useEffect(()=>{U(He(y.filters.priority)),D(He(y.filters.type)),M(He(y.filters.assignee)),Y(He(y.filters.project)),Q(He(y.filters.tags)),Se(y.sortField),Be(y.sortDirection),rt(y.grouping)},[y.filters.priority,y.filters.type,y.filters.assignee,y.filters.project,y.filters.tags,y.sortField,y.sortDirection,y.grouping]),m.useEffect(()=>{if(k.current===g)return;let X=!1;return D0().then(re=>{if(X||k.current===g)return;const we=lR(re,g),ze=we.defaultView,yt=He(we.filters.status),Dt=we.filters.activity??"all",$t=new URLSearchParams(window.location.search);let Bn=!1;const yn=new URLSearchParams($t);$t.get("view")===null&&ze!=="kanban"&&pC.includes(ze)&&(yn.set("view",ze),Bn=!0),$t.get("status")===null&&yt.length>0&&(yn.set("status",yt.join(",")),$(yt),Bn=!0),$t.get("stale")===null&&Dt!=="all"&&(yn.set("stale",Dt==="stale"?"1":"0"),te(Dt),Bn=!0),Bn&&h(yn,{replace:!0});const hn=_(yn.get("status")),Tr=yn.get("stale")===null?Dt:Sp(yn.get("stale"));ge(Wu({status:hn,priority:He(we.filters.priority),type:He(we.filters.type),assignee:He(we.filters.assignee),project:He(we.filters.project),tags:He(we.filters.tags),activity:Tr==="fresh"||Tr==="stale"?Tr:"all"})),queueMicrotask(()=>{k.current=g})}),()=>{X=!0}},[g]);const wt=m.useCallback(X=>{(g===null?U3(X):H3(g,X)).catch(we=>{console.warn("Failed to persist view prefs:",we)})},[g]),_i=m.useCallback(X=>{z(X),wt({defaultView:X})},[z,wt]),Oo=m.useRef(null);Oo.current={status:V,priority:L,type:K,assignee:W,project:F,tags:H,activity:oe,dateRange:J,search:O};const Ma=m.useCallback((X={})=>{const re=Oo.current;return{status:re.status,priority:re.priority,type:re.type,assignee:re.assignee,project:re.project,tags:re.tags,activity:re.activity,dateRange:xa(re.dateRange),search:re.search,...X}},[]),nn=m.useCallback((X={})=>{ge(Wu(Ma(X)))},[Ma]),Fo=m.useCallback(X=>{$(X),wt({filters:{status:X}}),nn({status:X})},[wt,nn]),La=m.useCallback(X=>{U(X),wt({filters:{priority:X}}),nn({priority:X})},[wt,nn]),Oa=m.useCallback(X=>{D(X),wt({filters:{type:X}}),nn({type:X})},[wt,nn]),Bc=m.useCallback(X=>{M(X),wt({filters:{assignee:X}}),nn({assignee:X})},[wt,nn]),Fa=m.useCallback(X=>{Y(X),wt({filters:{project:X}}),nn({project:X})},[wt,nn]),Ht=m.useCallback(X=>{Q(X),wt({filters:{tags:X}}),nn({tags:X})},[wt,nn]),Di=m.useCallback(X=>{te(X),wt({filters:{activity:X}}),nn({activity:X})},[wt,nn]),co=m.useCallback(X=>{B(X),nn({search:X})},[nn]),zo=m.useCallback(X=>{Z(X),nn({dateRange:xa(X)})},[nn]),Ds=m.useCallback(X=>{Se(X),wt({sortField:X})},[wt]),Bo=m.useCallback(X=>{Be(X),wt({sortDirection:X})},[wt]),za=m.useCallback(X=>{rt(X),wt({grouping:X})},[wt]),Uo=m.useCallback(()=>{co(""),Fo([]),Ht([]),zo(null),Di("all")},[co,Fo,Ht,zo,Di]),ir=m.useCallback(X=>{ge(X);const re=Ku(X);re&&($(He(re.status)),U(He(re.priority)),D(He(re.type)),M(He(re.assignee)),Y(He(re.project)),Q(He(re.tags)),B(re.search??""),te(re.activity&&re.activity!=="all"?re.activity:"all"),Z(Km(re.dateRange)))},[]),ur=m.useMemo(()=>Ku(ue)!==null,[ue]),Fn=m.useCallback(()=>{const re=Ku(ue)!==null?{status:V,priority:L,type:K,assignee:W,project:F,tags:H,activity:oe,dateRange:xa(J),search:O}:{};return{viewMode:I,filters:{...re,query:ue},sortField:Ce,sortDirection:ke,listSectionVisibility:{collapsed:[...ot]},kanbanColumnVisibility:ie,tableColumnVisibility:ye}},[I,ue,V,L,K,W,F,H,oe,J,O,Ce,ke,ot,ie,ye]),Ho=m.useCallback(X=>{yP(X,{setViewMode:z,setQuery:ge,setStatusFilter:re=>{$(re),wt({filters:{status:re}})},setPriorityFilter:re=>{U(re),wt({filters:{priority:re}})},setTypeFilter:re=>{D(re),wt({filters:{type:re}})},setAssigneeFilter:re=>{M(re),wt({filters:{assignee:re}})},setProjectFilter:re=>{Y(re),wt({filters:{project:re}})},setTagsFilter:re=>{Q(re),wt({filters:{tags:re}})},setActivityFilter:re=>{te(re),wt({filters:{activity:re}})},setDateRange:Z,setSearch:B,setSortField:Ds,setSortDirection:Bo,setListSectionVisibility:re=>St(new Set(re.collapsed)),setKanbanColumnVisibility:ve,setTableColumnVisibility:Ae}),_t(X.id)},[z,wt,Ds,Bo]),Uc=m.useCallback(X=>{Ho(X),Er.current=X.id,h(re=>{const we=new URLSearchParams(re);return we.set("loadView",X.id),we},{replace:!0})},[Ho,h]),Hc=m.useCallback(async X=>{try{const re=ac({name:X,context:{workspace:e??null,projectSlug:null},state:Fn()}),we=await rc(re),ze=we.views[we.views.length-1];_t((ze==null?void 0:ze.id)??null),ze&&(Er.current=ze.id,h(yt=>{const Dt=new URLSearchParams(yt);return Dt.set("loadView",ze.id),Dt},{replace:!0})),Ut(!1),Ct(!1),me(`Saved view "${X}"`,"success")}catch(re){throw me(re instanceof Error?re.message:"Failed to save view","error"),re}},[Fn,h,me,e]),Vo=m.useCallback(async()=>{if(!(!nt||!Ne))try{const X=ac({name:Ne.name,context:{workspace:e??null,projectSlug:null},state:Fn()}),re=Dh(Ne.config,X.config,X.config);await Eh(nt,{config:re}),me("View updated","success")}catch(X){me(X instanceof Error?X.message:"Failed to update view","error")}},[Fn,Ne,nt,me,e]);m.useEffect(()=>{if(!Ye){Er.current=null;return}if(Er.current!==Ye&&(nt&&nt!==Ye&&_t(null),!Mt)){if(le){me("Couldn't load saved view — try again","error");return}if(at){Er.current=Ye,Ho(at),h(X=>{const re=new URLSearchParams(X);return re.delete("loadView"),re},{replace:!0});return}Er.current=Ye,me("Saved view no longer exists","error"),h(X=>{const re=new URLSearchParams(X);return re.delete("loadView"),re},{replace:!0})}},[Ye,at,Mt,le,nt,Ho,h,me]);const Kn=m.useMemo(()=>ht.filter(X=>e?e==="_ungrouped"?X.projectWorkspace===null:X.projectWorkspace===e:!0),[ht,e]),uo=m.useMemo(()=>Array.from(new Set(Kn.map(X=>X.status))).sort(),[Kn]),Vr=m.useMemo(()=>Array.from(new Set(Kn.map(X=>X.priority))).sort(),[Kn]),Ba=m.useMemo(()=>Array.from(new Set(Kn.map(X=>X.assignee??"__unassigned__"))).sort(),[Kn]),$i=m.useMemo(()=>Array.from(new Map(Kn.filter(X=>X.projectSlug!==null).map(X=>[X.projectSlug,X.projectTitle]))).sort(([,X],[,re])=>X.localeCompare(re)),[Kn]),Wo=m.useMemo(()=>Array.from(new Set(Kn.flatMap(X=>X.tags??[]))).sort(),[Kn]),Ko=m.useMemo(()=>nP(u.factDeclarations),[u.factDeclarations]),$s=m.useMemo(()=>ue.trim()===""?null:nc(ue,Ko).query,[ue,Ko]),zn=m.useMemo(()=>eP(ht,$s,{workspace:e}),[ht,$s,e]),_n=m.useMemo(()=>Xd(zn,Ce,ke),[zn,Ce,ke]),Is=m.useMemo(()=>{if(Ue==="none")return[{id:"__all__",label:"All assignments",items:_n}];if(Ue==="type"){const X=f.definitions.map(ze=>({id:ze.id,label:Hl(f,ze.id),items:_n.filter(yt=>yt.type===ze.id)})),re=new Set(f.definitions.map(ze=>ze.id)),we=_n.filter(ze=>!ze.type||!re.has(ze.type));return we.length>0&&X.push({id:N,label:"Other",items:we}),X}if(Ue==="priority")return["critical","high","medium","low"].map(re=>({id:re,label:re.charAt(0).toUpperCase()+re.slice(1),items:_n.filter(we=>we.priority===re)}));if(Ue==="assignee")return Array.from(new Set(_n.map(re=>re.assignee??"__unassigned__"))).sort().map(re=>({id:re,label:re==="__unassigned__"?"Unassigned":re,items:_n.filter(we=>(we.assignee??"__unassigned__")===re)}));if(Ue==="project"){const X=new Map;for(const re of _n){const we=re.projectSlug??"__standalone__",ze=re.projectTitle??"Standalone";X.has(we)||X.set(we,ze)}return Array.from(X.entries()).sort(([,re],[,we])=>re.localeCompare(we)).map(([re,we])=>({id:re,label:we,items:_n.filter(ze=>(ze.projectSlug??"__standalone__")===re)}))}return v.map(X=>({id:X,label:b[X]??X,items:_n.filter(re=>re.status===X)}))},[Ue,_n,f,v,b]),Ft=m.useMemo(()=>{const X=new Set(f.definitions.map(we=>we.id));return zn.some(we=>!we.type||!X.has(we.type))?[...S,{id:N,title:"Other",description:"Assignments with no recognized type."}]:S},[S,f,zn]),{visibleItems:uf,visibleIndexByKey:Vc}=m.useMemo(()=>{let X;if(I==="table")X=_n;else if(I==="kanban"){const we=new Set(f.definitions.map(ze=>ze.id));Oe==="type"?X=[...f.definitions.flatMap(ze=>zn.filter(yt=>yt.type===ze.id)),...zn.filter(ze=>!ze.type||!we.has(ze.type))]:X=v.flatMap(ze=>zn.filter(yt=>yt.status===ze))}else X=Is.flatMap(we=>we.items);const re=new Map;return X.forEach((we,ze)=>re.set(vn(we),ze)),{visibleItems:X,visibleIndexByKey:re}},[I,_n,Is,Oe,f,zn,v]),{hotkeyRowProps:Ii}=Ud(uf,{scope:"list:assignments",onOpen:X=>{if(X.projectSlug===null){n(`/assignments/${X.id}`);return}const re=X.projectWorkspace?`/w/${X.projectWorkspace}`:t;n(`${re}/projects/${X.projectSlug}/assignments/${X.slug}`)}});if(en({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var X;return(X=r.current)==null?void 0:X.focus()}}),en({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>l()}),i)return s.jsx(bt,{label:"Loading assignments board…"});if(a||!o)return s.jsx(Rt,{error:a||"Assignments board is unavailable.",onRetry:l});async function Wc({item:X,toColumnId:re,action:we,reason:ze}){if(!we){const Dt=u.statuses.find($t=>$t.id===re);if(_h(Dt??{id:re}))return me(`Reach “${es(u,re)}” through its complete/fail transition.`,"error"),!1}We(vn(X));const yt=ht;it(Dt=>Dt.map($t=>vn($t)===vn(X)?{...$t,status:re,blockedReason:re==="blocked"?ze??$t.blockedReason:null}:$t));try{const Dt=X.projectSlug===null?we?await pP(X.id,we,ze):await hP(X.id,re):we?await Zw(X.projectSlug,X.slug,we,ze):await e0(X.projectSlug,X.slug,re);return it($t=>$t.map(Bn=>vn(Bn)===vn(X)?{...Bn,status:Dt.status,blockedReason:Dt.blockedReason,availableTransitions:Dt.availableTransitions,updated:Dt.updated}:Bn)),l(),me(`Moved to ${es(u,Dt.status)}`,"success"),!0}catch(Dt){return it(yt),me(Dt.message,"error"),!1}finally{We(null)}}async function fo({item:X,toColumnId:re,action:we}){if(X.status===re)return;const ze=we??Tu(X,re);if(ze!=null&&ze.disabled){me(ze.disabledReason||`Cannot move this assignment to ${re}.`,"error");return}if(ze&&t0(ze)){fe({item:X,toColumnId:re,action:ze});return}await Wc({item:X,toColumnId:re,action:ze})}function Kc(X,re){fo({item:X,toColumnId:re})}async function Mi(X,re){if(re===X.title)return;const we=vn(X),ze=ht;it(yt=>yt.map(Dt=>vn(Dt)===we?{...Dt,title:re}:Dt)),We(we);try{const yt=X.projectSlug===null?await Z9({id:X.id,title:re}):await J9({projectSlug:X.projectSlug,assignmentSlug:X.slug,title:re});it(Dt=>Dt.map($t=>vn($t)===we?{...$t,title:yt.title,updated:yt.updated}:$t)),l()}catch(yt){throw it(ze),me(yt.message,"error"),yt}finally{We(null)}}function Ua(X){St(re=>{const we=new Set(re);return we.has(X)?we.delete(X):we.add(X),we})}function Ms(X){Ce===X?Bo(ke==="asc"?"desc":"asc"):(Ds(X),Bo("asc"))}const pn=pt?ht.find(X=>vn(X)===pt)??null:null;function Ls(X,re){X.dataTransfer.effectAllowed="move",X.dataTransfer.setData("text/plain",re),De(re)}function po(){De(null),Je(null)}function Li(X,re){if(!pn)return;const we=Tu(pn,re);pn.status===re||we!=null&&we.disabled||(X.preventDefault(),X.dataTransfer.dropEffect="move",Je(re))}function Os(X,re){Qe===re&&!X.currentTarget.contains(X.relatedTarget)&&Je(null)}function jg(X,re){if(X.preventDefault(),!pn||pn.status===re){po();return}po(),fo({item:pn,toColumnId:re})}function Fs({field:X,children:re}){const we=Ce===X;return s.jsx("th",{className:"pb-3 font-medium",children:s.jsxs("button",{type:"button",onClick:()=>Ms(X),className:"inline-flex items-center gap-1 hover:text-foreground",children:[re,we?ke==="asc"?s.jsx(E2,{className:"h-3 w-3"}):s.jsx(tr,{className:"h-3 w-3"}):null]})})}return s.jsxs("div",{className:"space-y-5","data-density":y.density,children:[s.jsx("div",{className:"flex items-center justify-end",children:s.jsxs(_e,{to:`${t}/assignments/new`,className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[s.jsx(Tt,{className:"h-4 w-4"}),"New Assignment"]})}),s.jsxs(a0,{children:[s.jsx(OX,{className:"w-full md:min-w-[320px] md:flex-1",value:ue,onChange:ir,registry:Ko,declarations:u.factDeclarations,valueSources:{statuses:u.order,priorities:Vr,types:f.definitions.map(X=>X.id),assignees:Ba.filter(X=>X!=="__unassigned__"),projects:$i.map(([X])=>X),tags:Wo}}),ur?null:s.jsx("span",{className:"inline-flex items-center rounded-md border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-medium text-amber-700 dark:text-amber-300",title:"This query uses features the chips can't represent (OR / NOT / grouping / advanced fields). Edit it in the query box; the chips are read-only until it becomes chip-representable again.",children:"advanced query — edit in the box"}),s.jsx(qm,{ref:r,value:O,onChange:ur?co:()=>{},placeholder:"Search assignments or projects"}),s.jsx(kn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!ur,options:uo.map(X=>({value:X,label:b[X]??X})),value:V,onChange:Fo}),s.jsx(kn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!ur,options:Vr.map(X=>({value:X,label:X[0].toUpperCase()+X.slice(1)})),value:L,onChange:La}),s.jsx(kn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!ur,options:f.definitions.map(X=>({value:X.id,label:Hl(f,X.id)})),value:K,onChange:Oa}),s.jsx(kn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!ur,options:[{value:"__unassigned__",label:"Unassigned"},...Ba.filter(X=>X!=="__unassigned__").map(X=>({value:X,label:X}))],value:W,onChange:Bc}),s.jsx(kn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!ur,options:[{value:"__standalone__",label:"Standalone"},...$i.map(([X,re])=>({value:X,label:re}))],value:F,onChange:Fa}),s.jsx(kn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!ur,options:Wo.map(X=>({value:X,label:X})),value:H,onChange:Ht}),s.jsx(Wm,{className:"max-w-[200px]",value:J,onChange:ur?zo:()=>{}}),s.jsxs("select",{value:oe,disabled:!ur,onChange:X=>Di(X.target.value),className:"editor-input max-w-[180px]","aria-label":"Filter by activity",title:"Filter by activity",children:[s.jsx("option",{value:"all",children:"All activity"}),s.jsx("option",{value:"stale",children:"Stale only"}),s.jsx("option",{value:"fresh",children:"Fresh only"})]}),s.jsx("select",{value:I==="kanban"?Oe:Ue,onChange:X=>za(X.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:az.map(X=>{const re=I==="kanban"&&X!=="status"&&X!=="type",we=X==="none"?"No grouping":`Group: ${X.charAt(0).toUpperCase()+X.slice(1)}`;return s.jsx("option",{value:X,disabled:re,children:re?`${we} (list only)`:we},X)})}),s.jsx(Gm,{value:I,onChange:X=>_i(X),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),I==="table"?s.jsx(L3,{visibility:ye,onChange:Ae}):null,s.jsx(W3,{scope:je,loadedViewId:nt,onApply:Uc,onOpenSaveDialog:()=>{Ct(!1),Ut(!0)}}),s.jsx("button",{type:"button",onClick:()=>{Ne?Vo():(Ct(!1),Ut(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:Ne?`Update ${Ne.name}`:"Save current view",children:Ne?`Update '${Ne.name}'`:"Save view"}),Ne?s.jsx("button",{type:"button",onClick:()=>{Ct(!0),Ut(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),o.assignments.length===0?s.jsx(Nt,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:s.jsxs(_e,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[s.jsx(Yv,{className:"h-4 w-4"}),s.jsx("span",{children:"Browse Projects"})]})}):zn.length===0?s.jsx(Nt,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again.",actions:s.jsxs("button",{type:"button",onClick:Uo,className:"shell-action shell-action--cta",children:[s.jsx(P5,{className:"h-4 w-4"}),s.jsx("span",{children:"Clear all filters"})]})}):I==="table"?(()=>{const X=new Set(ye.hidden),re=we=>we==="title"||!X.has(we);return s.jsx(Ve,{title:`${_n.length} assignment${_n.length===1?"":"s"}`,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[re("title")?s.jsx(Fs,{field:"title",children:"Assignment"}):null,re("status")?s.jsx(Fs,{field:"status",children:"Status"}):null,s.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),re("priority")?s.jsx(Fs,{field:"priority",children:"Priority"}):null,re("assignee")?s.jsx(Fs,{field:"assignee",children:"Assignee"}):null,re("dependencies")?s.jsx(Fs,{field:"dependencies",children:"Dependencies"}):null,re("created")?s.jsx(Fs,{field:"created",children:"Created"}):null,re("updated")?s.jsx(Fs,{field:"updated",children:"Updated"}):null]})}),s.jsx("tbody",{children:_n.map((we,ze)=>s.jsxs(BX,{detailHref:xd(we),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...Ii(ze),children:[re("title")?s.jsxs("td",{className:"py-4 pr-4",children:[s.jsx(f_,{title:we.title,detailHref:xd(we),onSave:yt=>Mi(we,yt),disabled:Pe===vn(we)}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:we.projectTitle??s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),s.jsxs("p",{className:"mt-0.5 inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:we.id,children:[we.id.slice(0,8),s.jsx(jr,{value:we.id})]})]}):null,re("status")?s.jsx("td",{className:"py-4 pr-4",children:s.jsx("select",{value:we.status,disabled:Pe===vn(we),onChange:yt=>fo({item:we,toColumnId:yt.target.value}),className:be("appearance-none rounded-full border px-2.5 py-0.5 text-xs font-semibold tracking-wide outline-none","cursor-pointer bg-[length:12px] bg-[right_6px_center] bg-no-repeat pr-6",`bg-[url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E")]`,yd(u.statuses,we.status).className,Pe===vn(we)&&"animate-pulse opacity-60"),style:yd(u.statuses,we.status).style,children:v.map(yt=>{const Dt=we.status===yt,$t=Dt?void 0:Tu(we,yt),Bn=u.statuses.find(Ha=>Ha.id===yt),yn=!Dt&&_h(Bn??{id:yt})&&!$t,hn=(($t==null?void 0:$t.disabled)??!1)||yn,Tr=yn?`Reach ${b[yt]??yt} via its transition when available`:($t==null?void 0:$t.disabledReason)??void 0;return s.jsx("option",{value:yt,disabled:hn,title:hn?Tr:void 0,children:b[yt]},yt)})})}):null,s.jsx("td",{className:"py-4 pr-4",children:s.jsx(_a,{type:we.type,compact:!0})}),re("priority")?s.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:we.priority}):null,re("assignee")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:we.assignee??"Unassigned"}):null,re("dependencies")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:we.dependsOn.length}):null,re("created")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Xn(we.created)}):null,re("updated")?s.jsx("td",{className:"py-4 text-muted-foreground",children:Xn(we.updated)}):null]},vn(we)))})]})})})})():I==="list"?s.jsx("div",{className:"space-y-3",children:Is.map(({id:X,label:re,items:we})=>{var yn;if(we.length===0&&!(pn&&Ue==="status"))return null;const ze=!ot.has(X),yt=Ue==="status",Dt=yt&&pn?pn.status!==X&&!((yn=Tu(pn,X))!=null&&yn.disabled):!1,$t=yt&&pn?pn.status!==X&&!Dt:!1,Bn=yt&&Qe===X;return s.jsxs("div",{className:be("rounded-lg border border-border/60 bg-card/90 transition",Bn&&Dt&&"ring-2 ring-ring/30",$t&&"border-dashed opacity-65"),onDragOver:yt?hn=>Li(hn,X):void 0,onDragLeave:yt?hn=>Os(hn,X):void 0,onDrop:yt?hn=>jg(hn,X):void 0,children:[s.jsxs("button",{type:"button",onClick:()=>Ua(X),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[s.jsx(tr,{className:`h-4 w-4 text-muted-foreground transition-transform ${ze?"":"-rotate-90"}`}),s.jsx("span",{className:"font-semibold text-foreground",children:re}),s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:we.length})]}),ze&&we.length>0&&s.jsx("div",{className:"space-y-3 px-4 pb-4",children:we.map(hn=>{const Tr=vn(hn),Ha=pt===Tr,Va=Vc.get(Tr)??-1,ho=yt;return s.jsx("div",{draggable:ho,onDragStart:ho?Wr=>Ls(Wr,Tr):void 0,onDragEnd:ho?po:void 0,...Va>=0?Ii(Va):{},className:be("transition",ho&&"cursor-grab active:cursor-grabbing",Ha&&"scale-[0.98] opacity-50"),children:s.jsx(mC,{assignment:hn,dragging:Ha,transitioning:Pe===Tr,onPillSelect:Wr=>void fo({item:hn,toColumnId:Wr.targetStatus,action:Wr}),onOverride:Wr=>Kc(hn,Wr),onRenameTitle:Wr=>Mi(hn,Wr)})},Tr)})})]},X)})}):s.jsx(Hm,{columns:Oe==="type"?Ft:w,items:zn,getItemId:vn,getColumnId:X=>Oe==="type"?X.type&&f.definitions.some(re=>re.id===X.type)?X.type:N:X.status,canDrop:({item:X,fromColumnId:re,toColumnId:we})=>{if(re===we)return{allowed:!0};const ze=Tu(X,we);return ze!=null&&ze.disabled?{allowed:!1,reason:ze.disabledReason||ze.description}:{allowed:!0,reason:ze?ze.warning||ze.description:`Move to ${we} (direct status change).`}},onMove:Oe==="type"?void 0:({item:X,toColumnId:re})=>fo({item:X,toColumnId:re}),dragDisabled:Oe==="type",getExternalDragData:X=>X.projectSlug===null?{type:"standalone-assignment",id:X.id}:{type:"project-assignment",id:X.id},onCardContextMenu:(X,re)=>{re.preventDefault(),ne({item:X,anchor:{x:re.clientX,y:re.clientY}})},emptyMessage:X=>`No ${X.title.toLowerCase()} assignments.`,hiddenColumnIds:ie.hidden,onHideColumn:X=>ve(re=>({hidden:re.hidden.includes(X)?re.hidden.filter(ze=>ze!==X):[...re.hidden,X]})),renderCard:(X,{dragging:re})=>{const we=Vc.get(vn(X))??-1;return s.jsx("div",{...we>=0?Ii(we):{},children:s.jsx(mC,{assignment:X,dragging:re,transitioning:Pe===vn(X),onPillSelect:ze=>void fo({item:X,toColumnId:ze.targetStatus,action:ze}),onOverride:ze=>Kc(X,ze),onRenameTitle:ze=>Mi(X,ze)})})}}),s.jsx(Nn,{toast:ce,onDismiss:Ie}),s.jsx(V3,{open:Bt,onOpenChange:X=>{Ut(X),X||Ct(!1)},initialName:An&&Ne?`${Ne.name} (copy)`:"",title:An?"Save as new view":"Save view",onSubmit:Hc}),s.jsx(Jw,{open:ut!==null,action:(ut==null?void 0:ut.action)??null,assignmentTitle:(ut==null?void 0:ut.item.title)??"Assignment",loading:Pe===(ut?vn(ut.item):null),onOpenChange:X=>{X||fe(null)},onConfirm:async X=>{if(!ut)return;const re=ut;await Wc({item:re.item,toColumnId:re.toColumnId,action:re.action,reason:X})&&fe(null)}}),s.jsx(CP,{anchor:(q==null?void 0:q.anchor)??null,items:q?zX(q.item,{onEdit:()=>{const X=q.item,re=X.projectSlug===null?`/assignments/${X.id}`:`${X.projectWorkspace?`/w/${X.projectWorkspace}`:t}/projects/${X.projectSlug}/assignments/${X.slug}`;n(re)},onDelete:()=>qe(q.item),onMove:()=>vt(q.item)}):[],onClose:()=>ne(null)}),s.jsx(os,{open:xe!==null,title:"Delete assignment?",description:xe?`"${xe.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:Fe!==null,onOpenChange:X=>{!X&&Fe===null&&qe(null)},onConfirm:async()=>{if(!xe||xe.projectSlug===null){qe(null);return}const X=vn(xe);lt(X);try{const re=await fetch(`/api/projects/${encodeURIComponent(xe.projectSlug)}/assignments/${encodeURIComponent(xe.slug)}`,{method:"DELETE"});if(!re.ok){const we=await re.json().catch(()=>({}));throw new Error(we.error||"Failed to delete assignment")}qe(null),l(),me("Assignment deleted","success")}catch(re){me(re instanceof Error?re.message:"Failed to delete assignment","error")}finally{lt(null)}}}),s.jsx(c0,{open:mt!==null,onOpenChange:X=>{X||vt(null)},currentWorkspace:(mt==null?void 0:mt.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async X=>{if(!mt)return;const re=await fetch(`/api/assignments/${encodeURIComponent(mt.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:X})});if(!re.ok){const we=await re.json().catch(()=>({}));throw new Error(we.error||"Failed to move assignment")}l()}})]})}function zX(e,t){const n=[{key:"edit",label:"Edit",icon:jc,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:fn,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:am,onSelect:t.onMove}),n}function BX({detailHref:e,children:t,className:n,...r}){const o=p_(e);return s.jsx("tr",{...r,ref:o.containerRef,className:n,onMouseDown:o.onMouseDown,onClick:o.onClick,children:t})}function mC({assignment:e,dragging:t,transitioning:n,onPillSelect:r,onOverride:o,onRenameTitle:i}){var f;const a=xd(e),l=!!(r&&i),u=p_(a);return s.jsxs("div",{ref:l?u.containerRef:void 0,className:be("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",l&&"cursor-pointer"),onMouseDown:l?u.onMouseDown:void 0,onClick:l?u.onClick:void 0,children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[l?s.jsx(f_,{title:e.title,detailHref:a,onSave:i,disabled:n}):s.jsx(_e,{to:a,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e.projectTitle??s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),s.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:e.id??"",children:[(f=e.id)==null?void 0:f.slice(0,8),e.id&&s.jsx(jr,{value:e.id})]})]}),l?s.jsx(Cs,{id:e.id,slug:e.slug,projectSlug:e.projectSlug,status:e.status,availableTransitions:e.availableTransitions,title:e.title,disabled:n,className:"max-w-[150px]",onSelectAction:r,onSelectOverride:o}):s.jsx(ro,{status:e.status,className:"max-w-[150px]"})]}),e.blockedReason?s.jsx("p",{className:"mt-3 rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground",children:e.blockedReason}):null,s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[s.jsx(_a,{type:e.type}),s.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:e.priority}),s.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:e.assignee??"Unassigned"}),e.dependsOn.length>0?s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.dependsOn.length," ",e.dependsOn.length===1?"dependency":"dependencies"]}):null]}),s.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:[s.jsx("span",{children:n?"Updating":t?"Dragging":"Source-first"}),s.jsx("span",{children:Xn(e.updated)})]})]})}function Tu(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function vn(e){return e.id||e.slug||"unknown"}function is(e){const t=e.match(/^---\n([\s\S]*?)\n---\n?/);if(!t)return{order:[],blocks:new Map,body:e};const n=t[1],r=e.slice(t[0].length),o=n.split(`
|
|
661
|
+
`),i=[],a=new Map;let l=null,u=[];const f=()=>{l&&(i.push(l),a.set(l,u))};for(const p of o){const h=p.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(h&&!p.startsWith(" ")){f(),l=h[1],u=[p];continue}l&&u.push(p)}return f(),{order:i,blocks:a,body:r}}function Mc(e){return`---
|
|
662
|
+
${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
|
|
663
|
+
`)}
|
|
664
|
+
---
|
|
665
|
+
|
|
666
|
+
${e.body.replace(/^\n+/,"")}`}const UX=/[:#{}[\],&*?|>!%@`]/;function bv(e){return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1).replace(/\\(["\\])/g,"$1"):e.length>=2&&e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1).replace(/''/g,"'"):e}function h_(e){return UX.test(e)||/^\s|\s$/.test(e)||/^["']|["']$/.test(e)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e}function Mn(e,t){const n=e.blocks.get(t);if(!(n!=null&&n[0]))return"";const r=n[0].match(/^[^:]+:\s*(.*)$/);if(!r)return"";const o=r[1].trim();return o==="null"?"":bv(o)}function HX(e,t){return Mn(e,t)==="true"}function VX(e){const t=[];let n="",r=null;for(let o=0;o<e.length;o+=1){const i=e[o];if(r){n+=i,i==="\\"&&r==='"'&&o+1<e.length?(n+=e[o+1],o+=1):i===r&&(r=null);continue}if(i==='"'||i==="'"){r=i,n+=i;continue}if(i===","){t.push(n),n="";continue}n+=i}return t.push(n),t}function td(e,t){const n=e.blocks.get(t);if(!(n!=null&&n.length))return[];if(n[0].trim().endsWith("[]"))return[];const o=n[0].match(/^[^:]+:\s*\[(.*)\]\s*$/);return o?VX(o[1]).map(i=>bv(i.trim())).filter(i=>i.length>0):n.slice(1).map(i=>i.trim()).filter(i=>i.startsWith("- ")).map(i=>bv(i.slice(2).trim()))}function WX(e){return typeof e=="boolean"?e?"true":"false":e===null||e===""?"null":h_(e)}function Ln(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${WX(n)}`])}function nd(e,t,n){if(e.blocks.has(t)||e.order.push(t),n.length===0){e.blocks.set(t,[`${t}: []`]);return}e.blocks.set(t,[`${t}:`,...n.map(r=>` - ${h_(r)}`)])}function rd(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function ng(e){const t=is(e);return{title:Mn(t,"title"),slug:Mn(t,"slug"),workspace:Mn(t,"workspace"),archived:HX(t,"archived"),archivedAt:Mn(t,"archivedAt"),archivedReason:Mn(t,"archivedReason"),tags:td(t,"tags").join(", "),body:t.body}}function KX(e,t){const n=is(e),r={...ng(e),...t};return Ln(n,"title",r.title),Ln(n,"slug",r.slug),Ln(n,"workspace",r.workspace||null),Ln(n,"archived",r.archived),Ln(n,"archivedAt",r.archivedAt||null),Ln(n,"archivedReason",r.archivedReason||null),nd(n,"tags",rd(r.tags)),n.body=r.body,Mc(n)}function rg(e){const t=is(e);return{title:Mn(t,"title"),slug:Mn(t,"slug"),status:Mn(t,"status"),priority:Mn(t,"priority")||"medium",assignee:Mn(t,"assignee"),dependsOn:td(t,"dependsOn").join(", "),links:td(t,"links").join(", "),blockedReason:Mn(t,"blockedReason"),tags:td(t,"tags").join(", "),body:t.body}}function qX(e,t){const n=is(e),r={...rg(e),...t};return Ln(n,"title",r.title),Ln(n,"slug",r.slug),Ln(n,"status",r.status),Ln(n,"priority",r.priority),Ln(n,"assignee",r.assignee||null),nd(n,"dependsOn",rd(r.dependsOn)),nd(n,"links",rd(r.links)),Ln(n,"blockedReason",r.blockedReason||null),nd(n,"tags",rd(r.tags)),n.body=r.body,Mc(n)}function sg(e){const t=is(e);return{assignment:Mn(t,"assignment"),status:Mn(t,"status"),body:t.body}}function GX(e,t){const n=is(e),r={...sg(e),...t};return Ln(n,"assignment",r.assignment),Ln(n,"status",r.status),n.body=r.body,Mc(n)}function og(e){const t=is(e);return{assignment:Mn(t,"assignment"),body:t.body}}function YX(e,t){const n=is(e),r={...og(e),...t};return Ln(n,"assignment",r.assignment),n.body=r.body,Mc(n)}function ig(e){const t=is(e);return{name:Mn(t,"name"),slug:Mn(t,"slug"),description:Mn(t,"description"),whenToUse:Mn(t,"when_to_use"),tags:td(t,"tags").join(", "),body:t.body}}function XX(e,t){const n=is(e),r={...ig(e),...t};return Ln(n,"name",r.name),Ln(n,"slug",r.slug),Ln(n,"description",r.description||null),Ln(n,"when_to_use",r.whenToUse||null),nd(n,"tags",rd(r.tags)),n.body=r.body,Mc(n)}function F0(e){return{body:is(e).body}}function m_(e){return F0(e)}function g_(e,t){const n=is(e);return t.body!==void 0&&(n.body=t.body),Mc(n)}function QX(e,t){return g_(e,t)}function Zt(e,t,n){switch(e){case"project":return KX(t,n);case"assignment":return qX(t,n);case"plan":return GX(t,n);case"scratchpad":return YX(t,n);case"playbook":return XX(t,n);case"memory":return g_(t,n);case"resource":return QX(t,n);default:return t}}function JX(e){return(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="s"}function ZX(e){return!e.saving&&e.validationErrorCount===0}function Lc({initialContent:e,documentType:t,mode:n="edit",onSave:r,saving:o,error:i,title:a,description:l,onCancel:u,helpTitle:f,helpBody:p,allowSlugEdit:h=!1}){const[g,y]=m.useState(e),[k,v]=m.useState(!1),[b,w]=m.useState("edit");m.useEffect(()=>{y(e)},[e]);const S=rQ(t,g),N=g!==e,C=nQ(t,g),R=N?"Unsaved changes":n==="create"?"Draft":"Saved",T=t!=="memory"&&t!=="resource",A=m.useRef({content:g,saving:o,validationErrorCount:S.length,onSave:r});return A.current={content:g,saving:o,validationErrorCount:S.length,onSave:r},m.useEffect(()=>{const I=_=>{if(!JX(_))return;_.preventDefault();const{content:z,saving:O,validationErrorCount:B,onSave:V}=A.current;ZX({saving:O,validationErrorCount:B})&&V(z)};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[]),m.useEffect(()=>{if(!N)return;const I=_=>{_.preventDefault(),_.returnValue=""};return window.addEventListener("beforeunload",I),()=>window.removeEventListener("beforeunload",I)},[N]),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"rounded-lg border border-border/70 bg-card/90 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:a}),s.jsx("span",{className:"rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-muted-foreground",children:R})]}),l?s.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:l}):null]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:u,className:"shell-action",children:[s.jsx(dh,{className:"h-4 w-4"}),s.jsx("span",{children:"Back"})]}),T?s.jsxs("button",{type:"button",onClick:()=>v(I=>!I),className:"shell-action",children:[s.jsx(R5,{className:"h-4 w-4"}),s.jsx("span",{children:k?"Structured":"Raw Markdown"})]}):null,s.jsxs("button",{type:"button",onClick:()=>r(g),disabled:o||S.length>0,className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-semibold text-background transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(Od,{className:"h-4 w-4"}),s.jsx("span",{children:o?"Saving…":"Save"})]})]})]}),i?s.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:i}):null,S.length>0?s.jsx("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:s.jsx("ul",{className:"space-y-1",children:S.map(I=>s.jsx("li",{children:I},I))})}):null]}),s.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[s.jsx("button",{type:"button",onClick:()=>w("edit"),className:`shell-action ${b==="edit"?"shell-action--cta":""}`,children:"Edit"}),s.jsxs("button",{type:"button",onClick:()=>w("preview"),className:`shell-action ${b==="preview"?"shell-action--cta":""}`,children:[s.jsx(B1,{className:"h-4 w-4"}),"Preview"]})]}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(320px,0.8fr)]",children:[s.jsx("div",{className:b==="preview"?"hidden md:block":"",children:s.jsx("div",{className:"surface-panel space-y-3",children:k?s.jsx("textarea",{value:g,onChange:I=>y(I.target.value),className:"min-h-[720px] w-full rounded-md border border-border/70 bg-background/90 p-4 font-mono text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30",spellCheck:!1}):s.jsx(eQ,{documentType:t,content:g,onChange:y,allowSlugEdit:h})})}),s.jsx("div",{className:b==="edit"?"hidden md:block":"",children:s.jsxs("div",{className:"surface-panel sticky top-16 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(B1,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),s.jsx(jn,{content:C,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function eQ({documentType:e,content:t,onChange:n,allowSlugEdit:r}){const o=rs();if(e==="project"){const a=ng(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(Ru,{children:[s.jsx(Vt,{label:"Project title",children:s.jsx("input",{value:a.title,onChange:l=>{const u=l.target.value,f={title:u};r&&(a.slug===$r(a.title)||!a.slug.trim())&&(f.slug=$r(u)),n(Zt(e,t,f))},className:"editor-input"})}),s.jsx(Vt,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:a.slug,disabled:!r,onChange:l=>n(Zt(e,t,{slug:$r(l.target.value)})),className:`editor-input ${r?"":"editor-input-disabled"}`}),s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:r?"The slug becomes the folder name and URL. It is auto-generated from the title until you change it, and it cannot be renamed after creation.":"The slug is the folder name and URL-safe identifier. It is locked after creation so links and file paths stay stable."})]})}),s.jsx(Vt,{label:"Tags",children:s.jsx("input",{value:a.tags,onChange:l=>n(Zt(e,t,{tags:l.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),s.jsx(tQ,{value:a.workspace,onChange:l=>n(Zt(e,t,{workspace:l}))})]}),s.jsx(Vt,{label:"Project body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Zt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const a=rg(t),l=cP(o),u=!l.some(f=>f.id===a.status);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(Ru,{children:[s.jsx(Vt,{label:"Assignment title",children:s.jsx("input",{value:a.title,onChange:f=>{const p=f.target.value,h={title:p};r&&(a.slug===$r(a.title)||!a.slug.trim())&&(h.slug=$r(p)),n(Zt(e,t,h))},className:"editor-input"})}),s.jsx(Vt,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:a.slug,disabled:!r,onChange:f=>n(Zt(e,t,{slug:$r(f.target.value)})),className:`editor-input ${r?"":"editor-input-disabled"}`}),s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:r?"The slug becomes the assignment folder name and URL. It is auto-generated from the title until you change it, and it cannot be renamed after creation.":"The slug is locked after creation because assignment paths and dependency references use it as a stable identifier."})]})}),s.jsx(Vt,{label:"Status",children:s.jsxs("select",{value:a.status,onChange:f=>n(Zt(e,t,{status:f.target.value})),className:"editor-input",children:[u?s.jsx("option",{value:a.status,children:es(o,a.status)}):null,l.map(f=>s.jsx("option",{value:f.id,children:f.label},f.id))]})}),s.jsx(Vt,{label:"Priority",children:s.jsxs("select",{value:a.priority,onChange:f=>n(Zt(e,t,{priority:f.target.value})),className:"editor-input",children:[s.jsx("option",{value:"low",children:"Low"}),s.jsx("option",{value:"medium",children:"Medium"}),s.jsx("option",{value:"high",children:"High"}),s.jsx("option",{value:"critical",children:"Critical"})]})}),s.jsx(Vt,{label:"Assignee",children:s.jsx("input",{value:a.assignee,onChange:f=>n(Zt(e,t,{assignee:f.target.value})),placeholder:"Agent name",className:"editor-input"})}),s.jsx(Vt,{label:"Depends on",className:"md:col-span-2",children:s.jsx("input",{value:a.dependsOn,onChange:f=>n(Zt(e,t,{dependsOn:f.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),s.jsx(Vt,{label:"Links",className:"md:col-span-2",children:s.jsx("input",{value:a.links,onChange:f=>n(Zt(e,t,{links:f.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),s.jsx(Vt,{label:"Blocked reason",className:"md:col-span-2",children:s.jsx("input",{value:a.blockedReason,onChange:f=>n(Zt(e,t,{blockedReason:f.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),s.jsx(Vt,{label:"Tags",className:"md:col-span-2",children:s.jsx("input",{value:a.tags,onChange:f=>n(Zt(e,t,{tags:f.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),s.jsx(Vt,{label:"Assignment body",children:s.jsx("textarea",{value:a.body,onChange:f=>n(Zt(e,t,{body:f.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const a=sg(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(Ru,{children:[s.jsx(Vt,{label:"Assignment",children:s.jsx("input",{value:a.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),s.jsx(Vt,{label:"Plan status",children:s.jsxs("select",{value:a.status,onChange:l=>n(Zt(e,t,{status:l.target.value})),className:"editor-input",children:[s.jsx("option",{value:"draft",children:"Draft"}),s.jsx("option",{value:"approved",children:"Approved"}),s.jsx("option",{value:"in_progress",children:"In Progress"}),s.jsx("option",{value:"completed",children:"Completed"})]})})]}),s.jsx(Vt,{label:"Plan body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Zt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const a=og(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsx(Ru,{children:s.jsx(Vt,{label:"Assignment",children:s.jsx("input",{value:a.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),s.jsx(Vt,{label:"Scratchpad body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Zt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const a=e==="memory"?F0(t):m_(t),l=e==="memory"?"Memory body":"Resource body";return s.jsxs("div",{className:"space-y-3",children:[s.jsx(Vt,{label:l,children:s.jsx("textarea",{value:a.body,onChange:u=>n(Zt(e,t,{body:u.target.value})),className:"editor-textarea",spellCheck:!1})}),s.jsx("p",{className:"text-xs text-muted-foreground/80",children:"Frontmatter (name, scope/category, source, related assignments, tags) is preserved server-side on save."})]})}const i=ig(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(Ru,{children:[s.jsx(Vt,{label:"Playbook name",children:s.jsx("input",{value:i.name,onChange:a=>{const l=a.target.value,u={name:l};r&&(i.slug===$r(i.name)||!i.slug.trim())&&(u.slug=$r(l)),n(Zt(e,t,u))},className:"editor-input"})}),s.jsx(Vt,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:i.slug,disabled:!r,onChange:a=>n(Zt(e,t,{slug:$r(a.target.value)})),className:`editor-input ${r?"":"editor-input-disabled"}`}),s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:r?"The slug becomes the filename. It is auto-generated from the name until you change it.":"The slug is locked after creation because it is the filename."})]})}),s.jsx(Vt,{label:"Description",className:"md:col-span-2",children:s.jsx("input",{value:i.description,onChange:a=>n(Zt(e,t,{description:a.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),s.jsx(Vt,{label:"Tags",className:"md:col-span-2",children:s.jsx("input",{value:i.tags,onChange:a=>n(Zt(e,t,{tags:a.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),s.jsx(Vt,{label:"When to use",className:"md:col-span-2",children:s.jsx("input",{value:i.whenToUse,onChange:a=>n(Zt(e,t,{whenToUse:a.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),s.jsx(Vt,{label:"Playbook rules",children:s.jsx("textarea",{value:i.body,onChange:a=>n(Zt(e,t,{body:a.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function Ru({children:e}){return s.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function Vt({label:e,children:t,className:n}){return s.jsxs("label",{className:`block space-y-2 ${n??""}`,children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:e}),t]})}function tQ({value:e,onChange:t}){const{data:n}=Ra(),r=(n==null?void 0:n.workspaces)??[];return s.jsx(Vt,{label:"Workspace",children:s.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"editor-input",children:[s.jsx("option",{value:"",children:"Ungrouped"}),r.map(o=>s.jsx("option",{value:o,children:o},o))]})})}function nQ(e,t){switch(e){case"project":return ng(t).body;case"assignment":return rg(t).body;case"plan":return sg(t).body;case"scratchpad":return og(t).body;case"playbook":return ig(t).body;case"memory":return F0(t).body;case"resource":return m_(t).body}}function rQ(e,t){switch(e){case"project":{const n=ng(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!Up(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"assignment":{const n=rg(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!Up(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"plan":return sg(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return og(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=ig(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!Up(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"memory":case"resource":return[]}}function gC(){const e=Wt(),{workspace:t}=Kt(),n=xn(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,u]=m.useState(!1),[f,p]=m.useState(null);m.useEffect(()=>{fetch("/api/templates/project").then(g=>g.json()).then(g=>{let y=g.content;t&&t!=="_ungrouped"&&(y=y.replace(/^(tags: \[\])$/m,`$1
|
|
667
|
+
workspace: ${t}`)),o(y),a(!1)}).catch(g=>{p(g.message),a(!1)})},[t]);async function h(g){u(!0),p(null);try{const y=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),k=await y.json();if(!y.ok){p(k.error||`HTTP ${y.status}`),u(!1);return}e(`${n}/projects/${k.slug}`)}catch(y){p(y.message),u(!1);return}u(!1)}return i?s.jsx(bt,{label:"Loading project template…"}):f&&!r?s.jsx(Rt,{error:f}):s.jsx(Lc,{initialContent:r||"",documentType:"project",mode:"create",onSave:h,saving:l,error:f,title:"Create Project",description:"Projects hold the high-level objective, shared context, and human-authored overview. Put execution details in assignments instead of overloading project.md.",onCancel:()=>e(`${n}/projects`),helpTitle:"Project editing rules",helpBody:"Use this form for project intent, slug, tags, and overview content. If you ever need less common metadata, raw markdown mode still exposes the full file.",allowSlugEdit:!0})}function xC(){const{slug:e}=Kt(),t=xn(),n=Wt(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,u]=m.useState(!1),[f,p]=m.useState(null);m.useEffect(()=>{fetch("/api/templates/assignment").then(g=>g.json()).then(g=>{o(g.content),a(!1)}).catch(g=>{p(g.message),a(!1)})},[]);async function h(g){if(!e){p("Project slug is required.");return}u(!0),p(null);try{const y=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),k=await y.json();if(!y.ok){p(k.error||`HTTP ${y.status}`),u(!1);return}n(`${t}/projects/${e}/assignments/${k.slug}`)}catch(y){p(y.message),u(!1);return}u(!1)}return i?s.jsx(bt,{label:"Loading assignment template…"}):f&&!r?s.jsx(Rt,{error:f}):s.jsx(Lc,{initialContent:r||"",documentType:"assignment",mode:"create",onSave:h,saving:l,error:f,title:"Create Assignment",description:"Assignments are the execution unit. Declare dependencies here, keep status pending until work starts, and use blocked later only for runtime obstacles.",onCancel:()=>n(e?`${t}/projects/${e}`:`${t}/projects`),helpTitle:"Assignment editing rules",helpBody:"Use structured fields for priority, assignee, dependencies, and tags. Status can be changed through lifecycle actions, kanban drag, or the status override.",allowSlugEdit:!0})}function yC(){const{workspace:e}=Kt(),t=xn(),n=Wt(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,u]=m.useState(!1),[f,p]=m.useState(null);m.useEffect(()=>{const g=new URLSearchParams({standalone:"1"});e&&g.set("workspace",e),fetch(`/api/templates/assignment?${g.toString()}`).then(y=>y.json()).then(y=>{o(y.content),a(!1)}).catch(y=>{p(y.message),a(!1)})},[e]);async function h(g){var y;u(!0),p(null);try{const k=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),v=await k.json();if(!k.ok){p(v.error||`HTTP ${k.status}`),u(!1);return}const b=(y=v==null?void 0:v.assignment)==null?void 0:y.id;if(!b){p("Server did not return the new assignment id."),u(!1);return}n(`/assignments/${b}`)}catch(k){p(k.message),u(!1);return}u(!1)}return i?s.jsx(bt,{label:"Loading assignment template…"}):f&&!r?s.jsx(Rt,{error:f}):s.jsx(Lc,{initialContent:r||"",documentType:"assignment",mode:"create",onSave:h,saving:l,error:f,title:"Create Standalone Assignment",description:e?`Standalone assignments live outside any project. This one will be tagged with workspaceGroup: ${e} so it appears in this workspace's views.`:"Standalone assignments live outside any project. Add a workspaceGroup to make them appear in workspace-filtered views.",onCancel:()=>n(`${t}/assignments`),helpTitle:"Standalone assignment editing rules",helpBody:"No project field is needed (it must remain null). Use workspaceGroup to group with other workspace work. Status, priority, and tags work the same as project-nested assignments.",allowSlugEdit:!0})}function Oc({loadUrl:e,saveUrl:t,redirectTo:n,title:r,description:o,documentType:i,helpTitle:a,helpBody:l}){const u=Wt(),{data:f,loading:p,error:h}=cT(e),[g,y]=m.useState(!1),[k,v]=m.useState(null);async function b(w){y(!0),v(null);try{const S=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:w})}),N=await S.json();if(!S.ok){v(N.error||`HTTP ${S.status}`),y(!1);return}u(n)}catch(S){v(S.message),y(!1);return}y(!1)}return p?s.jsx(bt,{label:`Loading ${r.toLowerCase()}…`}):h||!f?s.jsx(Rt,{error:h||`${r} is unavailable.`}):s.jsx(Lc,{initialContent:f.content,documentType:i,onSave:b,saving:g,error:k,title:r,description:o,onCancel:()=>u(n),helpTitle:a,helpBody:l})}function bC(){const{slug:e}=Kt(),t=xn(),n=e??"";return s.jsx(Oc,{loadUrl:`/api/projects/${n}/edit`,saveUrl:`/api/projects/${n}`,redirectTo:`${t}/projects/${n}`,title:"Edit Project",description:"Project edits change the human-authored source document. The structured form stays focused on title, slug, tags, and overview content.",documentType:"project",helpTitle:"Editable vs derived project fields",helpBody:"Project status remains derived from assignment state. If you need less common frontmatter fields, switch to raw markdown mode instead of expanding the structured form."})}function Xy(){const{slug:e,aslug:t,id:n}=Kt(),r=xn(),o=!!n,i=o?`/api/assignments/${n}/edit`:`/api/projects/${e}/assignments/${t}/edit`,a=o?`/api/assignments/${n}`:`/api/projects/${e}/assignments/${t}`,l=o?`/assignments/${n}`:`${r}/projects/${e}/assignments/${t}`;return s.jsx(Oc,{loadUrl:i,saveUrl:a,redirectTo:l,title:"Edit Assignment",description:"Edit assignment fields including status, priority, assignee, dependencies, and body.",documentType:"assignment",helpTitle:"Assignment editing",helpBody:"All fields are editable. Status can also be changed through lifecycle actions or kanban drag."})}function Qy(){const{slug:e,aslug:t,id:n}=Kt(),r=xn(),o=!!n,i=o?`/api/assignments/${n}/plan/edit`:`/api/projects/${e}/assignments/${t}/plan/edit`,a=o?`/api/assignments/${n}/plan`:`/api/projects/${e}/assignments/${t}/plan`,l=o?`/assignments/${n}?tab=plan`:`${r}/projects/${e}/assignments/${t}?tab=plan`;return s.jsx(Oc,{loadUrl:i,saveUrl:a,redirectTo:l,title:"Edit Plan",description:"Plans are separate from assignment status, so keep implementation steps here instead of overloading the assignment body.",documentType:"plan",helpTitle:"Plan status is separate",helpBody:"Plan status tracks the plan document itself. It does not replace the assignment lifecycle state."})}function Jy(){const{slug:e,aslug:t,id:n}=Kt(),r=xn(),o=!!n,i=o?`/api/assignments/${n}/scratchpad/edit`:`/api/projects/${e}/assignments/${t}/scratchpad/edit`,a=o?`/api/assignments/${n}/scratchpad`:`/api/projects/${e}/assignments/${t}/scratchpad`,l=o?`/assignments/${n}?tab=scratchpad`:`${r}/projects/${e}/assignments/${t}?tab=scratchpad`;return s.jsx(Oc,{loadUrl:i,saveUrl:a,redirectTo:l,title:"Edit Scratchpad",description:"Scratchpad is the assignment’s working memory surface for notes, experiments, and temporary context.",documentType:"scratchpad",helpTitle:"Scratchpad usage",helpBody:"Scratchpad is for transient notes. Keep canonical objective and lifecycle data in assignment.md and any active plan files (plan.md, plan-v2.md, ...)."})}function x_({loadUrl:e,saveUrl:t,redirectTo:n,title:r,description:o,helpTitle:i,helpBody:a}){const l=Wt(),{data:u,loading:f,error:p}=cT(e),[h,g]=m.useState(""),[y,k]=m.useState(""),[v,b]=m.useState(!1),[w,S]=m.useState(null);async function N(){b(!0),S(null);try{const C=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:h,body:y})}),R=await C.json();if(!C.ok){S(R.error||`HTTP ${C.status}`),b(!1);return}l(n)}catch(C){S(C.message),b(!1);return}b(!1)}return f?s.jsx(bt,{label:`Loading ${r.toLowerCase()}…`}):p||!u?s.jsx(Rt,{error:p||`${r} is unavailable.`}):s.jsxs("div",{className:"space-y-4",children:[s.jsx(Ve,{title:r,description:o,children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("label",{className:"block space-y-2",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry title"}),s.jsx("input",{value:h,onChange:C=>g(C.target.value),placeholder:"Optional title",className:"editor-input"})]}),s.jsxs("label",{className:"block space-y-2",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry body"}),s.jsx("textarea",{value:y,onChange:C=>k(C.target.value),className:"editor-textarea",spellCheck:!1})]}),w?s.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:w}):null,s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(n),className:"shell-action",children:"Cancel"}),s.jsx("button",{type:"button",onClick:N,disabled:v||!y.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:v?"Appending…":"Append Entry"})]})]})}),s.jsx(Ve,{title:"Current Document",children:s.jsx(jn,{content:u.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function Zy(){const{slug:e,aslug:t,id:n}=Kt(),r=xn(),o=!!n,i=o?`/api/assignments/${n}/handoff/edit`:`/api/projects/${e}/assignments/${t}/handoff/edit`,a=o?`/api/assignments/${n}/handoff/entries`:`/api/projects/${e}/assignments/${t}/handoff/entries`,l=o?`/assignments/${n}?tab=handoff`:`${r}/projects/${e}/assignments/${t}?tab=handoff`;return s.jsx(x_,{loadUrl:i,saveUrl:a,redirectTo:l,title:"Append Handoff Entry",description:"Add a new handoff without rewriting previous history.",helpTitle:"Append-only handoff history",helpBody:"Handoff log entries preserve the baton-passing trail between sessions and agents. Add a new entry instead of editing older ones."})}function eb(){const{slug:e,aslug:t,id:n}=Kt(),r=xn(),o=!!n,i=o?`/api/assignments/${n}/decision-record/edit`:`/api/projects/${e}/assignments/${t}/decision-record/edit`,a=o?`/api/assignments/${n}/decision-record/entries`:`/api/projects/${e}/assignments/${t}/decision-record/entries`,l=o?`/assignments/${n}?tab=decisions`:`${r}/projects/${e}/assignments/${t}?tab=decisions`;return s.jsx(x_,{loadUrl:i,saveUrl:a,redirectTo:l,title:"Append Decision Entry",description:"Record a new decision and rationale without editing prior entries.",helpTitle:"Append-only decision history",helpBody:"Decision records should accumulate over time so the implementation rationale remains auditable and reviewable."})}function vC(){const{workspace:e}=Kt(),{data:t}=oo(),{data:n,loading:r,error:o,refetch:i}=ow(),{toast:a,showToast:l,dismissToast:u}=Tn(),[f,p]=m.useState(!1),[h,g]=m.useState(""),[y,k]=m.useState(!1),[v,b]=m.useState(null),[w,S]=m.useState(!1),N=rr();m.useEffect(()=>{const _=N.hash.match(/^#server-(.+)/);if(!_)return;const z=decodeURIComponent(_[1]),O=document.querySelector(`[data-server-name="${window.CSS.escape(z)}"]`);if(!O)return;O.scrollIntoView({block:"nearest"}),O.classList.add("ring-2","ring-primary/60");const B=window.setTimeout(()=>O.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(B)},[N.hash,n]);const C=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const _=new Set(t.filter(z=>e==="_ungrouped"?z.workspace===null:z.workspace===e).map(z=>z.slug));return n.sessions.filter(z=>z.windows.some(O=>O.panes.some(B=>B.assignment&&B.assignment.project!==null&&_.has(B.assignment.project))))})();async function R(_){if(_.preventDefault(),!!h.trim())try{const z=await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:h.trim()})});if(!z.ok){const O=await z.json().catch(()=>null);l((O==null?void 0:O.error)||`HTTP ${z.status}`,"error");return}g(""),p(!1),i(),l(`Tracking "${h.trim()}"`,"success")}catch(z){l(z instanceof Error?z.message:"Failed to register session","error")}}async function T(){k(!0);try{const _=await fetch("/api/servers/refresh",{method:"POST"});if(!_.ok){const z=await _.json().catch(()=>null);l((z==null?void 0:z.error)||`HTTP ${_.status}`,"error");return}i()}catch(_){l(_ instanceof Error?_.message:"Failed to refresh sessions","error")}finally{k(!1)}}async function A(_){S(!0);try{const z=await fetch(`/api/servers/${encodeURIComponent(_)}`,{method:"DELETE"});if(!z.ok){const O=await z.json().catch(()=>null);l((O==null?void 0:O.error)||`HTTP ${z.status}`,"error");return}b(null),i(),l(`Stopped tracking "${_}"`,"success")}catch(z){l(z instanceof Error?z.message:"Failed to remove session","error")}finally{S(!1)}}async function I(_){try{const z=await fetch(`/api/servers/${encodeURIComponent(_)}/refresh`,{method:"POST"});if(!z.ok){const O=await z.json().catch(()=>null);l((O==null?void 0:O.error)||`HTTP ${z.status}`,"error");return}i()}catch(z){l(z instanceof Error?z.message:"Failed to refresh session","error")}}return r?s.jsx(bt,{label:"Loading servers…"}):o?s.jsx(Rt,{error:o}):n?n.tmuxAvailable?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f?s.jsxs("form",{onSubmit:R,className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:h,onChange:_=>g(_.target.value),placeholder:"tmux session name",className:"editor-input text-sm",autoFocus:!0}),s.jsx("button",{type:"submit",className:"shell-action",children:"Add"}),s.jsx("button",{type:"button",className:"shell-action",onClick:()=>p(!1),children:"Cancel"})]}):s.jsxs("button",{className:"shell-action",onClick:()=>p(!0),children:[s.jsx(Tt,{className:"h-3.5 w-3.5"}),"Track Session"]}),s.jsxs("button",{className:"shell-action",onClick:T,disabled:y,children:[s.jsx(ew,{className:`h-3.5 w-3.5 ${y?"animate-spin":""}`}),"Refresh All"]})]}),C.length===0?s.jsx(Nt,{title:"No sessions tracked",description:"Register a tmux session to start tracking your dev servers."}):s.jsx("div",{className:"mt-4 space-y-4",children:C.map(_=>s.jsx(sQ,{session:_,onRefresh:()=>I(_.name),onRemove:()=>b(_.name),onRefetch:i},_.name))}),s.jsx(os,{open:v!==null,title:"Stop tracking session?",description:`Remove "${v??""}" from tracked servers. This does not stop the tmux session itself.`,confirmLabel:"Stop Tracking",destructive:!0,loading:w,onOpenChange:_=>{!_&&!w&&b(null)},onConfirm:async()=>{v&&await A(v)}}),s.jsx(Nn,{toast:a,onDismiss:u})]}):s.jsx(s.Fragment,{children:s.jsxs("div",{className:"surface-panel mt-4 flex flex-col items-center gap-3 py-12 text-center",children:[s.jsx(pa,{className:"h-10 w-10 text-muted-foreground/40"}),s.jsx("p",{className:"text-sm font-medium text-foreground",children:"tmux is not installed"}),s.jsxs("p",{className:"max-w-md text-sm text-muted-foreground",children:["Server tracking requires tmux. Install it with ",s.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"brew install tmux"})," to get started."]})]})}):null}function sQ({session:e,onRefresh:t,onRemove:n,onRefetch:r}){return s.jsxs("div",{className:"surface-panel","data-server-name":e.name,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Zv,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm font-semibold text-foreground",children:e.name}),s.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${e.alive?"border border-success-foreground/30 bg-success text-success-foreground":"border border-error-foreground/30 bg-error text-error-foreground"}`,children:e.alive?"alive":"dead"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last refreshed: ",Sr(e.lastRefreshed)]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{className:"shell-action",onClick:t,title:"Refresh","aria-label":"Refresh",children:s.jsx(ew,{className:"h-3.5 w-3.5"})}),s.jsx("button",{className:"shell-action",onClick:n,title:"Remove","aria-label":"Remove",children:s.jsx(fn,{className:"h-3.5 w-3.5"})})]})]}),e.alive&&e.windows.length>0&&s.jsx("div",{className:"mt-3 space-y-3",children:e.windows.map(o=>s.jsxs("div",{children:[s.jsxs("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:["Window ",o.index,": ",o.name]}),s.jsx("div",{className:"space-y-1.5",children:o.panes.map(i=>s.jsx(oQ,{pane:i,sessionName:e.name,windowIndex:o.index,onRefetch:r},`${o.index}:${i.index}`))})]},o.index))}),!e.alive&&s.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(e4,{className:"h-4 w-4"}),s.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function oQ({pane:e,sessionName:t,windowIndex:n,onRefetch:r}){const o=xn(),i=e.cwd.replace(/^\/Users\/[^/]+/,"~");return s.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2 text-sm",children:[s.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground/60",children:[":",e.index]}),s.jsx("span",{className:"shrink-0 rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",children:e.command}),s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx("span",{className:"block min-w-0 truncate",title:e.cwd,children:i}),s.jsx(jr,{value:e.cwd})]}),e.branch&&s.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Xv,{className:"h-3 w-3"}),e.branch,e.worktree&&s.jsx("span",{className:"rounded bg-status-in-progress px-1 py-0.5 text-[10px] font-medium text-status-in-progress-foreground",children:"worktree"})]}),e.ports.length>0&&s.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:e.urls.map(a=>s.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/5 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 dark:border-primary/40 dark:bg-primary/10 dark:hover:bg-primary/20",children:[a.replace("http://localhost:",":"),s.jsx(vc,{className:"h-2.5 w-2.5"})]},a))}),s.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?s.jsxs(_e,{to:e.assignment.project===null?`/assignments/${e.assignment.slug}`:`${o}/projects/${e.assignment.project}/assignments/${e.assignment.slug}`,className:"inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/20",children:[s.jsx(U5,{className:"h-2.5 w-2.5"}),e.assignment.title,e.assignment.project===null?s.jsx("span",{className:"ml-1 rounded bg-muted px-1 py-0.5 text-[9px] uppercase tracking-wide text-muted-foreground",children:"Standalone"}):null]}):s.jsx("span",{className:"text-xs text-muted-foreground/40",children:"unlinked"})})]})}function y_(e){return e<60?`${e}s`:e<3600?`${Math.round(e/60)}m`:e<86400?`${Math.round(e/3600)}h`:`${Math.round(e/86400)}d`}function iQ(e,t){const n=Date.parse(e),r=Math.floor((n-t)/1e3);return Number.isNaN(r)?"–":r<=0?"expired":y_(r)}function aQ(e){switch(e){case"idle":return"border-success-foreground/30 bg-success text-success-foreground";case"leased":return"border-warning-foreground/30 bg-warning text-warning-foreground";case"retired":return"border-muted-foreground/30 bg-muted text-muted-foreground"}}function lQ(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function wC(){const{data:e,loading:t,error:n,refetch:r}=uT(),[o,i]=m.useState(()=>Date.now()),[a,l]=m.useState(null),[u,f]=m.useState(!1),{toast:p,showToast:h,dismissToast:g}=Tn();if(m.useEffect(()=>{const k=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(k)},[]),t)return s.jsx(bt,{label:"Loading inventories…"});if(n)return s.jsx(Rt,{title:"Could not load inventories",error:n,action:s.jsx("button",{type:"button",onClick:r,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});if(!e||e.inventories.length===0)return s.jsx(Nt,{title:"No inventories yet",description:"Create one with `syntaur lease create-inventory <slug> --kind <kind>`, then add members with `syntaur lease member add <slug> <id>`."});async function y(){if(a){f(!0);try{const k=await fetch(`/api/leases/${encodeURIComponent(a.slug)}/force-release/${encodeURIComponent(a.lease.lease_id)}`,{method:"POST"});if(!k.ok){const v=await k.json().catch(()=>null);throw new Error((v==null?void 0:v.error)??`HTTP ${k.status}`)}r(),l(null)}catch(k){h(k instanceof Error?`Force release failed: ${k.message}`:"Force release failed","error")}finally{f(!1)}}}return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex items-start justify-between",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Inventories"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Claimable shared resources (dev envs, test DBs, named locks, …). Global in v1 — the same set appears on every workspace."})]})}),s.jsx("div",{className:"grid gap-4",children:e.inventories.map(k=>s.jsx(cQ,{detail:k,now:o,onForceRelease:v=>l({slug:k.inventory.slug,lease:v})},k.inventory.slug))}),s.jsx(os,{open:a!==null,title:"Force release this lease?",description:a?`This will revoke lease ${a.lease.lease_id} and (if it's still the current holder) free member ${a.lease.member_id}. Any agent still using this lease will see a stale-lease error on its next CLI call.`:"",confirmLabel:"Force release",destructive:!0,loading:u,onConfirm:y,onOpenChange:k=>{k||l(null)}}),s.jsx(Nn,{toast:p,onDismiss:g})]})}function cQ({detail:e,now:t,onForceRelease:n}){const{inventory:r,members:o,active_leases:i}=e,a=o.filter(u=>u.status==="idle").length,l=o.filter(u=>u.status==="leased").length;return s.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-lg font-semibold",children:[s.jsx(qv,{className:"mr-2 inline h-4 w-4 text-muted-foreground"}),r.display_name??r.slug]}),s.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[s.jsx("code",{className:"font-mono",children:r.slug})," · kind=",r.kind," · default TTL=",y_(r.default_ttl_s)]})]}),s.jsx("div",{className:"text-right text-xs text-muted-foreground",children:s.jsxs("div",{children:[a," idle · ",l," leased · ",o.length," total"]})})]}),s.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:o.map(u=>s.jsx(uQ,{member:u},u.member_id))}),i.length>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Active leases"}),s.jsx("div",{className:"mt-2 space-y-2",children:i.map(u=>s.jsx(dQ,{lease:u,now:t,onForceRelease:()=>n(u)},u.lease_id))})]})]})}function uQ({member:e}){const t=lQ(e.metadata_json);return s.jsxs("div",{className:"rounded-md border bg-muted/40 px-3 py-2 text-sm",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"font-mono",children:e.member_id}),s.jsx("span",{className:`rounded border px-1.5 py-0.5 text-xs ${aQ(e.status)}`,children:e.status})]}),t&&s.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:Object.entries(t).map(([n,r])=>s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-mono",children:n}),"=",s.jsx("span",{className:"font-mono",children:String(r)})]},n))})]})}function dQ({lease:e,now:t,onForceRelease:n}){return s.jsxs("div",{className:"flex items-center justify-between rounded border bg-muted/20 px-3 py-2 text-sm",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[e.lease_id.slice(0,8),"…"]}),s.jsx("span",{className:"font-mono",children:e.member_id}),e.requested_for&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["for ",e.requested_for]})]})}),s.jsxs("div",{className:"ml-3 flex items-center gap-3",children:[s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(k5,{className:"h-3 w-3"}),iQ(e.expires_at,t)]}),s.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 rounded border border-destructive/40 px-2 py-1 text-xs text-destructive hover:bg-destructive/10",children:[s.jsx(r4,{className:"h-3 w-3"}),"Force release"]})]})]})}function fQ(e){switch(e.kind){case"at":return`at ${e.at}`;case"in":return`in ${Math.round((e.durationMs??0)/1e3)}s`;case"cron":return`cron ${e.expr}${e.tz?` (${e.tz})`:""}`;case"after-reset":return`after ${e.provider} reset`;case"when-status":return`when ${e.assignmentId??"this"} → ${e.status}`;case"when-plan-lands":return`when ${e.assignmentId??"this"} plan lands`;default:return e.kind}}async function pQ(){const e=await fetch("/api/schedules");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).schedules}async function hQ(e){const t=await fetch("/api/schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)??`HTTP ${t.status}`);return n.schedule}async function mQ(e){const t=await fetch(`/api/schedules/${encodeURIComponent(e)}/cancel`,{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${t.status}`)}}function gQ(){const[e,t]=m.useState(null),[n,r]=m.useState(!0),[o,i]=m.useState(null),a=m.useCallback(async()=>{try{t(await pQ()),i(null)}catch(l){i(l instanceof Error?l.message:"Failed to fetch schedules")}finally{r(!1)}},[]);return m.useEffect(()=>{a()},[a]),Ei(l=>{l.type==="schedules-updated"&&a()}),{data:e,loading:n,error:o,refetch:a}}const xQ=[{value:"cron",label:"Cron expression"},{value:"at",label:"At a timestamp"},{value:"in",label:"After a delay"},{value:"after-reset",label:"After quota reset"},{value:"when-status",label:"When assignment reaches status"},{value:"when-plan-lands",label:"When plan lands"}];function yQ({open:e,onOpenChange:t,onCreated:n}){const[r,o]=m.useState(""),[i,a]=m.useState("claude"),[l,u]=m.useState("cron"),[f,p]=m.useState(!0),[h,g]=m.useState(""),[y,k]=m.useState(""),[v,b]=m.useState("0 3 * * *"),[w,S]=m.useState(""),[N,C]=m.useState(""),[R,T]=m.useState("5"),[A,I]=m.useState("claude"),[_,z]=m.useState(""),[O,B]=m.useState("rolling-5h"),[V,$]=m.useState("ready_to_implement"),[L,U]=m.useState(""),[K,D]=m.useState(!1),[W,M]=m.useState(null);function F(){switch(l){case"cron":return{kind:l,expr:v,...w?{tz:w}:{}};case"at":return{kind:l,at:N};case"in":return{kind:l,durationMs:Math.round(Number(R)*36e5),anchorIso:new Date().toISOString()};case"after-reset":return{kind:l,provider:A,anchor:{windowStartIso:_||new Date().toISOString(),windowKind:O}};case"when-status":return{kind:l,status:V,...L?{assignmentId:L}:{}};case"when-plan-lands":return{kind:l,...L?{assignmentId:L}:{}}}}async function Y(){D(!0),M(null);try{const J={assignmentId:r.trim(),agentId:i.trim(),trigger:F(),unattended:f,terminalPreference:h.trim()||null,promptTemplate:y.trim()||null};if(!J.assignmentId)throw new Error("Assignment id is required");await hQ(J),n(),t(!1)}catch(J){M(J instanceof Error?J.message:"Create failed")}finally{D(!1)}}const H="w-full rounded border bg-background px-2 py-1 text-sm",Q="block text-xs font-medium text-muted-foreground";return s.jsx(On,{open:e,onOpenChange:t,children:s.jsxs(Cn,{className:"max-h-[90vh] overflow-y-auto",children:[s.jsxs(sr,{className:"flex-row items-center justify-between space-y-0",children:[s.jsx(En,{children:"New schedule"}),s.jsx(oR,{className:"text-muted-foreground transition hover:text-foreground","aria-label":"Close",children:s.jsx(Nc,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Assignment id / slug"}),s.jsx("input",{autoFocus:!0,className:H,value:r,onChange:J=>o(J.target.value),placeholder:"scheduled-agents"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Agent"}),s.jsx("input",{className:H,value:i,onChange:J=>a(J.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Terminal (optional)"}),s.jsx("input",{className:H,value:h,onChange:J=>g(J.target.value),placeholder:"default"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Trigger"}),s.jsx("select",{className:H,value:l,onChange:J=>u(J.target.value),children:xQ.map(J=>s.jsx("option",{value:J.value,children:J.label},J.value))})]}),l==="cron"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Cron expr"}),s.jsx("input",{className:H,value:v,onChange:J=>b(J.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Timezone (optional)"}),s.jsx("input",{className:H,value:w,onChange:J=>S(J.target.value),placeholder:"local"})]})]}),l==="at"&&s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"ISO timestamp"}),s.jsx("input",{className:H,value:N,onChange:J=>C(J.target.value),placeholder:"2026-06-16T03:00:00Z"})]}),l==="in"&&s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Delay (hours)"}),s.jsx("input",{className:H,type:"number",value:R,onChange:J=>T(J.target.value)})]}),l==="after-reset"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Provider"}),s.jsxs("select",{className:H,value:A,onChange:J=>I(J.target.value),children:[s.jsx("option",{value:"claude",children:"claude"}),s.jsx("option",{value:"codex",children:"codex"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Window kind"}),s.jsxs("select",{className:H,value:O,onChange:J=>B(J.target.value),children:[s.jsx("option",{value:"rolling-5h",children:"rolling-5h"}),s.jsx("option",{value:"weekly",children:"weekly"})]})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx("label",{className:Q,children:"Window start (optional ISO)"}),s.jsx("input",{className:H,value:_,onChange:J=>z(J.target.value),placeholder:"now"})]})]}),l==="when-status"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Status"}),s.jsx("input",{className:H,value:V,onChange:J=>$(J.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Watch assignment (optional)"}),s.jsx("input",{className:H,value:L,onChange:J=>U(J.target.value),placeholder:"this assignment"})]})]}),l==="when-plan-lands"&&s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Watch assignment (optional)"}),s.jsx("input",{className:H,value:L,onChange:J=>U(J.target.value),placeholder:"this assignment"})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Prompt template (optional)"}),s.jsx("input",{className:H,value:y,onChange:J=>k(J.target.value),placeholder:"plan @assignment"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:f,onChange:J=>p(J.target.checked)}),"Unattended (hard limits + kill switch apply)"]}),W&&s.jsx("p",{className:"text-sm text-destructive",children:W})]}),s.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[s.jsx("button",{type:"button",onClick:()=>t(!1),className:"rounded border px-3 py-1 text-sm",children:"Cancel"}),s.jsx("button",{type:"button",onClick:Y,disabled:K,className:"rounded bg-primary px-3 py-1 text-sm text-primary-foreground disabled:opacity-50",children:K?"Creating…":"Create"})]})]})})}const bQ=new Set(["completed","failed","launch_failed","cancelled","killed"]);function vQ(e){return e==="running"?"border-success-foreground/30 bg-success text-success-foreground":e==="eligible"?"border-info-foreground/30 bg-info text-info-foreground":e==="held"?"border-warning-foreground/30 bg-warning text-warning-foreground":e==="launch_failed"||e==="failed"||e==="killed"?"border-error-foreground/30 bg-error text-error-foreground":"border-muted-foreground/30 bg-muted text-muted-foreground"}function wQ(){const{data:e,loading:t,error:n,refetch:r}=gQ(),[o,i]=m.useState(!1),{toast:a,showToast:l,dismissToast:u}=Tn();if(t)return s.jsx(bt,{label:"Loading schedules…"});if(n)return s.jsx(Rt,{title:"Could not load schedules",error:n,action:s.jsx("button",{type:"button",onClick:r,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});async function f(p){try{await mQ(p.id),r()}catch(h){l(h instanceof Error?`Cancel failed: ${h.message}`:"Cancel failed","error")}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Schedules"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Run work on an assignment unattended — on a clock, after a quota reset, or when an assignment reaches a status. The scheduler tick is the sole authority; this page calls the same CLI verbs."})]}),s.jsxs("button",{type:"button",onClick:()=>i(!0),className:"shell-action shell-action--cta",children:[s.jsx(Tt,{className:"h-4 w-4"}),"New schedule"]})]}),!e||e.length===0?s.jsx(Nt,{title:"No schedules yet",description:"Create one above, or with `syntaur schedule create --assignment <id> --cron '0 3 * * *'`."}):s.jsx("div",{className:"grid gap-2",children:e.map(p=>s.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-card p-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(C2,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"font-mono text-sm",children:p.assignmentId}),s.jsx("span",{className:`rounded border px-1.5 py-0.5 text-xs ${vQ(p.attempt.state)}`,children:p.attempt.state}),!p.unattended&&s.jsx("span",{className:"text-xs text-muted-foreground",children:"interactive"})]}),s.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[fQ(p.trigger)," · agent ",s.jsx("code",{className:"font-mono",children:p.agentId}),p.attempt.lastError&&s.jsxs("span",{className:"text-destructive",children:[" · ",p.attempt.lastError]})]})]}),!bQ.has(p.attempt.state)&&s.jsxs("button",{type:"button",onClick:()=>f(p),className:"flex items-center gap-1 rounded border border-destructive/40 px-2 py-1 text-xs text-destructive hover:bg-destructive/10",children:[s.jsx(g5,{className:"h-3 w-3"}),"Cancel"]})]},p.id))}),s.jsx(Nn,{toast:a,onDismiss:u}),s.jsx(yQ,{open:o,onOpenChange:i,onCreated:r})]})}const jQ={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"},fi="rounded-md border border-border/60 bg-background px-2 py-1 text-sm text-foreground focus:border-primary focus:outline-none focus:ring-2 focus:ring-ring/30";function jC(){const[e,t]=Rs(),n=aO(e),r=n.window??"30d",o=e.get("groupBy")==="assignment"?"assignment":"project",{data:i}=oo(),{data:a}=Ra(),{data:l}=dT(),[u,f]=m.useState(null),[p,h]=m.useState(!0),[g,y]=m.useState(null),[k,v]=m.useState(0);m.useEffect(()=>{if(!e.get("window")){const S=_b({window:"30d",...n});o==="assignment"&&S.set("groupBy","assignment"),t(S,{replace:!0})}},[]);const b=iT({window:r,...n}).toString();m.useEffect(()=>{const S=new AbortController;h(!0),y(null);const N=b?`/api/usage?${b}&groupBy=${o}`:`/api/usage?groupBy=${o}`;return fetch(N,{signal:S.signal}).then(async C=>{if(!C.ok){const R=await C.json().catch(()=>({}));throw new Error(R.error??`HTTP ${C.status}`)}return C.json()}).then(C=>{f(C),h(!1)}).catch(C=>{C instanceof Error&&C.name==="AbortError"||(y(C instanceof Error?C.message:String(C)),h(!1))}),()=>S.abort()},[b,o,k]);function w(S,N=o){const C=_b(S);N==="assignment"&&C.set("groupBy","assignment"),t(C)}return s.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[s.jsxs("header",{className:"flex items-center gap-3 mb-6",children:[s.jsx(um,{className:"w-6 h-6 text-primary"}),s.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Token usage"})]}),s.jsxs("div",{className:"flex flex-wrap gap-4 items-end mb-6 p-4 rounded-lg bg-card border border-border/60",children:[s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Window"}),s.jsx("select",{value:r,onChange:S=>w({...n,window:S.target.value}),className:fi,children:dm.map(S=>s.jsx("option",{value:S,children:jQ[S]},S))})]}),r==="custom"?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Since"}),s.jsx("input",{type:"date",value:n.since??"",onChange:S=>w({...n,window:"custom",since:S.target.value||void 0}),className:fi})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Until"}),s.jsx("input",{type:"date",value:n.until??"",onChange:S=>w({...n,window:"custom",until:S.target.value||void 0}),className:fi})]})]}):null,s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),s.jsxs("select",{value:n.workspace??"",onChange:S=>w({...n,workspace:S.target.value||void 0,project:void 0}),className:fi,children:[s.jsx("option",{value:"",children:"All"}),a!=null&&a.hasUngrouped?s.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,((a==null?void 0:a.workspaces)??[]).map(S=>s.jsx("option",{value:S,children:S},S))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Project"}),s.jsxs("select",{value:n.project??"",onChange:S=>w({...n,project:S.target.value||void 0,workspace:void 0}),className:fi,children:[s.jsx("option",{value:"",children:"All"}),(i??[]).map(S=>s.jsx("option",{value:S.slug,children:S.slug},S.slug))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Model"}),s.jsxs("select",{value:n.model??"",onChange:S=>w({...n,model:S.target.value||void 0}),className:fi,children:[s.jsx("option",{value:"",children:"All"}),((l==null?void 0:l.models)??[]).map(S=>s.jsx("option",{value:S,children:S},S))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Tool"}),s.jsxs("select",{value:n.tool??"",onChange:S=>w({...n,tool:S.target.value||void 0}),className:fi,children:[s.jsx("option",{value:"",children:"All"}),((l==null?void 0:l.tools)??[]).map(S=>s.jsx("option",{value:S,children:S},S))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Group by"}),s.jsxs("select",{value:o,onChange:S=>w(n,S.target.value),className:fi,children:[s.jsx("option",{value:"project",children:"Project"}),s.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),p&&s.jsx(bt,{label:"Loading usage…"}),g&&s.jsx(Rt,{error:g,action:s.jsx("button",{type:"button",className:"shell-action",onClick:()=>v(S=>S+1),children:"Retry"})}),u&&!p&&!g&&s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"mb-8",children:[s.jsx("h2",{className:"text-lg font-medium mb-2",children:"Summary"}),u.summary.length===0?s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No usage data for these filters. Run"," ",s.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-primary",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):s.jsxs("table",{className:"w-full text-sm border border-border/60 rounded overflow-hidden",children:[s.jsx("thead",{className:"bg-muted/50 text-muted-foreground",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),o==="assignment"&&s.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),s.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),s.jsx("th",{className:"text-right px-3 py-2",children:"Cost"}),s.jsx("th",{className:"text-left px-3 py-2",children:"Last event"})]})}),s.jsx("tbody",{children:u.summary.map((S,N)=>s.jsxs("tr",{className:"border-t border-border/60",children:[s.jsx("td",{className:"px-3 py-2",children:S.projectSlug||"(unattributed)"}),o==="assignment"&&s.jsx("td",{className:"px-3 py-2",children:S.assignmentSlug||"(unattributed)"}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:ec(S.totalTokens)}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:tc(S.totalCost)}),s.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:S.lastEventDay})]},N))})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-lg font-medium mb-2",children:"Daily breakdown"}),u.daily.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No daily rows."}):s.jsxs("table",{className:"w-full text-sm border border-border/60 rounded overflow-hidden",children:[s.jsx("thead",{className:"bg-muted/50 text-muted-foreground",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-3 py-2",children:"Day"}),s.jsx("th",{className:"text-left px-3 py-2",children:"Tool"}),s.jsx("th",{className:"text-left px-3 py-2",children:"Model"}),s.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),s.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),s.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),s.jsx("th",{className:"text-right px-3 py-2",children:"Cost"})]})}),s.jsx("tbody",{children:u.daily.map((S,N)=>s.jsxs("tr",{className:"border-t border-border/60",children:[s.jsx("td",{className:"px-3 py-2 tabular-nums",children:S.day}),s.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:S.tool}),s.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:S.model}),s.jsx("td",{className:"px-3 py-2",children:S.project_slug||"–"}),s.jsx("td",{className:"px-3 py-2",children:S.assignment_slug||"–"}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:ec(S.total_tokens)}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:tc(S.total_cost)})]},N))})]})]})]})]})}function kC(){const{workspace:e}=Kt(),{data:t}=oo(),{data:n,loading:r,error:o}=pm(),[i,a]=m.useState(""),[l,u]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState("started_desc"),[y,k]=m.useState(0),[v,b]=m.useState(new Set),[w,S]=m.useState(!1),[N,C]=m.useState(null),[R,T]=m.useState(null),A=(n==null?void 0:n.sessions.some($=>$.status==="active"))??!1;m.useEffect(()=>{if(!A)return;const $=window.setInterval(()=>k(L=>L+1),3e4);return()=>window.clearInterval($)},[A]),m.useEffect(()=>{b($=>{if($.size===0)return $;const L=new Set((n==null?void 0:n.sessions.map(K=>K.sessionId))??[]),U=new Set([...$].filter(K=>L.has(K)));return U.size===$.size?$:U})},[n]);const I=m.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const $=i.trim().toLowerCase();return[...n.sessions.filter(U=>{var W;if(e&&t){const M=((W=t.find(F=>F.slug===U.projectSlug))==null?void 0:W.workspace)??null;if(e==="_ungrouped"){if(M!==null)return!1}else if(M!==e)return!1}const K=NQ(U.started);return l&&(!K||K<l)||f&&(!K||K>f)?!1:$?[U.projectSlug??"",U.assignmentSlug??"",U.agent,U.sessionId,U.path,U.description??"",U.transcriptPath??""].join(" ").toLowerCase().includes($):!0})].sort((U,K)=>SQ(U,K,h))},[n,i,h,l,f,y,e,t]);function _($){b(L=>{const U=new Set(L);return U.has($)?U.delete($):U.add($),U})}function z(){v.size===I.length&&I.length>0?b(new Set):b(new Set(I.map($=>$.sessionId)))}async function O($){C(null),S(!0);try{const L=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:$})}),U=await L.json().catch(()=>null);if(!L.ok)throw new Error((U==null?void 0:U.error)||`HTTP ${L.status}`);b(K=>new Set([...K].filter(D=>!$.includes(D)))),T(null)}catch(L){C(L.message)}finally{S(!1)}}async function B($){try{const L=await fetch(`/api/agent-sessions/${encodeURIComponent($)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!L.ok){const U=await L.json().catch(()=>null);C((U==null?void 0:U.error)||`Failed to mark session stopped: HTTP ${L.status}`)}}catch(L){C(L.message)}}if(r)return s.jsx(bt,{label:"Loading agent sessions..."});if(o)return s.jsx(Rt,{error:o});if(!n)return null;const V=n.sessions.length>0;return s.jsxs(s.Fragment,{children:[s.jsxs(a0,{children:[s.jsx(qm,{value:i,onChange:a,placeholder:"Search project, assignment, agent, session ID, path, or description"}),s.jsxs("label",{className:"flex min-w-[150px] flex-col gap-1 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:["Started From",s.jsx("input",{type:"date",value:l,onChange:$=>u($.target.value),className:"editor-input min-w-[150px]"})]}),s.jsxs("label",{className:"flex min-w-[150px] flex-col gap-1 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:["Started To",s.jsx("input",{type:"date",value:f,onChange:$=>p($.target.value),className:"editor-input min-w-[150px]"})]}),s.jsxs("select",{value:h,onChange:$=>g($.target.value),className:"editor-input max-w-[200px]",children:[s.jsx("option",{value:"started_desc",children:"Newest first"}),s.jsx("option",{value:"started_asc",children:"Oldest first"}),s.jsx("option",{value:"assignment_asc",children:"Assignment A-Z"}),s.jsx("option",{value:"agent_asc",children:"Agent A-Z"})]})]}),N?s.jsx("div",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:N}):null,v.size>0&&s.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded border border-border/40 bg-muted/30 px-4 py-2 text-sm",children:[s.jsxs("span",{className:"text-muted-foreground",children:[v.size," session",v.size!==1?"s":""," selected"]}),s.jsxs("button",{className:"shell-action text-destructive",onClick:()=>T({sessionIds:[...v],title:`Delete ${v.size} selected session${v.size===1?"":"s"}?`,description:"This removes the selected agent session records from the dashboard. This cannot be undone.",confirmLabel:v.size===1?"Delete Session":"Delete Sessions"}),disabled:w,children:[s.jsx(fn,{className:"mr-1 inline h-3.5 w-3.5"}),"Delete Selected"]}),s.jsx("button",{className:"shell-action",onClick:()=>b(new Set),children:"Clear Selection"})]}),V?I.length===0?s.jsx(Nt,{title:"No agent sessions match these filters",description:"Adjust the status, search term, date range, or sorting controls to show sessions again."}):s.jsx("div",{className:"surface-panel mt-4 overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[960px] table-fixed text-sm lg:min-w-[1280px]",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/40 text-left text-xs uppercase tracking-wider text-muted-foreground",children:[s.jsx("th",{className:"w-[32px] pb-2 pr-3",children:s.jsx("button",{onClick:z,className:"text-muted-foreground hover:text-foreground",children:v.size===I.length&&I.length>0?s.jsx(ys,{className:"h-4 w-4"}):s.jsx(tw,{className:"h-4 w-4"})})}),s.jsx("th",{className:"w-[140px] pb-2 pr-3",children:"Project"}),s.jsx("th",{className:"w-[160px] pb-2 pr-3",children:"Assignment"}),s.jsx("th",{className:"w-[200px] pb-2 pr-3",children:"Description"}),s.jsx("th",{className:"w-[110px] pb-2 pr-3",children:"Agent"}),s.jsx("th",{className:"hidden w-[130px] pb-2 pr-3 lg:table-cell",children:"Session ID"}),s.jsx("th",{className:"w-[140px] pb-2 pr-3",children:"Started"}),s.jsx("th",{className:"hidden w-[200px] pb-2 pr-3 lg:table-cell",children:"Path"}),s.jsx("th",{className:"hidden w-[200px] pb-2 pr-3 lg:table-cell",children:"Transcript"}),s.jsx("th",{className:"w-[40px] pb-2"})]})}),s.jsx("tbody",{children:I.map($=>s.jsx(kQ,{session:$,selected:v.has($.sessionId),onToggle:()=>_($.sessionId),onDelete:()=>T({sessionIds:[$.sessionId],title:`Delete session ${$.sessionId.slice(0,8)}...?`,description:`Remove this ${$.agent} session record${$.assignmentSlug?` for ${$.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:B,onCopyError:C},$.sessionId))})]})}):s.jsx(Nt,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),s.jsx(os,{open:R!==null,title:(R==null?void 0:R.title)??"Delete session?",description:(R==null?void 0:R.description)??"",confirmLabel:(R==null?void 0:R.confirmLabel)??"Delete",destructive:!0,loading:w,onOpenChange:$=>{$||T(null)},onConfirm:async()=>{R&&await O(R.sessionIds)}})]})}function kQ({session:e,selected:t,onToggle:n,onDelete:r,onMarkStopped:o,onCopyError:i}){const a=xn(),l=e.sessionId.length>12?e.sessionId.slice(0,8)+"...":e.sessionId,u=e.path?e.path.replace(/^\/Users\/[^/]+/,"~"):"—",f=e.transcriptPath?e.transcriptPath.replace(/^\/Users\/[^/]+/,"~"):"—";return s.jsxs("tr",{className:"border-b border-border/20 last:border-0",children:[s.jsx("td",{className:"py-2 pr-3",children:s.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground",children:t?s.jsx(ys,{className:"h-4 w-4"}):s.jsx(tw,{className:"h-4 w-4"})})}),s.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?s.jsx(_e,{to:`${a}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:gn(e.projectSlug),children:gn(e.projectSlug)}):e.assignmentSlug?s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-mono uppercase tracking-wide text-muted-foreground",children:"Standalone"}):s.jsx("span",{className:"text-muted-foreground",children:"—"})}),s.jsx("td",{className:"py-2 pr-3",children:e.projectSlug&&e.assignmentSlug?s.jsx(_e,{to:`${a}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:gn(e.assignmentSlug),children:gn(e.assignmentSlug)}):e.assignmentSlug?s.jsx(_e,{to:`/assignments/${e.assignmentSlug}`,className:"block truncate font-mono text-primary hover:underline",title:e.assignmentSlug,children:e.assignmentSlug}):s.jsx("span",{className:"text-muted-foreground",children:"—"})}),s.jsx("td",{className:"py-2 pr-3",children:e.description?s.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.description,children:e.description}):s.jsx("span",{className:"text-muted-foreground",children:"—"})}),s.jsx("td",{className:"py-2 pr-3",children:s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(om,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"block min-w-0 truncate",children:e.agent})]})}),s.jsx("td",{className:"hidden py-2 pr-3 lg:table-cell",children:s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.sessionId,children:l}),s.jsx(jr,{value:e.sessionId}),s.jsx(q3,{sessionId:e.sessionId,disabled:!e.resumeSupported,disabledReason:"Resume not supported for this agent",onError:p=>i(p.message),onNotice:p=>i(p)})]})}),s.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:s.jsx("span",{className:"truncate block",children:Sr(e.started)})}),s.jsx("td",{className:"hidden py-2 pr-3 lg:table-cell",children:s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{className:"block min-w-0 truncate text-xs text-muted-foreground",title:e.path,children:u}),e.path&&s.jsx(jr,{value:e.path})]})}),s.jsx("td",{className:"hidden py-2 pr-3 lg:table-cell",children:e.transcriptPath?s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.transcriptPath,children:f}),s.jsx(jr,{value:e.transcriptPath})]}):s.jsx("span",{className:"text-muted-foreground",children:"—"})}),s.jsx("td",{className:"py-2",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Y3,{session:e,onMarkStopped:o}),s.jsx("button",{onClick:r,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:s.jsx(fn,{className:"h-3.5 w-3.5"})})]})})]})}function NQ(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return null;const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${n}-${r}-${o}`}function Cp(e){const t=Date.parse(e.started),n=e.ended?Date.parse(e.ended):Date.now();return Number.isNaN(t)||Number.isNaN(n)?0:Math.max(0,Math.floor((n-t)/6e4))}function SQ(e,t,n){switch(n){case"started_asc":return e.started.localeCompare(t.started);case"started_desc":return t.started.localeCompare(e.started);case"duration_asc":return Cp(e)-Cp(t);case"duration_desc":return Cp(t)-Cp(e);case"assignment_asc":return(e.assignmentSlug??"").localeCompare(t.assignmentSlug??"")||(e.projectSlug??"").localeCompare(t.projectSlug??"");case"agent_asc":return e.agent.localeCompare(t.agent)||(e.assignmentSlug??"").localeCompare(t.assignmentSlug??"");default:return 0}}function CQ(){const{data:e,loading:t,error:n,refetch:r}=iw(),[o,i]=m.useState(""),[a,l]=m.useState(null),[u,f]=m.useState(null),[p,h]=m.useState(null),g=m.useMemo(()=>{if(!(e!=null&&e.playbooks))return[];if(!o.trim())return e.playbooks;const v=o.toLowerCase();return e.playbooks.filter(b=>b.name.toLowerCase().includes(v)||b.description.toLowerCase().includes(v)||b.slug.toLowerCase().includes(v)||b.tags.some(w=>w.toLowerCase().includes(v)))},[e,o]);async function y(v,b,w){if(v.preventDefault(),v.stopPropagation(),!a){l(b);try{const S=w?"disable":"enable",N=await fetch(`/api/playbooks/${encodeURIComponent(b)}/${S}`,{method:"POST"});if(!N.ok){const C=await N.json().catch(()=>({}));throw new Error(C.error||`Failed to ${S} playbook`)}r()}catch(S){console.error(S),alert(S instanceof Error?S.message:"Failed to update playbook")}finally{l(null)}}}async function k(){if(u){h(u.slug);try{const v=await fetch(`/api/playbooks/${encodeURIComponent(u.slug)}`,{method:"DELETE"});if(!v.ok){const b=await v.json().catch(()=>({}));throw new Error(b.error||"Failed to delete playbook")}f(null),r()}catch(v){console.error(v),alert(v instanceof Error?v.message:"Failed to delete playbook")}finally{h(null)}}}return t?s.jsx(bt,{label:"Loading playbooks..."}):n?s.jsx(Rt,{error:n}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"relative flex-1 max-w-sm",children:[s.jsx(Ci,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{type:"text",placeholder:"Search playbooks...",value:o,onChange:v=>i(v.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs(_e,{to:"/playbooks/create",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[s.jsx(Tt,{className:"h-4 w-4"}),"Create Playbook"]})]}),s.jsxs(_e,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[s.jsx(A2,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:"Playbook Manifest"}),s.jsx("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground",children:"auto-generated"})]}),s.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Index of all playbooks with descriptions. Include ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-[11px]",children:"~/.syntaur/playbooks/manifest.md"})," in your CLAUDE.md for agent context."]})]})]}),g.length===0?s.jsx(Nt,{title:"No playbooks found",description:(e==null?void 0:e.playbooks.length)===0?"Playbooks define rules and workflows for how agents should operate. Create your first one to get started.":"No playbooks match your search.",actions:(e==null?void 0:e.playbooks.length)===0?s.jsxs(_e,{to:"/playbooks/create",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[s.jsx(Tt,{className:"h-4 w-4"}),"Create Playbook"]}):void 0}):s.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:g.map(v=>{const b=a===v.slug,w=[{key:"delete",label:"Delete",icon:fn,destructive:!0,onSelect:()=>f({slug:v.slug,name:v.name})}];return s.jsxs("div",{className:`surface-panel relative flex flex-col gap-2 p-4 transition hover:border-foreground/20 ${v.enabled?"":"opacity-75"}`,children:[s.jsx("div",{className:"absolute right-3 top-3 z-10",children:s.jsx(Xw,{items:w})}),s.jsxs(_e,{to:`/playbooks/${v.slug}`,className:"group flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(S2,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:v.name}),v.description?s.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground line-clamp-2",children:v.description}):null]})]}),s.jsx("div",{className:"flex items-center gap-2 pt-1 pr-20",children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[v.tags.slice(0,3).map(S=>s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground",children:[s.jsx(M2,{className:"h-2.5 w-2.5"}),S]},S)),v.tags.length>3?s.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["+",v.tags.length-3]}):null]})})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":v.enabled,"aria-label":v.enabled?"Disable playbook":"Enable playbook",onClick:S=>y(S,v.slug,v.enabled),disabled:b,className:`absolute bottom-3 right-3 z-10 inline-flex h-5 w-9 items-center rounded-full border opacity-100 transition disabled:opacity-50 ${v.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:s.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${v.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]},v.slug)})}),s.jsx(os,{open:u!==null,title:"Delete playbook?",description:u?`"${u.name}" will be removed from disk and the playbook manifest will be regenerated. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:p!==null,onConfirm:k,onOpenChange:v=>{v||f(null)}})]})}function EQ(){const{slug:e}=Kt(),t=Wt(),{data:n,loading:r,error:o,refetch:i}=yO(e),[a,l]=m.useState(!1),[u,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(!1),[k,v]=m.useState(""),[b,w]=m.useState(!1),[S,N]=m.useState(null),C=e==="manifest";m.useEffect(()=>{g&&(v(e??""),N(null))},[g,e]);const R=$r(k),T=R.length>0&&Up(R)&&R!=="manifest",A=R!==e;async function I(){if(!(!e||!T||!A)){w(!0),N(null);try{const O=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:R})});if(!O.ok){const B=await O.json().catch(()=>({}));throw new Error(B.error||"Failed to rename playbook")}y(!1),t(`/playbooks/${R}`)}catch(O){N(O instanceof Error?O.message:"Failed to rename playbook")}finally{w(!1)}}}async function _(){if(e){f(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{f(!1)}}}async function z(){if(!(!e||!n)){h(!0);try{const O=n.enabled?"disable":"enable",B=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${O}`,{method:"POST"});if(!B.ok){const V=await B.json().catch(()=>({}));throw new Error(V.error||`Failed to ${O} playbook`)}i()}catch(O){console.error(O),alert(O instanceof Error?O.message:"Failed to update playbook")}finally{h(!1)}}}return r?s.jsx(bt,{label:"Loading playbook..."}):o?s.jsx(Rt,{error:o}):n?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:C?"Playbook Manifest":n.name}),C?s.jsx("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:"auto-generated"}):null]}),!C&&n.description?s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description}):null,C?s.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["This file is rebuilt automatically when playbooks are added or removed. Include"," ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"~/.syntaur/playbooks/manifest.md"})," ","in your CLAUDE.md for agent context."]}):null,!C&&n.whenToUse?s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground italic",children:["When to use: ",n.whenToUse]}):null,s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[s.jsxs("span",{children:["Created ",Sr(n.created)]}),s.jsxs("span",{children:["Updated ",Sr(n.updated)]})]}),n.tags.length>0?s.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map(O=>s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:[s.jsx(M2,{className:"h-3 w-3"}),O]},O))}):null]}),C?null:s.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n.enabled?"Enabled":"Disabled"}),s.jsx("button",{type:"button",role:"switch","aria-checked":n.enabled,"aria-label":n.enabled?"Disable playbook":"Enable playbook",onClick:z,disabled:p,className:`inline-flex h-5 w-9 items-center rounded-full border transition disabled:opacity-50 ${n.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:s.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${n.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]}),s.jsxs(_e,{to:`/playbooks/${e}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[s.jsx(jc,{className:"h-3 w-3"}),"Edit"]}),s.jsxs("button",{type:"button",onClick:()=>y(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[s.jsx(i4,{className:"h-3 w-3"}),"Rename"]}),a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:_,disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:u?"Deleting...":"Confirm"}),s.jsx("button",{type:"button",onClick:()=>l(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):s.jsxs("button",{type:"button",onClick:()=>l(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[s.jsx(fn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(jn,{content:n.body})}),s.jsx(On,{open:g,onOpenChange:O=>b?void 0:y(O),children:s.jsxs(Cn,{children:[s.jsxs(sr,{children:[s.jsx(En,{children:"Rename playbook"}),s.jsx(ns,{children:"The slug changes both the file name and the canonical slug stored in frontmatter. The URL will update on save."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{htmlFor:"rename-slug-input",className:"block text-xs font-medium text-muted-foreground",children:"New slug"}),s.jsx("input",{id:"rename-slug-input",type:"text",autoFocus:!0,value:k,onChange:O=>v(O.target.value),disabled:b,className:"h-9 w-full rounded-md border border-border/70 bg-background px-3 text-sm text-foreground focus:border-foreground/40 focus:outline-none",placeholder:"my-new-slug"}),k&&R!==k?s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Will be normalized to ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:R||"—"})]}):null,k&&!T?s.jsx("p",{className:"text-xs text-destructive",children:'Slugs must be lowercase, hyphen-separated, with no special characters, and cannot be "manifest".'}):null]}),S?s.jsx("p",{className:"text-sm text-destructive",role:"alert",children:S}):null,s.jsxs(Hr,{children:[s.jsx("button",{type:"button",onClick:()=>y(!1),disabled:b,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",onClick:I,disabled:b||!T||!A,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:b?"Renaming…":"Rename"})]})]})})]}):null}function TQ(){const e=Wt(),[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(!1),[l,u]=m.useState(null);m.useEffect(()=>{fetch("/api/playbooks/template/new").then(p=>p.json()).then(p=>{n(p.content),o(!1)}).catch(p=>{u(p.message),o(!1)})},[]);async function f(p){a(!0),u(null);try{const h=await fetch("/api/playbooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:p})}),g=await h.json();if(!h.ok){u(g.error||`HTTP ${h.status}`),a(!1);return}e(`/playbooks/${g.slug}`)}catch(h){u(h.message),a(!1);return}a(!1)}return r?s.jsx(bt,{label:"Loading playbook template..."}):l&&!t?s.jsx(Rt,{error:l}):s.jsx(Lc,{initialContent:t||"",documentType:"playbook",mode:"create",onSave:f,saving:i,error:l,title:"Create Playbook",description:"Playbooks define rules and workflows for how agents should operate. Keep them short, imperative, and focused on a single concern.",onCancel:()=>e("/playbooks"),allowSlugEdit:!0})}function RQ(){const{slug:e}=Kt(),t=Wt(),[n,r]=m.useState(null),[o,i]=m.useState(!0),[a,l]=m.useState(!1),[u,f]=m.useState(null);m.useEffect(()=>{e&&fetch(`/api/playbooks/${e}/edit`).then(h=>h.json()).then(h=>{r(h.content),i(!1)}).catch(h=>{f(h.message),i(!1)})},[e]);async function p(h){if(e){l(!0),f(null);try{const g=await fetch(`/api/playbooks/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),y=await g.json();if(!g.ok){f(y.error||`HTTP ${g.status}`),l(!1);return}t(`/playbooks/${e}`)}catch(g){f(g.message),l(!1);return}l(!1)}}return o?s.jsx(bt,{label:"Loading playbook..."}):u&&!n?s.jsx(Rt,{error:u}):s.jsx(Lc,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:p,saving:a,error:u,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function AQ(){const{data:e,loading:t,error:n}=bO(),[r,o]=m.useState(""),[i,a]=m.useState("all"),[l,u]=m.useState("all"),[f,p]=m.useState("all"),h=(e==null?void 0:e.memories)??[],g=m.useMemo(()=>Array.from(new Set(h.map(b=>b.projectSlug))).sort(),[h]),y=m.useMemo(()=>Array.from(new Set(h.map(b=>b.scope).filter(Boolean))).sort(),[h]),k=m.useMemo(()=>Array.from(new Set(h.map(b=>b.source).filter(Boolean))).sort(),[h]),v=m.useMemo(()=>h.filter(b=>{if(i!=="all"&&b.projectSlug!==i||l!=="all"&&b.scope!==l||f!=="all"&&b.source!==f)return!1;if(r.trim()){const w=r.toLowerCase();if(!b.name.toLowerCase().includes(w)&&!b.slug.toLowerCase().includes(w)&&!b.projectTitle.toLowerCase().includes(w))return!1}return!0}),[h,r,i,l,f]);return t?s.jsx(bt,{label:"Loading memories…"}):n?s.jsx(Rt,{error:n}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Ci,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{type:"text",placeholder:"Search memories…",value:r,onChange:b=>o(b.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs("select",{value:i,onChange:b=>a(b.target.value),className:"editor-input max-w-[170px]",children:[s.jsx("option",{value:"all",children:"All projects"}),g.map(b=>s.jsx("option",{value:b,children:b},b))]}),s.jsxs("select",{value:l,onChange:b=>u(b.target.value),className:"editor-input max-w-[140px]",children:[s.jsx("option",{value:"all",children:"All scopes"}),y.map(b=>s.jsx("option",{value:b,children:b},b))]}),s.jsxs("select",{value:f,onChange:b=>p(b.target.value),className:"editor-input max-w-[140px]",children:[s.jsx("option",{value:"all",children:"All sources"}),k.map(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs(_e,{to:"/memories/new",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[s.jsx(Tt,{className:"h-4 w-4"}),"New Memory"]})]}),v.length===0?s.jsx(Nt,{title:h.length===0?"No memories yet":"No memories match these filters",description:h.length===0?"Memories capture patterns and learnings discovered while working in a project. Agents create them via /create-memory or you can add one manually.":"Clear the current filters or create a new memory.",actions:h.length===0?s.jsxs(_e,{to:"/memories/new",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[s.jsx(Tt,{className:"h-4 w-4"}),"New Memory"]}):void 0}):s.jsx("div",{className:"surface-panel overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Scope"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),s.jsx("tbody",{children:v.map(b=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[s.jsx("td",{className:"px-3 py-3",children:s.jsx(_e,{to:`/projects/${b.projectSlug}/memories/${b.slug}`,className:"font-semibold text-foreground hover:text-primary",children:b.name||b.slug})}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:s.jsx(_e,{to:`/projects/${b.projectSlug}`,className:"hover:text-foreground hover:underline",children:b.projectTitle})}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.scope||"—"}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.source||"—"}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.relatedAssignments.length}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Xn(b.updated)})]},`${b.projectSlug}/${b.slug}`))})]})})]})}function PQ(){const{slug:e,itemSlug:t}=Kt(),n=Wt(),{data:r,loading:o,error:i}=vO(e,t),[a,l]=m.useState(!1),[u,f]=m.useState(!1);async function p(){if(!(!e||!t)){f(!0);try{(await fetch(`/api/projects/${e}/memories/${t}`,{method:"DELETE"})).ok&&n("/memories")}finally{f(!1)}}}return o?s.jsx(bt,{label:"Loading memory…"}):i?s.jsx(Rt,{error:i}):r?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:r.name||r.slug}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(_e,{to:`/projects/${r.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:r.projectTitle}),r.scope?s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Scope: ",r.scope]}):null,r.source?s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",r.source]}):null,r.sourceAssignment?s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["From: ",r.sourceAssignment]}):null,s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[r.relatedAssignments.length," related"]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[s.jsxs("span",{children:["Created ",Sr(r.created)]}),s.jsxs("span",{children:["Updated ",Sr(r.updated)]})]}),r.tags&&r.tags.length>0?s.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:r.tags.map(h=>s.jsx("span",{className:"inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:h},h))}):null]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs(_e,{to:`/projects/${e}/memories/${t}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[s.jsx(jc,{className:"h-3 w-3"}),"Edit"]}),a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:p,disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:u?"Deleting…":"Confirm"}),s.jsx("button",{type:"button",onClick:()=>l(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):s.jsxs("button",{type:"button",onClick:()=>l(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[s.jsx(fn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(jn,{content:r.body})})]}):null}function _Q(){const e=Wt(),[t]=Rs(),n=t.get("project"),{data:r,loading:o,error:i}=oo(),[a,l]=m.useState(n??""),[u,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(!1),[k,v]=m.useState(null);m.useEffect(()=>{!a&&r&&r.length>0&&l(n??r[0].slug)},[r,n,a]);async function b(w){if(w.preventDefault(),!(!a||!u.trim())){y(!0),v(null);try{const S=await fetch(`/api/projects/${a}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:u.trim(),body:p||void 0})}),N=await S.json();if(!S.ok){v(N.error||`HTTP ${S.status}`),y(!1);return}e(`/projects/${N.projectSlug}/memories/${N.slug}`)}catch(S){v(S.message),y(!1)}}}return o?s.jsx(bt,{label:"Loading projects…"}):i?s.jsx(Rt,{error:i}):!r||r.length===0?s.jsx(Rt,{error:"You need at least one project before you can create a memory. Create a project from the sidebar."}):s.jsxs("form",{onSubmit:b,className:"space-y-5",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Memory"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Memories capture patterns and learnings discovered during work in a project. They are available to every assignment in that project."})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),s.jsx("select",{id:"project",value:a,onChange:w=>l(w.target.value),className:"editor-input",required:!0,children:r.map(w=>s.jsx("option",{value:w.slug,children:w.title},w.slug))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),s.jsx("input",{id:"name",type:"text",value:u,onChange:w=>f(w.target.value),placeholder:"e.g. PostgreSQL connection pooling",className:"editor-input",required:!0,autoFocus:!0}),s.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),s.jsx("textarea",{id:"body",value:p,onChange:w=>h(w.target.value),rows:14,placeholder:"Write the memory body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),k?s.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:k}):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"submit",disabled:g||!u.trim()||!a,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:g?"Creating…":"Create Memory"}),s.jsx("button",{type:"button",onClick:()=>e("/memories"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function DQ(){const{slug:e,itemSlug:t}=Kt();return s.jsx(Oc,{loadUrl:`/api/projects/${e}/memories/${t}/edit`,saveUrl:`/api/projects/${e}/memories/${t}`,redirectTo:`/projects/${e}/memories/${t}`,title:"Edit Memory",description:"Edit the body. The frontmatter (name, scope, source, related assignments) is preserved unchanged on save.",documentType:"memory",helpTitle:"Memory editing",helpBody:"Memory edits are body-only. Frontmatter changes from the editor are ignored server-side; the file's existing frontmatter is preserved and `updated` is bumped automatically."})}function $Q(){const{data:e,loading:t,error:n}=wO(),[r,o]=m.useState(""),[i,a]=m.useState("all"),[l,u]=m.useState("all"),[f,p]=m.useState("all"),h=(e==null?void 0:e.resources)??[],g=m.useMemo(()=>Array.from(new Set(h.map(b=>b.projectSlug))).sort(),[h]),y=m.useMemo(()=>Array.from(new Set(h.map(b=>b.category).filter(Boolean))).sort(),[h]),k=m.useMemo(()=>Array.from(new Set(h.map(b=>b.source).filter(Boolean))).sort(),[h]),v=m.useMemo(()=>h.filter(b=>{if(i!=="all"&&b.projectSlug!==i||l!=="all"&&b.category!==l||f!=="all"&&b.source!==f)return!1;if(r.trim()){const w=r.toLowerCase();if(!b.name.toLowerCase().includes(w)&&!b.slug.toLowerCase().includes(w)&&!b.projectTitle.toLowerCase().includes(w))return!1}return!0}),[h,r,i,l,f]);return t?s.jsx(bt,{label:"Loading resources…"}):n?s.jsx(Rt,{error:n}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Ci,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{type:"text",placeholder:"Search resources…",value:r,onChange:b=>o(b.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs("select",{value:i,onChange:b=>a(b.target.value),className:"editor-input max-w-[170px]",children:[s.jsx("option",{value:"all",children:"All projects"}),g.map(b=>s.jsx("option",{value:b,children:b},b))]}),s.jsxs("select",{value:l,onChange:b=>u(b.target.value),className:"editor-input max-w-[160px]",children:[s.jsx("option",{value:"all",children:"All categories"}),y.map(b=>s.jsx("option",{value:b,children:b},b))]}),s.jsxs("select",{value:f,onChange:b=>p(b.target.value),className:"editor-input max-w-[140px]",children:[s.jsx("option",{value:"all",children:"All sources"}),k.map(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs(_e,{to:"/resources/new",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[s.jsx(Tt,{className:"h-4 w-4"}),"New Resource"]})]}),v.length===0?s.jsx(Nt,{title:h.length===0?"No resources yet":"No resources match these filters",description:h.length===0?"Resources are reference materials shared across a project — specs, requirements, links, or any reference content.":"Clear the current filters or create a new resource.",actions:h.length===0?s.jsxs(_e,{to:"/resources/new",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[s.jsx(Tt,{className:"h-4 w-4"}),"New Resource"]}):void 0}):s.jsx("div",{className:"surface-panel overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Category"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),s.jsx("tbody",{children:v.map(b=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[s.jsx("td",{className:"px-3 py-3",children:s.jsx(_e,{to:`/projects/${b.projectSlug}/resources/${b.slug}`,className:"font-semibold text-foreground hover:text-primary",children:b.name||b.slug})}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:s.jsx(_e,{to:`/projects/${b.projectSlug}`,className:"hover:text-foreground hover:underline",children:b.projectTitle})}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.category||"—"}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.source||"—"}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.relatedAssignments.length}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Xn(b.updated)})]},`${b.projectSlug}/${b.slug}`))})]})})]})}function IQ(){const{slug:e,itemSlug:t}=Kt(),n=Wt(),{data:r,loading:o,error:i}=jO(e,t),[a,l]=m.useState(!1),[u,f]=m.useState(!1);async function p(){if(!(!e||!t)){f(!0);try{(await fetch(`/api/projects/${e}/resources/${t}`,{method:"DELETE"})).ok&&n("/resources")}finally{f(!1)}}}return o?s.jsx(bt,{label:"Loading resource…"}):i?s.jsx(Rt,{error:i}):r?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:r.name||r.slug}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(_e,{to:`/projects/${r.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:r.projectTitle}),r.category?s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Category: ",r.category]}):null,r.source?s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",r.source]}):null,s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[r.relatedAssignments.length," related"]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[s.jsxs("span",{children:["Created ",Sr(r.created)]}),s.jsxs("span",{children:["Updated ",Sr(r.updated)]})]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs(_e,{to:`/projects/${e}/resources/${t}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[s.jsx(jc,{className:"h-3 w-3"}),"Edit"]}),a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:p,disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:u?"Deleting…":"Confirm"}),s.jsx("button",{type:"button",onClick:()=>l(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):s.jsxs("button",{type:"button",onClick:()=>l(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[s.jsx(fn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(jn,{content:r.body})})]}):null}function MQ(){const e=Wt(),[t]=Rs(),n=t.get("project"),{data:r,loading:o,error:i}=oo(),[a,l]=m.useState(n??""),[u,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(!1),[k,v]=m.useState(null);m.useEffect(()=>{!a&&r&&r.length>0&&l(n??r[0].slug)},[r,n,a]);async function b(w){if(w.preventDefault(),!(!a||!u.trim())){y(!0),v(null);try{const S=await fetch(`/api/projects/${a}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:u.trim(),body:p||void 0})}),N=await S.json();if(!S.ok){v(N.error||`HTTP ${S.status}`),y(!1);return}e(`/projects/${N.projectSlug}/resources/${N.slug}`)}catch(S){v(S.message),y(!1)}}}return o?s.jsx(bt,{label:"Loading projects…"}):i?s.jsx(Rt,{error:i}):!r||r.length===0?s.jsx(Rt,{error:"You need at least one project before you can create a resource. Create a project from the sidebar."}):s.jsxs("form",{onSubmit:b,className:"space-y-5",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Resource"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Resources are reference material — specs, requirements, links — shared across every assignment in a project."})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),s.jsx("select",{id:"project",value:a,onChange:w=>l(w.target.value),className:"editor-input",required:!0,children:r.map(w=>s.jsx("option",{value:w.slug,children:w.title},w.slug))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),s.jsx("input",{id:"name",type:"text",value:u,onChange:w=>f(w.target.value),placeholder:"e.g. Auth Requirements",className:"editor-input",required:!0,autoFocus:!0}),s.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),s.jsx("textarea",{id:"body",value:p,onChange:w=>h(w.target.value),rows:14,placeholder:"Write the resource body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),k?s.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:k}):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"submit",disabled:g||!u.trim()||!a,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:g?"Creating…":"Create Resource"}),s.jsx("button",{type:"button",onClick:()=>e("/resources"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function LQ(){const{slug:e,itemSlug:t}=Kt();return s.jsx(Oc,{loadUrl:`/api/projects/${e}/resources/${t}/edit`,saveUrl:`/api/projects/${e}/resources/${t}`,redirectTo:`/projects/${e}/resources/${t}`,title:"Edit Resource",description:"Edit the body. The frontmatter (name, category, source, related assignments) is preserved unchanged on save.",documentType:"resource",helpTitle:"Resource editing",helpBody:"Resource edits are body-only. Frontmatter changes from the editor are ignored server-side; the file's existing frontmatter is preserved and `updated` is bumped automatically."})}const vv=["projects","playbooks","todos","servers","config"];function OQ(e){const t=new Set;for(const n of e.split(",").map(r=>r.trim()))vv.includes(n)&&t.add(n);return t}function NC(e){return e?Sr(e):"never"}function FQ(){const[e,t]=m.useState(!0),[n,r]=m.useState(null),[o,i]=m.useState(""),[a,l]=m.useState(new Set(vv)),[u,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(null),[k,v]=m.useState(null),[b,w]=m.useState(!1),S=m.useCallback(async()=>{try{const I=await fetch("/api/backup");if(!I.ok)throw new Error(`HTTP ${I.status}`);const _=await I.json();r(_),i(_.repo??""),l(OQ(_.categories)),f(!1)}catch(I){v({type:"error",message:`Failed to load backup config: ${I instanceof Error?I.message:String(I)}`})}finally{t(!1)}},[]);m.useEffect(()=>{S()},[S]);function N(I){l(_=>{const z=new Set(_);return z.has(I)?z.delete(I):z.add(I),z}),f(!0)}async function C(){h(!0),v(null);try{const I=Array.from(a),_=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:o.trim()||null,categories:I})}),z=await _.json();if(!_.ok)throw new Error(z.error||`HTTP ${_.status}`);r(z),f(!1),v({type:"success",message:"Backup configuration saved."})}catch(I){v({type:"error",message:`Save failed: ${I instanceof Error?I.message:String(I)}`})}finally{h(!1)}}async function R(){y("push"),v(null);try{const I=await fetch("/api/backup/push",{method:"POST"}),_=await I.json();if(!I.ok||_.success===!1)throw new Error(_.error||_.message||`HTTP ${I.status}`);v({type:"success",message:_.message||"Backup complete."}),await S()}catch(I){v({type:"error",message:`Backup failed: ${I instanceof Error?I.message:String(I)}`})}finally{y(null)}}async function T(){y("pull"),v(null);try{const I=await fetch("/api/backup/pull",{method:"POST"}),_=await I.json();if(!I.ok||_.success===!1)throw new Error(_.error||_.message||`HTTP ${I.status}`);v({type:"success",message:_.message||"Restore complete."}),await S()}catch(I){v({type:"error",message:`Restore failed: ${I instanceof Error?I.message:String(I)}`})}finally{y(null)}}if(e)return s.jsx(Ve,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})});const A=!!o.trim()&&a.size>0&&!g&&!u;return s.jsxs(Ve,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository and restore from it",children:[s.jsxs("div",{className:"space-y-4",children:[k&&s.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${k.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:k.message}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repository URL"}),s.jsx("input",{type:"text",value:o,onChange:I=>{i(I.target.value),f(!0)},placeholder:"git@github.com:you/syntaur-backup.git",className:"editor-input w-full text-sm"}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["SSH or HTTPS URL. Requires ",s.jsx("code",{className:"rounded bg-muted px-1",children:"git"})," installed and credentials configured locally."]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Categories to back up"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:vv.map(I=>{const _=a.has(I);return s.jsxs("button",{type:"button",onClick:()=>N(I),className:`shell-action text-xs ${_?"bg-primary/10 text-primary hover:bg-primary/20":"bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:[s.jsx("span",{className:`mr-1 inline-block h-2 w-2 rounded-full ${_?"bg-primary":"bg-muted-foreground/40"}`}),I]},I)})})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs text-muted-foreground sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-foreground",children:"Last backup: "}),NC((n==null?void 0:n.lastBackup)??null)]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),NC((n==null?void 0:n.lastRestore)??null)]}),(n==null?void 0:n.locked)&&s.jsx("div",{className:"sm:col-span-2 text-warning-foreground",children:"⚠ A backup operation is in progress or the lock file is stale."})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[s.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:C,disabled:p||!u,children:[s.jsx(Od,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Config"]}),s.jsxs("button",{className:"shell-action",onClick:R,disabled:!A,title:A?"Back up now":u?"Save config first":"Set repo and pick categories",children:[s.jsx(a4,{className:"h-3.5 w-3.5"}),g==="push"?"Backing up...":"Back Up Now"]}),s.jsxs("button",{className:"shell-action",onClick:()=>w(!0),disabled:!A,title:A?"Restore from backup":u?"Save config first":"Set repo and pick categories",children:[s.jsx(E5,{className:"h-3.5 w-3.5"}),g==="pull"?"Restoring...":"Restore"]}),u&&s.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]}),s.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-muted/20 p-3 text-xs text-muted-foreground",children:[s.jsx(N5,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),s.jsxs("span",{children:["Restore never overwrites ",s.jsx("code",{className:"rounded bg-muted px-1",children:"config.md"})," (would clobber backup settings). The agent sessions database is not backed up — only markdown files."]})]})]}),s.jsx(os,{open:b,title:"Restore from GitHub?",description:"Restore will overwrite local files for the selected categories with the contents of the GitHub repo. This cannot be undone. Continue?",confirmLabel:"Restore",destructive:!0,loading:g==="pull",onOpenChange:I=>{!I&&g!=="pull"&&w(!1)},onConfirm:async()=>{await T(),w(!1)}})]})}function zQ(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:r,bindAction:o,unbindAction:i}=Ri(),[a,l]=m.useState(null),[u,f]=m.useState(null),[p,h]=m.useState(!1),g=Object.values(t).some(N=>typeof N=="string"&&N.length>0);function y(N,C){f({type:N,message:C}),setTimeout(()=>f(null),2500)}function k(N){l({kind:N,combo:null,conflict:null,saving:!1,error:null})}function v(N){if(!a||N.key==="Escape")return;if(N.key==="Enter"&&a.combo){N.preventDefault(),b();return}if(N.key==="Enter")return;N.preventDefault(),N.stopPropagation();const C=fT(N.nativeEvent);if(!C)return;const R=r(C,a.kind);l({...a,combo:C,conflict:R,error:null})}async function b(){var N;if(a!=null&&a.combo){if((N=a.conflict)!=null&&N.description){l({...a,error:`Reserved: ${a.conflict.description}`});return}l({...a,saving:!0,error:null});try{await o(a.kind,a.combo),l(null),y("success",`Bound ${ku[a.kind]}`)}catch(C){l({...a,saving:!1,error:C instanceof Error?C.message:"Failed to save"})}}}async function w(N){try{await i(N),y("success",`Cleared ${ku[N]} binding`)}catch(C){y("error",C instanceof Error?C.message:"Failed to clear binding")}}async function S(){if(!p){h(!0);try{await e8(),y("success","All hotkey bindings cleared")}catch(N){y("error",N instanceof Error?N.message:"Failed to reset bindings")}finally{h(!1)}}}return s.jsxs(Ve,{title:"Hotkey Bindings",description:"Each canonical create action ships with a default hotkey that fires the action without opening the palette. Override any of them below — Clear restores the default.",actions:g?s.jsxs("button",{className:"shell-action text-xs",onClick:()=>void S(),disabled:p,children:[s.jsx(vs,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[u?s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${u.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:u.message}):null,s.jsx("ul",{className:"space-y-2",children:hm.map(N=>{var I,_;const C=n.find(z=>z.bindableKind===N),R=e[N],T=typeof t[N]=="string"&&!!t[N],A=(a==null?void 0:a.kind)===N;return s.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[s.jsx(Eb,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm text-foreground",children:(C==null?void 0:C.title)??ku[N]}),C!=null&&C.subtitle?s.jsx("div",{className:"text-xs text-muted-foreground",children:C.subtitle}):null]}),R?s.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-foreground",children:eo(R)}),s.jsx("span",{className:`text-[10px] uppercase tracking-wide ${T?"text-primary":"text-muted-foreground"}`,children:T?"custom":"default"})]}):s.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"unbound"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",className:"shell-action text-xs",onClick:()=>k(N),children:R?"Rebind":"Bind"}),T?s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void w(N),"aria-label":`Restore default ${ku[N]} binding`,children:[s.jsx(Nc,{className:"h-3 w-3"}),"Restore default"]}):null]}),A?s.jsx("div",{className:"mt-2 w-full rounded-md border border-primary/40 bg-primary/5 px-3 py-3 text-center outline-none",tabIndex:0,autoFocus:!0,onKeyDown:v,onBlur:()=>{(a==null?void 0:a.kind)===N&&!a.saving&&l(null)},children:a!=null&&a.combo?s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-base font-semibold tracking-wide text-foreground",children:eo(a.combo)}),(I=a.conflict)!=null&&I.description?s.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",a.conflict.description]}):(_=a.conflict)!=null&&_.kind?s.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',ku[a.conflict.kind],'". Press Enter to overwrite.']}):s.jsx("div",{className:"text-xs text-muted-foreground",children:"Press Enter to save, Esc to cancel, any other key to retry."}),a.error?s.jsx("div",{className:"text-xs text-destructive",children:a.error}):null]}):s.jsx("div",{className:"text-xs text-muted-foreground",children:"Press the key combination you want to bind…"})}):null]},N)})})]})}const BQ={kanban:"Kanban",list:"List",table:"Table"},UQ={comfortable:"Comfortable",compact:"Compact"},HQ={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},VQ={asc:"Ascending",desc:"Descending"};function WQ(){const e=JY(),t=e.global,[n,r]=m.useState(!1),[o,i]=m.useState(null);function a(f,p){i({type:f,message:p}),setTimeout(()=>i(null),2e3)}async function l(f,p){if(t[f]!==p){r(!0);try{await U3({[f]:p}),a("success","Saved")}catch(h){a("error",h instanceof Error?h.message:"Failed to save")}finally{r(!1)}}}async function u(){if(e.custom){r(!0);try{await ZY(),a("success","Reset to defaults")}catch(f){a("error",f instanceof Error?f.message:"Failed to reset")}finally{r(!1)}}}return s.jsxs(Ve,{title:"View defaults",description:"Defaults for the assignments board, list, and table views. Per-project overrides are saved automatically as you use them.",actions:e.custom?s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:u,disabled:n,children:[s.jsx(vs,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[o&&s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${o.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:o.message}),s.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Default view"}),s.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:Nw.map(f=>s.jsx("button",{type:"button",onClick:()=>l("defaultView",f),disabled:n,"aria-pressed":t.defaultView===f,className:`px-3 py-1 text-xs ${t.defaultView===f?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:BQ[f]},f))})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Density"}),s.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:iz.map(f=>s.jsx("button",{type:"button",onClick:()=>l("density",f),disabled:n,"aria-pressed":t.density===f,className:`px-3 py-1 text-xs ${t.density===f?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:UQ[f]},f))})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Sort by"}),s.jsx("dd",{className:"mt-1.5",children:s.jsx("select",{value:t.sortField,onChange:f=>l("sortField",f.target.value),disabled:n,className:"editor-input max-w-[220px]",children:aR.map(f=>s.jsx("option",{value:f,children:HQ[f]??f},f))})})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Direction"}),s.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:oz.map(f=>s.jsx("button",{type:"button",onClick:()=>l("sortDirection",f),disabled:n,"aria-pressed":t.sortDirection===f,className:`px-3 py-1 text-xs ${t.sortDirection===f?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:VQ[f]},f))})]})]})]})}function KQ({value:e,onChange:t,knownSlugs:n,rows:r=2,placeholder:o,className:i,wrapperClassName:a,singleLine:l,"aria-label":u}){const[f,p]=m.useState(0),[h,g]=m.useState(0),[y,k]=m.useState(!1),v=m.useRef(null),b=n_(e,f),w=b?r_(b.partial,n):[],S=!y&&w.length>0,N=Math.min(h,Math.max(0,w.length-1)),C=_=>l?_.replace(/[\r\n]+/g," "):_;function R(_){t(C(_.target.value)),p(_.target.selectionStart??_.target.value.length),g(0),k(!1)}function T(_){p(_.currentTarget.selectionStart??e.length)}function A(_){if(!b||!_)return;const z=s_(e,b,_);t(C(z.text)),p(z.caret),g(0),k(!0),requestAnimationFrame(()=>{const O=v.current;O&&(O.focus(),O.setSelectionRange(z.caret,z.caret))})}function I(_){S&&(_.key==="ArrowDown"?(_.preventDefault(),g(z=>Math.min(z+1,w.length-1))):_.key==="ArrowUp"?(_.preventDefault(),g(z=>Math.max(z-1,0))):_.key==="Enter"||_.key==="Tab"?(_.preventDefault(),A(w[N])):_.key==="Escape"&&(_.preventDefault(),k(!0)))}return s.jsxs("div",{className:be("relative",a),children:[s.jsx("textarea",{ref:v,value:e,rows:r,placeholder:o,"aria-label":u,onChange:R,onKeyDown:I,onKeyUp:T,onClick:T,className:i}),S&&s.jsx("ul",{role:"listbox",className:"absolute left-0 right-0 top-full z-30 mt-1 max-h-48 overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:w.map((_,z)=>s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":z===N,onMouseDown:O=>{O.preventDefault(),A(_)},className:be("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",z===N&&"bg-accent"),children:[s.jsx("span",{className:"text-muted-foreground",children:"@"}),s.jsx("span",{className:"truncate",children:_})]})},_))})]})}const qQ={first:"first",last:"last",none:"none"};function b_(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Au(e){return e.map(t=>({rowKey:b_(),id:t.id,originalId:t.id,isNew:!1,idEditable:!1,autoSlugFromLabel:!1,label:t.label,command:t.command,argsText:t.args?t.args.join(" "):"",promptArgPosition:t.promptArgPosition??"first",resolveFromShellAliases:t.resolveFromShellAliases??!1,default:t.default??!1,model:t.model??"",playbook:t.playbook??"",launchPrompt:t.launchPrompt??"",agentName:t.agentName??"",workdir:t.workdir??"",runner:t.runner,sourceKind:t.sourceKind,sourcePath:t.sourcePath??"",sourceRepo:t.sourceRepo??"",fieldErrors:{}}))}function GQ(e){return e.map(t=>{const n={id:t.id,label:t.label,command:t.command},r=t.argsText.split(/[,\s]+/).filter(Boolean);return r.length>0&&(n.args=r),t.promptArgPosition!=="first"&&(n.promptArgPosition=t.promptArgPosition),t.resolveFromShellAliases&&(n.resolveFromShellAliases=!0),t.default&&(n.default=!0),t.model.trim()&&(n.model=t.model.trim()),t.playbook.trim()&&(n.playbook=t.playbook.trim()),t.launchPrompt.trim()&&(n.launchPrompt=t.launchPrompt),t.agentName.trim()&&(n.agentName=t.agentName.trim()),t.workdir.trim()&&(n.workdir=t.workdir.trim()),t.runner&&(n.runner=t.runner),t.sourceKind&&(n.sourceKind=t.sourceKind),t.sourcePath.trim()&&(n.sourcePath=t.sourcePath.trim()),t.sourceRepo.trim()&&(n.sourceRepo=t.sourceRepo.trim()),n})}function YQ(e){if(e.length===0)return e;let t=-1;for(let n=0;n<e.length;n++)if(e[n].default){t=n;break}return e.map((n,r)=>({...n,default:t===-1?r===0:r===t}))}function XQ(e,t){return!t||t.length===0?e:e.map((n,r)=>{const o={};for(const i of t){if(i.index!==void 0){i.index===r&&(o[i.field]=i.message);continue}if(i.id!==void 0){i.id===n.id&&(o[i.field]=i.message);continue}o[i.field]=i.message}return{...n,fieldErrors:o}})}function QQ(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function JQ(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],o=t[n];if(r.id!==o.id||r.label!==o.label||r.command!==o.command||r.argsText!==o.argsText||r.promptArgPosition!==o.promptArgPosition||r.resolveFromShellAliases!==o.resolveFromShellAliases||r.default!==o.default||r.model!==o.model||r.playbook!==o.playbook||r.launchPrompt!==o.launchPrompt||r.agentName!==o.agentName||r.workdir!==o.workdir)return!1}return!0}function ZQ({row:e,index:t,canRemove:n,playbooks:r,onPatch:o,onSetDefault:i,onRemove:a}){const{attributes:l,listeners:u,setNodeRef:f,setActivatorNodeRef:p,transform:h,transition:g,isDragging:y}=Dm({id:e.rowKey}),k={transform:js.Transform.toString(h),transition:g,zIndex:y?50:void 0,position:y?"relative":void 0};function v(R){const T={label:R};if(e.autoSlugFromLabel){const A=$r(R);A&&rX.test(A)?T.id=A:T.id=`agent-${t+1}`}o(T)}function b(R){o({id:R,autoSlugFromLabel:!1})}const w=R=>e.fieldErrors[R]?"border-error-foreground/60":"",S=m.useMemo(()=>r.map(R=>R.slug),[r]),N=m.useMemo(()=>o_(e.launchPrompt,S),[e.launchPrompt,S]),C=!!(e.agentName.trim()||e.workdir.trim());return s.jsxs("div",{ref:f,style:k,className:`surface-panel space-y-2 px-3 py-2 ${y?"opacity-60 shadow-lg":""}`,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{ref:p,...l,...u,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:s.jsx(wc,{className:"h-4 w-4"})}),s.jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx("input",{type:"radio",name:"agents-default",checked:e.default,onChange:i,className:"h-3 w-3 cursor-pointer accent-foreground"}),"Default"]}),C&&s.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-foreground/[0.06] px-1.5 py-0.5 text-[10px] text-muted-foreground",title:e.agentName.trim()?`Runs as Claude agent "${e.agentName.trim()}"`:`Launches from ${e.workdir.trim()}`,children:[s.jsx(_5,{className:"h-3 w-3"}),e.agentName.trim()?`agent:${e.agentName.trim()}`:"workdir"]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide text-muted-foreground/70",children:"id"}),e.idEditable?s.jsx("input",{type:"text",value:e.id,onChange:R=>b(R.target.value),className:`editor-input w-32 font-mono text-xs ${w("id")}`,"aria-label":"Agent id"}):s.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id}),s.jsx("button",{type:"button",onClick:a,disabled:!n,"aria-label":"Remove agent",className:"rounded p-1 text-muted-foreground/60 transition hover:bg-foreground/[0.04] hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30",children:s.jsx(fn,{className:"h-3.5 w-3.5"})})]})]}),e.fieldErrors.id&&s.jsx("p",{className:"ml-7 text-[11px] text-error-foreground",children:e.fieldErrors.id}),s.jsxs("div",{className:"ml-7 grid grid-cols-1 gap-2 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Label"}),s.jsx("input",{type:"text",value:e.label,onChange:R=>v(R.target.value),className:`editor-input mt-0.5 w-full ${w("label")}`}),e.fieldErrors.label&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.label})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Command"}),s.jsx("input",{type:"text",value:e.command,placeholder:"claude or /usr/local/bin/claude",onChange:R=>o({command:R.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("command")}`}),e.fieldErrors.command&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.command})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Args (comma- or space-separated)"}),s.jsx("input",{type:"text",value:e.argsText,placeholder:"--dangerously-skip-permissions",onChange:R=>o({argsText:R.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("args")}`}),e.fieldErrors.args&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.args})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Prompt arg position"}),s.jsx("select",{value:e.promptArgPosition,onChange:R=>o({promptArgPosition:R.target.value}),className:`editor-input mt-0.5 w-full ${w("promptArgPosition")}`,children:J3.map(R=>s.jsx("option",{value:R,children:qQ[R]},R))}),e.fieldErrors.promptArgPosition&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.promptArgPosition})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Model"}),s.jsx("input",{type:"text",value:e.model,placeholder:"opus (optional)",onChange:R=>o({model:R.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("model")}`}),e.fieldErrors.model&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.model})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Runner"}),s.jsxs("select",{value:e.runner??"",onChange:R=>o({runner:R.target.value||void 0}),className:"editor-input mt-0.5 w-full","aria-label":"Runner type",children:[s.jsx("option",{value:"",children:"(infer)"}),s.jsx("option",{value:"claude",children:"claude"}),s.jsx("option",{value:"pi",children:"pi"}),s.jsx("option",{value:"codex",children:"codex"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Agent name (Claude --agent)"}),s.jsx("input",{type:"text",value:e.agentName,onChange:R=>o({agentName:R.target.value}),className:`editor-input mt-0.5 w-full ${w("agentName")}`,placeholder:"claude agents only","aria-label":"Claude agent name"}),e.fieldErrors.agentName&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.agentName})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Working directory"}),s.jsx("input",{type:"text",value:e.workdir,placeholder:"pi/codex only, e.g. ~/job-applier-agent",onChange:R=>o({workdir:R.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("workdir")}`,"aria-label":"Working directory"}),e.fieldErrors.workdir&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.workdir})]}),s.jsxs("div",{className:"col-span-full",children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Launch prompt"}),s.jsx(KQ,{value:e.launchPrompt,onChange:R=>o({launchPrompt:R}),knownSlugs:S,singleLine:!0,rows:5,placeholder:"@assignment Run @<playbook> end-to-end. (optional)",wrapperClassName:"mt-0.5",className:`editor-input w-full resize-y font-mono leading-relaxed min-h-[6rem] ${w("launchPrompt")}`,"aria-label":"Launch prompt"}),e.fieldErrors.launchPrompt&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.launchPrompt}),N.length>0&&!e.fieldErrors.launchPrompt&&s.jsx("ul",{className:"mt-0.5 space-y-0.5 text-[11px] text-error-foreground",children:N.map(R=>s.jsx("li",{children:R},R))})]}),s.jsxs("label",{className:"col-span-full inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox",checked:e.resolveFromShellAliases,onChange:R=>o({resolveFromShellAliases:R.target.checked}),className:"h-3.5 w-3.5 cursor-pointer accent-foreground"}),"Resolve from shell aliases (look up ",s.jsx("code",{className:"font-mono",children:"command"})," in your interactive shell before launching)"]})]})]})}function eJ(){const e=M0(),t=iw(),n=m.useMemo(()=>{var z;return(((z=t.data)==null?void 0:z.playbooks)??[]).filter(O=>O.enabled).map(O=>({slug:O.slug,name:O.name}))},[t.data]),[r,o]=m.useState(()=>Au(e.agents)),[i,a]=m.useState(()=>Au(e.agents)),[l,u]=m.useState(!1),[f,p]=m.useState(null),[h,g]=m.useState(!1),[y,k]=m.useState(null);m.useEffect(()=>{const z=Au(e.agents);o(z),a(z),p(null)},[e.agents]);const v=m.useMemo(()=>!JQ(r,i),[r,i]),b=Cm(ji(Ac,{activationConstraint:{distance:8}}),ji(Rc));function w(z,O){k({type:z,message:O}),setTimeout(()=>k(null),2500)}function S(z,O){o(B=>B.map(V=>V.rowKey===z?{...V,...O,fieldErrors:tJ(V.fieldErrors,O)}:V))}function N(z){o(O=>O.map(B=>({...B,default:B.rowKey===z})))}function C(){o(z=>{const O=new Set(z.map(K=>K.id)),B="new-agent";let V=B,$=1;for(;O.has(V);)$+=1,V=`${B}-${$}`;const L=$===1?"New Agent":`New Agent ${$}`,U={rowKey:b_(),id:V,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:L,command:"",argsText:"",agentName:"",workdir:"",runner:void 0,sourceKind:void 0,sourcePath:"",sourceRepo:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...z,U]})}function R(z){o(O=>O.filter(B=>B.rowKey!==z))}async function T(){u(!0),p(null);try{const z=YQ(r),O=GQ(z),B=await e_(O),V=Au(B.agents);o(V),a(V),w("success","Agents saved")}catch(z){if(z instanceof Z3)p(z.message),o(O=>XQ(QQ(O),z.fieldErrors)),w("error",z.message);else{const O=z instanceof Error?z.message:"Failed to save";p(O),w("error",O)}}finally{u(!1)}}function A(){o(i),p(null)}async function I(){if(e.custom){u(!0),p(null);try{const z=await aX(),O=Au(z.agents);o(O),a(O),w("success","Reset to defaults")}catch(z){const O=z instanceof Error?z.message:"Failed to reset";p(O),w("error",O)}finally{u(!1)}}}function _(z){const{active:O,over:B}=z;!B||O.id===B.id||o(V=>{const $=V.findIndex(U=>U.rowKey===O.id),L=V.findIndex(U=>U.rowKey===B.id);return $===-1||L===-1?V:Pc(V,$,L)})}return s.jsxs(Ve,{title:"Agents",description:"Raw config for the agents the dashboard and 'Open in agent' actions can launch. The default agent is used when no other one is specified. Add, discover, and create agents on the Agents page.",actions:e.custom?s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>g(!0),disabled:l,children:[s.jsx(vs,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-primary/30 bg-primary/[0.04] px-3 py-2 text-xs text-muted-foreground",children:[s.jsx(Kv,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-primary"}),s.jsxs("span",{children:["Add, discover, and create agents on the"," ",s.jsx(_e,{to:"/agents",className:"font-medium text-primary hover:underline",children:"Agents page"}),". This panel is the raw config editor (badges, identity, launch prompt)."]})]}),!e.custom&&s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/60 bg-foreground/[0.02] px-3 py-2 text-xs text-muted-foreground",children:[s.jsx(Qv,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),s.jsxs("span",{children:["Using built-in defaults — first save will write your own list to"," ",s.jsx("code",{className:"font-mono",children:"~/.syntaur/config.md"}),"."]})]}),y&&s.jsx("div",{className:`rounded-md border px-3 py-1.5 text-xs ${y.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:y.message}),f&&(!y||y.type!=="error")&&s.jsx("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-1.5 text-xs text-error-foreground",children:f}),s.jsx(Pm,{sensors:b,collisionDetection:Em,onDragEnd:_,children:s.jsx(_m,{items:r.map(z=>z.rowKey),strategy:Lw,children:s.jsx("div",{className:"space-y-2",children:r.map((z,O)=>s.jsx(ZQ,{row:z,index:O,canRemove:r.length>1,playbooks:n,onPatch:B=>S(z.rowKey,B),onSetDefault:()=>N(z.rowKey),onRemove:()=>R(z.rowKey)},z.rowKey))})})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:C,disabled:l,className:"shell-action text-xs",children:[s.jsx(Tt,{className:"h-3 w-3"}),"Add agent"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:A,disabled:!v||l,className:"shell-action text-xs",children:"Discard"}),s.jsxs("button",{type:"button",onClick:T,disabled:!v||l,className:"shell-action text-xs",children:[s.jsx(Od,{className:"h-3 w-3"}),"Save"]})]})]}),s.jsx(os,{open:h,title:"Reset agents to defaults?",description:"Reset agents to built-in defaults? Any custom agents will be deleted from your config.",confirmLabel:"Reset",destructive:!0,loading:l,onOpenChange:z=>{!z&&!l&&g(!1)},onConfirm:async()=>{await I(),g(!1)}})]})}function tJ(e,t){if(Object.keys(e).length===0)return e;const n={...e};return"id"in t&&delete n.id,"label"in t&&delete n.label,"command"in t&&delete n.command,"argsText"in t&&delete n.args,"promptArgPosition"in t&&delete n.promptArgPosition,"resolveFromShellAliases"in t&&delete n.resolveFromShellAliases,"default"in t&&delete n.default,"model"in t&&delete n.model,"playbook"in t&&delete n.playbook,"launchPrompt"in t&&delete n.launchPrompt,n}const rh={agentDiscovery:{claudeGlobal:!0,claudeProject:!0,directory:!0,roots:["~"]},standaloneDefaultCwd:null};function v_(e){if(!e||typeof e!="object")return rh;const t=e,n=t.agentDiscovery??{},r=Array.isArray(n.roots)&&n.roots.length?n.roots.filter(o=>typeof o=="string"&&o.trim()!==""):["~"];return{agentDiscovery:{claudeGlobal:n.claudeGlobal!==!1,claudeProject:n.claudeProject!==!1,directory:n.directory!==!1,roots:r.length?r:["~"]},standaloneDefaultCwd:typeof t.standaloneDefaultCwd=="string"?t.standaloneDefaultCwd:null}}function nJ(){const[e,t]=m.useState(rh),[n,r]=m.useState(!0),[o,i]=m.useState(0);return m.useEffect(()=>{let a=!1;return r(!0),fetch("/api/config/agent-discovery").then(l=>l.ok?l.json():rh).then(l=>{a||(t(v_(l)),r(!1))}).catch(()=>{a||(t(rh),r(!1))}),()=>{a=!0}},[o]),{settings:e,loading:n,reload:()=>i(a=>a+1)}}async function rJ(e){const t=await fetch("/api/config/agent-discovery",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${t.status}`)}return v_(await t.json())}function sJ(){const{settings:e,loading:t,reload:n}=nJ(),{toast:r,showToast:o,dismissToast:i}=Tn(),[a,l]=m.useState(!0),[u,f]=m.useState(!0),[p,h]=m.useState(!0),[g,y]=m.useState("~"),[k,v]=m.useState(""),[b,w]=m.useState(!1);m.useEffect(()=>{t||(l(e.agentDiscovery.claudeGlobal),f(e.agentDiscovery.claudeProject),h(e.agentDiscovery.directory),y(e.agentDiscovery.roots.join(", ")),v(e.standaloneDefaultCwd??""))},[t,e]);async function S(){w(!0);try{const R=g.split(/[,\n]+/).map(T=>T.trim()).filter(Boolean);await rJ({agentDiscovery:{claudeGlobal:a,claudeProject:u,directory:p,roots:R.length?R:["~"]},standaloneDefaultCwd:k.trim()||null}),o("Discovery settings saved","success"),n()}catch(R){o(R instanceof Error?R.message:"Save failed","error")}finally{w(!1)}}const N="rounded-md border border-border/70 bg-background px-3 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60",C=[[a,l,"Claude · global","~/.claude/agents"],[u,f,"Claude · project","each repo’s .claude/agents"],[p,h,"Directory scan","strong-marker dirs under the roots"]];return s.jsxs(Ve,{title:"Agent discovery",description:"Which sources feed the Agents page register tray, the directory scan roots, and where a standalone Claude agent launches from.",children:[s.jsxs("fieldset",{className:"space-y-2",disabled:t||b,children:[s.jsx("legend",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Sources"}),C.map(([R,T,A,I])=>s.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[s.jsx("input",{type:"checkbox",checked:R,onChange:_=>T(_.target.checked),className:"size-4"}),s.jsx("span",{className:"font-medium",children:A}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",I]})]},A))]}),s.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Scan roots ",s.jsx("span",{className:"text-muted-foreground/50",children:"(comma-separated; depth-1 dirs)"}),s.jsx("input",{className:N,value:g,onChange:R=>y(R.target.value),placeholder:"~",disabled:t||b})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Standalone Claude cwd"," ",s.jsx("span",{className:"text-muted-foreground/50",children:"(absolute path; blank → home)"}),s.jsx("input",{className:N,value:k,onChange:R=>v(R.target.value),placeholder:"/Users/you/work",disabled:t||b})]}),s.jsx("div",{className:"flex justify-end",children:s.jsxs("button",{type:"button",onClick:()=>void S(),disabled:t||b,className:"shell-action disabled:opacity-50",children:[s.jsx(Od,{className:"size-3.5"}),s.jsx("span",{children:b?"Saving…":"Save"})]})}),s.jsx(Nn,{toast:r,onDismiss:i})]})}const w_=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],zh={terminal:"terminal-app",custom:!1};let Ml=null,Rl=null,Bh=0;const wv=new Set;function j_(e){Ml=e;for(const t of wv)t(e)}function z0(e){if(!e||typeof e!="object")return zh;const t=e;return{terminal:typeof t.terminal=="string"&&w_.includes(t.terminal)?t.terminal:zh.terminal,custom:t.custom===!0}}function oJ(){if(Ml)return Promise.resolve(Ml);if(Rl)return Rl;const e=++Bh;return Rl=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Rl=null;const n=z0(t);return e!==Bh?Ml??n:(Ml=n,n)}).catch(()=>(Rl=null,zh)),Rl}function iJ(){const[e,t]=m.useState(()=>Ml??zh);return m.useEffect(()=>{let n=!1;return oJ().then(r=>{n||t(r)}),wv.add(t),()=>{n=!0,wv.delete(t)}},[]),e}async function aJ(e){++Bh;const t=await fetch("/api/config/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({terminal:e})});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.error)??`HTTP ${t.status}`)}const n=z0(await t.json());return j_(n),n}async function lJ(){++Bh;const e=await fetch("/api/config/terminal",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=z0(await e.json());return j_(t),t}const Ep={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function cJ(){const{terminal:e,custom:t}=iJ(),[n,r]=m.useState(!1),[o,i]=m.useState(null);function a(f){i(f),setTimeout(()=>i(null),2500)}async function l(f){if(!(f===e&&t)){r(!0);try{await aJ(f),a({type:"success",message:`Terminal set to ${Ep[f]}.`})}catch(p){a({type:"error",message:p instanceof Error?p.message:"Save failed."})}finally{r(!1)}}}async function u(){r(!0);try{const f=await lJ();a({type:"success",message:`Reset to OS default (${Ep[f.terminal]}).`})}catch(f){a({type:"error",message:f instanceof Error?f.message:"Reset failed."})}finally{r(!1)}}return s.jsxs(Ve,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${Ep[e]}) when unset.`,actions:t?s.jsxs("button",{className:"shell-action text-xs",onClick:u,disabled:n,type:"button",children:[s.jsx(vs,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[o&&s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${o.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:o.message}),s.jsxs("label",{className:"block text-sm",children:[s.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Launch in"}),s.jsx("select",{value:e,onChange:f=>l(f.target.value),disabled:n,className:"w-full max-w-sm rounded-md border border-border/60 bg-background px-3 py-1.5 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:w_.map(f=>s.jsx("option",{value:f,children:Ep[f]},f))})]})]})}const SC={all:"Everything",assignment:"Assignments",project:"Projects",todo:"Todos",server:"Servers",playbook:"Playbooks"},uJ=["all",...mm];function tb(e){return Object.entries(e).map(([t,n])=>({prefix:t,kind:n}))}function dJ(e){const t=[],n={},r=new Set;for(const{prefix:i,kind:a}of e){const l=i.trim();if(l===""){t.push("An alias prefix is empty.");continue}if(r.has(l)){t.push(`Duplicate prefix "${l}".`);continue}r.add(l),n[l]=a}const o=LO(n);return o.ok||t.push(...o.errors),{map:n,errors:t}}function fJ(){const{search:e,custom:t}=fw(),[n,r]=m.useState(e.defaultScope),[o,i]=m.useState(e.externalIds),[a,l]=m.useState(()=>tb(e.aliases)),[u,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(null),k=JSON.stringify(e);m.useEffect(()=>{u||(r(e.defaultScope),i(e.externalIds),l(tb(e.aliases)))},[k]);const{map:v,errors:b}=dJ(a);function w(_){y(_),setTimeout(()=>y(null),2500)}function S(){l(_=>[..._,{prefix:"",kind:"assignment"}]),f(!0)}function N(_){l(z=>z.filter((O,B)=>B!==_)),f(!0)}function C(_,z){l(O=>O.map((B,V)=>V===_?{...B,...z}:B)),f(!0)}function R(_){r(_.defaultScope),i(_.externalIds),l(tb(_.aliases)),f(!1)}async function T(){if(!(b.length>0)){h(!0);try{const _=await zO({defaultScope:n,aliases:v,externalIds:o});R(_.search),w({type:"success",message:"Search settings saved."})}catch(_){w({type:"error",message:_ instanceof Error?_.message:"Save failed."})}finally{h(!1)}}}async function A(){h(!0);try{const _=await BO();R(_.search),w({type:"success",message:"Reset to defaults."})}catch(_){w({type:"error",message:_ instanceof Error?_.message:"Reset failed."})}finally{h(!1)}}const I=u&&b.length===0&&!p;return s.jsxs(Ve,{title:"Search",description:"Customize the Cmd+K command palette: default scope, type-alias prefixes, and external-ID indexing.",actions:t?s.jsxs("button",{className:"shell-action text-xs",onClick:A,disabled:p,type:"button",children:[s.jsx(vs,{className:"h-3 w-3"}),"Reset to defaults"]}):void 0,children:[g&&s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${g.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:g.message}),s.jsxs("div",{className:"space-y-5",children:[s.jsxs("label",{className:"block text-sm",children:[s.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Default scope"}),s.jsx("select",{value:n,onChange:_=>{r(_.target.value),f(!0)},disabled:p,className:"w-full max-w-sm rounded-md border border-border/60 bg-background px-3 py-1.5 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:uJ.map(_=>s.jsx("option",{value:_,children:SC[_]},_))}),s.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:["Searches with no type prefix are limited to this. An ",s.jsx("code",{children:"all:"})," prefix (or empty box) always searches everything."]})]}),s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Type-alias prefixes"}),s.jsx("div",{className:"space-y-2",children:a.map((_,z)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:_.prefix,onChange:O=>C(z,{prefix:O.target.value}),placeholder:"prefix",disabled:p,spellCheck:!1,className:"w-24 rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"}),s.jsx("span",{className:"text-muted-foreground",children:"→"}),s.jsx("select",{value:_.kind,onChange:O=>C(z,{kind:O.target.value}),disabled:p,className:"rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:mm.map(O=>s.jsx("option",{value:O,children:SC[O]},O))}),s.jsx("button",{type:"button",onClick:()=>N(z),disabled:p,"aria-label":`Remove alias ${_.prefix}`,className:"rounded-md p-1 text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-60",children:s.jsx(Nc,{className:"h-3.5 w-3.5"})})]},z))}),s.jsxs("button",{type:"button",onClick:S,disabled:p,className:"mt-2 inline-flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-60",children:[s.jsx(Tt,{className:"h-3 w-3"}),"Add alias"]})]}),s.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:o,onChange:_=>{i(_.target.checked),f(!0)},disabled:p,className:"mt-0.5"}),s.jsxs("span",{children:[s.jsx("span",{className:"font-medium",children:"Index external IDs"}),s.jsxs("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:["Fold external IDs (e.g. Jira keys) into search and enable"," ",s.jsx("code",{children:"jira:"}),"/",s.jsx("code",{children:"externalid:"})," and bare-ID matching."]})]})]}),u&&b.length>0&&s.jsx("ul",{className:"space-y-1 text-xs text-error-foreground",children:b.map((_,z)=>s.jsx("li",{children:_},z))}),s.jsx("div",{children:s.jsx("button",{type:"button",onClick:T,disabled:!I,className:"rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:p?"Saving…":"Save search settings"})})]})]})}function Pu(e){return e===bh?"Ungrouped":e}function pJ(){const{data:e,loading:t,error:n,refetch:r}=Ra(),{hidden:o,custom:i,loading:a,error:l,reload:u}=vR(),[f,p]=m.useState(!1),[h,g]=m.useState(null);function y(w){g(w),setTimeout(()=>g(null),2500)}const k=e?[...e.workspaces,...e.hasUngrouped?[bh]:[]]:[];async function v(w,S){const N=S?o.filter(C=>C!==w):[...o,w];p(!0);try{await N8(N),y({type:"success",message:S?`Showing "${Pu(w)}" in the left nav.`:`Hiding "${Pu(w)}" from the left nav.`})}catch(C){y({type:"error",message:C instanceof Error?C.message:"Save failed."})}finally{p(!1)}}async function b(){p(!0);try{await S8(),y({type:"success",message:"All workspaces shown in the left nav."})}catch(w){y({type:"error",message:w instanceof Error?w.message:"Reset failed."})}finally{p(!1)}}return s.jsxs(Ve,{title:"Workspace visibility",description:"Choose which workspaces appear in the left nav. Hidden workspaces stay fully reachable by direct URL — this only controls the sidebar.",actions:i?s.jsxs("button",{className:"shell-action text-xs",onClick:b,disabled:f,type:"button",children:[s.jsx(vs,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[h&&s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${h.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:h.message}),t||a?s.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading workspaces…"}):n||l?s.jsxs("div",{className:"flex items-center gap-3 text-sm text-error-foreground",children:[s.jsx("span",{children:n?"Failed to load workspaces.":"Failed to load the visibility preference."}),s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>{n&&r(),l&&u()},children:[s.jsx(vs,{className:"h-3 w-3"}),"Retry"]})]}):k.length===0?s.jsx("div",{className:"text-sm text-muted-foreground",children:"No workspaces yet."}):s.jsx("ul",{className:"flex flex-col divide-y divide-border/40",children:k.map(w=>{const S=!w8(w,o);return s.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[s.jsxs("span",{className:"truncate text-sm",title:Pu(w),children:[Pu(w),w===bh&&s.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":S,"aria-label":`Show "${Pu(w)}" in the left nav`,onClick:()=>v(w,!S),disabled:f,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-60 ${S?"bg-primary":"bg-muted"}`,children:s.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${S?"translate-x-4":"translate-x-0"}`})})]},w)})})]})}function hJ(){const{preset:e,setPreset:t,resetPreset:n}=sw(),[r,o]=m.useState(!1),[i,a]=m.useState(null);async function l(f){if(!(f===e||r)){o(!0),a(null);try{await t(f),a({type:"success",message:"Theme updated"}),setTimeout(()=>a(null),2e3)}catch(p){a({type:"error",message:p instanceof Error?p.message:"Failed to save theme"})}finally{o(!1)}}}async function u(){o(!0),a(null);try{await n(),a({type:"success",message:"Theme reset to default"}),setTimeout(()=>a(null),2e3)}catch(f){a({type:"error",message:f instanceof Error?f.message:"Failed to reset theme"})}finally{o(!1)}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ve,{title:"Theme",description:"Pick a color theme for the dashboard. The default is the Syntaur brand.",actions:e!=="default"?s.jsxs("button",{className:"shell-action text-xs",onClick:u,disabled:r,children:[s.jsx(vs,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[i&&s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${i.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:i.message}),s.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:X2.map(f=>{const p=f.slug===e;return s.jsxs("button",{type:"button",onClick:()=>l(f.slug),disabled:r,"aria-pressed":p,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${p?"border-primary ring-2 ring-primary/40":"border-border/60 hover:border-primary/40"}`,children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:f.swatches.primary}}),s.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:f.swatches.secondary}}),s.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:f.swatches.coral}}),s.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:f.swatches.teal}}),s.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:f.swatches.amber}}),p&&s.jsx("span",{className:"ml-auto inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-primary-foreground",children:s.jsx(Nr,{className:"h-3 w-3"})})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-foreground",children:f.label}),s.jsx("div",{className:"text-xs text-muted-foreground",children:f.description})]})]},f.slug)})})]}),s.jsx(zQ,{}),s.jsx(cJ,{}),s.jsx(fJ,{}),s.jsx(pJ,{}),s.jsx(eJ,{}),s.jsx(sJ,{}),s.jsx(WQ,{}),s.jsx(FQ,{})]})}const mJ={"claude-global":"Claude · global","claude-project":"Claude · project",directory:"Directory"};function CC(){const{agents:e}=M0(),{candidates:t,loading:n,reload:r}=cX(null),{toast:o,showToast:i,dismissToast:a}=Tn(),[l,u]=m.useState(null),[f,p]=m.useState(!1),[h,g]=m.useState(""),[y,k]=m.useState({});function v(C){k(R=>{const T={...R};return delete T[C],T})}const b=t.filter(C=>!C.alreadyRegistered);async function w(C){u(C.id);try{await e_(e.filter(R=>R.id!==C.id)),i(`Removed "${C.label}" — its def stays on disk`,"success")}catch(R){i(R instanceof Error?R.message:"Remove failed","error")}finally{u(null)}}async function S(C,R){const T=(R==null?void 0:R.name)??C.name;u(C.path);try{await uX({path:C.path,name:T,runner:(R==null?void 0:R.runner)??C.runner,sourceKind:C.source,sourceRepo:C.sourceRepo,description:C.description}),i(`Registered "${T}"`,"success"),v(C.path),r()}catch(A){i(A instanceof Error?A.message:"Register failed","error")}finally{u(null)}}async function N(){const C=h.trim();if(C){u("manual");try{await dX(C),i(`Added agent from ${C}`,"success"),g(""),r()}catch(R){i(R instanceof Error?R.message:"Manual add failed","error")}finally{u(null)}}}return s.jsxs("div",{className:"mx-auto max-w-4xl space-y-8 py-2",children:[s.jsxs("header",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Kv,{className:"mt-1 size-6 text-primary"}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Agents"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"One flat library of agents — claude, pi, and codex. Register what Syntaur discovers, add a missed path, or author a new one."})]})]}),s.jsxs("button",{type:"button",onClick:()=>p(C=>!C),className:"shell-action shrink-0",children:[s.jsx(I2,{className:"size-3.5"}),s.jsx("span",{children:f?"Close":"Create agent"})]})]}),f&&s.jsx(xJ,{onCreated:C=>{p(!1),i(`Created "${C}"`,"success"),r()},onError:C=>i(C,"error")}),s.jsxs("section",{className:"space-y-3",children:[s.jsxs("h2",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:["Registered (",e.length,")"]}),s.jsx("ul",{className:"space-y-2",children:e.map(C=>s.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border/60 bg-card px-3 py-2",children:[s.jsx(yv,{agent:C}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate font-medium text-foreground",children:C.label}),C.default&&s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"default"})]}),s.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[s.jsx("code",{children:C.id}),C.sourcePath?` · ${C.sourcePath}`:` · ${C.command}`]})]}),s.jsxs("button",{type:"button",onClick:()=>{window.location.href=na({kind:"standalone",id:C.id})},title:"Launch this agent standalone (no assignment)",className:"shell-action px-2 py-1 text-xs",children:[s.jsx(pa,{className:"size-3.5"}),s.jsx("span",{children:"Launch"})]}),s.jsx("button",{type:"button",onClick:()=>void w(C),disabled:l===C.id,title:"Remove from the library (leaves the on-disk def alone)",className:"shell-action px-2 py-1 text-xs text-muted-foreground hover:text-error-foreground disabled:opacity-50",children:s.jsx(fn,{className:"size-3.5"})})]},C.id))})]}),s.jsxs("section",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("h2",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:["Discovered (",b.length,")"]}),s.jsxs("button",{type:"button",onClick:r,disabled:n,className:"shell-action px-2 py-1 text-xs",title:"Re-scan",children:[s.jsx(ew,{className:`size-3.5 ${n?"animate-spin":""}`}),s.jsx("span",{children:"Rescan"})]})]}),n?s.jsx("p",{className:"text-sm text-muted-foreground",children:"Scanning…"}):b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing new to register. Adjust discovery sources in Settings → Agents, or add a path below."}):s.jsx("ul",{className:"space-y-2",children:b.map(C=>{var R;return s.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border/60 bg-card px-3 py-2",children:[s.jsx(yv,{runner:((R=y[C.path])==null?void 0:R.runner)??C.runner}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate font-medium text-foreground",children:C.name}),C.recommended&&s.jsx("span",{className:"rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:"recommended"}),s.jsx("span",{className:"text-[10px] text-muted-foreground/70",children:mJ[C.source]})]}),s.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[C.description?`${C.description} · `:"",C.path]})]}),y[C.path]?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:y[C.path].name,onChange:T=>k(A=>({...A,[C.path]:{...A[C.path],name:T.target.value}})),className:"w-28 rounded-md border border-border/70 bg-background px-2 py-1 text-xs","aria-label":"Agent name"}),s.jsxs("select",{value:y[C.path].runner,onChange:T=>k(A=>({...A,[C.path]:{...A[C.path],runner:T.target.value}})),className:"rounded-md border border-border/70 bg-background px-2 py-1 text-xs","aria-label":"Runner",children:[s.jsx("option",{value:"pi",children:"pi"}),s.jsx("option",{value:"codex",children:"codex"})]}),s.jsxs("button",{type:"button",onClick:()=>void S(C,y[C.path]),disabled:l===C.path||!y[C.path].name.trim(),className:"shell-action px-2 py-1 text-xs disabled:opacity-50",children:[s.jsx(Tt,{className:"size-3.5"}),s.jsx("span",{children:"Confirm"})]}),s.jsx("button",{type:"button",onClick:()=>v(C.path),className:"shell-action px-2 py-1 text-xs text-muted-foreground",children:"Cancel"})]}):s.jsxs("button",{type:"button",onClick:()=>{C.source==="directory"?k(T=>({...T,[C.path]:{name:C.name,runner:C.runner}})):S(C)},disabled:l===C.path,className:"shell-action px-2 py-1 text-xs disabled:opacity-50",children:[s.jsx(Tt,{className:"size-3.5"}),s.jsx("span",{children:"Register"})]})]},`${C.source}:${C.path}`)})})]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:"Add by path"}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Point at a Claude agent ",s.jsx("code",{children:".md"})," or an agent directory the scan missed (including a bare ",s.jsx("code",{children:"AGENTS.md"})," folder)."]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:h,onChange:C=>g(C.target.value),onKeyDown:C=>{C.key==="Enter"&&N()},placeholder:"~/agents/my-bot or ~/.claude/agents/foo.md",className:"flex-1 rounded-md border border-border/70 bg-background px-3 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60"}),s.jsxs("button",{type:"button",onClick:()=>void N(),disabled:l==="manual"||!h.trim(),className:"shell-action disabled:opacity-50",children:[s.jsx($5,{className:"size-3.5"}),s.jsx("span",{children:"Add"})]})]})]}),s.jsx(Nn,{toast:o,onDismiss:a})]})}const gJ=["claude","pi","codex"];function xJ({onCreated:e,onError:t}){const[n,r]=m.useState(""),[o,i]=m.useState("claude"),[a,l]=m.useState(""),[u,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,v]=m.useState(!1);async function b(){if(!n.trim()||!p.trim()){t("Name and instructions are required");return}v(!0);try{await fX({name:n.trim(),runner:o,model:a.trim()||void 0,description:u.trim()||void 0,instructions:p,location:g.trim()||void 0}),e(n.trim())}catch(S){t(S instanceof Error?S.message:"Create failed")}finally{v(!1)}}const w="rounded-md border border-border/70 bg-background px-3 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60";return s.jsxs("div",{className:"space-y-3 rounded-md border border-border/60 bg-card p-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Name",s.jsx("input",{className:w,value:n,onChange:S=>r(S.target.value),placeholder:"Researcher"})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Type",s.jsx("select",{className:w,value:o,onChange:S=>i(S.target.value),children:gJ.map(S=>s.jsx("option",{value:S,children:S},S))})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Model ",s.jsx("span",{className:"text-muted-foreground/50",children:"(optional)"}),s.jsx("input",{className:w,value:a,onChange:S=>l(S.target.value),placeholder:"opus"})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Location ",s.jsx("span",{className:"text-muted-foreground/50",children:"(optional)"}),s.jsx("input",{className:w,value:g,onChange:S=>y(S.target.value),placeholder:o==="claude"?"~/.claude/agents":"~ (parent dir)"})]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Description ",s.jsx("span",{className:"text-muted-foreground/50",children:"(optional)"}),s.jsx("input",{className:w,value:u,onChange:S=>f(S.target.value)})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Instructions",s.jsx("textarea",{className:`${w} min-h-[120px] font-mono`,value:p,onChange:S=>h(S.target.value),placeholder:"You are a meticulous researcher…"})]}),s.jsx("div",{className:"flex justify-end",children:s.jsxs("button",{type:"button",onClick:()=>void b(),disabled:k||!n.trim()||!p.trim(),className:"shell-action disabled:opacity-50",children:[s.jsx(I2,{className:"size-3.5"}),s.jsx("span",{children:k?"Creating…":"Create & register"})]})})]})}function yJ({open:e,affected:t,remaining:n,ruleReferences:r,headlineReferences:o,onResolve:i,onCancel:a}){var R,T;const[l,u]=m.useState(n.length>0?"remap":"delete"),[f,p]=m.useState(((R=n[0])==null?void 0:R.id)??""),[h,g]=m.useState(((T=n[0])==null?void 0:T.id)??""),[y,k]=m.useState(!1),v=t.count>0;m.useEffect(()=>{var A,I;e&&(u(n.length>0?"remap":"delete"),p(((A=n[0])==null?void 0:A.id)??""),g(((I=n[0])==null?void 0:I.id)??""),k(!1))},[e,n]);const b=!o||h!==""&&h!==t.id,w=l==="remap"&&n.length>0&&f!==""&&f!==t.id||l==="delete"&&(!v||y)&&b;function S(){w&&(l==="remap"?i({id:t.id,mode:"remap",target:f},f):i({id:t.id,mode:"delete"},o?h:""))}const N=t.assignments.slice(0,10),C=t.count-N.length;return s.jsx(On,{open:e,onOpenChange:A=>A?void 0:a(),children:s.jsxs(Cn,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsxs(En,{children:['Delete status "',t.label,'"',v?` — ${t.count} assignment${t.count===1?"":"s"} reference it`:""]}),s.jsx(ns,{children:v?"Choose how to resolve the affected assignments before this status is removed from the workflow.":"No assignments use this status, but workflow rules reference it. Choose how to resolve them."})]}),v&&s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("ul",{className:"space-y-1 text-sm",children:[N.map(A=>s.jsx("li",{children:s.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:A.display})},`${A.projectSlug??"standalone"}/${A.assignmentSlug}`)),C>0&&s.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",C," more not shown"]})]})}),r.length>0&&s.jsxs("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/5 p-3",children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:"Workflow rules referencing this status:"}),s.jsx("ul",{className:"space-y-0.5 font-mono text-xs text-muted-foreground",children:r.map((A,I)=>s.jsxs("li",{children:[s.jsx("span",{className:"text-foreground",children:A.section}),s.jsx("span",{className:"mx-1",children:"·"}),A.detail]},I))}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:l==="remap"?"These will be remapped to the target status.":"Ladder rungs and transitions referencing this status will be removed"+(o?"; headline rules must be remapped below.":".")})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="remap",onChange:()=>u("remap"),disabled:n.length===0,className:"mt-1"}),s.jsxs("span",{className:"flex-1",children:[s.jsx("span",{className:"block text-sm font-medium",children:v?"Remap to another status":"Remap rules to another status"}),s.jsxs("select",{value:f,onChange:A=>p(A.target.value),onClick:()=>u("remap"),disabled:l!=="remap"||n.length===0,className:"mt-2 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&s.jsx("option",{value:"",children:"(no other statuses)"}),n.map(A=>s.jsxs("option",{value:A.id,children:[A.label," (",A.id,")"]},A.id))]}),n.length===0&&s.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:"No other saved statuses to remap to. Add another status first, or use Delete."})]})]}),s.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="delete",onChange:()=>u("delete"),className:"mt-1"}),s.jsxs("span",{className:"flex-1",children:[s.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:v?"Delete these assignments":"Drop the referencing rules"}),s.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:v?`Permanently removes ${t.count} assignment${t.count===1?"":"s"} from disk. This cannot be undone.`:"Ladder rungs and transitions referencing this status are removed."}),l==="delete"&&o&&s.jsxs("span",{className:"mt-2 block",children:[s.jsx("span",{className:"block text-xs font-medium",children:"Remap headline rules to"}),s.jsxs("select",{value:h,onChange:A=>g(A.target.value),disabled:n.length===0,className:"mt-1 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&s.jsx("option",{value:"",children:"(no other statuses)"}),n.map(A=>s.jsxs("option",{value:A.id,children:[A.label," (",A.id,")"]},A.id))]}),s.jsx("span",{className:"mt-1 block text-xs text-muted-foreground",children:"The headline projection cannot reference a deleted status, so it must point somewhere."})]}),l==="delete"&&v&&s.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:y,onChange:A=>k(A.target.checked)}),s.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),s.jsxs(Hr,{children:[s.jsx("button",{type:"button",onClick:a,className:"shell-action",children:"Cancel"}),s.jsx("button",{type:"button",onClick:S,disabled:!w,className:`shell-action ${l==="delete"?"bg-error text-error-foreground hover:opacity-90":"shell-action--cta"} disabled:cursor-not-allowed disabled:opacity-50`,children:l==="remap"?v?`Remap ${t.count} → ${f||"..."}`:`Remap rules → ${f||"..."}`:v?`Delete ${t.count}`:"Drop rules"})]})]})})}function bJ({open:e,references:t,onConfirm:n,onCancel:r}){return s.jsx(On,{open:e,onOpenChange:o=>o?void 0:r(),children:s.jsxs(Cn,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsx(En,{children:"Delete fact — referenced by derive rules"}),s.jsx(ns,{children:"Removing this fact will break the following derive conditions. The doctor check will flag them as invalid until they are fixed."})]}),s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsx("ul",{className:"space-y-2 text-sm",children:t.map((o,i)=>s.jsxs("li",{className:"font-mono text-xs text-muted-foreground",children:[s.jsx("span",{className:"text-foreground",children:o.location}),s.jsx("span",{className:"mx-1",children:"·"}),s.jsx("span",{children:o.when})]},i))})}),s.jsxs(Hr,{children:[s.jsx("button",{type:"button",onClick:r,className:"shell-action",children:"Cancel"}),s.jsx("button",{type:"button",onClick:n,className:"shell-action bg-error text-error-foreground hover:opacity-90",children:"Confirm delete — rules will become invalid"})]})]})})}function vJ({value:e,onChange:t,ariaLabel:n}){const r=n??"Pick a color",o=n?`${n} (hex)`:"Color hex value";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"color",value:e||"#64748b",onChange:i=>t(i.target.value),className:"h-7 w-7 shrink-0 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5",title:"Pick a color","aria-label":r}),s.jsx("input",{type:"text",value:e,onChange:i=>t(i.target.value),placeholder:"#64748b",className:"editor-input w-[5.5rem] font-mono text-xs","aria-label":o})]})}function wJ({row:e,isSaved:t,onUpdate:n,onRemove:r}){const{attributes:o,listeners:i,setNodeRef:a,setActivatorNodeRef:l,transform:u,transition:f,isDragging:p}=Dm({id:e.rowKey}),h={transform:js.Transform.toString(u),transition:f,zIndex:p?50:void 0,position:p?"relative":void 0};return s.jsxs("div",{ref:a,style:h,className:`surface-panel flex flex-wrap items-center gap-3 px-3 py-2 ${p?"opacity-60 shadow-lg":""}`,children:[s.jsx("button",{ref:l,...o,...i,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:s.jsx(wc,{className:"h-4 w-4"})}),s.jsx("div",{className:"min-w-[8rem] flex-1",children:t?s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsx("input",{type:"text",value:e.id,readOnly:!0,"aria-label":"Status ID",className:"editor-input w-full text-sm cursor-not-allowed opacity-60"})}),s.jsx(br,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:"To rename a saved status, delete the row and create a new one (this triggers the orphan-resolution flow if assignments still reference it)."})]}):s.jsx("input",{type:"text",value:e.id,onChange:g=>n("id",g.target.value),"aria-label":"Status ID",className:"editor-input w-full text-sm"})}),s.jsx("div",{className:"min-w-[8rem] flex-1",children:s.jsx("input",{type:"text",value:e.label,onChange:g=>n("label",g.target.value),"aria-label":"Status label",className:"editor-input w-full text-sm"})}),s.jsx("div",{className:"min-w-[10rem] flex-1",children:s.jsx("input",{type:"text",value:e.description,onChange:g=>n("description",g.target.value),"aria-label":"Status description",placeholder:"description (optional)",className:"editor-input w-full text-sm"})}),s.jsx(vJ,{value:e.color,onChange:g=>n("color",g),ariaLabel:`Color for ${e.label||e.id}`}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),s.jsx(br,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:'When enabled, assignments in this status count as finished — they fill the "done" portion of progress bars and satisfy dependency requirements.'})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":e.terminal,"aria-label":`Done state for ${e.label||e.id}`,onClick:()=>n("terminal",!e.terminal),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background ${e.terminal?"bg-primary":"bg-muted"}`,children:s.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${e.terminal?"translate-x-4":"translate-x-0"}`})})]}),s.jsx("button",{type:"button",className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",onClick:r,title:"Remove status","aria-label":`Remove status ${e.id}`,children:s.jsx(fn,{className:"h-3.5 w-3.5"})})]})}function jJ({statuses:e,savedStatusIds:t,onUpdate:n,onAdd:r,onRemove:o,onReorder:i}){const a=Cm(ji(Ac,{activationConstraint:{distance:8}}),ji(Rc,{coordinateGetter:dA}));function l(u){const{active:f,over:p}=u;if(!p||f.id===p.id)return;const h=e.findIndex(y=>y.rowKey===f.id),g=e.findIndex(y=>y.rowKey===p.id);h===-1||g===-1||i(Pc(e,h,g))}return s.jsx(Ve,{title:"Status Definitions",description:"Define the statuses assignments can have. Drag rows to set the display order used by Kanban columns, progress bars, and dropdowns.",actions:s.jsxs("button",{className:"shell-action text-xs",onClick:r,children:[s.jsx(Tt,{className:"h-3 w-3"}),"Add Status"]}),children:s.jsx(Pm,{sensors:a,collisionDetection:Em,onDragEnd:l,children:s.jsx(_m,{items:e.map(u=>u.rowKey),strategy:Lw,children:s.jsx("div",{className:"space-y-2",children:e.map((u,f)=>s.jsx(wJ,{row:u,isSaved:t.has(u.id),onUpdate:(p,h)=>n(f,p,h),onRemove:()=>o(f)},u.rowKey))})})})})}function kJ(e){const t=Array.from(e.pendingResolutions.values()),r={statuses:e.statuses.map(o=>({id:o.id,label:o.label,...o.description?{description:o.description}:{},...o.color?{color:o.color}:{},...o.terminal?{terminal:!0}:{}})),order:e.order,resolutions:t};return e.transitions!==void 0&&(r.transitions=e.transitions),e.derive!==void 0&&(r.derive=e.derive),e.facts!==void 0&&(r.facts=e.facts),e.factRemovalAcks&&e.factRemovalAcks.length>0&&(r.factRemovalAcks=e.factRemovalAcks),{body:r,resolutions:t}}function NJ(e,t,n){const r=[];t.phaseLadder.forEach((o,i)=>{o.phase===e&&r.push({section:"phaseLadder",detail:`phaseLadder rung ${i} ("${o.phase}")`})}),t.headline.parked===e&&r.push({section:"headline",detail:"headline.parked"}),t.headline.blocked===e&&r.push({section:"headline",detail:"headline.blocked"});for(const o of n)(o.from===e||o.to===e)&&r.push({section:"transitions",detail:`transition ${o.from} --${o.command}--> ${o.to}`});return r}function SJ(e,t){return t.headline.parked===e||t.headline.blocked===e}function CJ(e,t,n){return{phaseLadder:e.phaseLadder.map(r=>r.phase===t?{...r,phase:n}:r),disposition:e.disposition,headline:{parked:e.headline.parked===t?n:e.headline.parked,blocked:e.headline.blocked===t?n:e.headline.blocked}}}function EJ(e,t,n){return e.map(r=>({...r,from:r.from===t?n:r.from,to:r.to===t?n:r.to}))}function TJ(e,t,n){return{phaseLadder:e.phaseLadder.filter(r=>r.phase!==t),disposition:e.disposition,headline:{parked:e.headline.parked===t?n:e.headline.parked,blocked:e.headline.blocked===t?n:e.headline.blocked}}}function RJ(e,t){return e.filter(n=>n.from!==t&&n.to!==t)}function AJ(e,t){const n=new Map;t.forEach((o,i)=>{n.has(o)||n.set(o,i)});const r=t.length;return e.map((o,i)=>({s:o,originalIndex:i,r:n.get(o.id)??r})).sort((o,i)=>o.r-i.r||o.originalIndex-i.originalIndex).map(o=>o.s)}function EC(e,t){const n=new Map;for(const[r,o]of e.entries())t.has(o.id)||o.mode==="remap"&&!t.has(o.target)||n.set(r,o);return n}function k_(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function PJ(e){const t=e.statuses.map(n=>({rowKey:k_(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return AJ(t,e.order)}function _J(e){return Jb(e)}function TC(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function DJ(e){const t=new Map;for(let n=0;n<e.length;n++){const r=TC(Jb(e.slice(0,n))),o=TC(Jb(e.slice(0,n+1)));for(const[i,a]of o.entries()){const l=r.get(i)??0;if(a>l){t.set(n,i);break}}}return t}const $J=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],IJ=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function MJ(){return{name:"",type:"bool",binds:null}}function LJ({rows:e,onChange:t,saving:n}){const r=DJ(e),o=m.useCallback(()=>{t([...e,MJ()])},[e,t]),i=m.useCallback((l,u,f)=>{t(e.map((p,h)=>h===l?{...p,[u]:f}:p))},[e,t]),a=m.useCallback(l=>{t(e.filter((u,f)=>f!==l))},[e,t]);return s.jsxs(Ve,{title:"Facts",description:"Declare custom facts and attestation fields for derive rules and the fact vocabulary.",children:[s.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["Names must match ",s.jsx("code",{className:"font-mono",children:"^[a-z][a-zA-Z0-9]*"})," — start with a lowercase letter, then letters or numbers only (no spaces, hyphens, or underscores)."]}),s.jsxs("div",{className:"space-y-2",children:[e.length===0&&s.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No custom facts declared."}),e.map((l,u)=>{const f=r.get(u),p=l.type==="attestation";return s.jsxs("div",{className:`rounded-md border p-2 ${f?"border-error-foreground/40 bg-error/5":"border-border/60 bg-background/80"}`,children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"flex-1 grid grid-cols-1 sm:grid-cols-3 gap-2",children:[s.jsx("input",{type:"text",value:l.name,onChange:h=>i(u,"name",h.target.value),placeholder:"factName",disabled:n,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm font-mono focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"}),s.jsx("select",{value:l.type,onChange:h=>{const g=h.target.value;t(e.map((y,k)=>k===u?{...y,type:g,binds:g==="attestation"?y.binds:null}:y))},disabled:n,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:$J.map(h=>s.jsx("option",{value:h.value,children:h.label},h.value))}),p?s.jsx("select",{value:l.binds??"none",onChange:h=>i(u,"binds",h.target.value),disabled:n,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:IJ.map(h=>s.jsx("option",{value:h.value,children:h.label},h.value))}):s.jsx("span",{className:"text-sm text-muted-foreground py-1",children:"—"})]}),f&&s.jsxs(Lr,{children:[s.jsx(Or,{asChild:!0,children:s.jsx("span",{className:"mt-1 inline-flex text-error-foreground","aria-label":"Invalid fact",children:s.jsx(ph,{className:"h-3.5 w-3.5 flex-shrink-0"})})}),s.jsx(br,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:f})]}),s.jsx("button",{type:"button",onClick:()=>a(u),disabled:n,className:"mt-0.5 shell-action text-xs text-muted-foreground hover:text-error disabled:opacity-50",title:"Delete",children:s.jsx(fn,{className:"h-3.5 w-3.5"})})]}),f&&s.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:f})]},u)})]}),s.jsxs("button",{type:"button",onClick:o,disabled:n,className:"mt-2 shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[s.jsx(Tt,{className:"h-3.5 w-3.5"}),"Add fact"]})]})}function N_(e,t=Bm){var r,o;if(e==="*")return null;const n=ym(e);if(!n.ast)return((r=n.errors[0])==null?void 0:r.message)??"unparseable condition";try{return Vu(n.ast,t),null}catch(i){if(i instanceof yr)return((o=i.errors[0])==null?void 0:o.message)??"invalid condition";throw i}}function nb(e){if(e.values.length!==1)return null;const t=e.values[0];return{field:e.field,op:e.op,value:t.raw,valueType:t.type}}function OJ(e){if(e.kind==="atom"){const t=nb(e);return t?{outerJoin:"AND",groups:[{join:"AND",comparisons:[t]}]}:null}if(e.kind==="and"||e.kind==="or"){const t=e.kind==="and"?"AND":"OR",n=e.kind==="and"?"or":"and",r=e.kind==="and"?"OR":"AND",o=[];for(const i of e.children)if(i.kind==="atom"){const a=nb(i);if(!a)return null;o.push({join:r,comparisons:[a]})}else if(i.kind===n){const a=[];for(const l of i.children){if(l.kind!=="atom")return null;const u=nb(l);if(!u)return null;a.push(u)}o.push({join:r,comparisons:a})}else return null;return{outerJoin:t,groups:o}}return null}function RC(e){const t=e.trim();if(t===""||t==="*")return null;const n=ym(t);return n.ast?OJ(n.ast):null}const FJ=/^[A-Za-z_][A-Za-z0-9_-]*$/;function zJ(e){return e===""||!FJ.test(e)||/^(and|or|not)$/i.test(e)}function BJ(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function UJ(e){return e.valueType==="number"||e.valueType==="date"||e.valueType==="duration"?e.value:zJ(e.value)?BJ(e.value):e.value}function HJ(e){const t=UJ(e);return e.op===":"?`${e.field}:${t}`:`${e.field} ${e.op} ${t}`}function VJ(e){return e.groups.map(n=>{const r=n.comparisons.map(HJ).join(` ${n.join} `);return n.comparisons.length>1?`(${r})`:r}).join(` ${e.outerJoin} `)}function WJ(e,t){return e.trim()==="*"?null:e.trim()===""?"condition is empty":N_(e,t)}function KJ(e){return z9(F9(e))}function qJ(e){const t=Qw(e),n=[];for(const r of rP(e)){const o=t[r.toLowerCase()];o&&n.push({name:r,kind:o.kind})}return n}function S_(e){switch(e){case"bool":return"word";case"number":case"ordinal":case"duration":case"timestamp":return"number";default:return"string"}}function jv(e){switch(e){case"bool":return[":"];case"number":case"ordinal":case"duration":case"timestamp":return[":","=","!=","<","<=",">",">="];default:return[":","!="]}}function _u(e){const t=e[0];return{outerJoin:"AND",groups:[{join:"AND",comparisons:[t?{field:t.name,op:jv(t.kind)[0],value:t.kind==="bool"?"true":"",valueType:S_(t.kind)}:{field:"",op:":",value:""}]}]}}function C_({value:e,onChange:t,fieldOptions:n,registry:r,disabled:o}){const i=m.useMemo(()=>RC(e),[e]),a=e.trim()===""||i!==null,[l,u]=m.useState(a?"builder":"raw"),[f,p]=m.useState(()=>i??_u(n)),h=m.useRef(e);m.useEffect(()=>{if(e===h.current)return;const T=RC(e);T&&p(T),!(e.trim()===""||T)&&l==="builder"&&u("raw"),h.current=e},[e]);const g=WJ(e,r);function y(T){h.current=T,t(T)}function k(T){p(T),y(VJ(T))}function v(T){k({outerJoin:T,groups:f.groups.map(A=>({...A,join:T==="AND"?"OR":"AND"}))})}function b(T,A,I){const _=f.groups.map((z,O)=>O===T?{...z,comparisons:z.comparisons.map((B,V)=>V===A?{...B,...I}:B)}:z);k({...f,groups:_})}function w(T){const A=_u(n).groups[0].comparisons[0],I=f.groups.map((_,z)=>z===T?{..._,comparisons:[..._.comparisons,{...A}]}:_);k({...f,groups:I})}function S(T,A){let I=f.groups.map((_,z)=>z===T?{..._,comparisons:_.comparisons.filter((O,B)=>B!==A)}:_);I=I.filter(_=>_.comparisons.length>0),I.length===0&&(I=_u(n).groups),k({...f,groups:I})}function N(){const T=f.outerJoin==="AND"?"OR":"AND";k({...f,groups:[...f.groups,{join:T,comparisons:[_u(n).groups[0].comparisons[0]]}]})}function C(){if(l==="builder"){u("raw");return}a&&(p(i??_u(n)),u("builder"))}const R="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Condition"}),s.jsxs("button",{type:"button",onClick:C,disabled:o||l==="raw"&&!a,title:l==="raw"&&!a?"Condition too complex for the builder — edit as raw AQL":l==="builder"?"Switch to raw AQL":"Switch to builder",className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[l==="builder"?s.jsx(S5,{className:"h-3 w-3"}):s.jsx(V5,{className:"h-3 w-3"}),l==="builder"?"Raw AQL":"Builder"]})]}),l==="raw"?s.jsx("input",{type:"text",list:"aql-field-names",value:e,onChange:T=>y(T.target.value),disabled:o,placeholder:"e.g. planApproved:true AND implementationStarted:true",className:`${R} w-full font-mono`}):s.jsxs("div",{className:"space-y-2",children:[f.groups.map((T,A)=>s.jsxs("div",{children:[A>0&&s.jsxs("div",{className:"my-1 flex items-center gap-2",children:[s.jsx("span",{className:"h-px flex-1 bg-border/60"}),s.jsx("button",{type:"button",onClick:()=>v(f.outerJoin==="AND"?"OR":"AND"),disabled:o,className:"shell-action text-[10px] uppercase tracking-wide",children:f.outerJoin}),s.jsx("span",{className:"h-px flex-1 bg-border/60"})]}),s.jsxs("div",{className:"rounded-md border border-border/50 bg-background/60 p-2 space-y-1.5",children:[T.comparisons.map((I,_)=>{const z=n.find(V=>V.name===I.field),O=(z==null?void 0:z.kind)??"string",B=jv(O);return s.jsxs("div",{className:"flex items-center gap-1.5",children:[_>0&&s.jsx("span",{className:"w-9 shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:T.join}),s.jsxs("select",{value:I.field,onChange:V=>{const $=n.find(K=>K.name===V.target.value),L=($==null?void 0:$.kind)??"string",U=jv(L);b(A,_,{field:V.target.value,op:U.includes(I.op)?I.op:U[0],value:L==="bool"?"true":I.value,valueType:S_(L)})},disabled:o,className:`${R} font-mono`,children:[n.length===0&&s.jsx("option",{value:"",children:"(no fields)"}),!n.some(V=>V.name===I.field)&&I.field!==""&&s.jsx("option",{value:I.field,children:I.field}),n.map(V=>s.jsx("option",{value:V.name,children:V.name},V.name))]}),s.jsx("select",{value:I.op,onChange:V=>b(A,_,{op:V.target.value}),disabled:o,className:`${R} font-mono`,children:B.map(V=>s.jsx("option",{value:V,children:V},V))}),O==="bool"?s.jsxs("select",{value:I.value||"true",onChange:V=>b(A,_,{value:V.target.value}),disabled:o,className:`${R} font-mono`,children:[s.jsx("option",{value:"true",children:"true"}),s.jsx("option",{value:"false",children:"false"})]}):s.jsx("input",{type:"text",value:I.value,onChange:V=>b(A,_,{value:V.target.value}),disabled:o,placeholder:"value",className:`${R} w-24 font-mono`}),s.jsx("button",{type:"button",onClick:()=>S(A,_),disabled:o,className:"ml-auto inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove condition",children:s.jsx(fn,{className:"h-3.5 w-3.5"})})]},_)}),s.jsxs("button",{type:"button",onClick:()=>w(A),disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(Tt,{className:"h-3 w-3"}),T.join," condition"]})]})]},A)),s.jsxs("button",{type:"button",onClick:N,disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(Tt,{className:"h-3 w-3"}),f.outerJoin," group"]})]}),s.jsx("datalist",{id:"aql-field-names",children:n.map(T=>s.jsx("option",{value:T.name},T.name))}),s.jsx("p",{className:"font-mono text-[11px] text-muted-foreground truncate",title:e,children:e.trim()===""?s.jsx("span",{className:"italic",children:"empty condition"}):e}),g&&s.jsx("p",{className:"text-xs text-error-foreground",children:g})]})}let AC=0;function Uh(){return AC+=1,`dr_${AC}_${Math.random().toString(36).slice(2,8)}`}function rb(e){const t=[...e.disposition].sort((n,r)=>n.when===null&&r.when!==null?1:n.when!==null&&r.when===null?-1:0);return{phaseLadder:e.phaseLadder.map(n=>({rowKey:Uh(),phase:n.phase,when:n.when,next:n.next??""})),disposition:t.map(n=>({rowKey:Uh(),when:n.when,is:n.is})),headline:{parked:e.headline.parked,blocked:e.headline.blocked}}}function kv(e){const t=e.phaseLadder.map(r=>r.next.trim()?{phase:r.phase,when:r.when,next:r.next.trim()}:{phase:r.phase,when:r.when}),n=e.disposition.map(r=>({when:r.when,is:r.is}));return{phaseLadder:t,disposition:n,headline:{terminal:"passthrough",active:"phase",parked:e.headline.parked,blocked:e.headline.blocked}}}function GJ(e){return e.findIndex(t=>t.when.trim()==="*")}function E_(e,t,n){return Iz(e,{statuses:t},r=>N_(r,n))}const PC=["active","blocked","parked"];function YJ({value:e,deriveCustom:t,statuses:n,acceptedFacts:r,onChange:o,onReset:i,disabled:a}){const l=m.useMemo(()=>Qw(r),[r]),u=m.useMemo(()=>qJ(r),[r]),f=Cm(ji(Ac,{activationConstraint:{distance:8}}),ji(Rc,{coordinateGetter:dA})),p=m.useMemo(()=>{try{return E_(kv(e),n,l)}catch{return["derive rules are malformed"]}},[e,n,l]),h=GJ(e.phaseLadder),g=h>=0?e.phaseLadder[h]:null,y=e.phaseLadder.filter((_,z)=>z!==h);function k(_,z){o({...e,phaseLadder:[..._?[_]:[],...z]})}function v(_,z){const O=e.phaseLadder.map(B=>B.rowKey===_?{...B,...z}:B);o({...e,phaseLadder:O})}function b(){var z;const _={rowKey:Uh(),phase:((z=n[0])==null?void 0:z.id)??"",when:"",next:""};k(g,[...y,_])}function w(_){o({...e,phaseLadder:e.phaseLadder.filter(z=>z.rowKey!==_)})}function S(_){const{active:z,over:O}=_;if(!O||z.id===O.id)return;const B=y.findIndex($=>$.rowKey===z.id),V=y.findIndex($=>$.rowKey===O.id);B===-1||V===-1||k(g,Pc(y,B,V))}function N(_,z){o({...e,disposition:e.disposition.map(O=>O.rowKey===_?{...O,...z}:O)})}function C(){const _={rowKey:Uh(),when:"",is:"active"},z=e.disposition.findIndex(B=>B.when===null),O=[...e.disposition];z>=0?O.splice(z,0,_):O.push(_),o({...e,disposition:O})}function R(_){o({...e,disposition:e.disposition.filter(z=>z.rowKey!==_)})}function T(_,z){o({...e,headline:{...e.headline,[_]:z}})}const A="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";function I(_,z,O){return s.jsxs("select",{value:_,onChange:B=>z(B.target.value),disabled:a,"aria-label":O,className:`${A} font-mono`,children:[!n.some(B=>B.id===_)&&_!==""&&s.jsx("option",{value:_,children:_}),n.map(B=>s.jsxs("option",{value:B.id,children:[B.label," (",B.id,")"]},B.id))]})}return s.jsxs(Ve,{title:"Derive Rules",description:"The phase ladder, disposition rules, and headline projection that map facts to a status. Highest matching rung wins — drag to reorder priority.",actions:t?s.jsxs("button",{type:"button",className:"shell-action text-xs inline-flex items-center gap-1",onClick:i,disabled:a,children:[s.jsx(vs,{className:"h-3 w-3"}),"Reset to default rules"]}):void 0,children:[!t&&s.jsx("div",{className:"mb-3 rounded-md border border-border/60 bg-muted/30 px-3 py-1.5 text-xs text-muted-foreground",children:"Using built-in derive rules. Editing anything below switches to a custom configuration."}),p.length>0&&s.jsxs("div",{className:"mb-3 rounded-md border border-error-foreground/30 bg-error/10 px-3 py-2 text-xs text-error-foreground",children:[s.jsx("p",{className:"font-medium",children:"These derive rules won't save until fixed:"}),s.jsx("ul",{className:"mt-1 list-disc pl-4 space-y-0.5",children:p.map((_,z)=>s.jsx("li",{children:_},z))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Phase ladder"}),g&&s.jsxs("div",{className:"surface-panel flex flex-wrap items-start gap-3 px-3 py-2 opacity-90",children:[s.jsx("span",{className:"mt-1 text-muted-foreground/40",children:s.jsx(wc,{className:"h-4 w-4 opacity-30"})}),s.jsxs("div",{className:"min-w-[10rem] flex-1 space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"Phase (catch-all, lowest priority)"}),I(g.phase,_=>v(g.rowKey,{phase:_}),"Catch-all phase"),s.jsx("span",{className:"ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"matches everything"})]}),s.jsxs("div",{className:"min-w-[12rem] flex-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),s.jsx("input",{type:"text",value:g.next,onChange:_=>v(g.rowKey,{next:_.target.value}),disabled:a,className:`${A} w-full`})]})]}),s.jsx(Pm,{sensors:f,collisionDetection:Em,onDragEnd:S,children:s.jsx(_m,{items:y.map(_=>_.rowKey),strategy:Lw,children:s.jsx("div",{className:"space-y-2",children:y.map(_=>s.jsx(XJ,{rung:_,disabled:a,statusSelect:I,fieldOptions:u,registry:l,onUpdate:z=>v(_.rowKey,z),onRemove:()=>w(_.rowKey)},_.rowKey))})})}),s.jsxs("button",{type:"button",onClick:b,disabled:a,className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(Tt,{className:"h-3 w-3"}),"Add rung"]})]}),s.jsxs("div",{className:"mt-5 space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Disposition (first match wins)"}),s.jsx("div",{className:"space-y-2",children:e.disposition.map(_=>_.when===null?s.jsxs("div",{className:"surface-panel flex items-center gap-3 px-3 py-2",children:[s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:"otherwise"}),s.jsx("span",{className:"text-sm text-muted-foreground",children:"is"}),s.jsx("select",{value:_.is,onChange:z=>N(_.rowKey,{is:z.target.value}),disabled:a,className:`${A} font-mono`,children:PC.map(z=>s.jsx("option",{value:z,children:z},z))})]},_.rowKey):s.jsxs("div",{className:"surface-panel flex flex-wrap items-start gap-3 px-3 py-2",children:[s.jsx("div",{className:"min-w-[14rem] flex-1",children:s.jsx(C_,{value:_.when,onChange:z=>N(_.rowKey,{when:z}),fieldOptions:u,registry:l,disabled:a})}),s.jsxs("div",{className:"flex items-center gap-2 pt-5",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"is"}),s.jsx("select",{value:_.is,onChange:z=>N(_.rowKey,{is:z.target.value}),disabled:a,className:`${A} font-mono`,children:PC.map(z=>s.jsx("option",{value:z,children:z},z))}),s.jsx("button",{type:"button",onClick:()=>R(_.rowKey),disabled:a,className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove disposition rule",children:s.jsx(fn,{className:"h-3.5 w-3.5"})})]})]},_.rowKey))}),s.jsxs("button",{type:"button",onClick:C,disabled:a,className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(Tt,{className:"h-3 w-3"}),"Add disposition rule"]})]}),s.jsxs("div",{className:"mt-5 space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Headline projection"}),s.jsxs("div",{className:"surface-panel grid grid-cols-1 gap-3 px-3 py-2 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"When parked, show"}),I(e.headline.parked,_=>T("parked",_),"Parked headline status")]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"When blocked, show"}),I(e.headline.blocked,_=>T("blocked",_),"Blocked headline status")]}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:["Terminal statuses: ",s.jsx("span",{className:"font-mono",children:"passthrough"})]}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:["Active: ",s.jsx("span",{className:"font-mono",children:"phase"})]})]})]})]})}function XJ({rung:e,disabled:t,statusSelect:n,fieldOptions:r,registry:o,onUpdate:i,onRemove:a}){const{attributes:l,listeners:u,setNodeRef:f,setActivatorNodeRef:p,transform:h,transition:g,isDragging:y}=Dm({id:e.rowKey}),k={transform:js.Transform.toString(h),transition:g,zIndex:y?50:void 0,position:y?"relative":void 0};return s.jsxs("div",{ref:f,style:k,className:`surface-panel flex flex-wrap items-start gap-3 px-3 py-2 ${y?"opacity-60 shadow-lg":""}`,children:[s.jsx("button",{ref:p,...l,...u,type:"button","aria-label":"Drag to reorder rung",className:"mt-1 cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:s.jsx(wc,{className:"h-4 w-4"})}),s.jsxs("div",{className:"min-w-[10rem] space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"Phase"}),n(e.phase,v=>i({phase:v}),"Rung phase")]}),s.jsx("div",{className:"min-w-[14rem] flex-1",children:s.jsx(C_,{value:e.when,onChange:v=>i({when:v}),fieldOptions:r,registry:o,disabled:t})}),s.jsxs("div",{className:"min-w-[12rem] flex-1 space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),s.jsx("input",{type:"text",value:e.next,onChange:v=>i({next:v.target.value}),disabled:t,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"})]}),s.jsx("button",{type:"button",onClick:a,disabled:t,className:"mt-5 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove rung",children:s.jsx(fn,{className:"h-3.5 w-3.5"})})]})}const QJ=new Map([["pending:start","in_progress"],["pending:block","blocked"],["draft:shape","ready_for_planning"],["draft:start","in_progress"],["ready_for_planning:plan-ready","ready_to_implement"],["ready_for_planning:start","in_progress"],["ready_to_implement:implement","in_progress"],["in_progress:block","blocked"],["in_progress:review","review"],["in_progress:complete","completed"],["in_progress:fail","failed"],["blocked:unblock","in_progress"],["review:start","in_progress"],["review:complete","completed"],["review:fail","failed"],["completed:reopen","in_progress"],["failed:reopen","in_progress"]]);let _C=0;function B0(){return _C+=1,`tr_${_C}_${Math.random().toString(36).slice(2,8)}`}function JJ(e){return{rowKey:B0(),from:e.from,command:e.command,to:e.to,label:e.label??"",description:e.description??"",requiresReason:e.requiresReason??!1}}function Nv(e){return e.map(JJ)}function ZJ(e){const t={from:e.from,command:e.command,to:e.to};return e.label.trim()&&(t.label=e.label.trim()),e.description.trim()&&(t.description=e.description.trim()),e.requiresReason&&(t.requiresReason=!0),t}function eZ(e){return e.map(ZJ)}function T_(){const e=[];for(const[t,n]of QJ){const r=t.indexOf(":");e.push({from:t.slice(0,r),command:t.slice(r+1),to:n})}return e}function tZ(e,t){return e.filter(n=>t.has(n.from)&&t.has(n.to))}function nZ(e){const t=[],n=new Map;for(const r of e){let o=n.get(r.from);o||(o={from:r.from,rows:[]},n.set(r.from,o),t.push(o)),o.rows.push(r)}return t}function R_(e,t){const n=[];for(const r of e)t.has(r.from)||n.push(`transition ${r.from} --${r.command}--> ${r.to}: "${r.from}" is not a defined status`),t.has(r.to)||n.push(`transition ${r.from} --${r.command}--> ${r.to}: "${r.to}" is not a defined status`);return n}function A_(e,t){var i;const n=(i=t[0])==null?void 0:i.id,r=new Set;for(const a of e)a.to&&r.add(a.to);const o=new Set;for(const a of t)a.id!==n&&(r.has(a.id)||o.add(a.id));return o}function rZ(e,t){const n=[];for(const r of e){const o=new Set;t.has(r.from)||o.add(r.from),t.has(r.to)||o.add(r.to),o.size&&n.push({rowKey:r.rowKey,missing:[...o]})}return n}function sZ(e,t){const n=new Set(t.map(l=>l.id)),r=A_(e,t),o=[],i=new Set;for(const l of t)i.has(l.id)||(i.add(l.id),o.push({id:l.id,label:l.label,color:l.color,terminal:l.terminal??!1,orphan:r.has(l.id),missing:!1}));for(const l of e)for(const u of[l.from,l.to])u&&!i.has(u)&&(i.add(u),o.push({id:u,label:u,terminal:!1,orphan:!1,missing:!0}));const a=e.map(l=>({rowKey:l.rowKey,from:l.from,to:l.to,command:l.command,label:l.label,requiresReason:l.requiresReason,undefinedRef:!n.has(l.from)||!n.has(l.to)}));return{nodes:o,edges:a}}function oZ(e,t){const n=new Set(t.map(l=>l.id)),r=new Map(t.map(l=>[l.id,l.label])),o=new Map(e.map(l=>[l.rowKey,l])),i=[];for(const l of rZ(e,n)){const u=o.get(l.rowKey);for(const f of l.missing)i.push({kind:"undefined-ref",rowKey:l.rowKey,statusId:f,message:u?`Transition ${u.from} --${u.command}--> ${u.to} references undefined status "${f}"`:`Transition references undefined status "${f}"`})}const a=A_(e,t);for(const l of t)a.has(l.id)&&i.push({kind:"orphan-status",statusId:l.id,message:`Status "${r.get(l.id)??l.id}" has no incoming transition`});return i}function Rn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=Rn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var iZ={value:()=>{}};function ag(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new sh(n)}function sh(e){this._=e}function aZ(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}sh.prototype=ag.prototype={constructor:sh,on:function(e,t){var n=this._,r=aZ(e+"",n),o,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((o=(e=r[i]).type)&&(o=lZ(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(o=(e=r[i]).type)n[o]=DC(n[o],e.name,t);else if(t==null)for(o in n)n[o]=DC(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new sh(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function lZ(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function DC(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=iZ,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Sv="http://www.w3.org/1999/xhtml";const $C={svg:"http://www.w3.org/2000/svg",xhtml:Sv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function lg(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),$C.hasOwnProperty(t)?{space:$C[t],local:e}:e}function cZ(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Sv&&t.documentElement.namespaceURI===Sv?t.createElement(e):t.createElementNS(n,e)}}function uZ(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function P_(e){var t=lg(e);return(t.local?uZ:cZ)(t)}function dZ(){}function U0(e){return e==null?dZ:function(){return this.querySelector(e)}}function fZ(e){typeof e!="function"&&(e=U0(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,l=r[o]=new Array(a),u,f,p=0;p<a;++p)(u=i[p])&&(f=e.call(u,u.__data__,p,i))&&("__data__"in u&&(f.__data__=u.__data__),l[p]=f);return new Ur(r,this._parents)}function pZ(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function hZ(){return[]}function __(e){return e==null?hZ:function(){return this.querySelectorAll(e)}}function mZ(e){return function(){return pZ(e.apply(this,arguments))}}function gZ(e){typeof e=="function"?e=mZ(e):e=__(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var a=t[i],l=a.length,u,f=0;f<l;++f)(u=a[f])&&(r.push(e.call(u,u.__data__,f,a)),o.push(u));return new Ur(r,o)}function D_(e){return function(){return this.matches(e)}}function $_(e){return function(t){return t.matches(e)}}var xZ=Array.prototype.find;function yZ(e){return function(){return xZ.call(this.children,e)}}function bZ(){return this.firstElementChild}function vZ(e){return this.select(e==null?bZ:yZ(typeof e=="function"?e:$_(e)))}var wZ=Array.prototype.filter;function jZ(){return Array.from(this.children)}function kZ(e){return function(){return wZ.call(this.children,e)}}function NZ(e){return this.selectAll(e==null?jZ:kZ(typeof e=="function"?e:$_(e)))}function SZ(e){typeof e!="function"&&(e=D_(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,l=r[o]=[],u,f=0;f<a;++f)(u=i[f])&&e.call(u,u.__data__,f,i)&&l.push(u);return new Ur(r,this._parents)}function I_(e){return new Array(e.length)}function CZ(){return new Ur(this._enter||this._groups.map(I_),this._parents)}function Hh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Hh.prototype={constructor:Hh,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function EZ(e){return function(){return e}}function TZ(e,t,n,r,o,i){for(var a=0,l,u=t.length,f=i.length;a<f;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Hh(e,i[a]);for(;a<u;++a)(l=t[a])&&(o[a]=l)}function RZ(e,t,n,r,o,i,a){var l,u,f=new Map,p=t.length,h=i.length,g=new Array(p),y;for(l=0;l<p;++l)(u=t[l])&&(g[l]=y=a.call(u,u.__data__,l,t)+"",f.has(y)?o[l]=u:f.set(y,u));for(l=0;l<h;++l)y=a.call(e,i[l],l,i)+"",(u=f.get(y))?(r[l]=u,u.__data__=i[l],f.delete(y)):n[l]=new Hh(e,i[l]);for(l=0;l<p;++l)(u=t[l])&&f.get(g[l])===u&&(o[l]=u)}function AZ(e){return e.__data__}function PZ(e,t){if(!arguments.length)return Array.from(this,AZ);var n=t?RZ:TZ,r=this._parents,o=this._groups;typeof e!="function"&&(e=EZ(e));for(var i=o.length,a=new Array(i),l=new Array(i),u=new Array(i),f=0;f<i;++f){var p=r[f],h=o[f],g=h.length,y=_Z(e.call(p,p&&p.__data__,f,r)),k=y.length,v=l[f]=new Array(k),b=a[f]=new Array(k),w=u[f]=new Array(g);n(p,h,v,b,w,y,t);for(var S=0,N=0,C,R;S<k;++S)if(C=v[S]){for(S>=N&&(N=S+1);!(R=b[N])&&++N<k;);C._next=R||null}}return a=new Ur(a,r),a._enter=l,a._exit=u,a}function _Z(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function DZ(){return new Ur(this._exit||this._groups.map(I_),this._parents)}function $Z(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function IZ(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,a=Math.min(o,i),l=new Array(o),u=0;u<a;++u)for(var f=n[u],p=r[u],h=f.length,g=l[u]=new Array(h),y,k=0;k<h;++k)(y=f[k]||p[k])&&(g[k]=y);for(;u<o;++u)l[u]=n[u];return new Ur(l,this._parents)}function MZ(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],a;--o>=0;)(a=r[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function LZ(e){e||(e=OZ);function t(h,g){return h&&g?e(h.__data__,g.__data__):!h-!g}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a=n[i],l=a.length,u=o[i]=new Array(l),f,p=0;p<l;++p)(f=a[p])&&(u[p]=f);u.sort(t)}return new Ur(o,this._parents).order()}function OZ(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function FZ(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function zZ(){return Array.from(this)}function BZ(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null}function UZ(){let e=0;for(const t of this)++e;return e}function HZ(){return!this.node()}function VZ(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,a=o.length,l;i<a;++i)(l=o[i])&&e.call(l,l.__data__,i,o);return this}function WZ(e){return function(){this.removeAttribute(e)}}function KZ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qZ(e,t){return function(){this.setAttribute(e,t)}}function GZ(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function YZ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function XZ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function QZ(e,t){var n=lg(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?KZ:WZ:typeof t=="function"?n.local?XZ:YZ:n.local?GZ:qZ)(n,t))}function M_(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function JZ(e){return function(){this.style.removeProperty(e)}}function ZZ(e,t,n){return function(){this.style.setProperty(e,t,n)}}function eee(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function tee(e,t,n){return arguments.length>1?this.each((t==null?JZ:typeof t=="function"?eee:ZZ)(e,t,n??"")):lc(this.node(),e)}function lc(e,t){return e.style.getPropertyValue(t)||M_(e).getComputedStyle(e,null).getPropertyValue(t)}function nee(e){return function(){delete this[e]}}function ree(e,t){return function(){this[e]=t}}function see(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function oee(e,t){return arguments.length>1?this.each((t==null?nee:typeof t=="function"?see:ree)(e,t)):this.node()[e]}function L_(e){return e.trim().split(/^|\s+/)}function H0(e){return e.classList||new O_(e)}function O_(e){this._node=e,this._names=L_(e.getAttribute("class")||"")}O_.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function F_(e,t){for(var n=H0(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function z_(e,t){for(var n=H0(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function iee(e){return function(){F_(this,e)}}function aee(e){return function(){z_(this,e)}}function lee(e,t){return function(){(t.apply(this,arguments)?F_:z_)(this,e)}}function cee(e,t){var n=L_(e+"");if(arguments.length<2){for(var r=H0(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?lee:t?iee:aee)(n,t))}function uee(){this.textContent=""}function dee(e){return function(){this.textContent=e}}function fee(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function pee(e){return arguments.length?this.each(e==null?uee:(typeof e=="function"?fee:dee)(e)):this.node().textContent}function hee(){this.innerHTML=""}function mee(e){return function(){this.innerHTML=e}}function gee(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function xee(e){return arguments.length?this.each(e==null?hee:(typeof e=="function"?gee:mee)(e)):this.node().innerHTML}function yee(){this.nextSibling&&this.parentNode.appendChild(this)}function bee(){return this.each(yee)}function vee(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wee(){return this.each(vee)}function jee(e){var t=typeof e=="function"?e:P_(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function kee(){return null}function Nee(e,t){var n=typeof e=="function"?e:P_(e),r=t==null?kee:typeof t=="function"?t:U0(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function See(){var e=this.parentNode;e&&e.removeChild(this)}function Cee(){return this.each(See)}function Eee(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tee(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ree(e){return this.select(e?Tee:Eee)}function Aee(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Pee(e){return function(t){e.call(this,t,this.__data__)}}function _ee(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Dee(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function $ee(e,t,n){return function(){var r=this.__on,o,i=Pee(t);if(r){for(var a=0,l=r.length;a<l;++a)if((o=r[a]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Iee(e,t,n){var r=_ee(e+""),o,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,f=l.length,p;u<f;++u)for(o=0,p=l[u];o<i;++o)if((a=r[o]).type===p.type&&a.name===p.name)return p.value}return}for(l=t?$ee:Dee,o=0;o<i;++o)this.each(l(r[o],t,n));return this}function B_(e,t,n){var r=M_(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Mee(e,t){return function(){return B_(this,e,t)}}function Lee(e,t){return function(){return B_(this,e,t.apply(this,arguments))}}function Oee(e,t){return this.each((typeof t=="function"?Lee:Mee)(e,t))}function*Fee(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,a;o<i;++o)(a=r[o])&&(yield a)}var U_=[null];function Ur(e,t){this._groups=e,this._parents=t}function nf(){return new Ur([[document.documentElement]],U_)}function zee(){return this}Ur.prototype=nf.prototype={constructor:Ur,select:fZ,selectAll:gZ,selectChild:vZ,selectChildren:NZ,filter:SZ,data:PZ,enter:CZ,exit:DZ,join:$Z,merge:IZ,selection:zee,order:MZ,sort:LZ,call:FZ,nodes:zZ,node:BZ,size:UZ,empty:HZ,each:VZ,attr:QZ,style:tee,property:oee,classed:cee,text:pee,html:xee,raise:bee,lower:wee,append:jee,insert:Nee,remove:Cee,clone:Ree,datum:Aee,on:Iee,dispatch:Oee,[Symbol.iterator]:Fee};function Fr(e){return typeof e=="string"?new Ur([[document.querySelector(e)]],[document.documentElement]):new Ur([[e]],U_)}function Bee(e){let t;for(;t=e.sourceEvent;)e=t;return e}function hs(e,t){if(e=Bee(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Uee={passive:!1},kd={capture:!0,passive:!1};function sb(e){e.stopImmediatePropagation()}function Jl(e){e.preventDefault(),e.stopImmediatePropagation()}function H_(e){var t=e.document.documentElement,n=Fr(e).on("dragstart.drag",Jl,kd);"onselectstart"in t?n.on("selectstart.drag",Jl,kd):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function V_(e,t){var n=e.document.documentElement,r=Fr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Jl,kd),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Tp=e=>()=>e;function Cv(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:a,y:l,dx:u,dy:f,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:p}})}Cv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Hee(e){return!e.ctrlKey&&!e.button}function Vee(){return this.parentNode}function Wee(e,t){return t??{x:e.x,y:e.y}}function Kee(){return navigator.maxTouchPoints||"ontouchstart"in this}function W_(){var e=Hee,t=Vee,n=Wee,r=Kee,o={},i=ag("start","drag","end"),a=0,l,u,f,p,h=0;function g(C){C.on("mousedown.drag",y).filter(r).on("touchstart.drag",b).on("touchmove.drag",w,Uee).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(C,R){if(!(p||!e.call(this,C,R))){var T=N(this,t.call(this,C,R),C,R,"mouse");T&&(Fr(C.view).on("mousemove.drag",k,kd).on("mouseup.drag",v,kd),H_(C.view),sb(C),f=!1,l=C.clientX,u=C.clientY,T("start",C))}}function k(C){if(Jl(C),!f){var R=C.clientX-l,T=C.clientY-u;f=R*R+T*T>h}o.mouse("drag",C)}function v(C){Fr(C.view).on("mousemove.drag mouseup.drag",null),V_(C.view,f),Jl(C),o.mouse("end",C)}function b(C,R){if(e.call(this,C,R)){var T=C.changedTouches,A=t.call(this,C,R),I=T.length,_,z;for(_=0;_<I;++_)(z=N(this,A,C,R,T[_].identifier,T[_]))&&(sb(C),z("start",C,T[_]))}}function w(C){var R=C.changedTouches,T=R.length,A,I;for(A=0;A<T;++A)(I=o[R[A].identifier])&&(Jl(C),I("drag",C,R[A]))}function S(C){var R=C.changedTouches,T=R.length,A,I;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),A=0;A<T;++A)(I=o[R[A].identifier])&&(sb(C),I("end",C,R[A]))}function N(C,R,T,A,I,_){var z=i.copy(),O=hs(_||T,R),B,V,$;if(($=n.call(C,new Cv("beforestart",{sourceEvent:T,target:g,identifier:I,active:a,x:O[0],y:O[1],dx:0,dy:0,dispatch:z}),A))!=null)return B=$.x-O[0]||0,V=$.y-O[1]||0,function L(U,K,D){var W=O,M;switch(U){case"start":o[I]=L,M=a++;break;case"end":delete o[I],--a;case"drag":O=hs(D||K,R),M=a;break}z.call(U,C,new Cv(U,{sourceEvent:K,subject:$,target:g,identifier:I,active:M,x:O[0]+B,y:O[1]+V,dx:O[0]-W[0],dy:O[1]-W[1],dispatch:z}),A)}}return g.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Tp(!!C),g):e},g.container=function(C){return arguments.length?(t=typeof C=="function"?C:Tp(C),g):t},g.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Tp(C),g):n},g.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:Tp(!!C),g):r},g.on=function(){var C=i.on.apply(i,arguments);return C===i?g:C},g.clickDistance=function(C){return arguments.length?(h=(C=+C)*C,g):Math.sqrt(h)},g}function V0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function K_(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function rf(){}var Nd=.7,Vh=1/Nd,Zl="\\s*([+-]?\\d+)\\s*",Sd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",no="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",qee=/^#([0-9a-f]{3,8})$/,Gee=new RegExp(`^rgb\\(${Zl},${Zl},${Zl}\\)$`),Yee=new RegExp(`^rgb\\(${no},${no},${no}\\)$`),Xee=new RegExp(`^rgba\\(${Zl},${Zl},${Zl},${Sd}\\)$`),Qee=new RegExp(`^rgba\\(${no},${no},${no},${Sd}\\)$`),Jee=new RegExp(`^hsl\\(${Sd},${no},${no}\\)$`),Zee=new RegExp(`^hsla\\(${Sd},${no},${no},${Sd}\\)$`),IC={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};V0(rf,Na,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:MC,formatHex:MC,formatHex8:ete,formatHsl:tte,formatRgb:LC,toString:LC});function MC(){return this.rgb().formatHex()}function ete(){return this.rgb().formatHex8()}function tte(){return q_(this).formatHsl()}function LC(){return this.rgb().formatRgb()}function Na(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=qee.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?OC(t):n===3?new wr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Rp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Rp(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Gee.exec(e))?new wr(t[1],t[2],t[3],1):(t=Yee.exec(e))?new wr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Xee.exec(e))?Rp(t[1],t[2],t[3],t[4]):(t=Qee.exec(e))?Rp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Jee.exec(e))?BC(t[1],t[2]/100,t[3]/100,1):(t=Zee.exec(e))?BC(t[1],t[2]/100,t[3]/100,t[4]):IC.hasOwnProperty(e)?OC(IC[e]):e==="transparent"?new wr(NaN,NaN,NaN,0):null}function OC(e){return new wr(e>>16&255,e>>8&255,e&255,1)}function Rp(e,t,n,r){return r<=0&&(e=t=n=NaN),new wr(e,t,n,r)}function nte(e){return e instanceof rf||(e=Na(e)),e?(e=e.rgb(),new wr(e.r,e.g,e.b,e.opacity)):new wr}function Ev(e,t,n,r){return arguments.length===1?nte(e):new wr(e,t,n,r??1)}function wr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}V0(wr,Ev,K_(rf,{brighter(e){return e=e==null?Vh:Math.pow(Vh,e),new wr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Nd:Math.pow(Nd,e),new wr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wr(ba(this.r),ba(this.g),ba(this.b),Wh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:FC,formatHex:FC,formatHex8:rte,formatRgb:zC,toString:zC}));function FC(){return`#${fa(this.r)}${fa(this.g)}${fa(this.b)}`}function rte(){return`#${fa(this.r)}${fa(this.g)}${fa(this.b)}${fa((isNaN(this.opacity)?1:this.opacity)*255)}`}function zC(){const e=Wh(this.opacity);return`${e===1?"rgb(":"rgba("}${ba(this.r)}, ${ba(this.g)}, ${ba(this.b)}${e===1?")":`, ${e})`}`}function Wh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ba(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function fa(e){return e=ba(e),(e<16?"0":"")+e.toString(16)}function BC(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ms(e,t,n,r)}function q_(e){if(e instanceof ms)return new ms(e.h,e.s,e.l,e.opacity);if(e instanceof rf||(e=Na(e)),!e)return new ms;if(e instanceof ms)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,l=i-o,u=(i+o)/2;return l?(t===i?a=(n-r)/l+(n<r)*6:n===i?a=(r-t)/l+2:a=(t-n)/l+4,l/=u<.5?i+o:2-i-o,a*=60):l=u>0&&u<1?0:a,new ms(a,l,u,e.opacity)}function ste(e,t,n,r){return arguments.length===1?q_(e):new ms(e,t,n,r??1)}function ms(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}V0(ms,ste,K_(rf,{brighter(e){return e=e==null?Vh:Math.pow(Vh,e),new ms(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Nd:Math.pow(Nd,e),new ms(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new wr(ob(e>=240?e-240:e+120,o,r),ob(e,o,r),ob(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new ms(UC(this.h),Ap(this.s),Ap(this.l),Wh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Wh(this.opacity);return`${e===1?"hsl(":"hsla("}${UC(this.h)}, ${Ap(this.s)*100}%, ${Ap(this.l)*100}%${e===1?")":`, ${e})`}`}}));function UC(e){return e=(e||0)%360,e<0?e+360:e}function Ap(e){return Math.max(0,Math.min(1,e||0))}function ob(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const cg=e=>()=>e;function G_(e,t){return function(n){return e+n*t}}function ote(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function wce(e,t){var n=t-e;return n?G_(e,n>180||n<-180?n-360*Math.round(n/360):n):cg(isNaN(e)?t:e)}function ite(e){return(e=+e)==1?Y_:function(t,n){return n-t?ote(t,n,e):cg(isNaN(t)?n:t)}}function Y_(e,t){var n=t-e;return n?G_(e,n):cg(isNaN(e)?t:e)}const Kh=(function e(t){var n=ite(t);function r(o,i){var a=n((o=Ev(o)).r,(i=Ev(i)).r),l=n(o.g,i.g),u=n(o.b,i.b),f=Y_(o.opacity,i.opacity);return function(p){return o.r=a(p),o.g=l(p),o.b=u(p),o.opacity=f(p),o+""}}return r.gamma=e,r})(1);function ate(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function lte(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function cte(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),a;for(a=0;a<r;++a)o[a]=sd(e[a],t[a]);for(;a<n;++a)i[a]=t[a];return function(l){for(a=0;a<r;++a)i[a]=o[a](l);return i}}function ute(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function qs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function dte(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=sd(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Tv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ib=new RegExp(Tv.source,"g");function fte(e){return function(){return e}}function pte(e){return function(t){return e(t)+""}}function X_(e,t){var n=Tv.lastIndex=ib.lastIndex=0,r,o,i,a=-1,l=[],u=[];for(e=e+"",t=t+"";(r=Tv.exec(e))&&(o=ib.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(r=r[0])===(o=o[0])?l[a]?l[a]+=o:l[++a]=o:(l[++a]=null,u.push({i:a,x:qs(r,o)})),n=ib.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?u[0]?pte(u[0].x):fte(t):(t=u.length,function(f){for(var p=0,h;p<t;++p)l[(h=u[p]).i]=h.x(f);return l.join("")})}function sd(e,t){var n=typeof t,r;return t==null||n==="boolean"?cg(t):(n==="number"?qs:n==="string"?(r=Na(t))?(t=r,Kh):X_:t instanceof Na?Kh:t instanceof Date?ute:lte(t)?ate:Array.isArray(t)?cte:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?dte:qs)(e,t)}var HC=180/Math.PI,Rv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Q_(e,t,n,r,o,i){var a,l,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*n+t*r)&&(n-=e*u,r-=t*u),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,u/=l),e*r<t*n&&(e=-e,t=-t,u=-u,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*HC,skewX:Math.atan(u)*HC,scaleX:a,scaleY:l}}var Pp;function hte(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rv:Q_(t.a,t.b,t.c,t.d,t.e,t.f)}function mte(e){return e==null||(Pp||(Pp=document.createElementNS("http://www.w3.org/2000/svg","g")),Pp.setAttribute("transform",e),!(e=Pp.transform.baseVal.consolidate()))?Rv:(e=e.matrix,Q_(e.a,e.b,e.c,e.d,e.e,e.f))}function J_(e,t,n,r){function o(f){return f.length?f.pop()+" ":""}function i(f,p,h,g,y,k){if(f!==h||p!==g){var v=y.push("translate(",null,t,null,n);k.push({i:v-4,x:qs(f,h)},{i:v-2,x:qs(p,g)})}else(h||g)&&y.push("translate("+h+t+g+n)}function a(f,p,h,g){f!==p?(f-p>180?p+=360:p-f>180&&(f+=360),g.push({i:h.push(o(h)+"rotate(",null,r)-2,x:qs(f,p)})):p&&h.push(o(h)+"rotate("+p+r)}function l(f,p,h,g){f!==p?g.push({i:h.push(o(h)+"skewX(",null,r)-2,x:qs(f,p)}):p&&h.push(o(h)+"skewX("+p+r)}function u(f,p,h,g,y,k){if(f!==h||p!==g){var v=y.push(o(y)+"scale(",null,",",null,")");k.push({i:v-4,x:qs(f,h)},{i:v-2,x:qs(p,g)})}else(h!==1||g!==1)&&y.push(o(y)+"scale("+h+","+g+")")}return function(f,p){var h=[],g=[];return f=e(f),p=e(p),i(f.translateX,f.translateY,p.translateX,p.translateY,h,g),a(f.rotate,p.rotate,h,g),l(f.skewX,p.skewX,h,g),u(f.scaleX,f.scaleY,p.scaleX,p.scaleY,h,g),f=p=null,function(y){for(var k=-1,v=g.length,b;++k<v;)h[(b=g[k]).i]=b.x(y);return h.join("")}}}var gte=J_(hte,"px, ","px)","deg)"),xte=J_(mte,", ",")",")"),yte=1e-12;function VC(e){return((e=Math.exp(e))+1/e)/2}function bte(e){return((e=Math.exp(e))-1/e)/2}function vte(e){return((e=Math.exp(2*e))-1)/(e+1)}const oh=(function e(t,n,r){function o(i,a){var l=i[0],u=i[1],f=i[2],p=a[0],h=a[1],g=a[2],y=p-l,k=h-u,v=y*y+k*k,b,w;if(v<yte)w=Math.log(g/f)/t,b=function(A){return[l+A*y,u+A*k,f*Math.exp(t*A*w)]};else{var S=Math.sqrt(v),N=(g*g-f*f+r*v)/(2*f*n*S),C=(g*g-f*f-r*v)/(2*g*n*S),R=Math.log(Math.sqrt(N*N+1)-N),T=Math.log(Math.sqrt(C*C+1)-C);w=(T-R)/t,b=function(A){var I=A*w,_=VC(R),z=f/(n*S)*(_*vte(t*I+R)-bte(R));return[l+z*y,u+z*k,f*_/VC(t*I+R)]}}return b.duration=w*1e3*t/Math.SQRT2,b}return o.rho=function(i){var a=Math.max(.001,+i),l=a*a,u=l*l;return e(a,l,u)},o})(Math.SQRT2,2,4);var cc=0,Mu=0,Du=0,Z_=1e3,qh,Lu,Gh=0,Sa=0,ug=0,Cd=typeof performance=="object"&&performance.now?performance:Date,eD=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function W0(){return Sa||(eD(wte),Sa=Cd.now()+ug)}function wte(){Sa=0}function Yh(){this._call=this._time=this._next=null}Yh.prototype=tD.prototype={constructor:Yh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?W0():+n)+(t==null?0:+t),!this._next&&Lu!==this&&(Lu?Lu._next=this:qh=this,Lu=this),this._call=e,this._time=n,Av()},stop:function(){this._call&&(this._call=null,this._time=1/0,Av())}};function tD(e,t,n){var r=new Yh;return r.restart(e,t,n),r}function jte(){W0(),++cc;for(var e=qh,t;e;)(t=Sa-e._time)>=0&&e._call.call(void 0,t),e=e._next;--cc}function WC(){Sa=(Gh=Cd.now())+ug,cc=Mu=0;try{jte()}finally{cc=0,Nte(),Sa=0}}function kte(){var e=Cd.now(),t=e-Gh;t>Z_&&(ug-=t,Gh=e)}function Nte(){for(var e,t=qh,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qh=n);Lu=e,Av(r)}function Av(e){if(!cc){Mu&&(Mu=clearTimeout(Mu));var t=e-Sa;t>24?(e<1/0&&(Mu=setTimeout(WC,e-Cd.now()-ug)),Du&&(Du=clearInterval(Du))):(Du||(Gh=Cd.now(),Du=setInterval(kte,Z_)),cc=1,eD(WC))}}function KC(e,t,n){var r=new Yh;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Ste=ag("start","end","cancel","interrupt"),Cte=[],nD=0,qC=1,Pv=2,ih=3,GC=4,_v=5,ah=6;function dg(e,t,n,r,o,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Ete(e,n,{name:t,index:r,group:o,on:Ste,tween:Cte,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:nD})}function K0(e,t){var n=Ps(e,t);if(n.state>nD)throw new Error("too late; already scheduled");return n}function ao(e,t){var n=Ps(e,t);if(n.state>ih)throw new Error("too late; already running");return n}function Ps(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ete(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=tD(i,0,n.time);function i(f){n.state=qC,n.timer.restart(a,n.delay,n.time),n.delay<=f&&a(f-n.delay)}function a(f){var p,h,g,y;if(n.state!==qC)return u();for(p in r)if(y=r[p],y.name===n.name){if(y.state===ih)return KC(a);y.state===GC?(y.state=ah,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[p]):+p<t&&(y.state=ah,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[p])}if(KC(function(){n.state===ih&&(n.state=GC,n.timer.restart(l,n.delay,n.time),l(f))}),n.state=Pv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Pv){for(n.state=ih,o=new Array(g=n.tween.length),p=0,h=-1;p<g;++p)(y=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(o[++h]=y);o.length=h+1}}function l(f){for(var p=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(u),n.state=_v,1),h=-1,g=o.length;++h<g;)o[h].call(e,p);n.state===_v&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=ah,n.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function lh(e,t){var n=e.__transition,r,o,i=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){i=!1;continue}o=r.state>Pv&&r.state<_v,r.state=ah,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function Tte(e){return this.each(function(){lh(this,e)})}function Rte(e,t){var n,r;return function(){var o=ao(this,e),i=o.tween;if(i!==n){r=n=i;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}o.tween=r}}function Ate(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=ao(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var l={name:t,value:n},u=0,f=o.length;u<f;++u)if(o[u].name===t){o[u]=l;break}u===f&&o.push(l)}i.tween=o}}function Pte(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ps(this.node(),n).tween,o=0,i=r.length,a;o<i;++o)if((a=r[o]).name===e)return a.value;return null}return this.each((t==null?Rte:Ate)(n,e,t))}function q0(e,t,n){var r=e._id;return e.each(function(){var o=ao(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Ps(o,r).value[t]}}function rD(e,t){var n;return(typeof t=="number"?qs:t instanceof Na?Kh:(n=Na(t))?(t=n,Kh):X_)(e,t)}function _te(e){return function(){this.removeAttribute(e)}}function Dte(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $te(e,t,n){var r,o=n+"",i;return function(){var a=this.getAttribute(e);return a===o?null:a===r?i:i=t(r=a,n)}}function Ite(e,t,n){var r,o=n+"",i;return function(){var a=this.getAttributeNS(e.space,e.local);return a===o?null:a===r?i:i=t(r=a,n)}}function Mte(e,t,n){var r,o,i;return function(){var a,l=n(this),u;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),u=l+"",a===u?null:a===r&&u===o?i:(o=u,i=t(r=a,l)))}}function Lte(e,t,n){var r,o,i;return function(){var a,l=n(this),u;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),u=l+"",a===u?null:a===r&&u===o?i:(o=u,i=t(r=a,l)))}}function Ote(e,t){var n=lg(e),r=n==="transform"?xte:rD;return this.attrTween(e,typeof t=="function"?(n.local?Lte:Mte)(n,r,q0(this,"attr."+e,t)):t==null?(n.local?Dte:_te)(n):(n.local?Ite:$te)(n,r,t))}function Fte(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function zte(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Bte(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&zte(e,i)),n}return o._value=t,o}function Ute(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Fte(e,i)),n}return o._value=t,o}function Hte(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=lg(e);return this.tween(n,(r.local?Bte:Ute)(r,t))}function Vte(e,t){return function(){K0(this,e).delay=+t.apply(this,arguments)}}function Wte(e,t){return t=+t,function(){K0(this,e).delay=t}}function Kte(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Vte:Wte)(t,e)):Ps(this.node(),t).delay}function qte(e,t){return function(){ao(this,e).duration=+t.apply(this,arguments)}}function Gte(e,t){return t=+t,function(){ao(this,e).duration=t}}function Yte(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?qte:Gte)(t,e)):Ps(this.node(),t).duration}function Xte(e,t){if(typeof t!="function")throw new Error;return function(){ao(this,e).ease=t}}function Qte(e){var t=this._id;return arguments.length?this.each(Xte(t,e)):Ps(this.node(),t).ease}function Jte(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ao(this,e).ease=n}}function Zte(e){if(typeof e!="function")throw new Error;return this.each(Jte(this._id,e))}function ene(e){typeof e!="function"&&(e=D_(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,l=r[o]=[],u,f=0;f<a;++f)(u=i[f])&&e.call(u,u.__data__,f,i)&&l.push(u);return new $o(r,this._parents,this._name,this._id)}function tne(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),a=new Array(r),l=0;l<i;++l)for(var u=t[l],f=n[l],p=u.length,h=a[l]=new Array(p),g,y=0;y<p;++y)(g=u[y]||f[y])&&(h[y]=g);for(;l<r;++l)a[l]=t[l];return new $o(a,this._parents,this._name,this._id)}function nne(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function rne(e,t,n){var r,o,i=nne(t)?K0:ao;return function(){var a=i(this,e),l=a.on;l!==r&&(o=(r=l).copy()).on(t,n),a.on=o}}function sne(e,t){var n=this._id;return arguments.length<2?Ps(this.node(),n).on.on(e):this.each(rne(n,e,t))}function one(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ine(){return this.on("end.remove",one(this._id))}function ane(e){var t=this._name,n=this._id;typeof e!="function"&&(e=U0(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var l=r[a],u=l.length,f=i[a]=new Array(u),p,h,g=0;g<u;++g)(p=l[g])&&(h=e.call(p,p.__data__,g,l))&&("__data__"in p&&(h.__data__=p.__data__),f[g]=h,dg(f[g],t,n,g,f,Ps(p,n)));return new $o(i,this._parents,t,n)}function lne(e){var t=this._name,n=this._id;typeof e!="function"&&(e=__(e));for(var r=this._groups,o=r.length,i=[],a=[],l=0;l<o;++l)for(var u=r[l],f=u.length,p,h=0;h<f;++h)if(p=u[h]){for(var g=e.call(p,p.__data__,h,u),y,k=Ps(p,n),v=0,b=g.length;v<b;++v)(y=g[v])&&dg(y,t,n,v,g,k);i.push(g),a.push(p)}return new $o(i,a,t,n)}var cne=nf.prototype.constructor;function une(){return new cne(this._groups,this._parents)}function dne(e,t){var n,r,o;return function(){var i=lc(this,e),a=(this.style.removeProperty(e),lc(this,e));return i===a?null:i===n&&a===r?o:o=t(n=i,r=a)}}function sD(e){return function(){this.style.removeProperty(e)}}function fne(e,t,n){var r,o=n+"",i;return function(){var a=lc(this,e);return a===o?null:a===r?i:i=t(r=a,n)}}function pne(e,t,n){var r,o,i;return function(){var a=lc(this,e),l=n(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(e),lc(this,e))),a===u?null:a===r&&u===o?i:(o=u,i=t(r=a,l))}}function hne(e,t){var n,r,o,i="style."+t,a="end."+i,l;return function(){var u=ao(this,e),f=u.on,p=u.value[i]==null?l||(l=sD(t)):void 0;(f!==n||o!==p)&&(r=(n=f).copy()).on(a,o=p),u.on=r}}function mne(e,t,n){var r=(e+="")=="transform"?gte:rD;return t==null?this.styleTween(e,dne(e,r)).on("end.style."+e,sD(e)):typeof t=="function"?this.styleTween(e,pne(e,r,q0(this,"style."+e,t))).each(hne(this._id,e)):this.styleTween(e,fne(e,r,t),n).on("end.style."+e,null)}function gne(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function xne(e,t,n){var r,o;function i(){var a=t.apply(this,arguments);return a!==o&&(r=(o=a)&&gne(e,a,n)),r}return i._value=t,i}function yne(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,xne(e,t,n??""))}function bne(e){return function(){this.textContent=e}}function vne(e){return function(){var t=e(this);this.textContent=t??""}}function wne(e){return this.tween("text",typeof e=="function"?vne(q0(this,"text",e)):bne(e==null?"":e+""))}function jne(e){return function(t){this.textContent=e.call(this,t)}}function kne(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&jne(o)),t}return r._value=e,r}function Nne(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,kne(e))}function Sne(){for(var e=this._name,t=this._id,n=oD(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a=r[i],l=a.length,u,f=0;f<l;++f)if(u=a[f]){var p=Ps(u,t);dg(u,e,n,f,a,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new $o(r,this._parents,e,n)}function Cne(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,a){var l={value:a},u={value:function(){--o===0&&i()}};n.each(function(){var f=ao(this,r),p=f.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(u)),f.on=t}),o===0&&i()})}var Ene=0;function $o(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function oD(){return++Ene}var So=nf.prototype;$o.prototype={constructor:$o,select:ane,selectAll:lne,selectChild:So.selectChild,selectChildren:So.selectChildren,filter:ene,merge:tne,selection:une,transition:Sne,call:So.call,nodes:So.nodes,node:So.node,size:So.size,empty:So.empty,each:So.each,on:sne,attr:Ote,attrTween:Hte,style:mne,styleTween:yne,text:wne,textTween:Nne,remove:ine,tween:Pte,delay:Kte,duration:Yte,ease:Qte,easeVarying:Zte,end:Cne,[Symbol.iterator]:So[Symbol.iterator]};function Tne(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Rne={time:null,delay:0,duration:250,ease:Tne};function Ane(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Pne(e){var t,n;e instanceof $o?(t=e._id,e=e._name):(t=oD(),(n=Rne).time=W0(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a=r[i],l=a.length,u,f=0;f<l;++f)(u=a[f])&&dg(u,e,t,f,a,n||Ane(u,t));return new $o(r,this._parents,e,t)}nf.prototype.interrupt=Tte;nf.prototype.transition=Pne;const _p=e=>()=>e;function _ne(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Ao(e,t,n){this.k=e,this.x=t,this.y=n}Ao.prototype={constructor:Ao,scale:function(e){return e===1?this:new Ao(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ao(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var fg=new Ao(1,0,0);iD.prototype=Ao.prototype;function iD(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fg;return e.__zoom}function ab(e){e.stopImmediatePropagation()}function $u(e){e.preventDefault(),e.stopImmediatePropagation()}function Dne(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function $ne(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function YC(){return this.__zoom||fg}function Ine(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Mne(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lne(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function aD(){var e=Dne,t=$ne,n=Lne,r=Ine,o=Mne,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,u=oh,f=ag("start","zoom","end"),p,h,g,y=500,k=150,v=0,b=10;function w($){$.property("__zoom",YC).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",_).on("dblclick.zoom",z).filter(o).on("touchstart.zoom",O).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function($,L,U,K){var D=$.selection?$.selection():$;D.property("__zoom",YC),$!==D?R($,L,U,K):D.interrupt().each(function(){T(this,arguments).event(K).start().zoom(null,typeof L=="function"?L.apply(this,arguments):L).end()})},w.scaleBy=function($,L,U,K){w.scaleTo($,function(){var D=this.__zoom.k,W=typeof L=="function"?L.apply(this,arguments):L;return D*W},U,K)},w.scaleTo=function($,L,U,K){w.transform($,function(){var D=t.apply(this,arguments),W=this.__zoom,M=U==null?C(D):typeof U=="function"?U.apply(this,arguments):U,F=W.invert(M),Y=typeof L=="function"?L.apply(this,arguments):L;return n(N(S(W,Y),M,F),D,a)},U,K)},w.translateBy=function($,L,U,K){w.transform($,function(){return n(this.__zoom.translate(typeof L=="function"?L.apply(this,arguments):L,typeof U=="function"?U.apply(this,arguments):U),t.apply(this,arguments),a)},null,K)},w.translateTo=function($,L,U,K,D){w.transform($,function(){var W=t.apply(this,arguments),M=this.__zoom,F=K==null?C(W):typeof K=="function"?K.apply(this,arguments):K;return n(fg.translate(F[0],F[1]).scale(M.k).translate(typeof L=="function"?-L.apply(this,arguments):-L,typeof U=="function"?-U.apply(this,arguments):-U),W,a)},K,D)};function S($,L){return L=Math.max(i[0],Math.min(i[1],L)),L===$.k?$:new Ao(L,$.x,$.y)}function N($,L,U){var K=L[0]-U[0]*$.k,D=L[1]-U[1]*$.k;return K===$.x&&D===$.y?$:new Ao($.k,K,D)}function C($){return[(+$[0][0]+ +$[1][0])/2,(+$[0][1]+ +$[1][1])/2]}function R($,L,U,K){$.on("start.zoom",function(){T(this,arguments).event(K).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(K).end()}).tween("zoom",function(){var D=this,W=arguments,M=T(D,W).event(K),F=t.apply(D,W),Y=U==null?C(F):typeof U=="function"?U.apply(D,W):U,H=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),Q=D.__zoom,J=typeof L=="function"?L.apply(D,W):L,Z=u(Q.invert(Y).concat(H/Q.k),J.invert(Y).concat(H/J.k));return function(oe){if(oe===1)oe=J;else{var te=Z(oe),ue=H/te[2];oe=new Ao(ue,Y[0]-te[0]*ue,Y[1]-te[1]*ue)}M.zoom(null,oe)}})}function T($,L,U){return!U&&$.__zooming||new A($,L)}function A($,L){this.that=$,this.args=L,this.active=0,this.sourceEvent=null,this.extent=t.apply($,L),this.taps=0}A.prototype={event:function($){return $&&(this.sourceEvent=$),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function($,L){return this.mouse&&$!=="mouse"&&(this.mouse[1]=L.invert(this.mouse[0])),this.touch0&&$!=="touch"&&(this.touch0[1]=L.invert(this.touch0[0])),this.touch1&&$!=="touch"&&(this.touch1[1]=L.invert(this.touch1[0])),this.that.__zoom=L,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function($){var L=Fr(this.that).datum();f.call($,this.that,new _ne($,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:f}),L)}};function I($,...L){if(!e.apply(this,arguments))return;var U=T(this,L).event($),K=this.__zoom,D=Math.max(i[0],Math.min(i[1],K.k*Math.pow(2,r.apply(this,arguments)))),W=hs($);if(U.wheel)(U.mouse[0][0]!==W[0]||U.mouse[0][1]!==W[1])&&(U.mouse[1]=K.invert(U.mouse[0]=W)),clearTimeout(U.wheel);else{if(K.k===D)return;U.mouse=[W,K.invert(W)],lh(this),U.start()}$u($),U.wheel=setTimeout(M,k),U.zoom("mouse",n(N(S(K,D),U.mouse[0],U.mouse[1]),U.extent,a));function M(){U.wheel=null,U.end()}}function _($,...L){if(g||!e.apply(this,arguments))return;var U=$.currentTarget,K=T(this,L,!0).event($),D=Fr($.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",H,!0),W=hs($,U),M=$.clientX,F=$.clientY;H_($.view),ab($),K.mouse=[W,this.__zoom.invert(W)],lh(this),K.start();function Y(Q){if($u(Q),!K.moved){var J=Q.clientX-M,Z=Q.clientY-F;K.moved=J*J+Z*Z>v}K.event(Q).zoom("mouse",n(N(K.that.__zoom,K.mouse[0]=hs(Q,U),K.mouse[1]),K.extent,a))}function H(Q){D.on("mousemove.zoom mouseup.zoom",null),V_(Q.view,K.moved),$u(Q),K.event(Q).end()}}function z($,...L){if(e.apply(this,arguments)){var U=this.__zoom,K=hs($.changedTouches?$.changedTouches[0]:$,this),D=U.invert(K),W=U.k*($.shiftKey?.5:2),M=n(N(S(U,W),K,D),t.apply(this,L),a);$u($),l>0?Fr(this).transition().duration(l).call(R,M,K,$):Fr(this).call(w.transform,M,K,$)}}function O($,...L){if(e.apply(this,arguments)){var U=$.touches,K=U.length,D=T(this,L,$.changedTouches.length===K).event($),W,M,F,Y;for(ab($),M=0;M<K;++M)F=U[M],Y=hs(F,this),Y=[Y,this.__zoom.invert(Y),F.identifier],D.touch0?!D.touch1&&D.touch0[2]!==Y[2]&&(D.touch1=Y,D.taps=0):(D.touch0=Y,W=!0,D.taps=1+!!p);p&&(p=clearTimeout(p)),W&&(D.taps<2&&(h=Y[0],p=setTimeout(function(){p=null},y)),lh(this),D.start())}}function B($,...L){if(this.__zooming){var U=T(this,L).event($),K=$.changedTouches,D=K.length,W,M,F,Y;for($u($),W=0;W<D;++W)M=K[W],F=hs(M,this),U.touch0&&U.touch0[2]===M.identifier?U.touch0[0]=F:U.touch1&&U.touch1[2]===M.identifier&&(U.touch1[0]=F);if(M=U.that.__zoom,U.touch1){var H=U.touch0[0],Q=U.touch0[1],J=U.touch1[0],Z=U.touch1[1],oe=(oe=J[0]-H[0])*oe+(oe=J[1]-H[1])*oe,te=(te=Z[0]-Q[0])*te+(te=Z[1]-Q[1])*te;M=S(M,Math.sqrt(oe/te)),F=[(H[0]+J[0])/2,(H[1]+J[1])/2],Y=[(Q[0]+Z[0])/2,(Q[1]+Z[1])/2]}else if(U.touch0)F=U.touch0[0],Y=U.touch0[1];else return;U.zoom("touch",n(N(M,F,Y),U.extent,a))}}function V($,...L){if(this.__zooming){var U=T(this,L).event($),K=$.changedTouches,D=K.length,W,M;for(ab($),g&&clearTimeout(g),g=setTimeout(function(){g=null},y),W=0;W<D;++W)M=K[W],U.touch0&&U.touch0[2]===M.identifier?delete U.touch0:U.touch1&&U.touch1[2]===M.identifier&&delete U.touch1;if(U.touch1&&!U.touch0&&(U.touch0=U.touch1,delete U.touch1),U.touch0)U.touch0[1]=this.__zoom.invert(U.touch0[0]);else if(U.end(),U.taps===2&&(M=hs(M,this),Math.hypot(h[0]-M[0],h[1]-M[1])<b)){var F=Fr(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return w.wheelDelta=function($){return arguments.length?(r=typeof $=="function"?$:_p(+$),w):r},w.filter=function($){return arguments.length?(e=typeof $=="function"?$:_p(!!$),w):e},w.touchable=function($){return arguments.length?(o=typeof $=="function"?$:_p(!!$),w):o},w.extent=function($){return arguments.length?(t=typeof $=="function"?$:_p([[+$[0][0],+$[0][1]],[+$[1][0],+$[1][1]]]),w):t},w.scaleExtent=function($){return arguments.length?(i[0]=+$[0],i[1]=+$[1],w):[i[0],i[1]]},w.translateExtent=function($){return arguments.length?(a[0][0]=+$[0][0],a[1][0]=+$[1][0],a[0][1]=+$[0][1],a[1][1]=+$[1][1],w):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},w.constrain=function($){return arguments.length?(n=$,w):n},w.duration=function($){return arguments.length?(l=+$,w):l},w.interpolate=function($){return arguments.length?(u=$,w):u},w.on=function(){var $=f.on.apply(f,arguments);return $===f?w:$},w.clickDistance=function($){return arguments.length?(v=($=+$)*$,w):Math.sqrt(v)},w.tapDistance=function($){return arguments.length?(b=+$,w):b},w}const Es={error001:(e="react")=>`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Ed=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],lD=["Enter"," ","Escape"],cD={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var uc;(function(e){e.Strict="strict",e.Loose="loose"})(uc||(uc={}));var va;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(va||(va={}));var Td;(function(e){e.Partial="partial",e.Full="full"})(Td||(Td={}));const uD={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var xi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(xi||(xi={}));var Xh;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Xh||(Xh={}));var ct;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ct||(ct={}));const XC={[ct.Left]:ct.Right,[ct.Right]:ct.Left,[ct.Top]:ct.Bottom,[ct.Bottom]:ct.Top};function dD(e){return e===null?null:e?"valid":"invalid"}const fD=e=>"id"in e&&"source"in e&&"target"in e,One=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),G0=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),sf=(e,t=[0,0])=>{const{width:n,height:r}=Lo(e),o=e.origin??t,i=n*o[0],a=r*o[1];return{x:e.position.x-i,y:e.position.y-a}},Fne=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let a=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(o):G0(o)?o:t.nodeLookup.get(o.id));const l=a?Qh(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return pg(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return hg(n)},of=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=pg(n,Qh(o)),r=!0)}),r?hg(n):{x:0,y:0,width:0,height:0}},Y0=(e,t,[n,r,o]=[0,0,1],i=!1,a=!1)=>{const l={...Fc(t,[n,r,o]),width:t.width/o,height:t.height/o},u=[];for(const f of e.values()){const{measured:p,selectable:h=!0,hidden:g=!1}=f;if(a&&!h||g)continue;const y=p.width??f.width??f.initialWidth??null,k=p.height??f.height??f.initialHeight??null,v=Rd(l,fc(f)),b=(y??0)*(k??0),w=i&&v>0;(!f.internals.handleBounds||w||v>=b||f.dragging)&&u.push(f)}return u},zne=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Bne(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Une({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},a){if(e.size===0)return!0;const l=Bne(e,a),u=of(l),f=Q0(u,t,n,(a==null?void 0:a.minZoom)??o,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(f,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function pD({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:u,y:f}=l?l.internals.positionAbsolute:{x:0,y:0},p=a.origin??r;let h=a.extent||o;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",Es.error005());else{const y=l.measured.width,k=l.measured.height;y&&k&&(h=[[u,f],[u+y,f+k]])}else l&&Ea(a.extent)&&(h=[[a.extent[0][0]+u,a.extent[0][1]+f],[a.extent[1][0]+u,a.extent[1][1]+f]]);const g=Ea(h)?Ca(t,h,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",Es.error015())),{position:{x:g.x-u+(a.measured.width??0)*p[0],y:g.y-f+(a.measured.height??0)*p[1]},positionAbsolute:g}}async function Hne({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(g=>g.id)),a=[];for(const g of n){if(g.deletable===!1)continue;const y=i.has(g.id),k=!y&&g.parentId&&a.find(v=>v.id===g.parentId);(y||k)&&a.push(g)}const l=new Set(t.map(g=>g.id)),u=r.filter(g=>g.deletable!==!1),p=zne(a,u);for(const g of u)l.has(g.id)&&!p.find(k=>k.id===g.id)&&p.push(g);if(!o)return{edges:p,nodes:a};const h=await o({nodes:a,edges:p});return typeof h=="boolean"?h?{edges:p,nodes:a}:{edges:[],nodes:[]}:h}const dc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ca=(e={x:0,y:0},t,n)=>({x:dc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:dc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function hD(e,t,n){const{width:r,height:o}=Lo(n),{x:i,y:a}=n.internals.positionAbsolute;return Ca(e,[[i,a],[i+r,a+o]],t)}const QC=(e,t,n)=>e<t?dc(Math.abs(e-t),1,t)/t:e>n?-dc(Math.abs(e-n),1,t)/t:0,X0=(e,t,n=15,r=40)=>{const o=QC(e.x,r,t.width-r)*n,i=QC(e.y,r,t.height-r)*n;return[o,i]},pg=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Dv=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),hg=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),fc=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=G0(e)?e.internals.positionAbsolute:sf(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Qh=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=G0(e)?e.internals.positionAbsolute:sf(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},mD=(e,t)=>hg(pg(Dv(e),Dv(t))),Rd=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},JC=e=>gs(e.width)&&gs(e.height)&&gs(e.x)&&gs(e.y),gs=e=>!isNaN(e)&&isFinite(e),gD=(e,t)=>(n,r)=>{},af=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Fc=({x:e,y:t},[n,r,o],i=!1,a=[1,1])=>{const l={x:(e-n)/o,y:(t-r)/o};return i?af(l,a):l},pc=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Al(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Vne(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Al(e,n),o=Al(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Al(e.top??e.y??0,n),o=Al(e.bottom??e.y??0,n),i=Al(e.left??e.x??0,t),a=Al(e.right??e.x??0,t);return{top:r,right:a,bottom:o,left:i,x:i+a,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Wne(e,t,n,r,o,i){const{x:a,y:l}=pc(e,[t,n,r]),{x:u,y:f}=pc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=o-u,h=i-f;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(h)}}const Q0=(e,t,n,r,o,i)=>{const a=Vne(i,t,n),l=(t-a.x)/e.width,u=(n-a.y)/e.height,f=Math.min(l,u),p=dc(f,r,o),h=e.x+e.width/2,g=e.y+e.height/2,y=t/2-h*p,k=n/2-g*p,v=Wne(e,y,k,p,t,n),b={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:y-b.left+b.right,y:k-b.top+b.bottom,zoom:p}},Ad=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ea(e){return e!=null&&e!=="parent"}function Lo(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function xD(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function yD(e,t={width:0,height:0},n,r,o){const i={...e},a=r.get(n);if(a){const l=a.origin||o;i.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function ZC(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Kne(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function qne(e){return{...cD,...e||{}}}function od(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:a}=xs(e),l=Fc({x:i-((o==null?void 0:o.left)??0),y:a-((o==null?void 0:o.top)??0)},r),{x:u,y:f}=n?af(l,t):l;return{xSnapped:u,ySnapped:f,...l}}const J0=e=>({width:e.offsetWidth,height:e.offsetHeight}),bD=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Gne=["INPUT","SELECT","TEXTAREA"];function vD(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Gne.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const wD=e=>"clientX"in e,xs=(e,t)=>{var i,a;const n=wD(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},eE=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:o,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...J0(a)}})};function jD({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:a,targetControlY:l}){const u=e*.125+o*.375+a*.375+n*.125,f=t*.125+i*.375+l*.375+r*.125,p=Math.abs(u-e),h=Math.abs(f-t);return[u,f,p,h]}function Dp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function tE({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case ct.Left:return[t-Dp(t-r,i),n];case ct.Right:return[t+Dp(r-t,i),n];case ct.Top:return[t,n-Dp(n-o,i)];case ct.Bottom:return[t,n+Dp(o-n,i)]}}function Z0({sourceX:e,sourceY:t,sourcePosition:n=ct.Bottom,targetX:r,targetY:o,targetPosition:i=ct.Top,curvature:a=.25}){const[l,u]=tE({pos:n,x1:e,y1:t,x2:r,y2:o,c:a}),[f,p]=tE({pos:i,x1:r,y1:o,x2:e,y2:t,c:a}),[h,g,y,k]=jD({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${l},${u} ${f},${p} ${r},${o}`,h,g,y,k]}function kD({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,a=Math.abs(r-t)/2,l=r<t?r+a:r-a;return[i,l,o,a]}function Yne({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const a=o&&n?r+1e3:r,l=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return a+l}function Xne({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=pg(Qh(e),Qh(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return Rd(a,hg(i))>0}const Qne=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Jne=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Zne=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",Es.error006()),t;const r=n.getEdgeId||Qne;let o;return fD(e)?o={...e}:o={...e,id:r(e)},Jne(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function ND({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,a,l]=kD({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,a,l]}const nE={[ct.Left]:{x:-1,y:0},[ct.Right]:{x:1,y:0},[ct.Top]:{x:0,y:-1},[ct.Bottom]:{x:0,y:1}},ere=({source:e,sourcePosition:t=ct.Bottom,target:n})=>t===ct.Left||t===ct.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},rE=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function tre({source:e,sourcePosition:t=ct.Bottom,target:n,targetPosition:r=ct.Top,center:o,offset:i,stepPosition:a}){const l=nE[t],u=nE[r],f={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+u.x*i,y:n.y+u.y*i},h=ere({source:f,sourcePosition:t,target:p}),g=h.x!==0?"x":"y",y=h[g];let k=[],v,b;const w={x:0,y:0},S={x:0,y:0},[,,N,C]=kD({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){g==="x"?(v=o.x??f.x+(p.x-f.x)*a,b=o.y??(f.y+p.y)/2):(v=o.x??(f.x+p.x)/2,b=o.y??f.y+(p.y-f.y)*a);const I=[{x:v,y:f.y},{x:v,y:p.y}],_=[{x:f.x,y:b},{x:p.x,y:b}];l[g]===y?k=g==="x"?I:_:k=g==="x"?_:I}else{const I=[{x:f.x,y:p.y}],_=[{x:p.x,y:f.y}];if(g==="x"?k=l.x===y?_:I:k=l.y===y?I:_,t===r){const $=Math.abs(e[g]-n[g]);if($<=i){const L=Math.min(i-1,i-$);l[g]===y?w[g]=(f[g]>e[g]?-1:1)*L:S[g]=(p[g]>n[g]?-1:1)*L}}if(t!==r){const $=g==="x"?"y":"x",L=l[g]===u[$],U=f[$]>p[$],K=f[$]<p[$];(l[g]===1&&(!L&&U||L&&K)||l[g]!==1&&(!L&&K||L&&U))&&(k=g==="x"?I:_)}const z={x:f.x+w.x,y:f.y+w.y},O={x:p.x+S.x,y:p.y+S.y},B=Math.max(Math.abs(z.x-k[0].x),Math.abs(O.x-k[0].x)),V=Math.max(Math.abs(z.y-k[0].y),Math.abs(O.y-k[0].y));B>=V?(v=(z.x+O.x)/2,b=k[0].y):(v=k[0].x,b=(z.y+O.y)/2)}const R={x:f.x+w.x,y:f.y+w.y},T={x:p.x+S.x,y:p.y+S.y};return[[e,...R.x!==k[0].x||R.y!==k[0].y?[R]:[],...k,...T.x!==k[k.length-1].x||T.y!==k[k.length-1].y?[T]:[],n],v,b,N,C]}function nre(e,t,n,r){const o=Math.min(rE(e,t)/2,rE(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const f=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${i+o*f},${a}Q ${i},${a} ${i},${a+o*p}`}const l=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${i},${a+o*u}Q ${i},${a} ${i+o*l},${a}`}function $v({sourceX:e,sourceY:t,sourcePosition:n=ct.Bottom,targetX:r,targetY:o,targetPosition:i=ct.Top,borderRadius:a=5,centerX:l,centerY:u,offset:f=20,stepPosition:p=.5}){const[h,g,y,k,v]=tre({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:l,y:u},offset:f,stepPosition:p});let b=`M${h[0].x} ${h[0].y}`;for(let w=1;w<h.length-1;w++)b+=nre(h[w-1],h[w],h[w+1],a);return b+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[b,g,y,k,v]}function sE(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function rre(e){var h;const{sourceNode:t,targetNode:n}=e;if(!sE(t)||!sE(n))return null;const r=t.internals.handleBounds||oE(t.handles),o=n.internals.handleBounds||oE(n.handles),i=iE((r==null?void 0:r.source)??[],e.sourceHandle),a=iE(e.connectionMode===uc.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!a)return(h=e.onError)==null||h.call(e,"008",Es.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||ct.Bottom,u=(a==null?void 0:a.position)||ct.Top,f=Ta(t,i,l),p=Ta(n,a,u);return{sourceX:f.x,sourceY:f.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:u}}function oE(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Ta(e,t,n=ct.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??Lo(e);if(r)return{x:o+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case ct.Top:return{x:o+a/2,y:i};case ct.Right:return{x:o+a,y:i+l/2};case ct.Bottom:return{x:o+a/2,y:i+l};case ct.Left:return{x:o,y:i+l/2}}}function iE(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Iv(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function sre(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||o].forEach(u=>{if(u&&typeof u=="object"){const f=Iv(u,t);i.has(f)||(a.push({id:f,color:u.color||n,...u}),i.add(f))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const SD=1e3,ore=10,ej={nodeOrigin:[0,0],nodeExtent:Ed,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ire={...ej,checkEquality:!0};function tj(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function are(e,t,n){const r=tj(ej,n);for(const o of e.values())if(o.parentId)rj(o,e,t,r);else{const i=sf(o,r.nodeOrigin),a=Ea(o.extent)?o.extent:r.nodeExtent,l=Ca(i,a,Lo(o));o.internals.positionAbsolute=l}}function lre(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function nj(e){return e==="manual"}function Mv(e,t,n,r={}){var p,h;const o=tj(ire,r),i={i:0},a=new Map(t),l=o!=null&&o.elevateNodesOnSelect&&!nj(o.zIndexMode)?SD:0;let u=e.length>0,f=!1;t.clear(),n.clear();for(const g of e){let y=a.get(g.id);if(o.checkEquality&&g===(y==null?void 0:y.internals.userNode))t.set(g.id,y);else{const k=sf(g,o.nodeOrigin),v=Ea(g.extent)?g.extent:o.nodeExtent,b=Ca(k,v,Lo(g));y={...o.defaults,...g,measured:{width:(p=g.measured)==null?void 0:p.width,height:(h=g.measured)==null?void 0:h.height},internals:{positionAbsolute:b,handleBounds:lre(g,y),z:CD(g,l,o.zIndexMode),userNode:g}},t.set(g.id,y)}(y.measured===void 0||y.measured.width===void 0||y.measured.height===void 0)&&!y.hidden&&(u=!1),g.parentId&&rj(y,t,n,r,i),f||(f=g.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:f}}function cre(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function rj(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:u}=tj(ej,r),f=e.parentId,p=t.get(f);if(!p){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}cre(e,n),o&&!p.parentId&&p.internals.rootParentIndex===void 0&&u==="auto"&&(p.internals.rootParentIndex=++o.i,p.internals.z=p.internals.z+o.i*ore),o&&p.internals.rootParentIndex!==void 0&&(o.i=p.internals.rootParentIndex);const h=i&&!nj(u)?SD:0,{x:g,y,z:k}=ure(e,p,a,l,h,u),{positionAbsolute:v}=e.internals,b=g!==v.x||y!==v.y;(b||k!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:g,y}:v,z:k}})}function CD(e,t,n){const r=gs(e.zIndex)?e.zIndex:0;return nj(n)?r:r+(e.selected?t:0)}function ure(e,t,n,r,o,i){const{x:a,y:l}=t.internals.positionAbsolute,u=Lo(e),f=sf(e,n),p=Ea(e.extent)?Ca(f,e.extent,u):f;let h=Ca({x:a+p.x,y:l+p.y},r,u);e.extent==="parent"&&(h=hD(h,u,t));const g=CD(e,o,i),y=t.internals.z??0;return{x:h.x,y:h.y,z:y>=g?y+1:g}}function sj(e,t,n,r=[0,0]){var a;const o=[],i=new Map;for(const l of e){const u=t.get(l.parentId);if(!u)continue;const f=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??fc(u),p=mD(f,l.rect);i.set(l.parentId,{expandedRect:p,parent:u})}return i.size>0&&i.forEach(({expandedRect:l,parent:u},f)=>{var N;const p=u.internals.positionAbsolute,h=Lo(u),g=u.origin??r,y=l.x<p.x?Math.round(Math.abs(p.x-l.x)):0,k=l.y<p.y?Math.round(Math.abs(p.y-l.y)):0,v=Math.max(h.width,Math.round(l.width)),b=Math.max(h.height,Math.round(l.height)),w=(v-h.width)*g[0],S=(b-h.height)*g[1];(y>0||k>0||w||S)&&(o.push({id:f,type:"position",position:{x:u.position.x-y+w,y:u.position.y-k+S}}),(N=n.get(f))==null||N.forEach(C=>{e.some(R=>R.id===C.id)||o.push({id:C.id,type:"position",position:{x:C.position.x+y,y:C.position.y+k}})})),(h.width<l.width||h.height<l.height||y||k)&&o.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:v+(y?g[0]*y-w:0),height:b+(k?g[1]*k-S:0)}})}),o}function dre(e,t,n,r,o,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let u=!1;if(!l)return{changes:[],updatedInternals:u};const f=[],p=window.getComputedStyle(l),{m22:h}=new window.DOMMatrixReadOnly(p.transform),g=[];for(const y of e.values()){const k=t.get(y.id);if(!k)continue;if(k.hidden){t.set(k.id,{...k,internals:{...k.internals,handleBounds:void 0}}),u=!0;continue}const v=J0(y.nodeElement),b=k.measured.width!==v.width||k.measured.height!==v.height;if(!!(v.width&&v.height&&(b||!k.internals.handleBounds||y.force))){const S=y.nodeElement.getBoundingClientRect(),N=Ea(k.extent)?k.extent:i;let{positionAbsolute:C}=k.internals;k.parentId&&k.extent==="parent"?C=hD(C,v,t.get(k.parentId)):N&&(C=Ca(C,N,v));const R={...k,measured:v,internals:{...k.internals,positionAbsolute:C,handleBounds:{source:eE("source",y.nodeElement,S,h,k.id),target:eE("target",y.nodeElement,S,h,k.id)}}};t.set(k.id,R),k.parentId&&rj(R,t,n,{nodeOrigin:o,zIndexMode:a}),u=!0,b&&(f.push({id:k.id,type:"dimensions",dimensions:v}),k.expandParent&&k.parentId&&g.push({id:k.id,parentId:k.parentId,rect:fc(R,o)}))}}if(g.length>0){const y=sj(g,t,n,o);f.push(...y)}return{changes:f,updatedInternals:u}}async function fre({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function aE(e,t,n,r,o,i){let a=o;const l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${o}-${e}`;const u=r.get(a)||new Map;if(r.set(a,u.set(n,t)),i){a=`${o}-${e}-${i}`;const f=r.get(a)||new Map;r.set(a,f.set(n,t))}}function ED(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:a=null,targetHandle:l=null}=r,u={edgeId:r.id,source:o,target:i,sourceHandle:a,targetHandle:l},f=`${o}-${a}--${i}-${l}`,p=`${i}-${l}--${o}-${a}`;aE("source",u,p,e,o,a),aE("target",u,f,e,i,l),t.set(r.id,r)}}function TD(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:TD(n,t):!1}function lE(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function pre(e,t,n,r){const o=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!TD(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(i);l&&o.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return o}function lb({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,u;const o=[];for(const[f,p]of t){const h=(a=n.get(f))==null?void 0:a.internals.userNode;h&&o.push({...h,position:p.position,dragging:r})}if(!e)return[o[0],o];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((u=t.get(e))==null?void 0:u.position)||i.position,dragging:r}:o[0],o]}function hre({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},a=af(i,t);return{x:a.x-i.x,y:a.y-i.y}}function mre({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},a=0,l=new Map,u=!1,f={x:0,y:0},p=null,h=!1,g=null,y=!1,k=!1,v=null;function b({noDragClassName:S,handleSelector:N,domNode:C,isSelectable:R,nodeId:T,nodeClickDistance:A=0}){g=Fr(C);function I({x:B,y:V}){const{nodeLookup:$,nodeExtent:L,snapGrid:U,snapToGrid:K,nodeOrigin:D,onNodeDrag:W,onSelectionDrag:M,onError:F,updateNodePositions:Y}=t();i={x:B,y:V};let H=!1;const Q=l.size>1,J=Q&&L?Dv(of(l)):null,Z=Q&&K?hre({dragItems:l,snapGrid:U,x:B,y:V}):null;for(const[oe,te]of l){if(!$.has(oe))continue;let ue={x:B-te.distance.x,y:V-te.distance.y};K&&(ue=Z?{x:Math.round(ue.x+Z.x),y:Math.round(ue.y+Z.y)}:af(ue,U));let ge=null;if(Q&&L&&!te.extent&&J){const{positionAbsolute:ke}=te.internals,Be=ke.x-J.x+L[0][0],ie=ke.x+te.measured.width-J.x2+L[1][0],ve=ke.y-J.y+L[0][1],ye=ke.y+te.measured.height-J.y2+L[1][1];ge=[[Be,ve],[ie,ye]]}const{position:Ce,positionAbsolute:Se}=pD({nodeId:oe,nextPosition:ue,nodeLookup:$,nodeExtent:ge||L,nodeOrigin:D,onError:F});H=H||te.position.x!==Ce.x||te.position.y!==Ce.y,te.position=Ce,te.internals.positionAbsolute=Se}if(k=k||H,!!H&&(Y(l,!0),v&&(r||W||!T&&M))){const[oe,te]=lb({nodeId:T,dragItems:l,nodeLookup:$});r==null||r(v,l,oe,te),W==null||W(v,oe,te),T||M==null||M(v,te)}}async function _(){if(!p)return;const{transform:B,panBy:V,autoPanSpeed:$,autoPanOnNodeDrag:L}=t();if(!L){u=!1,cancelAnimationFrame(a);return}const[U,K]=X0(f,p,$);(U!==0||K!==0)&&(i.x=(i.x??0)-U/B[2],i.y=(i.y??0)-K/B[2],await V({x:U,y:K})&&I(i)),a=requestAnimationFrame(_)}function z(B){var Q;const{nodeLookup:V,multiSelectionActive:$,nodesDraggable:L,transform:U,snapGrid:K,snapToGrid:D,selectNodesOnDrag:W,onNodeDragStart:M,onSelectionDragStart:F,unselectNodesAndEdges:Y}=t();h=!0,(!W||!R)&&!$&&T&&((Q=V.get(T))!=null&&Q.selected||Y()),R&&W&&T&&(e==null||e(T));const H=od(B.sourceEvent,{transform:U,snapGrid:K,snapToGrid:D,containerBounds:p});if(i=H,l=pre(V,L,H,T),l.size>0&&(n||M||!T&&F)){const[J,Z]=lb({nodeId:T,dragItems:l,nodeLookup:V});n==null||n(B.sourceEvent,l,J,Z),M==null||M(B.sourceEvent,J,Z),T||F==null||F(B.sourceEvent,Z)}}const O=W_().clickDistance(A).on("start",B=>{const{domNode:V,nodeDragThreshold:$,transform:L,snapGrid:U,snapToGrid:K}=t();p=(V==null?void 0:V.getBoundingClientRect())||null,y=!1,k=!1,v=B.sourceEvent,$===0&&z(B),i=od(B.sourceEvent,{transform:L,snapGrid:U,snapToGrid:K,containerBounds:p}),f=xs(B.sourceEvent,p)}).on("drag",B=>{const{autoPanOnNodeDrag:V,transform:$,snapGrid:L,snapToGrid:U,nodeDragThreshold:K,nodeLookup:D}=t(),W=od(B.sourceEvent,{transform:$,snapGrid:L,snapToGrid:U,containerBounds:p});if(v=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||T&&!D.has(T))&&(y=!0),!y){if(!u&&V&&h&&(u=!0,_()),!h){const M=xs(B.sourceEvent,p),F=M.x-f.x,Y=M.y-f.y;Math.sqrt(F*F+Y*Y)>K&&z(B)}(i.x!==W.xSnapped||i.y!==W.ySnapped)&&l&&h&&(f=xs(B.sourceEvent,p),I(W))}}).on("end",B=>{if(!h||y){y&&l.size>0&&t().updateNodePositions(l,!1);return}if(u=!1,h=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:V,updateNodePositions:$,onNodeDragStop:L,onSelectionDragStop:U}=t();if(k&&($(l,!1),k=!1),o||L||!T&&U){const[K,D]=lb({nodeId:T,dragItems:l,nodeLookup:V,dragging:!1});o==null||o(B.sourceEvent,l,K,D),L==null||L(B.sourceEvent,K,D),T||U==null||U(B.sourceEvent,D)}}}).filter(B=>{const V=B.target;return!B.button&&(!S||!lE(V,`.${S}`,C))&&(!N||lE(V,N,C))});g.call(O)}function w(){g==null||g.on(".drag",null)}return{update:b,destroy:w}}function gre(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Rd(o,fc(i))>0&&r.push(i);return r}const xre=250;function yre(e,t,n,r){var l,u;let o=[],i=1/0;const a=gre(e,n,t+xre);for(const f of a){const p=[...((l=f.internals.handleBounds)==null?void 0:l.source)??[],...((u=f.internals.handleBounds)==null?void 0:u.target)??[]];for(const h of p){if(r.nodeId===h.nodeId&&r.type===h.type&&r.id===h.id)continue;const{x:g,y}=Ta(f,h,h.position,!0),k=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(y-e.y,2));k>t||(k<i?(o=[{...h,x:g,y}],i=k):k===i&&o.push({...h,x:g,y}))}}if(!o.length)return null;if(o.length>1){const f=r.type==="source"?"target":"source";return o.find(p=>p.type===f)??o[0]}return o[0]}function RD(e,t,n,r,o,i=!1){var f,p,h;const a=r.get(e);if(!a)return null;const l=o==="strict"?(f=a.internals.handleBounds)==null?void 0:f[t]:[...((p=a.internals.handleBounds)==null?void 0:p.source)??[],...((h=a.internals.handleBounds)==null?void 0:h.target)??[]],u=(n?l==null?void 0:l.find(g=>g.id===n):l==null?void 0:l[0])??null;return u&&i?{...u,...Ta(a,u,u.position,!0)}:u}function AD(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function bre(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const PD=()=>!0;function vre(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:u,lib:f,autoPanOnConnect:p,flowId:h,panBy:g,cancelConnection:y,onConnectStart:k,onConnect:v,onConnectEnd:b,isValidConnection:w=PD,onReconnectEnd:S,updateConnection:N,getTransform:C,getFromHandle:R,autoPanSpeed:T,dragThreshold:A=1,handleDomNode:I}){const _=bD(e.target);let z=0,O;const{x:B,y:V}=xs(e),$=AD(i,I),L=l==null?void 0:l.getBoundingClientRect();let U=!1;if(!L||!$)return;const K=RD(o,$,r,u,t);if(!K)return;let D=xs(e,L),W=!1,M=null,F=!1,Y=null;function H(){if(!p||!L)return;const[Ce,Se]=X0(D,L,T);g({x:Ce,y:Se}),z=requestAnimationFrame(H)}const Q={...K,nodeId:o,type:$,position:K.position},J=u.get(o);let oe={inProgress:!0,isValid:null,from:Ta(J,Q,ct.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:J,to:D,toHandle:null,toPosition:XC[Q.position],toNode:null,pointer:D};function te(){U=!0,N(oe),k==null||k(e,{nodeId:o,handleId:r,handleType:$})}A===0&&te();function ue(Ce){if(!U){const{x:ye,y:Ae}=xs(Ce),Ue=ye-B,rt=Ae-V;if(!(Ue*Ue+rt*rt>A*A))return;te()}if(!R()||!Q){ge(Ce);return}const Se=C();D=xs(Ce,L),O=yre(Fc(D,Se,!1,[1,1]),n,u,Q),W||(H(),W=!0);const ke=_D(Ce,{handle:O,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:a?"target":"source",isValidConnection:w,doc:_,lib:f,flowId:h,nodeLookup:u});Y=ke.handleDomNode,M=ke.connection,F=bre(!!O,ke.isValid);const Be=u.get(o),ie=Be?Ta(Be,Q,ct.Left,!0):oe.from,ve={...oe,from:ie,isValid:F,to:ke.toHandle&&F?pc({x:ke.toHandle.x,y:ke.toHandle.y},Se):D,toHandle:ke.toHandle,toPosition:F&&ke.toHandle?ke.toHandle.position:XC[Q.position],toNode:ke.toHandle?u.get(ke.toHandle.nodeId):null,pointer:D};N(ve),oe=ve}function ge(Ce){if(!("touches"in Ce&&Ce.touches.length>0)){if(U){(O||Y)&&M&&F&&(v==null||v(M));const{inProgress:Se,...ke}=oe,Be={...ke,toPosition:oe.toHandle?oe.toPosition:null};b==null||b(Ce,Be),i&&(S==null||S(Ce,Be))}y(),cancelAnimationFrame(z),W=!1,F=!1,M=null,Y=null,_.removeEventListener("mousemove",ue),_.removeEventListener("mouseup",ge),_.removeEventListener("touchmove",ue),_.removeEventListener("touchend",ge)}}_.addEventListener("mousemove",ue),_.addEventListener("mouseup",ge),_.addEventListener("touchmove",ue),_.addEventListener("touchend",ge)}function _D(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:a,lib:l,flowId:u,isValidConnection:f=PD,nodeLookup:p}){const h=i==="target",g=t?a.querySelector(`.${l}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:k}=xs(e),v=a.elementFromPoint(y,k),b=v!=null&&v.classList.contains(`${l}-flow__handle`)?v:g,w={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const S=AD(void 0,b),N=b.getAttribute("data-nodeid"),C=b.getAttribute("data-handleid"),R=b.classList.contains("connectable"),T=b.classList.contains("connectableend");if(!N||!S)return w;const A={source:h?N:r,sourceHandle:h?C:o,target:h?r:N,targetHandle:h?o:C};w.connection=A;const _=R&&T&&(n===uc.Strict?h&&S==="source"||!h&&S==="target":N!==r||C!==o);w.isValid=_&&f(A),w.toHandle=RD(N,S,C,p,n,!0)}return w}const Lv={onPointerDown:vre,isValid:_D};function wre({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=Fr(e);function i({translateExtent:l,width:u,height:f,zoomStep:p=1,pannable:h=!0,zoomable:g=!0,inversePan:y=!1}){const k=N=>{if(N.sourceEvent.type!=="wheel"||!t)return;const C=n(),R=N.sourceEvent.ctrlKey&&Ad()?10:1,T=-N.sourceEvent.deltaY*(N.sourceEvent.deltaMode===1?.05:N.sourceEvent.deltaMode?1:.002)*p,A=C[2]*Math.pow(2,T*R);t.scaleTo(A)};let v=[0,0];const b=N=>{(N.sourceEvent.type==="mousedown"||N.sourceEvent.type==="touchstart")&&(v=[N.sourceEvent.clientX??N.sourceEvent.touches[0].clientX,N.sourceEvent.clientY??N.sourceEvent.touches[0].clientY])},w=N=>{const C=n();if(N.sourceEvent.type!=="mousemove"&&N.sourceEvent.type!=="touchmove"||!t)return;const R=[N.sourceEvent.clientX??N.sourceEvent.touches[0].clientX,N.sourceEvent.clientY??N.sourceEvent.touches[0].clientY],T=[R[0]-v[0],R[1]-v[1]];v=R;const A=r()*Math.max(C[2],Math.log(C[2]))*(y?-1:1),I={x:C[0]-T[0]*A,y:C[1]-T[1]*A},_=[[0,0],[u,f]];t.setViewportConstrained({x:I.x,y:I.y,zoom:C[2]},_,l)},S=aD().on("start",b).on("zoom",h?w:null).on("zoom.wheel",g?k:null);o.call(S,{})}function a(){o.on("zoom",null)}return{update:i,destroy:a,pointer:hs}}const mg=e=>({x:e.x,y:e.y,zoom:e.k}),cb=({x:e,y:t,zoom:n})=>fg.translate(e,t).scale(n),Ll=(e,t)=>e.target.closest(`.${t}`),DD=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),jre=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ub=(e,t=0,n=jre,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},$D=e=>{const t=e.ctrlKey&&Ad()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function kre({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:f}){return p=>{if(Ll(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const h=n.property("__zoom").k||1;if(p.ctrlKey&&a){const b=hs(p),w=$D(p),S=h*Math.pow(2,w);r.scaleTo(n,S,b,p);return}const g=p.deltaMode===1?20:1;let y=o===va.Vertical?0:p.deltaX*g,k=o===va.Horizontal?0:p.deltaY*g;!Ad()&&p.shiftKey&&o!==va.Vertical&&(y=p.deltaY*g,k=0),r.translateBy(n,-(y/h)*i,-(k/h)*i,{internal:!0});const v=mg(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(p,v),e.panScrollTimeout=setTimeout(()=>{f==null||f(p,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,v))}}function Nre({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=Ll(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,o)}}function Sre({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const o=mg(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Cre({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&DD(t,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((l=i.sourceEvent)!=null&&l.internal)&&(o==null||o(i.sourceEvent,mg(i.transform)))}}function Ere({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&DD(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const u=mg(a.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(a.sourceEvent,u)},n?150:0)}}}function Tre({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:u,lib:f,connectionInProgress:p}){return h=>{var b;const g=e||t,y=n&&h.ctrlKey,k=h.type==="wheel";if(h.button===1&&h.type==="mousedown"&&(Ll(h,`${f}-flow__node`)||Ll(h,`${f}-flow__edge`)))return!0;if(!r&&!g&&!o&&!i&&!n||a||p&&!k||Ll(h,l)&&k||Ll(h,u)&&(!k||o&&k&&!e)||!n&&h.ctrlKey&&k)return!1;if(!n&&h.type==="touchstart"&&((b=h.touches)==null?void 0:b.length)>1)return h.preventDefault(),!1;if(!g&&!o&&!y&&k||!r&&(h.type==="mousedown"||h.type==="touchstart")||Array.isArray(r)&&!r.includes(h.button)&&h.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||k)&&v}}function Rre({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:u}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),h=aD().scaleExtent([t,n]).translateExtent(r),g=Fr(e).call(h);S({x:o.x,y:o.y,zoom:dc(o.zoom,t,n)},[[0,0],[p.width,p.height]],r);const y=g.on("wheel.zoom"),k=g.on("dblclick.zoom");h.wheelDelta($D);async function v(O,B){return g?new Promise(V=>{h==null||h.interpolate((B==null?void 0:B.interpolate)==="linear"?sd:oh).transform(ub(g,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>V(!0)),O)}):!1}function b({noWheelClassName:O,noPanClassName:B,onPaneContextMenu:V,userSelectionActive:$,panOnScroll:L,panOnDrag:U,panOnScrollMode:K,panOnScrollSpeed:D,preventScrolling:W,zoomOnPinch:M,zoomOnScroll:F,zoomOnDoubleClick:Y,zoomActivationKeyPressed:H,lib:Q,onTransformChange:J,connectionInProgress:Z,paneClickDistance:oe,selectionOnDrag:te}){$&&!f.isZoomingOrPanning&&w();const ue=L&&!H&&!$;h.clickDistance(te?1/0:!gs(oe)||oe<0?0:oe);const ge=ue?kre({zoomPanValues:f,noWheelClassName:O,d3Selection:g,d3Zoom:h,panOnScrollMode:K,panOnScrollSpeed:D,zoomOnPinch:M,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):Nre({noWheelClassName:O,preventScrolling:W,d3ZoomHandler:y});g.on("wheel.zoom",ge,{passive:!1});const Ce=Sre({zoomPanValues:f,onDraggingChange:u,onPanZoomStart:a});h.on("start",Ce);const Se=Cre({zoomPanValues:f,panOnDrag:U,onPaneContextMenu:!!V,onPanZoom:i,onTransformChange:J});h.on("zoom",Se);const ke=Ere({zoomPanValues:f,panOnDrag:U,panOnScroll:L,onPaneContextMenu:V,onPanZoomEnd:l,onDraggingChange:u});h.on("end",ke);const Be=Tre({zoomActivationKeyPressed:H,panOnDrag:U,zoomOnScroll:F,panOnScroll:L,zoomOnDoubleClick:Y,zoomOnPinch:M,userSelectionActive:$,noPanClassName:B,noWheelClassName:O,lib:Q,connectionInProgress:Z});h.filter(Be),Y?g.on("dblclick.zoom",k):g.on("dblclick.zoom",null)}function w(){h.on("zoom",null)}async function S(O,B,V){const $=cb(O),L=h==null?void 0:h.constrain()($,B,V);return L&&await v(L),L}async function N(O,B){const V=cb(O);return await v(V,B),V}function C(O){if(g){const B=cb(O),V=g.property("__zoom");(V.k!==O.zoom||V.x!==O.x||V.y!==O.y)&&(h==null||h.transform(g,B,null,{sync:!0}))}}function R(){const O=g?iD(g.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}async function T(O,B){return g?new Promise(V=>{h==null||h.interpolate((B==null?void 0:B.interpolate)==="linear"?sd:oh).scaleTo(ub(g,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>V(!0)),O)}):!1}async function A(O,B){return g?new Promise(V=>{h==null||h.interpolate((B==null?void 0:B.interpolate)==="linear"?sd:oh).scaleBy(ub(g,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>V(!0)),O)}):!1}function I(O){h==null||h.scaleExtent(O)}function _(O){h==null||h.translateExtent(O)}function z(O){const B=!gs(O)||O<0?0:O;h==null||h.clickDistance(B)}return{update:b,destroy:w,setViewport:N,setViewportConstrained:S,getViewport:R,scaleTo:T,scaleBy:A,setScaleExtent:I,setTranslateExtent:_,syncViewport:C,setClickDistance:z}}var hc;(function(e){e.Line="line",e.Handle="handle"})(hc||(hc={}));function Are({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const a=e-t,l=n-r,u=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&o&&(u[0]=u[0]*-1),l&&i&&(u[1]=u[1]*-1),u}function cE(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function pi(e,t){return Math.max(0,t-e)}function hi(e,t){return Math.max(0,e-t)}function $p(e,t,n){return Math.max(0,t-e,e-n)}function uE(e,t){return e?!t:t}function Pre(e,t,n,r,o,i,a,l){let{affectsX:u,affectsY:f}=t;const{isHorizontal:p,isVertical:h}=t,g=p&&h,{xSnapped:y,ySnapped:k}=n,{minWidth:v,maxWidth:b,minHeight:w,maxHeight:S}=r,{x:N,y:C,width:R,height:T,aspectRatio:A}=e;let I=Math.floor(p?y-e.pointerX:0),_=Math.floor(h?k-e.pointerY:0);const z=R+(u?-I:I),O=T+(f?-_:_),B=-i[0]*R,V=-i[1]*T;let $=$p(z,v,b),L=$p(O,w,S);if(a){let D=0,W=0;u&&I<0?D=pi(N+I+B,a[0][0]):!u&&I>0&&(D=hi(N+z+B,a[1][0])),f&&_<0?W=pi(C+_+V,a[0][1]):!f&&_>0&&(W=hi(C+O+V,a[1][1])),$=Math.max($,D),L=Math.max(L,W)}if(l){let D=0,W=0;u&&I>0?D=hi(N+I,l[0][0]):!u&&I<0&&(D=pi(N+z,l[1][0])),f&&_>0?W=hi(C+_,l[0][1]):!f&&_<0&&(W=pi(C+O,l[1][1])),$=Math.max($,D),L=Math.max(L,W)}if(o){if(p){const D=$p(z/A,w,S)*A;if($=Math.max($,D),a){let W=0;!u&&!f||u&&!f&&g?W=hi(C+V+z/A,a[1][1])*A:W=pi(C+V+(u?I:-I)/A,a[0][1])*A,$=Math.max($,W)}if(l){let W=0;!u&&!f||u&&!f&&g?W=pi(C+z/A,l[1][1])*A:W=hi(C+(u?I:-I)/A,l[0][1])*A,$=Math.max($,W)}}if(h){const D=$p(O*A,v,b)/A;if(L=Math.max(L,D),a){let W=0;!u&&!f||f&&!u&&g?W=hi(N+O*A+B,a[1][0])/A:W=pi(N+(f?_:-_)*A+B,a[0][0])/A,L=Math.max(L,W)}if(l){let W=0;!u&&!f||f&&!u&&g?W=pi(N+O*A,l[1][0])/A:W=hi(N+(f?_:-_)*A,l[0][0])/A,L=Math.max(L,W)}}}_=_+(_<0?L:-L),I=I+(I<0?$:-$),o&&(g?z>O*A?_=(uE(u,f)?-I:I)/A:I=(uE(u,f)?-_:_)*A:p?(_=I/A,f=u):(I=_*A,u=f));const U=u?N+I:N,K=f?C+_:C;return{width:R+(u?-I:I),height:T+(f?-_:_),x:i[0]*I*(u?-1:1)+U,y:i[1]*_*(f?-1:1)+K}}const ID={width:0,height:0,x:0,y:0},_re={...ID,pointerX:0,pointerY:0,aspectRatio:1};function Dre(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,l=n[0]*i,u=n[1]*a;return[[r-l,o-u],[r+i-l,o+a-u]]}function $re({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=Fr(e);let a={controlDirection:cE("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:f,boundaries:p,keepAspectRatio:h,resizeDirection:g,onResizeStart:y,onResize:k,onResizeEnd:v,shouldResize:b}){let w={...ID},S={..._re};a={boundaries:p,resizeDirection:g,keepAspectRatio:h,controlDirection:cE(f)};let N,C=null,R=[],T,A,I,_=!1;const z=W_().on("start",O=>{const{nodeLookup:B,transform:V,snapGrid:$,snapToGrid:L,nodeOrigin:U,paneDomNode:K}=n();if(N=B.get(t),!N)return;C=(K==null?void 0:K.getBoundingClientRect())??null;const{xSnapped:D,ySnapped:W}=od(O.sourceEvent,{transform:V,snapGrid:$,snapToGrid:L,containerBounds:C});w={width:N.measured.width??0,height:N.measured.height??0,x:N.position.x??0,y:N.position.y??0},S={...w,pointerX:D,pointerY:W,aspectRatio:w.width/w.height},T=void 0,A=Ea(N.extent)?N.extent:void 0,N.parentId&&(N.extent==="parent"||N.expandParent)&&(T=B.get(N.parentId)),T&&N.extent==="parent"&&(A=[[0,0],[T.measured.width,T.measured.height]]),R=[],I=void 0;for(const[M,F]of B)if(F.parentId===t&&(R.push({id:M,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const Y=Dre(F,N,F.origin??U);I?I=[[Math.min(Y[0][0],I[0][0]),Math.min(Y[0][1],I[0][1])],[Math.max(Y[1][0],I[1][0]),Math.max(Y[1][1],I[1][1])]]:I=Y}y==null||y(O,{...w})}).on("drag",O=>{const{transform:B,snapGrid:V,snapToGrid:$,nodeOrigin:L}=n(),U=od(O.sourceEvent,{transform:B,snapGrid:V,snapToGrid:$,containerBounds:C}),K=[];if(!N)return;const{x:D,y:W,width:M,height:F}=w,Y={},H=N.origin??L,{width:Q,height:J,x:Z,y:oe}=Pre(S,a.controlDirection,U,a.boundaries,a.keepAspectRatio,H,A,I),te=Q!==M,ue=J!==F,ge=Z!==D&&te,Ce=oe!==W&&ue;if(!ge&&!Ce&&!te&&!ue)return;if((ge||Ce||H[0]===1||H[1]===1)&&(Y.x=ge?Z:w.x,Y.y=Ce?oe:w.y,w.x=Y.x,w.y=Y.y,R.length>0)){const ie=Z-D,ve=oe-W;for(const ye of R)ye.position={x:ye.position.x-ie+H[0]*(Q-M),y:ye.position.y-ve+H[1]*(J-F)},K.push(ye)}if((te||ue)&&(Y.width=te&&(!a.resizeDirection||a.resizeDirection==="horizontal")?Q:w.width,Y.height=ue&&(!a.resizeDirection||a.resizeDirection==="vertical")?J:w.height,w.width=Y.width,w.height=Y.height),T&&N.expandParent){const ie=H[0]*(Y.width??0);Y.x&&Y.x<ie&&(w.x=ie,S.x=S.x-(Y.x-ie));const ve=H[1]*(Y.height??0);Y.y&&Y.y<ve&&(w.y=ve,S.y=S.y-(Y.y-ve))}const Se=Are({width:w.width,prevWidth:M,height:w.height,prevHeight:F,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),ke={...w,direction:Se};(b==null?void 0:b(O,ke))!==!1&&(_=!0,k==null||k(O,ke),r(Y,K))}).on("end",O=>{_&&(v==null||v(O,{...w}),o==null||o({...w}),_=!1)});i.call(z)}function u(){i.on(".drag",null)}return{update:l,destroy:u}}var db={exports:{}},fb={},pb={exports:{}},hb={};/**
|
|
668
|
+
* @license React
|
|
669
|
+
* use-sync-external-store-shim.production.js
|
|
670
|
+
*
|
|
671
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
672
|
+
*
|
|
673
|
+
* This source code is licensed under the MIT license found in the
|
|
674
|
+
* LICENSE file in the root directory of this source tree.
|
|
675
|
+
*/var dE;function Ire(){if(dE)return hb;dE=1;var e=$d();function t(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function l(h,g){var y=g(),k=r({inst:{value:y,getSnapshot:g}}),v=k[0].inst,b=k[1];return i(function(){v.value=y,v.getSnapshot=g,u(v)&&b({inst:v})},[h,y,g]),o(function(){return u(v)&&b({inst:v}),h(function(){u(v)&&b({inst:v})})},[h]),a(y),y}function u(h){var g=h.getSnapshot;h=h.value;try{var y=g();return!n(h,y)}catch{return!0}}function f(h,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return hb.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,hb}var fE;function Mre(){return fE||(fE=1,pb.exports=Ire()),pb.exports}/**
|
|
676
|
+
* @license React
|
|
677
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
678
|
+
*
|
|
679
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
680
|
+
*
|
|
681
|
+
* This source code is licensed under the MIT license found in the
|
|
682
|
+
* LICENSE file in the root directory of this source tree.
|
|
683
|
+
*/var pE;function Lre(){if(pE)return fb;pE=1;var e=$d(),t=Mre();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,l=e.useMemo,u=e.useDebugValue;return fb.useSyncExternalStoreWithSelector=function(f,p,h,g,y){var k=i(null);if(k.current===null){var v={hasValue:!1,value:null};k.current=v}else v=k.current;k=l(function(){function w(T){if(!S){if(S=!0,N=T,T=g(T),y!==void 0&&v.hasValue){var A=v.value;if(y(A,T))return C=A}return C=T}if(A=C,r(N,T))return A;var I=g(T);return y!==void 0&&y(A,I)?(N=T,A):(N=T,C=I)}var S=!1,N,C,R=h===void 0?null:h;return[function(){return w(p())},R===null?void 0:function(){return w(R())}]},[p,h,g,y]);var b=o(f,k[0],k[1]);return a(function(){v.hasValue=!0,v.value=b},[b]),u(b),b},fb}var hE;function Ore(){return hE||(hE=1,db.exports=Lre()),db.exports}var Fre=Ore();const zre=Dd(Fre),Bre={},mE=e=>{let t;const n=new Set,r=(p,h)=>{const g=typeof p=="function"?p(t):p;if(!Object.is(g,t)){const y=t;t=h??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(k=>k(t,y))}},o=()=>t,u={setState:r,getState:o,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Bre?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,o,u);return u},Ure=e=>e?mE(e):mE,{useDebugValue:Hre}=Ot,{useSyncExternalStoreWithSelector:Vre}=zre,Wre=e=>e;function MD(e,t=Wre,n){const r=Vre(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Hre(r),r}const gE=(e,t)=>{const n=Ure(e),r=(o,i=t)=>MD(n,o,i);return Object.assign(r,n),r},Kre=(e,t)=>e?gE(e,t):gE;function on(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const gg=m.createContext(null),qre=gg.Provider,LD=Es.error001("react");function Pt(e,t){const n=m.useContext(gg);if(n===null)throw new Error(LD);return MD(n,e,t)}function an(){const e=m.useContext(gg);if(e===null)throw new Error(LD);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const xE={display:"none"},Gre={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},OD="react-flow__node-desc",FD="react-flow__edge-desc",Yre="react-flow__aria-live",Xre=e=>e.ariaLiveMessage,Qre=e=>e.ariaLabelConfig;function Jre({rfId:e}){const t=Pt(Xre);return s.jsx("div",{id:`${Yre}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Gre,children:t})}function Zre({rfId:e,disableKeyboardA11y:t}){const n=Pt(Qre);return s.jsxs(s.Fragment,{children:[s.jsx("div",{id:`${OD}-${e}`,style:xE,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),s.jsx("div",{id:`${FD}-${e}`,style:xE,children:n["edge.a11yDescription.default"]}),!t&&s.jsx(Jre,{rfId:e})]})}const lf=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const a=`${e}`.split("-");return s.jsx("div",{className:Rn(["react-flow__panel",n,...a]),style:r,ref:i,...o,children:t})});lf.displayName="Panel";function ese({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:s.jsx(lf,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:s.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const tse=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Ip=e=>e.id;function nse(e,t){return on(e.selectedNodes.map(Ip),t.selectedNodes.map(Ip))&&on(e.selectedEdges.map(Ip),t.selectedEdges.map(Ip))}function rse({onSelectionChange:e}){const t=an(),{selectedNodes:n,selectedEdges:r}=Pt(tse,nse);return m.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const sse=e=>!!e.onSelectionChangeHandlers;function ose({onSelectionChange:e}){const t=Pt(sse);return e||t?s.jsx(rse,{onSelectionChange:e}):null}const zD=[0,0],ise={x:0,y:0,zoom:1},ase=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],yE=[...ase,"rfId"],lse=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),bE={translateExtent:Ed,nodeOrigin:zD,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function cse(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:u}=Pt(lse,on),f=an();m.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{p.current=bE,l()}),[]);const p=m.useRef(bE);return m.useEffect(()=>{for(const h of yE){const g=e[h],y=p.current[h];g!==y&&(typeof e[h]>"u"||(h==="nodes"?t(g):h==="edges"?n(g):h==="minZoom"?r(g):h==="maxZoom"?o(g):h==="translateExtent"?i(g):h==="nodeExtent"?a(g):h==="ariaLabelConfig"?f.setState({ariaLabelConfig:qne(g)}):h==="fitView"?f.setState({fitViewQueued:g}):h==="fitViewOptions"?f.setState({fitViewOptions:g}):f.setState({[h]:g})))}p.current=e},yE.map(h=>e[h])),null}function vE(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function use(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const o=vE(),i=()=>n(o!=null&&o.matches?"dark":"light");return i(),o==null||o.addEventListener("change",i),()=>{o==null||o.removeEventListener("change",i)}},[e]),t!==null?t:(r=vE())!=null&&r.matches?"dark":"light"}const wE=typeof document<"u"?document:null;function Pd(e=null,t={target:wE,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),o=m.useRef(!1),i=m.useRef(new Set([])),[a,l]=m.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.replace("+",`
|
|
684
|
+
`).replace(`
|
|
685
|
+
|
|
686
|
+
`,`
|
|
687
|
+
+`).split(`
|
|
688
|
+
`)),p=f.reduce((h,g)=>h.concat(...g),[]);return[f,p]}return[[],[]]},[e]);return m.useEffect(()=>{const u=(t==null?void 0:t.target)??wE,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=y=>{var b,w;if(o.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!o.current||o.current&&!f)&&vD(y))return!1;const v=kE(y.code,l);if(i.current.add(y[v]),jE(a,i.current,!1)){const S=((w=(b=y.composedPath)==null?void 0:b.call(y))==null?void 0:w[0])||y.target,N=(S==null?void 0:S.nodeName)==="BUTTON"||(S==null?void 0:S.nodeName)==="A";t.preventDefault!==!1&&(o.current||!N)&&y.preventDefault(),r(!0)}},h=y=>{const k=kE(y.code,l);jE(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(y[k]),y.key==="Meta"&&i.current.clear(),o.current=!1},g=()=>{i.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",p),u==null||u.addEventListener("keyup",h),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{u==null||u.removeEventListener("keydown",p),u==null||u.removeEventListener("keyup",h),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function jE(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function kE(e,t){return t.includes(e)?"code":"key"}const dse=()=>{const e=an();return m.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:a,panZoom:l}=e.getState(),u=Q0(t,r,o,i,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:l,y:u}=a.getBoundingClientRect(),f={x:t.x-l,y:t.y-u},p=n.snapGrid??o,h=n.snapToGrid??i;return Fc(f,r,h,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),a=pc(t,n);return{x:a.x+o,y:a.y+i}}}),[])};function BD(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...i};for(const u of a)fse(u,l);n.push(l)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function fse(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function UD(e,t){return BD(e,t)}function HD(e,t){return BD(e,t)}function sa(e,t){return{id:e,type:"select",selected:t}}function Ol(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const a=t.has(o);!(i.selected===void 0&&!a)&&i.selected!==a&&(n&&(i.selected=a),r.push(sa(i.id,a)))}return r}function NE({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const l=t.get(a.id),u=((o=l==null?void 0:l.internals)==null?void 0:o.userNode)??l;u!==void 0&&u!==a&&n.push({id:a.id,item:a,type:"replace"}),u===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function SE(e){return{id:e.id,type:"remove"}}const pse=gD();function hse(e,t,n={}){return Zne(e,t,{...n,onError:n.onError??pse})}const CE=e=>One(e),mse=e=>fD(e);function VD(e){return m.forwardRef(e)}const gse=typeof window<"u"?m.useLayoutEffect:m.useEffect;function EE(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>xse(()=>n(o=>o+BigInt(1))));return gse(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function xse(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const WD=m.createContext(null);function yse({children:e}){const t=an(),n=m.useCallback(l=>{const{nodes:u=[],setNodes:f,hasDefaultNodes:p,onNodesChange:h,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:k}=t.getState();let v=u;for(const w of l)v=typeof w=="function"?w(v):w;let b=NE({items:v,lookup:g});for(const w of k.values())b=w(b);p&&f(v),b.length>0?h==null||h(b):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:w,nodes:S,setNodes:N}=t.getState();w&&N(S)})},[]),r=EE(n),o=m.useCallback(l=>{const{edges:u=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:h,edgeLookup:g}=t.getState();let y=u;for(const k of l)y=typeof k=="function"?k(y):k;p?f(y):h&&h(NE({items:y,lookup:g}))},[]),i=EE(o),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return s.jsx(WD.Provider,{value:a,children:e})}function bse(){const e=m.useContext(WD);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const vse=e=>!!e.panZoom;function xg(){const e=dse(),t=an(),n=bse(),r=Pt(vse),o=m.useMemo(()=>{const i=h=>t.getState().nodeLookup.get(h),a=h=>{n.nodeQueue.push(h)},l=h=>{n.edgeQueue.push(h)},u=h=>{var w,S;const{nodeLookup:g,nodeOrigin:y}=t.getState(),k=CE(h)?h:g.get(h.id),v=k.parentId?yD(k.position,k.measured,k.parentId,g,y):k.position,b={...k,position:v,width:((w=k.measured)==null?void 0:w.width)??k.width,height:((S=k.measured)==null?void 0:S.height)??k.height};return fc(b)},f=(h,g,y={replace:!1})=>{a(k=>k.map(v=>{if(v.id===h){const b=typeof g=="function"?g(v):g;return y.replace&&CE(b)?b:{...v,...b}}return v}))},p=(h,g,y={replace:!1})=>{l(k=>k.map(v=>{if(v.id===h){const b=typeof g=="function"?g(v):g;return y.replace&&mse(b)?b:{...v,...b}}return v}))};return{getNodes:()=>t.getState().nodes.map(h=>({...h})),getNode:h=>{var g;return(g=i(h))==null?void 0:g.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:h=[]}=t.getState();return h.map(g=>({...g}))},getEdge:h=>t.getState().edgeLookup.get(h),setNodes:a,setEdges:l,addNodes:h=>{const g=Array.isArray(h)?h:[h];n.nodeQueue.push(y=>[...y,...g])},addEdges:h=>{const g=Array.isArray(h)?h:[h];n.edgeQueue.push(y=>[...y,...g])},toObject:()=>{const{nodes:h=[],edges:g=[],transform:y}=t.getState(),[k,v,b]=y;return{nodes:h.map(w=>({...w})),edges:g.map(w=>({...w})),viewport:{x:k,y:v,zoom:b}}},deleteElements:async({nodes:h=[],edges:g=[]})=>{const{nodes:y,edges:k,onNodesDelete:v,onEdgesDelete:b,triggerNodeChanges:w,triggerEdgeChanges:S,onDelete:N,onBeforeDelete:C}=t.getState(),{nodes:R,edges:T}=await Hne({nodesToRemove:h,edgesToRemove:g,nodes:y,edges:k,onBeforeDelete:C}),A=T.length>0,I=R.length>0;if(A){const _=T.map(SE);b==null||b(T),S(_)}if(I){const _=R.map(SE);v==null||v(R),w(_)}return(I||A)&&(N==null||N({nodes:R,edges:T})),{deletedNodes:R,deletedEdges:T}},getIntersectingNodes:(h,g=!0,y)=>{const k=JC(h),v=k?h:u(h),b=y!==void 0;return v?(y||t.getState().nodes).filter(w=>{const S=t.getState().nodeLookup.get(w.id);if(S&&!k&&(w.id===h.id||!S.internals.positionAbsolute))return!1;const N=fc(b?w:S),C=Rd(N,v);return g&&C>0||C>=N.width*N.height||C>=v.width*v.height}):[]},isNodeIntersecting:(h,g,y=!0)=>{const v=JC(h)?h:u(h);if(!v)return!1;const b=Rd(v,g);return y&&b>0||b>=g.width*g.height||b>=v.width*v.height},updateNode:f,updateNodeData:(h,g,y={replace:!1})=>{f(h,k=>{const v=typeof g=="function"?g(k):g;return y.replace?{...k,data:v}:{...k,data:{...k.data,...v}}},y)},updateEdge:p,updateEdgeData:(h,g,y={replace:!1})=>{p(h,k=>{const v=typeof g=="function"?g(k):g;return y.replace?{...k,data:v}:{...k,data:{...k.data,...v}}},y)},getNodesBounds:h=>{const{nodeLookup:g,nodeOrigin:y}=t.getState();return Fne(h,{nodeLookup:g,nodeOrigin:y})},getHandleConnections:({type:h,id:g,nodeId:y})=>{var k;return Array.from(((k=t.getState().connectionLookup.get(`${y}-${h}${g?`-${g}`:""}`))==null?void 0:k.values())??[])},getNodeConnections:({type:h,handleId:g,nodeId:y})=>{var k;return Array.from(((k=t.getState().connectionLookup.get(`${y}${h?g?`-${h}-${g}`:`-${h}`:""}`))==null?void 0:k.values())??[])},fitView:async h=>{const g=t.getState().fitViewResolver??Kne();return t.setState({fitViewQueued:!0,fitViewOptions:h,fitViewResolver:g}),n.nodeQueue.push(y=>[...y]),g.promise}}},[]);return m.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const TE=e=>e.selected,wse=typeof window<"u"?window:void 0;function jse({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=an(),{deleteElements:r}=xg(),o=Pd(e,{actInsideInputWithModifier:!1}),i=Pd(t,{target:wse});m.useEffect(()=>{if(o){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(TE),edges:a.filter(TE)}),n.setState({nodesSelectionActive:!1})}},[o]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function kse(e){const t=an();m.useEffect(()=>{const n=()=>{var o,i,a,l;if(!e.current||!(((i=(o=e.current).checkVisibility)==null?void 0:i.call(o))??!0))return!1;const r=J0(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Es.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const yg={position:"absolute",width:"100%",height:"100%",top:0,left:0},Nse=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Sse({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=va.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:f,minZoom:p,maxZoom:h,zoomActivationKeyCode:g,preventScrolling:y=!0,children:k,noWheelClassName:v,noPanClassName:b,onViewportChange:w,isControlledViewport:S,paneClickDistance:N,selectionOnDrag:C}){const R=an(),T=m.useRef(null),{userSelectionActive:A,lib:I,connectionInProgress:_}=Pt(Nse,on),z=Pd(g),O=m.useRef();kse(T);const B=m.useCallback(V=>{w==null||w({x:V[0],y:V[1],zoom:V[2]}),S||R.setState({transform:V})},[w,S]);return m.useEffect(()=>{if(T.current){O.current=Rre({domNode:T.current,minZoom:p,maxZoom:h,translateExtent:f,viewport:u,onDraggingChange:U=>R.setState(K=>K.paneDragging===U?K:{paneDragging:U}),onPanZoomStart:(U,K)=>{const{onViewportChangeStart:D,onMoveStart:W}=R.getState();W==null||W(U,K),D==null||D(K)},onPanZoom:(U,K)=>{const{onViewportChange:D,onMove:W}=R.getState();W==null||W(U,K),D==null||D(K)},onPanZoomEnd:(U,K)=>{const{onViewportChangeEnd:D,onMoveEnd:W}=R.getState();W==null||W(U,K),D==null||D(K)}});const{x:V,y:$,zoom:L}=O.current.getViewport();return R.setState({panZoom:O.current,transform:[V,$,L],domNode:T.current.closest(".react-flow")}),()=>{var U;(U=O.current)==null||U.destroy()}}},[]),m.useEffect(()=>{var V;(V=O.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:z,preventScrolling:y,noPanClassName:b,userSelectionActive:A,noWheelClassName:v,lib:I,onTransformChange:B,connectionInProgress:_,selectionOnDrag:C,paneClickDistance:N})},[e,t,n,r,o,i,a,l,z,y,b,A,v,I,B,_,C,N]),s.jsx("div",{className:"react-flow__renderer",ref:T,style:yg,children:k})}const Cse=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ese(){const{userSelectionActive:e,userSelectionRect:t}=Pt(Cse,on);return e&&t?s.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const mb=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Tse=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Rse({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Td.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:p,onPaneScroll:h,onPaneMouseEnter:g,onPaneMouseMove:y,onPaneMouseLeave:k,children:v}){const b=m.useRef(0),w=an(),{userSelectionActive:S,elementsSelectable:N,dragging:C,connectionInProgress:R,panBy:T,autoPanSpeed:A}=Pt(Tse,on),I=N&&(e||S),_=m.useRef(null),z=m.useRef(),O=m.useRef(new Set),B=m.useRef(new Set),V=m.useRef(!1),$=m.useRef({x:0,y:0}),L=m.useRef(!1),U=te=>{if(V.current||R){V.current=!1;return}f==null||f(te),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},K=te=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){te.preventDefault();return}p==null||p(te)},D=h?te=>h(te):void 0,W=te=>{V.current&&(te.stopPropagation(),V.current=!1)},M=te=>{var ye,Ae;const{domNode:ue,transform:ge}=w.getState();if(z.current=ue==null?void 0:ue.getBoundingClientRect(),!z.current)return;const Ce=te.target===_.current;if(!Ce&&!!te.target.closest(".nokey")||!e||!(a&&Ce||t)||te.button!==0||!te.isPrimary)return;(Ae=(ye=te.target)==null?void 0:ye.setPointerCapture)==null||Ae.call(ye,te.pointerId),V.current=!1;const{x:Be,y:ie}=xs(te.nativeEvent,z.current),ve=Fc({x:Be,y:ie},ge);w.setState({userSelectionRect:{width:0,height:0,startX:ve.x,startY:ve.y,x:Be,y:ie}}),Ce||(te.stopPropagation(),te.preventDefault())};function F(te,ue){const{userSelectionRect:ge}=w.getState();if(!ge)return;const{transform:Ce,nodeLookup:Se,edgeLookup:ke,connectionLookup:Be,triggerNodeChanges:ie,triggerEdgeChanges:ve,defaultEdgeOptions:ye}=w.getState(),Ae={x:ge.startX,y:ge.startY},{x:Ue,y:rt}=pc(Ae,Ce),Oe={startX:Ae.x,startY:Ae.y,x:te<Ue?te:Ue,y:ue<rt?ue:rt,width:Math.abs(te-Ue),height:Math.abs(ue-rt)},ot=O.current,St=B.current;O.current=new Set(Y0(Se,Oe,Ce,n===Td.Partial,!0).map(it=>it.id)),B.current=new Set;const ht=(ye==null?void 0:ye.selectable)??!0;for(const it of O.current){const ce=Be.get(it);if(ce)for(const{edgeId:me}of ce.values()){const Ie=ke.get(me);Ie&&(Ie.selectable??ht)&&B.current.add(me)}}if(!ZC(ot,O.current)){const it=Ol(Se,O.current,!0);ie(it)}if(!ZC(St,B.current)){const it=Ol(ke,B.current);ve(it)}w.setState({userSelectionRect:Oe,userSelectionActive:!0,nodesSelectionActive:!1})}function Y(){if(!o||!z.current)return;const[te,ue]=X0($.current,z.current,A);T({x:te,y:ue}).then(ge=>{if(!V.current||!ge){b.current=requestAnimationFrame(Y);return}const{x:Ce,y:Se}=$.current;F(Ce,Se),b.current=requestAnimationFrame(Y)})}const H=()=>{cancelAnimationFrame(b.current),b.current=0,L.current=!1};m.useEffect(()=>()=>H(),[]);const Q=te=>{const{userSelectionRect:ue,transform:ge,resetSelectedElements:Ce}=w.getState();if(!z.current||!ue)return;const{x:Se,y:ke}=xs(te.nativeEvent,z.current);$.current={x:Se,y:ke};const Be=pc({x:ue.startX,y:ue.startY},ge);if(!V.current){const ie=t?0:i;if(Math.hypot(Se-Be.x,ke-Be.y)<=ie)return;Ce(),l==null||l(te)}V.current=!0,L.current||(Y(),L.current=!0),F(Se,ke)},J=te=>{var ue,ge;te.button===0&&((ge=(ue=te.target)==null?void 0:ue.releasePointerCapture)==null||ge.call(ue,te.pointerId),!S&&te.target===_.current&&w.getState().userSelectionRect&&(U==null||U(te)),w.setState({userSelectionActive:!1,userSelectionRect:null}),V.current&&(u==null||u(te),w.setState({nodesSelectionActive:O.current.size>0})),H())},Z=te=>{var ue,ge;(ge=(ue=te.target)==null?void 0:ue.releasePointerCapture)==null||ge.call(ue,te.pointerId),H()},oe=r===!0||Array.isArray(r)&&r.includes(0);return s.jsxs("div",{className:Rn(["react-flow__pane",{draggable:oe,dragging:C,selection:e}]),onClick:I?void 0:mb(U,_),onContextMenu:mb(K,_),onWheel:mb(D,_),onPointerEnter:I?void 0:g,onPointerMove:I?Q:y,onPointerUp:I?J:void 0,onPointerCancel:I?Z:void 0,onPointerDownCapture:I?M:void 0,onClickCapture:I?W:void 0,onPointerLeave:k,ref:_,style:yg,children:[v,s.jsx(Ese,{})]})}function Ov({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:u}=t.getState(),f=l.get(e);if(!f){u==null||u("012",Es.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&a)&&(i({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):o([e])}function KD({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:a}){const l=an(),[u,f]=m.useState(!1),p=m.useRef();return m.useEffect(()=>{p.current=mre({getStoreItems:()=>l.getState(),onNodeMouseDown:h=>{Ov({id:h,store:l,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:a}),()=>{var h;(h=p.current)==null||h.destroy()}},[n,r,t,i,e,o,a]),u}const Ase=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function qD(){const e=an();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:u,nodeLookup:f,nodeOrigin:p}=e.getState(),h=new Map,g=Ase(a),y=o?i[0]:5,k=o?i[1]:5,v=n.direction.x*y*n.factor,b=n.direction.y*k*n.factor;for(const[,w]of f){if(!g(w))continue;let S={x:w.internals.positionAbsolute.x+v,y:w.internals.positionAbsolute.y+b};o&&(S=af(S,i));const{position:N,positionAbsolute:C}=pD({nodeId:w.id,nextPosition:S,nodeLookup:f,nodeExtent:r,nodeOrigin:p,onError:l});w.position=N,w.internals.positionAbsolute=C,h.set(w.id,w)}u(h)},[])}const oj=m.createContext(null),Pse=oj.Provider;oj.Consumer;const GD=()=>m.useContext(oj),_se=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Dse=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:u,isValid:f}=a,p=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:p,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===uc.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!o,valid:p&&f}};function $se({type:e="source",position:t=ct.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:u,className:f,onMouseDown:p,onTouchStart:h,...g},y){var L,U;const k=a||null,v=e==="target",b=an(),w=GD(),{connectOnClick:S,noPanClassName:N,rfId:C}=Pt(_se,on),{connectingFrom:R,connectingTo:T,clickConnecting:A,isPossibleEndHandle:I,connectionInProcess:_,clickConnectionInProcess:z,valid:O}=Pt(Dse(w,k,e),on);w||(U=(L=b.getState()).onError)==null||U.call(L,"010",Es.error010());const B=K=>{const{defaultEdgeOptions:D,onConnect:W,hasDefaultEdges:M}=b.getState(),F={...D,...K};if(M){const{edges:Y,setEdges:H,onError:Q}=b.getState();H(hse(F,Y,{onError:Q}))}W==null||W(F),l==null||l(F)},V=K=>{if(!w)return;const D=wD(K.nativeEvent);if(o&&(D&&K.button===0||!D)){const W=b.getState();Lv.onPointerDown(K.nativeEvent,{handleDomNode:K.currentTarget,autoPanOnConnect:W.autoPanOnConnect,connectionMode:W.connectionMode,connectionRadius:W.connectionRadius,domNode:W.domNode,nodeLookup:W.nodeLookup,lib:W.lib,isTarget:v,handleId:k,nodeId:w,flowId:W.rfId,panBy:W.panBy,cancelConnection:W.cancelConnection,onConnectStart:W.onConnectStart,onConnectEnd:(...M)=>{var F,Y;return(Y=(F=b.getState()).onConnectEnd)==null?void 0:Y.call(F,...M)},updateConnection:W.updateConnection,onConnect:B,isValidConnection:n||((...M)=>{var F,Y;return((Y=(F=b.getState()).isValidConnection)==null?void 0:Y.call(F,...M))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:W.autoPanSpeed,dragThreshold:W.connectionDragThreshold})}D?p==null||p(K):h==null||h(K)},$=K=>{const{onClickConnectStart:D,onClickConnectEnd:W,connectionClickStartHandle:M,connectionMode:F,isValidConnection:Y,lib:H,rfId:Q,nodeLookup:J,connection:Z}=b.getState();if(!w||!M&&!o)return;if(!M){D==null||D(K.nativeEvent,{nodeId:w,handleId:k,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:w,type:e,id:k}});return}const oe=bD(K.target),te=n||Y,{connection:ue,isValid:ge}=Lv.isValid(K.nativeEvent,{handle:{nodeId:w,id:k,type:e},connectionMode:F,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:te,flowId:Q,doc:oe,lib:H,nodeLookup:J});ge&&ue&&B(ue);const Ce=structuredClone(Z);delete Ce.inProgress,Ce.toPosition=Ce.toHandle?Ce.toHandle.position:null,W==null||W(K,Ce),b.setState({connectionClickStartHandle:null})};return s.jsx("div",{"data-handleid":k,"data-nodeid":w,"data-handlepos":t,"data-id":`${C}-${w}-${k}-${e}`,className:Rn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",N,f,{source:!v,target:v,connectable:r,connectablestart:o,connectableend:i,clickconnecting:A,connectingfrom:R,connectingto:T,valid:O,connectionindicator:r&&(!_||I)&&(_||z?i:o)}]),onMouseDown:V,onTouchStart:V,onClick:S?$:void 0,ref:y,...g,children:u})}const mc=m.memo(VD($se));function Ise({data:e,isConnectable:t,sourcePosition:n=ct.Bottom}){return s.jsxs(s.Fragment,{children:[e==null?void 0:e.label,s.jsx(mc,{type:"source",position:n,isConnectable:t})]})}function Mse({data:e,isConnectable:t,targetPosition:n=ct.Top,sourcePosition:r=ct.Bottom}){return s.jsxs(s.Fragment,{children:[s.jsx(mc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,s.jsx(mc,{type:"source",position:r,isConnectable:t})]})}function Lse(){return null}function Ose({data:e,isConnectable:t,targetPosition:n=ct.Top}){return s.jsxs(s.Fragment,{children:[s.jsx(mc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Jh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},RE={input:Ise,default:Mse,output:Ose,group:Lse};function Fse(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const zse=e=>{const{width:t,height:n,x:r,y:o}=of(e.nodeLookup,{filter:i=>!!i.selected});return{width:gs(t)?t:null,height:gs(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function Bse({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=an(),{width:o,height:i,transformString:a,userSelectionActive:l}=Pt(zse,on),u=qD(),f=m.useRef(null);m.useEffect(()=>{var y;n||(y=f.current)==null||y.focus({preventScroll:!0})},[n]);const p=!l&&o!==null&&i!==null;if(KD({nodeRef:f,disabled:!p}),!p)return null;const h=e?y=>{const k=r.getState().nodes.filter(v=>v.selected);e(y,k)}:void 0,g=y=>{Object.prototype.hasOwnProperty.call(Jh,y.key)&&(y.preventDefault(),u({direction:Jh[y.key],factor:y.shiftKey?4:1}))};return s.jsx("div",{className:Rn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:s.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:o,height:i}})})}const AE=typeof window<"u"?window:void 0,Use=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function YD({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:f,selectionOnDrag:p,selectionMode:h,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:k,panActivationKeyCode:v,zoomActivationKeyCode:b,elementsSelectable:w,zoomOnScroll:S,zoomOnPinch:N,panOnScroll:C,panOnScrollSpeed:R,panOnScrollMode:T,zoomOnDoubleClick:A,panOnDrag:I,autoPanOnSelection:_,defaultViewport:z,translateExtent:O,minZoom:B,maxZoom:V,preventScrolling:$,onSelectionContextMenu:L,noWheelClassName:U,noPanClassName:K,disableKeyboardA11y:D,onViewportChange:W,isControlledViewport:M}){const{nodesSelectionActive:F,userSelectionActive:Y}=Pt(Use,on),H=Pd(f,{target:AE}),Q=Pd(v,{target:AE}),J=Q||I,Z=Q||C,oe=p&&J!==!0,te=H||Y||oe;return jse({deleteKeyCode:u,multiSelectionKeyCode:k}),s.jsx(Sse,{onPaneContextMenu:i,elementsSelectable:w,zoomOnScroll:S,zoomOnPinch:N,panOnScroll:Z,panOnScrollSpeed:R,panOnScrollMode:T,zoomOnDoubleClick:A,panOnDrag:!H&&J,defaultViewport:z,translateExtent:O,minZoom:B,maxZoom:V,zoomActivationKeyCode:b,preventScrolling:$,noWheelClassName:U,noPanClassName:K,onViewportChange:W,isControlledViewport:M,paneClickDistance:l,selectionOnDrag:oe,children:s.jsxs(Rse,{onSelectionStart:g,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:J,autoPanOnSelection:_,isSelecting:!!te,selectionMode:h,selectionKeyPressed:H,paneClickDistance:l,selectionOnDrag:oe,children:[e,F&&s.jsx(Bse,{onSelectionContextMenu:L,noPanClassName:K,disableKeyboardA11y:D})]})})}YD.displayName="FlowRenderer";const Hse=m.memo(YD),Vse=e=>t=>e?Y0(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Wse(e){return Pt(m.useCallback(Vse(e),[e]),on)}const Kse=e=>e.updateNodeInternals;function qse(){const e=Pt(Kse),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Gse({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=an(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),u=m.useRef(e.targetPosition),f=m.useRef(t),p=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!p||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[p,e.hidden]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(i.current){const h=f.current!==t,g=l.current!==e.sourcePosition,y=u.current!==e.targetPosition;(h||g||y)&&(f.current=t,l.current=e.sourcePosition,u.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Yse({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:u,nodesConnectable:f,nodesFocusable:p,resizeObserver:h,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:k,rfId:v,nodeTypes:b,nodeClickDistance:w,onError:S}){const{node:N,internals:C,isParent:R}=Pt(te=>{const ue=te.nodeLookup.get(e),ge=te.parentLookup.has(e);return{node:ue,internals:ue.internals,isParent:ge}},on);let T=N.type||"default",A=(b==null?void 0:b[T])||RE[T];A===void 0&&(S==null||S("003",Es.error003(T)),T="default",A=(b==null?void 0:b.default)||RE.default);const I=!!(N.draggable||l&&typeof N.draggable>"u"),_=!!(N.selectable||u&&typeof N.selectable>"u"),z=!!(N.connectable||f&&typeof N.connectable>"u"),O=!!(N.focusable||p&&typeof N.focusable>"u"),B=an(),V=xD(N),$=Gse({node:N,nodeType:T,hasDimensions:V,resizeObserver:h}),L=KD({nodeRef:$,disabled:N.hidden||!I,noDragClassName:g,handleSelector:N.dragHandle,nodeId:e,isSelectable:_,nodeClickDistance:w}),U=qD();if(N.hidden)return null;const K=Lo(N),D=Fse(N),W=_||I||t||n||r||o,M=n?te=>n(te,{...C.userNode}):void 0,F=r?te=>r(te,{...C.userNode}):void 0,Y=o?te=>o(te,{...C.userNode}):void 0,H=i?te=>i(te,{...C.userNode}):void 0,Q=a?te=>a(te,{...C.userNode}):void 0,J=te=>{const{selectNodesOnDrag:ue,nodeDragThreshold:ge}=B.getState();_&&(!ue||!I||ge>0)&&Ov({id:e,store:B,nodeRef:$}),t&&t(te,{...C.userNode})},Z=te=>{if(!(vD(te.nativeEvent)||k)){if(lD.includes(te.key)&&_){const ue=te.key==="Escape";Ov({id:e,store:B,unselect:ue,nodeRef:$})}else if(I&&N.selected&&Object.prototype.hasOwnProperty.call(Jh,te.key)){te.preventDefault();const{ariaLabelConfig:ue}=B.getState();B.setState({ariaLiveMessage:ue["node.a11yDescription.ariaLiveMessage"]({direction:te.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),U({direction:Jh[te.key],factor:te.shiftKey?4:1})}}},oe=()=>{var Be;if(k||!((Be=$.current)!=null&&Be.matches(":focus-visible")))return;const{transform:te,width:ue,height:ge,autoPanOnNodeFocus:Ce,setCenter:Se}=B.getState();if(!Ce)return;Y0(new Map([[e,N]]),{x:0,y:0,width:ue,height:ge},te,!0).length>0||Se(N.position.x+K.width/2,N.position.y+K.height/2,{zoom:te[2]})};return s.jsx("div",{className:Rn(["react-flow__node",`react-flow__node-${T}`,{[y]:I},N.className,{selected:N.selected,selectable:_,parent:R,draggable:I,dragging:L}]),ref:$,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:W?"all":"none",visibility:V?"visible":"hidden",...N.style,...D},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:M,onMouseMove:F,onMouseLeave:Y,onContextMenu:H,onClick:J,onDoubleClick:Q,onKeyDown:O?Z:void 0,tabIndex:O?0:void 0,onFocus:O?oe:void 0,role:N.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":k?void 0:`${OD}-${v}`,"aria-label":N.ariaLabel,...N.domAttributes,children:s.jsx(Pse,{value:e,children:s.jsx(A,{id:e,data:N.data,type:T,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:N.selected??!1,selectable:_,draggable:I,deletable:N.deletable??!0,isConnectable:z,sourcePosition:N.sourcePosition,targetPosition:N.targetPosition,dragging:L,dragHandle:N.dragHandle,zIndex:C.z,parentId:N.parentId,...K})})})}var Xse=m.memo(Yse);const Qse=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function XD(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=Pt(Qse,on),a=Wse(e.onlyRenderVisibleElements),l=qse();return s.jsx("div",{className:"react-flow__nodes",style:yg,children:a.map(u=>s.jsx(Xse,{id:u,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},u))})}XD.displayName="NodeRenderer";const Jse=m.memo(XD);function Zse(e){return Pt(m.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),a=n.nodeLookup.get(o.target);i&&a&&Xne({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),on)}const eoe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return s.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},toe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return s.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},PE={[Xh.Arrow]:eoe,[Xh.ArrowClosed]:toe};function noe(e){const t=an();return m.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(PE,e)?PE[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",Es.error009(e)),null)},[e])}const roe=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const u=noe(t);return u?s.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:s.jsx(u,{color:n,strokeWidth:a})}):null},QD=({defaultColor:e,rfId:t})=>{const n=Pt(i=>i.edges),r=Pt(i=>i.defaultEdgeOptions),o=m.useMemo(()=>sre(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?s.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:s.jsx("defs",{children:o.map(i=>s.jsx(roe,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};QD.displayName="MarkerDefinitions";var soe=m.memo(QD);function JD({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:u,className:f,...p}){const[h,g]=m.useState({x:1,y:0,width:0,height:0}),y=Rn(["react-flow__edge-textwrapper",f]),k=m.useRef(null);return m.useEffect(()=>{if(k.current){const v=k.current.getBBox();g({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?s.jsxs("g",{transform:`translate(${e-h.width/2} ${t-h.height/2})`,className:y,visibility:h.width?"visible":"hidden",...p,children:[o&&s.jsx("rect",{width:h.width+2*a[0],x:-a[0],y:-a[1],height:h.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),s.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:k,style:r,children:n}),u]}):null}JD.displayName="EdgeText";const ooe=m.memo(JD);function cf({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:f=20,...p}){return s.jsxs(s.Fragment,{children:[s.jsx("path",{...p,d:e,fill:"none",className:Rn(["react-flow__edge-path",p.className])}),f?s.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&gs(t)&&gs(n)?s.jsx(ooe,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function _E({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===ct.Left||e===ct.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function ZD({sourceX:e,sourceY:t,sourcePosition:n=ct.Bottom,targetX:r,targetY:o,targetPosition:i=ct.Top}){const[a,l]=_E({pos:n,x1:e,y1:t,x2:r,y2:o}),[u,f]=_E({pos:i,x1:r,y1:o,x2:e,y2:t}),[p,h,g,y]=jD({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:f});return[`M${e},${t} C${a},${l} ${u},${f} ${r},${o}`,p,h,g,y]}function e$(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a,targetPosition:l,label:u,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:v,markerStart:b,interactionWidth:w})=>{const[S,N,C]=ZD({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l}),R=e.isInternal?void 0:t;return s.jsx(cf,{id:R,path:S,labelX:N,labelY:C,label:u,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:v,markerStart:b,interactionWidth:w})})}const ioe=e$({isInternal:!1}),t$=e$({isInternal:!0});ioe.displayName="SimpleBezierEdge";t$.displayName="SimpleBezierEdgeInternal";function n$(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,sourcePosition:y=ct.Bottom,targetPosition:k=ct.Top,markerEnd:v,markerStart:b,pathOptions:w,interactionWidth:S})=>{const[N,C,R]=$v({sourceX:n,sourceY:r,sourcePosition:y,targetX:o,targetY:i,targetPosition:k,borderRadius:w==null?void 0:w.borderRadius,offset:w==null?void 0:w.offset,stepPosition:w==null?void 0:w.stepPosition}),T=e.isInternal?void 0:t;return s.jsx(cf,{id:T,path:N,labelX:C,labelY:R,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:b,interactionWidth:S})})}const r$=n$({isInternal:!1}),s$=n$({isInternal:!0});r$.displayName="SmoothStepEdge";s$.displayName="SmoothStepEdgeInternal";function o$(e){return m.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return s.jsx(r$,{...n,id:r,pathOptions:m.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const aoe=o$({isInternal:!1}),i$=o$({isInternal:!0});aoe.displayName="StepEdge";i$.displayName="StepEdgeInternal";function a$(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:k,interactionWidth:v})=>{const[b,w,S]=ND({sourceX:n,sourceY:r,targetX:o,targetY:i}),N=e.isInternal?void 0:t;return s.jsx(cf,{id:N,path:b,labelX:w,labelY:S,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:k,interactionWidth:v})})}const loe=a$({isInternal:!1}),l$=a$({isInternal:!0});loe.displayName="StraightEdge";l$.displayName="StraightEdgeInternal";function c$(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a=ct.Bottom,targetPosition:l=ct.Top,label:u,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:v,markerStart:b,pathOptions:w,interactionWidth:S})=>{const[N,C,R]=Z0({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l,curvature:w==null?void 0:w.curvature}),T=e.isInternal?void 0:t;return s.jsx(cf,{id:T,path:N,labelX:C,labelY:R,label:u,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:v,markerStart:b,interactionWidth:S})})}const coe=c$({isInternal:!1}),u$=c$({isInternal:!0});coe.displayName="BezierEdge";u$.displayName="BezierEdgeInternal";const DE={default:u$,straight:l$,step:i$,smoothstep:s$,simplebezier:t$},$E={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},uoe=(e,t,n)=>n===ct.Left?e-t:n===ct.Right?e+t:e,doe=(e,t,n)=>n===ct.Top?e-t:n===ct.Bottom?e+t:e,IE="react-flow__edgeupdater";function ME({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:a,type:l}){return s.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:a,className:Rn([IE,`${IE}-${l}`]),cx:uoe(t,r,e),cy:doe(n,r,e),r,stroke:"transparent",fill:"transparent"})}function foe({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:a,sourcePosition:l,targetPosition:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,setReconnecting:g,setUpdateHover:y}){const k=an(),v=(C,R)=>{if(C.button!==0)return;const{autoPanOnConnect:T,domNode:A,connectionMode:I,connectionRadius:_,lib:z,onConnectStart:O,cancelConnection:B,nodeLookup:V,rfId:$,panBy:L,updateConnection:U}=k.getState(),K=R.type==="target",D=(F,Y)=>{g(!1),h==null||h(F,n,R.type,Y)},W=F=>f==null?void 0:f(n,F),M=(F,Y)=>{g(!0),p==null||p(C,n,R.type),O==null||O(F,Y)};Lv.onPointerDown(C.nativeEvent,{autoPanOnConnect:T,connectionMode:I,connectionRadius:_,domNode:A,handleId:R.id,nodeId:R.nodeId,nodeLookup:V,isTarget:K,edgeUpdaterType:R.type,lib:z,flowId:$,cancelConnection:B,panBy:L,isValidConnection:(...F)=>{var Y,H;return((H=(Y=k.getState()).isValidConnection)==null?void 0:H.call(Y,...F))??!0},onConnect:W,onConnectStart:M,onConnectEnd:(...F)=>{var Y,H;return(H=(Y=k.getState()).onConnectEnd)==null?void 0:H.call(Y,...F)},onReconnectEnd:D,updateConnection:U,getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,dragThreshold:k.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},b=C=>v(C,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),w=C=>v(C,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),S=()=>y(!0),N=()=>y(!1);return s.jsxs(s.Fragment,{children:[(e===!0||e==="source")&&s.jsx(ME,{position:l,centerX:r,centerY:o,radius:t,onMouseDown:b,onMouseEnter:S,onMouseOut:N,type:"source"}),(e===!0||e==="target")&&s.jsx(ME,{position:u,centerX:i,centerY:a,radius:t,onMouseDown:w,onMouseEnter:S,onMouseOut:N,type:"target"})]})}function poe({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:f,reconnectRadius:p,onReconnect:h,onReconnectStart:g,onReconnectEnd:y,rfId:k,edgeTypes:v,noPanClassName:b,onError:w,disableKeyboardA11y:S}){let N=Pt(Se=>Se.edgeLookup.get(e));const C=Pt(Se=>Se.defaultEdgeOptions);N=C?{...C,...N}:N;let R=N.type||"default",T=(v==null?void 0:v[R])||DE[R];T===void 0&&(w==null||w("011",Es.error011(R)),R="default",T=(v==null?void 0:v.default)||DE.default);const A=!!(N.focusable||t&&typeof N.focusable>"u"),I=typeof h<"u"&&(N.reconnectable||n&&typeof N.reconnectable>"u"),_=!!(N.selectable||r&&typeof N.selectable>"u"),z=m.useRef(null),[O,B]=m.useState(!1),[V,$]=m.useState(!1),L=an(),{zIndex:U,sourceX:K,sourceY:D,targetX:W,targetY:M,sourcePosition:F,targetPosition:Y}=Pt(m.useCallback(Se=>{const ke=Se.nodeLookup.get(N.source),Be=Se.nodeLookup.get(N.target);if(!ke||!Be)return{zIndex:N.zIndex,...$E};const ie=rre({id:e,sourceNode:ke,targetNode:Be,sourceHandle:N.sourceHandle||null,targetHandle:N.targetHandle||null,connectionMode:Se.connectionMode,onError:w});return{zIndex:Yne({selected:N.selected,zIndex:N.zIndex,sourceNode:ke,targetNode:Be,elevateOnSelect:Se.elevateEdgesOnSelect,zIndexMode:Se.zIndexMode}),...ie||$E}},[N.source,N.target,N.sourceHandle,N.targetHandle,N.selected,N.zIndex]),on),H=m.useMemo(()=>N.markerStart?`url('#${Iv(N.markerStart,k)}')`:void 0,[N.markerStart,k]),Q=m.useMemo(()=>N.markerEnd?`url('#${Iv(N.markerEnd,k)}')`:void 0,[N.markerEnd,k]);if(N.hidden||K===null||D===null||W===null||M===null)return null;const J=Se=>{var ve;const{addSelectedEdges:ke,unselectNodesAndEdges:Be,multiSelectionActive:ie}=L.getState();_&&(L.setState({nodesSelectionActive:!1}),N.selected&&ie?(Be({nodes:[],edges:[N]}),(ve=z.current)==null||ve.blur()):ke([e])),o&&o(Se,N)},Z=i?Se=>{i(Se,{...N})}:void 0,oe=a?Se=>{a(Se,{...N})}:void 0,te=l?Se=>{l(Se,{...N})}:void 0,ue=u?Se=>{u(Se,{...N})}:void 0,ge=f?Se=>{f(Se,{...N})}:void 0,Ce=Se=>{var ke;if(!S&&lD.includes(Se.key)&&_){const{unselectNodesAndEdges:Be,addSelectedEdges:ie}=L.getState();Se.key==="Escape"?((ke=z.current)==null||ke.blur(),Be({edges:[N]})):ie([e])}};return s.jsx("svg",{style:{zIndex:U},children:s.jsxs("g",{className:Rn(["react-flow__edge",`react-flow__edge-${R}`,N.className,b,{selected:N.selected,animated:N.animated,inactive:!_&&!o,updating:O,selectable:_}]),onClick:J,onDoubleClick:Z,onContextMenu:oe,onMouseEnter:te,onMouseMove:ue,onMouseLeave:ge,onKeyDown:A?Ce:void 0,tabIndex:A?0:void 0,role:N.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":N.ariaLabel===null?void 0:N.ariaLabel||`Edge from ${N.source} to ${N.target}`,"aria-describedby":A?`${FD}-${k}`:void 0,ref:z,...N.domAttributes,children:[!V&&s.jsx(T,{id:e,source:N.source,target:N.target,type:N.type,selected:N.selected,animated:N.animated,selectable:_,deletable:N.deletable??!0,label:N.label,labelStyle:N.labelStyle,labelShowBg:N.labelShowBg,labelBgStyle:N.labelBgStyle,labelBgPadding:N.labelBgPadding,labelBgBorderRadius:N.labelBgBorderRadius,sourceX:K,sourceY:D,targetX:W,targetY:M,sourcePosition:F,targetPosition:Y,data:N.data,style:N.style,sourceHandleId:N.sourceHandle,targetHandleId:N.targetHandle,markerStart:H,markerEnd:Q,pathOptions:"pathOptions"in N?N.pathOptions:void 0,interactionWidth:N.interactionWidth}),I&&s.jsx(foe,{edge:N,isReconnectable:I,reconnectRadius:p,onReconnect:h,onReconnectStart:g,onReconnectEnd:y,sourceX:K,sourceY:D,targetX:W,targetY:M,sourcePosition:F,targetPosition:Y,setUpdateHover:B,setReconnecting:$})]})})}var hoe=m.memo(poe);const moe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function d$({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:f,onEdgeClick:p,reconnectRadius:h,onEdgeDoubleClick:g,onReconnectStart:y,onReconnectEnd:k,disableKeyboardA11y:v}){const{edgesFocusable:b,edgesReconnectable:w,elementsSelectable:S,onError:N}=Pt(moe,on),C=Zse(t);return s.jsxs("div",{className:"react-flow__edges",children:[s.jsx(soe,{defaultColor:e,rfId:n}),C.map(R=>s.jsx(hoe,{id:R,edgesFocusable:b,edgesReconnectable:w,elementsSelectable:S,noPanClassName:o,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:f,onClick:p,reconnectRadius:h,onDoubleClick:g,onReconnectStart:y,onReconnectEnd:k,rfId:n,onError:N,edgeTypes:r,disableKeyboardA11y:v},R))]})}d$.displayName="EdgeRenderer";const goe=m.memo(d$),xoe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function yoe({children:e}){const t=Pt(xoe);return s.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function boe(e){const t=xg(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const voe=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function woe(e){const t=Pt(voe),n=an();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function joe(e){return e.connection.inProgress?{...e.connection,to:Fc(e.connection.to,e.transform)}:{...e.connection}}function koe(e){return joe}function Noe(e){const t=koe();return Pt(t,on)}const Soe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Coe({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:a,isValid:l,inProgress:u}=Pt(Soe,on);return!(i&&o&&u)?null:s.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:s.jsx("g",{className:Rn(["react-flow__connection",dD(l)]),children:s.jsx(f$,{style:t,type:n,CustomComponent:r,isValid:l})})})}const f$=({style:e,type:t=xi.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:a,fromHandle:l,fromPosition:u,to:f,toNode:p,toHandle:h,toPosition:g,pointer:y}=Noe();if(!o)return;if(n)return s.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:i.x,fromY:i.y,toX:f.x,toY:f.y,fromPosition:u,toPosition:g,connectionStatus:dD(r),toNode:p,toHandle:h,pointer:y});let k="";const v={sourceX:i.x,sourceY:i.y,sourcePosition:u,targetX:f.x,targetY:f.y,targetPosition:g};switch(t){case xi.Bezier:[k]=Z0(v);break;case xi.SimpleBezier:[k]=ZD(v);break;case xi.Step:[k]=$v({...v,borderRadius:0});break;case xi.SmoothStep:[k]=$v(v);break;default:[k]=ND(v)}return s.jsx("path",{d:k,fill:"none",className:"react-flow__connection-path",style:e})};f$.displayName="ConnectionLine";const Eoe={};function LE(e=Eoe){m.useRef(e),an(),m.useEffect(()=>{},[e])}function Toe(){an(),m.useRef(!1),m.useEffect(()=>{},[])}function p$({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:h,onSelectionStart:g,onSelectionEnd:y,connectionLineType:k,connectionLineStyle:v,connectionLineComponent:b,connectionLineContainerStyle:w,selectionKeyCode:S,selectionOnDrag:N,selectionMode:C,multiSelectionKeyCode:R,panActivationKeyCode:T,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:_,elementsSelectable:z,defaultViewport:O,translateExtent:B,minZoom:V,maxZoom:$,preventScrolling:L,defaultMarkerColor:U,zoomOnScroll:K,zoomOnPinch:D,panOnScroll:W,panOnScrollSpeed:M,panOnScrollMode:F,zoomOnDoubleClick:Y,panOnDrag:H,autoPanOnSelection:Q,onPaneClick:J,onPaneMouseEnter:Z,onPaneMouseMove:oe,onPaneMouseLeave:te,onPaneScroll:ue,onPaneContextMenu:ge,paneClickDistance:Ce,nodeClickDistance:Se,onEdgeContextMenu:ke,onEdgeMouseEnter:Be,onEdgeMouseMove:ie,onEdgeMouseLeave:ve,reconnectRadius:ye,onReconnect:Ae,onReconnectStart:Ue,onReconnectEnd:rt,noDragClassName:Oe,noWheelClassName:ot,noPanClassName:St,disableKeyboardA11y:ht,nodeExtent:it,rfId:ce,viewport:me,onViewportChange:Ie}){return LE(e),LE(t),Toe(),boe(n),woe(me),s.jsx(Hse,{onPaneClick:J,onPaneMouseEnter:Z,onPaneMouseMove:oe,onPaneMouseLeave:te,onPaneContextMenu:ge,onPaneScroll:ue,paneClickDistance:Ce,deleteKeyCode:I,selectionKeyCode:S,selectionOnDrag:N,selectionMode:C,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:R,panActivationKeyCode:T,zoomActivationKeyCode:A,elementsSelectable:z,zoomOnScroll:K,zoomOnPinch:D,zoomOnDoubleClick:Y,panOnScroll:W,panOnScrollSpeed:M,panOnScrollMode:F,panOnDrag:H,autoPanOnSelection:Q,defaultViewport:O,translateExtent:B,minZoom:V,maxZoom:$,onSelectionContextMenu:h,preventScrolling:L,noDragClassName:Oe,noWheelClassName:ot,noPanClassName:St,disableKeyboardA11y:ht,onViewportChange:Ie,isControlledViewport:!!me,children:s.jsxs(yoe,{children:[s.jsx(goe,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:a,onReconnect:Ae,onReconnectStart:Ue,onReconnectEnd:rt,onlyRenderVisibleElements:_,onEdgeContextMenu:ke,onEdgeMouseEnter:Be,onEdgeMouseMove:ie,onEdgeMouseLeave:ve,reconnectRadius:ye,defaultMarkerColor:U,noPanClassName:St,disableKeyboardA11y:ht,rfId:ce}),s.jsx(Coe,{style:v,type:k,component:b,containerStyle:w}),s.jsx("div",{className:"react-flow__edgelabel-renderer"}),s.jsx(Jse,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:p,nodeClickDistance:Se,onlyRenderVisibleElements:_,noPanClassName:St,noDragClassName:Oe,disableKeyboardA11y:ht,nodeExtent:it,rfId:ce}),s.jsx("div",{className:"react-flow__viewport-portal"})]})})}p$.displayName="GraphView";const Roe=m.memo(p$),Aoe=gD(),OE=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:u=.5,maxZoom:f=2,nodeOrigin:p,nodeExtent:h,zIndexMode:g="basic"}={})=>{const y=new Map,k=new Map,v=new Map,b=new Map,w=r??t??[],S=n??e??[],N=p??[0,0],C=h??Ed;ED(v,b,w);const{nodesInitialized:R}=Mv(S,y,k,{nodeOrigin:N,nodeExtent:C,zIndexMode:g});let T=[0,0,1];if(a&&o&&i){const A=of(y,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:I,y:_,zoom:z}=Q0(A,o,i,u,f,(l==null?void 0:l.padding)??.1);T=[I,_,z]}return{rfId:"1",width:o??0,height:i??0,transform:T,nodes:S,nodesInitialized:R,nodeLookup:y,parentLookup:k,edges:w,edgeLookup:b,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:f,translateExtent:Ed,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:uc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:N,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...uD},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Aoe,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:cD,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Poe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:f,nodeOrigin:p,nodeExtent:h,zIndexMode:g})=>Kre((y,k)=>{async function v(){const{nodeLookup:b,panZoom:w,fitViewOptions:S,fitViewResolver:N,width:C,height:R,minZoom:T,maxZoom:A}=k();w&&(await Une({nodes:b,width:C,height:R,panZoom:w,minZoom:T,maxZoom:A},S),N==null||N.resolve(!0),y({fitViewResolver:null}))}return{...OE({nodes:e,edges:t,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:f,nodeOrigin:p,nodeExtent:h,defaultNodes:n,defaultEdges:r,zIndexMode:g}),setNodes:b=>{const{nodeLookup:w,parentLookup:S,nodeOrigin:N,elevateNodesOnSelect:C,fitViewQueued:R,zIndexMode:T,nodesSelectionActive:A}=k(),{nodesInitialized:I,hasSelectedNodes:_}=Mv(b,w,S,{nodeOrigin:N,nodeExtent:h,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:T}),z=A&&_;R&&I?(v(),y({nodes:b,nodesInitialized:I,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:z})):y({nodes:b,nodesInitialized:I,nodesSelectionActive:z})},setEdges:b=>{const{connectionLookup:w,edgeLookup:S}=k();ED(w,S,b),y({edges:b})},setDefaultNodesAndEdges:(b,w)=>{if(b){const{setNodes:S}=k();S(b),y({hasDefaultNodes:!0})}if(w){const{setEdges:S}=k();S(w),y({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:w,nodeLookup:S,parentLookup:N,domNode:C,nodeOrigin:R,nodeExtent:T,debug:A,fitViewQueued:I,zIndexMode:_}=k(),{changes:z,updatedInternals:O}=dre(b,S,N,C,R,T,_);O&&(are(S,N,{nodeOrigin:R,nodeExtent:T,zIndexMode:_}),I?(v(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),(z==null?void 0:z.length)>0&&(A&&console.log("React Flow: trigger node changes",z),w==null||w(z)))},updateNodePositions:(b,w=!1)=>{const S=[];let N=[];const{nodeLookup:C,triggerNodeChanges:R,connection:T,updateConnection:A,onNodesChangeMiddlewareMap:I}=k();for(const[_,z]of b){const O=C.get(_),B=!!(O!=null&&O.expandParent&&(O!=null&&O.parentId)&&(z!=null&&z.position)),V={id:_,type:"position",position:B?{x:Math.max(0,z.position.x),y:Math.max(0,z.position.y)}:z.position,dragging:w};if(O&&T.inProgress&&T.fromNode.id===O.id){const $=Ta(O,T.fromHandle,ct.Left,!0);A({...T,from:$})}B&&O.parentId&&S.push({id:_,parentId:O.parentId,rect:{...z.internals.positionAbsolute,width:z.measured.width??0,height:z.measured.height??0}}),N.push(V)}if(S.length>0){const{parentLookup:_,nodeOrigin:z}=k(),O=sj(S,C,_,z);N.push(...O)}for(const _ of I.values())N=_(N);R(N)},triggerNodeChanges:b=>{const{onNodesChange:w,setNodes:S,nodes:N,hasDefaultNodes:C,debug:R}=k();if(b!=null&&b.length){if(C){const T=UD(b,N);S(T)}R&&console.log("React Flow: trigger node changes",b),w==null||w(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:w,setEdges:S,edges:N,hasDefaultEdges:C,debug:R}=k();if(b!=null&&b.length){if(C){const T=HD(b,N);S(T)}R&&console.log("React Flow: trigger edge changes",b),w==null||w(b)}},addSelectedNodes:b=>{const{multiSelectionActive:w,edgeLookup:S,nodeLookup:N,triggerNodeChanges:C,triggerEdgeChanges:R}=k();if(w){const T=b.map(A=>sa(A,!0));C(T);return}C(Ol(N,new Set([...b]),!0)),R(Ol(S))},addSelectedEdges:b=>{const{multiSelectionActive:w,edgeLookup:S,nodeLookup:N,triggerNodeChanges:C,triggerEdgeChanges:R}=k();if(w){const T=b.map(A=>sa(A,!0));R(T);return}R(Ol(S,new Set([...b]))),C(Ol(N,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:w}={})=>{const{edges:S,nodes:N,nodeLookup:C,triggerNodeChanges:R,triggerEdgeChanges:T}=k(),A=b||N,I=w||S,_=[];for(const O of A){if(!O.selected)continue;const B=C.get(O.id);B&&(B.selected=!1),_.push(sa(O.id,!1))}const z=[];for(const O of I)O.selected&&z.push(sa(O.id,!1));R(_),T(z)},setMinZoom:b=>{const{panZoom:w,maxZoom:S}=k();w==null||w.setScaleExtent([b,S]),y({minZoom:b})},setMaxZoom:b=>{const{panZoom:w,minZoom:S}=k();w==null||w.setScaleExtent([S,b]),y({maxZoom:b})},setTranslateExtent:b=>{var w;(w=k().panZoom)==null||w.setTranslateExtent(b),y({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:w,triggerNodeChanges:S,triggerEdgeChanges:N,elementsSelectable:C}=k();if(!C)return;const R=w.reduce((A,I)=>I.selected?[...A,sa(I.id,!1)]:A,[]),T=b.reduce((A,I)=>I.selected?[...A,sa(I.id,!1)]:A,[]);S(R),N(T)},setNodeExtent:b=>{const{nodes:w,nodeLookup:S,parentLookup:N,nodeOrigin:C,elevateNodesOnSelect:R,nodeExtent:T,zIndexMode:A}=k();b[0][0]===T[0][0]&&b[0][1]===T[0][1]&&b[1][0]===T[1][0]&&b[1][1]===T[1][1]||(Mv(w,S,N,{nodeOrigin:C,nodeExtent:b,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:A}),y({nodeExtent:b}))},panBy:b=>{const{transform:w,width:S,height:N,panZoom:C,translateExtent:R}=k();return fre({delta:b,panZoom:C,transform:w,translateExtent:R,width:S,height:N})},setCenter:async(b,w,S)=>{const{width:N,height:C,maxZoom:R,panZoom:T}=k();if(!T)return!1;const A=typeof(S==null?void 0:S.zoom)<"u"?S.zoom:R;return await T.setViewport({x:N/2-b*A,y:C/2-w*A,zoom:A},{duration:S==null?void 0:S.duration,ease:S==null?void 0:S.ease,interpolate:S==null?void 0:S.interpolate}),!0},cancelConnection:()=>{y({connection:{...uD}})},updateConnection:b=>{y({connection:b})},reset:()=>y({...OE()})}},Object.is);function _oe({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:u,fitView:f,nodeOrigin:p,nodeExtent:h,zIndexMode:g,children:y}){const[k]=m.useState(()=>Poe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:f,minZoom:a,maxZoom:l,fitViewOptions:u,nodeOrigin:p,nodeExtent:h,zIndexMode:g}));return s.jsx(qre,{value:k,children:s.jsx(yse,{children:y})})}function Doe({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:a,fitView:l,fitViewOptions:u,minZoom:f,maxZoom:p,nodeOrigin:h,nodeExtent:g,zIndexMode:y}){return m.useContext(gg)?s.jsx(s.Fragment,{children:e}):s.jsx(_oe,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:u,initialMinZoom:f,initialMaxZoom:p,nodeOrigin:h,nodeExtent:g,zIndexMode:y,children:e})}const $oe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Ioe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:u,onInit:f,onMove:p,onMoveStart:h,onMoveEnd:g,onConnect:y,onConnectStart:k,onConnectEnd:v,onClickConnectStart:b,onClickConnectEnd:w,onNodeMouseEnter:S,onNodeMouseMove:N,onNodeMouseLeave:C,onNodeContextMenu:R,onNodeDoubleClick:T,onNodeDragStart:A,onNodeDrag:I,onNodeDragStop:_,onNodesDelete:z,onEdgesDelete:O,onDelete:B,onSelectionChange:V,onSelectionDragStart:$,onSelectionDrag:L,onSelectionDragStop:U,onSelectionContextMenu:K,onSelectionStart:D,onSelectionEnd:W,onBeforeDelete:M,connectionMode:F,connectionLineType:Y=xi.Bezier,connectionLineStyle:H,connectionLineComponent:Q,connectionLineContainerStyle:J,deleteKeyCode:Z="Backspace",selectionKeyCode:oe="Shift",selectionOnDrag:te=!1,selectionMode:ue=Td.Full,panActivationKeyCode:ge="Space",multiSelectionKeyCode:Ce=Ad()?"Meta":"Control",zoomActivationKeyCode:Se=Ad()?"Meta":"Control",snapToGrid:ke,snapGrid:Be,onlyRenderVisibleElements:ie=!1,selectNodesOnDrag:ve,nodesDraggable:ye,autoPanOnNodeFocus:Ae,nodesConnectable:Ue,nodesFocusable:rt,nodeOrigin:Oe=zD,edgesFocusable:ot,edgesReconnectable:St,elementsSelectable:ht=!0,defaultViewport:it=ise,minZoom:ce=.5,maxZoom:me=2,translateExtent:Ie=Ed,preventScrolling:Pe=!0,nodeExtent:We,defaultMarkerColor:pt="#b1b1b7",zoomOnScroll:De=!0,zoomOnPinch:Qe=!0,panOnScroll:Je=!1,panOnScrollSpeed:ut=.5,panOnScrollMode:fe=va.Free,zoomOnDoubleClick:q=!0,panOnDrag:ne=!0,onPaneClick:xe,onPaneMouseEnter:qe,onPaneMouseMove:Fe,onPaneMouseLeave:lt,onPaneScroll:mt,onPaneContextMenu:vt,paneClickDistance:nt=1,nodeClickDistance:_t=0,children:Bt,onReconnect:Ut,onReconnectStart:An,onReconnectEnd:Ct,onEdgeContextMenu:je,onEdgeDoubleClick:Ye,onEdgeMouseEnter:at,onEdgeMouseMove:Mt,onEdgeMouseLeave:le,reconnectRadius:Ne=10,onNodesChange:et,onEdgesChange:Pn,noDragClassName:Er="nodrag",noWheelClassName:lo="nowheel",noPanClassName:wt="nopan",fitView:_i,fitViewOptions:Oo,connectOnClick:Ma,attributionPosition:nn,proOptions:Fo,defaultEdgeOptions:La,elevateNodesOnSelect:Oa=!0,elevateEdgesOnSelect:Bc=!1,disableKeyboardA11y:Fa=!1,autoPanOnConnect:Ht,autoPanOnNodeDrag:Di,autoPanOnSelection:co=!0,autoPanSpeed:zo,connectionRadius:Ds,isValidConnection:Bo,onError:za,style:Uo,id:ir,nodeDragThreshold:ur,connectionDragThreshold:Fn,viewport:Ho,onViewportChange:Uc,width:Hc,height:Vo,colorMode:Kn="light",debug:uo,onScroll:Vr,ariaLabelConfig:Ba,zIndexMode:$i="basic",...Wo},Ko){const $s=ir||"1",zn=use(Kn),_n=m.useCallback(Is=>{Is.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Vr==null||Vr(Is)},[Vr]);return s.jsx("div",{"data-testid":"rf__wrapper",...Wo,onScroll:_n,style:{...Uo,...$oe},ref:Ko,className:Rn(["react-flow",o,zn]),id:ir,role:"application",children:s.jsxs(Doe,{nodes:e,edges:t,width:Hc,height:Vo,fitView:_i,fitViewOptions:Oo,minZoom:ce,maxZoom:me,nodeOrigin:Oe,nodeExtent:We,zIndexMode:$i,children:[s.jsx(cse,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:k,onConnectEnd:v,onClickConnectStart:b,onClickConnectEnd:w,nodesDraggable:ye,autoPanOnNodeFocus:Ae,nodesConnectable:Ue,nodesFocusable:rt,edgesFocusable:ot,edgesReconnectable:St,elementsSelectable:ht,elevateNodesOnSelect:Oa,elevateEdgesOnSelect:Bc,minZoom:ce,maxZoom:me,nodeExtent:We,onNodesChange:et,onEdgesChange:Pn,snapToGrid:ke,snapGrid:Be,connectionMode:F,translateExtent:Ie,connectOnClick:Ma,defaultEdgeOptions:La,fitView:_i,fitViewOptions:Oo,onNodesDelete:z,onEdgesDelete:O,onDelete:B,onNodeDragStart:A,onNodeDrag:I,onNodeDragStop:_,onSelectionDrag:L,onSelectionDragStart:$,onSelectionDragStop:U,onMove:p,onMoveStart:h,onMoveEnd:g,noPanClassName:wt,nodeOrigin:Oe,rfId:$s,autoPanOnConnect:Ht,autoPanOnNodeDrag:Di,autoPanSpeed:zo,onError:za,connectionRadius:Ds,isValidConnection:Bo,selectNodesOnDrag:ve,nodeDragThreshold:ur,connectionDragThreshold:Fn,onBeforeDelete:M,debug:uo,ariaLabelConfig:Ba,zIndexMode:$i}),s.jsx(Roe,{onInit:f,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:S,onNodeMouseMove:N,onNodeMouseLeave:C,onNodeContextMenu:R,onNodeDoubleClick:T,nodeTypes:i,edgeTypes:a,connectionLineType:Y,connectionLineStyle:H,connectionLineComponent:Q,connectionLineContainerStyle:J,selectionKeyCode:oe,selectionOnDrag:te,selectionMode:ue,deleteKeyCode:Z,multiSelectionKeyCode:Ce,panActivationKeyCode:ge,zoomActivationKeyCode:Se,onlyRenderVisibleElements:ie,defaultViewport:it,translateExtent:Ie,minZoom:ce,maxZoom:me,preventScrolling:Pe,zoomOnScroll:De,zoomOnPinch:Qe,zoomOnDoubleClick:q,panOnScroll:Je,panOnScrollSpeed:ut,panOnScrollMode:fe,panOnDrag:ne,autoPanOnSelection:co,onPaneClick:xe,onPaneMouseEnter:qe,onPaneMouseMove:Fe,onPaneMouseLeave:lt,onPaneScroll:mt,onPaneContextMenu:vt,paneClickDistance:nt,nodeClickDistance:_t,onSelectionContextMenu:K,onSelectionStart:D,onSelectionEnd:W,onReconnect:Ut,onReconnectStart:An,onReconnectEnd:Ct,onEdgeContextMenu:je,onEdgeDoubleClick:Ye,onEdgeMouseEnter:at,onEdgeMouseMove:Mt,onEdgeMouseLeave:le,reconnectRadius:Ne,defaultMarkerColor:pt,noDragClassName:Er,noWheelClassName:lo,noPanClassName:wt,rfId:$s,disableKeyboardA11y:Fa,nodeExtent:We,viewport:Ho,onViewportChange:Uc}),s.jsx(ose,{onSelectionChange:V}),Bt,s.jsx(ese,{proOptions:Fo,position:nn}),s.jsx(Zre,{rfId:$s,disableKeyboardA11y:Fa})]})})}var Moe=VD(Ioe);const Loe=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function Ooe({children:e}){const t=Pt(Loe);return t?Xs.createPortal(e,t):null}function Foe(e){const[t,n]=m.useState(e),r=m.useCallback(o=>n(i=>UD(o,i)),[]);return[t,n,r]}function zoe(e){const[t,n]=m.useState(e),r=m.useCallback(o=>n(i=>HD(o,i)),[]);return[t,n,r]}function Boe({dimensions:e,lineWidth:t,variant:n,className:r}){return s.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Rn(["react-flow__background-pattern",n,r])})}function Uoe({radius:e,className:t}){return s.jsx("circle",{cx:e,cy:e,r:e,className:Rn(["react-flow__background-pattern","dots",t])})}var vi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(vi||(vi={}));const Hoe={[vi.Dots]:1,[vi.Lines]:1,[vi.Cross]:6},Voe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function h$({id:e,variant:t=vi.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:a,bgColor:l,style:u,className:f,patternClassName:p}){const h=m.useRef(null),{transform:g,patternId:y}=Pt(Voe,on),k=r||Hoe[t],v=t===vi.Dots,b=t===vi.Cross,w=Array.isArray(n)?n:[n,n],S=[w[0]*g[2]||1,w[1]*g[2]||1],N=k*g[2],C=Array.isArray(i)?i:[i,i],R=b?[N,N]:S,T=[C[0]*g[2]||1+R[0]/2,C[1]*g[2]||1+R[1]/2],A=`${y}${e||""}`;return s.jsxs("svg",{className:Rn(["react-flow__background",f]),style:{...u,...yg,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:h,"data-testid":"rf__background",children:[s.jsx("pattern",{id:A,x:g[0]%S[0],y:g[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:v?s.jsx(Uoe,{radius:N/2,className:p}):s.jsx(Boe,{dimensions:R,lineWidth:o,variant:t,className:p})}),s.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}h$.displayName="Background";const Woe=m.memo(h$);function Koe(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:s.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function qoe(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:s.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Goe(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:s.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Yoe(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:s.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Xoe(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:s.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Mp({children:e,className:t,...n}){return s.jsx("button",{type:"button",className:Rn(["react-flow__controls-button",t]),...n,children:e})}const Qoe=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function m$({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:u,className:f,children:p,position:h="bottom-left",orientation:g="vertical","aria-label":y}){const k=an(),{isInteractive:v,minZoomReached:b,maxZoomReached:w,ariaLabelConfig:S}=Pt(Qoe,on),{zoomIn:N,zoomOut:C,fitView:R}=xg(),T=()=>{N(),i==null||i()},A=()=>{C(),a==null||a()},I=()=>{R(o),l==null||l()},_=()=>{k.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),u==null||u(!v)},z=g==="horizontal"?"horizontal":"vertical";return s.jsxs(lf,{className:Rn(["react-flow__controls",z,f]),position:h,style:e,"data-testid":"rf__controls","aria-label":y??S["controls.ariaLabel"],children:[t&&s.jsxs(s.Fragment,{children:[s.jsx(Mp,{onClick:T,className:"react-flow__controls-zoomin",title:S["controls.zoomIn.ariaLabel"],"aria-label":S["controls.zoomIn.ariaLabel"],disabled:w,children:s.jsx(Koe,{})}),s.jsx(Mp,{onClick:A,className:"react-flow__controls-zoomout",title:S["controls.zoomOut.ariaLabel"],"aria-label":S["controls.zoomOut.ariaLabel"],disabled:b,children:s.jsx(qoe,{})})]}),n&&s.jsx(Mp,{className:"react-flow__controls-fitview",onClick:I,title:S["controls.fitView.ariaLabel"],"aria-label":S["controls.fitView.ariaLabel"],children:s.jsx(Goe,{})}),r&&s.jsx(Mp,{className:"react-flow__controls-interactive",onClick:_,title:S["controls.interactive.ariaLabel"],"aria-label":S["controls.interactive.ariaLabel"],children:v?s.jsx(Xoe,{}):s.jsx(Yoe,{})}),p]})}m$.displayName="Controls";const Joe=m.memo(m$);function Zoe({id:e,x:t,y:n,width:r,height:o,style:i,color:a,strokeColor:l,strokeWidth:u,className:f,borderRadius:p,shapeRendering:h,selected:g,onClick:y}){const{background:k,backgroundColor:v}=i||{},b=a||k||v;return s.jsx("rect",{className:Rn(["react-flow__minimap-node",{selected:g},f]),x:t,y:n,rx:p,ry:p,width:r,height:o,style:{fill:b,stroke:l,strokeWidth:u},shapeRendering:h,onClick:y?w=>y(w,e):void 0})}const eie=m.memo(Zoe),tie=e=>e.nodes.map(t=>t.id),gb=e=>e instanceof Function?e:()=>e;function nie({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=eie,onClick:a}){const l=Pt(tie,on),u=gb(t),f=gb(e),p=gb(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return s.jsx(s.Fragment,{children:l.map(g=>s.jsx(sie,{id:g,nodeColorFunc:u,nodeStrokeColorFunc:f,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:a,shapeRendering:h},g))})}function rie({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:u}){const{node:f,x:p,y:h,width:g,height:y}=Pt(k=>{const v=k.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const b=v.internals.userNode,{x:w,y:S}=v.internals.positionAbsolute,{width:N,height:C}=Lo(b);return{node:b,x:w,y:S,width:N,height:C}},on);return!f||f.hidden||!xD(f)?null:s.jsx(l,{x:p,y:h,width:g,height:y,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:o,strokeColor:n(f),strokeWidth:i,shapeRendering:a,onClick:u,id:f.id})}const sie=m.memo(rie);var oie=m.memo(nie);const iie=200,aie=150,lie=e=>!e.hidden,cie=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?mD(of(e.nodeLookup,{filter:lie}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},uie="react-flow__minimap-desc";function g$({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:u,maskColor:f,maskStrokeColor:p,maskStrokeWidth:h,position:g="bottom-right",onClick:y,onNodeClick:k,pannable:v=!1,zoomable:b=!1,ariaLabel:w,inversePan:S,zoomStep:N=1,offsetScale:C=5}){const R=an(),T=m.useRef(null),{boundingRect:A,viewBB:I,rfId:_,panZoom:z,translateExtent:O,flowWidth:B,flowHeight:V,ariaLabelConfig:$}=Pt(cie,on),L=(e==null?void 0:e.width)??iie,U=(e==null?void 0:e.height)??aie,K=A.width/L,D=A.height/U,W=Math.max(K,D),M=W*L,F=W*U,Y=C*W,H=A.x-(M-A.width)/2-Y,Q=A.y-(F-A.height)/2-Y,J=M+Y*2,Z=F+Y*2,oe=`${uie}-${_}`,te=m.useRef(0),ue=m.useRef();te.current=W,m.useEffect(()=>{if(T.current&&z)return ue.current=wre({domNode:T.current,panZoom:z,getTransform:()=>R.getState().transform,getViewScale:()=>te.current}),()=>{var ke;(ke=ue.current)==null||ke.destroy()}},[z]),m.useEffect(()=>{var ke;(ke=ue.current)==null||ke.update({translateExtent:O,width:B,height:V,inversePan:S,pannable:v,zoomStep:N,zoomable:b})},[v,b,S,N,O,B,V]);const ge=y?ke=>{var ve;const[Be,ie]=((ve=ue.current)==null?void 0:ve.pointer(ke))||[0,0];y(ke,{x:Be,y:ie})}:void 0,Ce=k?m.useCallback((ke,Be)=>{const ie=R.getState().nodeLookup.get(Be).internals.userNode;k(ke,ie)},[]):void 0,Se=w??$["minimap.ariaLabel"];return s.jsx(lf,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof h=="number"?h*W:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:Rn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:s.jsxs("svg",{width:L,height:U,viewBox:`${H} ${Q} ${J} ${Z}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":oe,ref:T,onClick:ge,children:[Se&&s.jsx("title",{id:oe,children:Se}),s.jsx(oie,{onClick:Ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:a,nodeComponent:l}),s.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-Y},${Q-Y}h${J+Y*2}v${Z+Y*2}h${-J-Y*2}z
|
|
689
|
+
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}g$.displayName="MiniMap";m.memo(g$);const die=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,fie={[hc.Line]:"right",[hc.Handle]:"bottom-right"};function pie({nodeId:e,position:t,variant:n=hc.Handle,className:r,style:o=void 0,children:i,color:a,minWidth:l=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:g,autoScale:y=!0,shouldResize:k,onResizeStart:v,onResize:b,onResizeEnd:w}){const S=GD(),N=typeof e=="string"?e:S,C=an(),R=m.useRef(null),T=n===hc.Handle,A=Pt(m.useCallback(die(T&&y),[T,y]),on),I=m.useRef(null),_=t??fie[n];m.useEffect(()=>{if(!(!R.current||!N))return I.current||(I.current=$re({domNode:R.current,nodeId:N,getStoreItems:()=>{const{nodeLookup:O,transform:B,snapGrid:V,snapToGrid:$,nodeOrigin:L,domNode:U}=C.getState();return{nodeLookup:O,transform:B,snapGrid:V,snapToGrid:$,nodeOrigin:L,paneDomNode:U}},onChange:(O,B)=>{const{triggerNodeChanges:V,nodeLookup:$,parentLookup:L,nodeOrigin:U}=C.getState(),K=[],D={x:O.x,y:O.y},W=$.get(N);if(W&&W.expandParent&&W.parentId){const M=W.origin??U,F=O.width??W.measured.width??0,Y=O.height??W.measured.height??0,H={id:W.id,parentId:W.parentId,rect:{width:F,height:Y,...yD({x:O.x??W.position.x,y:O.y??W.position.y},{width:F,height:Y},W.parentId,$,M)}},Q=sj([H],$,L,U);K.push(...Q),D.x=O.x?Math.max(M[0]*F,O.x):void 0,D.y=O.y?Math.max(M[1]*Y,O.y):void 0}if(D.x!==void 0&&D.y!==void 0){const M={id:N,type:"position",position:{...D}};K.push(M)}if(O.width!==void 0&&O.height!==void 0){const F={id:N,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:O.width,height:O.height}};K.push(F)}for(const M of B){const F={...M,type:"position"};K.push(F)}V(K)},onEnd:({width:O,height:B})=>{const V={id:N,type:"dimensions",resizing:!1,dimensions:{width:O,height:B}};C.getState().triggerNodeChanges([V])}})),I.current.update({controlPosition:_,boundaries:{minWidth:l,minHeight:u,maxWidth:f,maxHeight:p},keepAspectRatio:h,resizeDirection:g,onResizeStart:v,onResize:b,onResizeEnd:w,shouldResize:k}),()=>{var O;(O=I.current)==null||O.destroy()}},[_,l,u,f,p,h,v,b,w,k]);const z=_.split("-");return s.jsx("div",{className:Rn(["react-flow__resize-control","nodrag",...z,n,r]),ref:R,style:{...o,scale:A,...a&&{[T?"backgroundColor":"borderColor"]:a}},children:i})}m.memo(pie);var x$=Object.defineProperty,hie=(e,t,n)=>t in e?x$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mie=(e,t)=>{for(var n in t)x$(e,n,{get:t[n],enumerable:!0})},gie=(e,t,n)=>hie(e,t+"",n),y$={};mie(y$,{Graph:()=>_s,alg:()=>ij,json:()=>v$,version:()=>bie});var xie=Object.defineProperty,b$=(e,t)=>{for(var n in t)xie(e,n,{get:t[n],enumerable:!0})},_s=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){let t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,i])=>{e(o)&&t.setNode(o,i)}),Object.values(this._edgeObjs).forEach(o=>{t.hasNode(o.v)&&t.hasNode(o.w)&&t.setEdge(o,this.edge(o))});let n={},r=o=>{let i=this.parent(o);return!i||t.hasNode(i)?(n[o]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(o=>t.setParent(o,r(o))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let o,i,a,l,u=!1;typeof e=="object"&&e!==null&&"v"in e?(o=e.v,i=e.w,a=e.name,arguments.length===2&&(l=t,u=!0)):(o=e,i=t,a=r,arguments.length>2&&(l=n,u=!0)),o=""+o,i=""+i,a!==void 0&&(a=""+a);let f=Ou(this._isDirected,o,i,a);if(f in this._edgeLabels)return u&&(this._edgeLabels[f]=l),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(i),this._edgeLabels[f]=u?l:this._defaultEdgeLabelFn(o,i,a);let p=yie(this._isDirected,o,i,a);return o=p.v,i=p.w,Object.freeze(p),this._edgeObjs[f]=p,FE(this._preds[i],o),FE(this._sucs[o],i),this._in[i][f]=p,this._out[o][f]=p,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?xb(this._isDirected,e):Ou(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?xb(this._isDirected,e):Ou(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?xb(this._isDirected,e):Ou(this._isDirected,e,t,n),o=this._edgeObjs[r];if(o){let i=o.v,a=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],zE(this._preds[a],i),zE(this._sucs[i],a),delete this._in[a][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(o=>o.v===t&&o.w===n||o.v===n&&o.w===t):r}};function FE(e,t){e[t]?e[t]++:e[t]=1}function zE(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Ou(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let a=o;o=i,i=a}return o+""+i+""+(r===void 0?"\0":r)}function yie(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let l=o;o=i,i=l}let a={v:o,w:i};return r&&(a.name=r),a}function xb(e,t){return Ou(e,t.v,t.w,t.name)}var bie="4.0.1",v$={};b$(v$,{read:()=>kie,write:()=>vie});function vie(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:wie(e),edges:jie(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function wie(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),o={v:t};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function jie(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function kie(e){let t=new _s(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var ij={};b$(ij,{CycleException:()=>em,bellmanFord:()=>w$,components:()=>Cie,dijkstra:()=>Zh,dijkstraAll:()=>Rie,findCycles:()=>Aie,floydWarshall:()=>_ie,isAcyclic:()=>$ie,postorder:()=>Mie,preorder:()=>Lie,prim:()=>Oie,shortestPaths:()=>Fie,tarjan:()=>k$,topsort:()=>N$});var Nie=()=>1;function w$(e,t,n,r){return Sie(e,String(t),n||Nie,r||function(o){return e.outEdges(o)})}function Sie(e,t,n,r){let o={},i,a=0,l=e.nodes(),u=function(h){let g=n(h);o[h.v].distance+g<o[h.w].distance&&(o[h.w]={distance:o[h.v].distance+g,predecessor:h.v},i=!0)},f=function(){l.forEach(function(h){r(h).forEach(function(g){let y=g.v===h?g.v:g.w,k=y===g.v?g.w:g.v;u({v:y,w:k})})})};l.forEach(function(h){let g=h===t?0:Number.POSITIVE_INFINITY;o[h]={distance:g,predecessor:""}});let p=l.length;for(let h=1;h<p&&(i=!1,a++,f(),!!i);h++);if(a===p-1&&(i=!1,f(),i))throw new Error("The graph contains a negative weight cycle");return o}function Cie(e){let t={},n=[],r;function o(i){i in t||(t[i]=!0,r.push(i),e.successors(i).forEach(o),e.predecessors(i).forEach(o))}return e.nodes().forEach(function(i){r=[],o(i),r.length&&n.push(r)}),n}var j$=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let o=this._arr,i=o.length;return n[r]=i,o.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,o=e;n<t.length&&(o=t[n].priority<t[o].priority?n:o,r<t.length&&(o=t[r].priority<t[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,o=n[e],i=n[t];n[e]=i,n[t]=o,r[i.key]=e,r[o.key]=t}},Eie=()=>1;function Zh(e,t,n,r){let o=function(i){return e.outEdges(i)};return Tie(e,String(t),n||Eie,r||o)}function Tie(e,t,n,r){let o={},i=new j$,a,l,u=function(f){let p=f.v!==a?f.v:f.w,h=o[p],g=n(f),y=l.distance+g;if(g<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+f+" Weight: "+g);y<h.distance&&(h.distance=y,h.predecessor=a,i.decrease(p,y))};for(e.nodes().forEach(function(f){let p=f===t?0:Number.POSITIVE_INFINITY;o[f]={distance:p,predecessor:""},i.add(f,p)});i.size()>0&&(a=i.removeMin(),l=o[a],l.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(u);return o}function Rie(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=Zh(e,o,t,n),r},{})}function k$(e){let t=0,n=[],r={},o=[];function i(a){let l=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(u){u in r?r[u].onStack&&(l.lowlink=Math.min(l.lowlink,r[u].index)):(i(u),l.lowlink=Math.min(l.lowlink,r[u].lowlink))}),l.lowlink===l.index){let u=[],f;do f=n.pop(),r[f].onStack=!1,u.push(f);while(a!==f);o.push(u)}}return e.nodes().forEach(function(a){a in r||i(a)}),o}function Aie(e){return k$(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Pie=()=>1;function _ie(e,t,n){return Die(e,t||Pie,n||function(r){return e.outEdges(r)})}function Die(e,t,n){let r={},o=e.nodes();return o.forEach(function(i){r[i]={},r[i][i]={distance:0,predecessor:""},o.forEach(function(a){i!==a&&(r[i][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(a){let l=a.v===i?a.w:a.v,u=t(a);r[i][l]={distance:u,predecessor:i}})}),o.forEach(function(i){let a=r[i];o.forEach(function(l){let u=r[l];o.forEach(function(f){let p=u[i],h=a[f],g=u[f],y=p.distance+h.distance;y<g.distance&&(g.distance=y,g.predecessor=h.predecessor)})})}),r}var em=class extends Error{constructor(...e){super(...e)}};function N$(e){let t={},n={},r=[];function o(i){if(i in n)throw new em;i in t||(n[i]=!0,t[i]=!0,e.predecessors(i).forEach(o),delete n[i],r.push(i))}if(e.sinks().forEach(o),Object.keys(t).length!==e.nodeCount())throw new em;return r}function $ie(e){try{N$(e)}catch(t){if(t instanceof em)return!1;throw t}return!0}function Iie(e,t,n,r,o){Array.isArray(t)||(t=[t]);let i=(l=>{var u;return(u=e.isDirected()?e.successors(l):e.neighbors(l))!=null?u:[]}),a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);o=S$(e,l,n==="post",a,i,r,o)}),o}function S$(e,t,n,r,o,i,a){return t in r||(r[t]=!0,n||(a=i(a,t)),o(t).forEach(function(l){a=S$(e,l,n,r,o,i,a)}),n&&(a=i(a,t))),a}function C$(e,t,n){return Iie(e,t,n,function(r,o){return r.push(o),r},[])}function Mie(e,t){return C$(e,t,"post")}function Lie(e,t){return C$(e,t,"pre")}function Oie(e,t){let n=new _s,r={},o=new j$,i;function a(u){let f=u.v===i?u.w:u.v,p=o.priority(f);if(p!==void 0){let h=t(u);h<p&&(r[f]=i,o.decrease(f,h))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(u){o.add(u,Number.POSITIVE_INFINITY),n.setNode(u)}),o.decrease(e.nodes()[0],0);let l=!1;for(;o.size()>0;){if(i=o.removeMin(),i in r)n.setEdge(i,r[i]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(i).forEach(a)}return n}function Fie(e,t,n,r){return zie(e,t,n,r??(o=>{let i=e.outEdges(o);return i??[]}))}function zie(e,t,n,r){if(n===void 0)return Zh(e,t,n,r);let o=!1,i=e.nodes();for(let a=0;a<i.length;a++){let l=r(i[a]);for(let u=0;u<l.length;u++){let f=l[u],p=f.v===i[a]?f.v:f.w,h=p===f.v?f.w:f.v;n({v:p,w:h})<0&&(o=!0)}if(o)return w$(e,t,n,r)}return Zh(e,t,n,r)}function zc(e,t,n,r){let o=r;for(;e.hasNode(o);)o=aj(r);return n.dummy=t,e.setNode(o,n),o}function Bie(e){let t=new _s().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},o=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),t}function E$(e){let t=new _s({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function BE(e,t){let n=e.x,r=e.y,o=t.x-n,i=t.y-r,a=e.width/2,l=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let u,f;return Math.abs(i)*a>Math.abs(o)*l?(i<0&&(l=-l),u=l*o/i,f=l):(o<0&&(a=-a),u=a,f=a*i/o),{x:n+u,y:r+f}}function bg(e){let t=_d(R$(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;o!==void 0&&(t[o]||(t[o]=[]),t[o][r.order]=n)}),t}function Uie(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=Js(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function Hie(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=Js(Math.min,t),r=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;r[l]||(r[l]=[]),r[l].push(a)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((a,l)=>{a===void 0&&l%i!==0?--o:a!==void 0&&o&&a.forEach(u=>e.node(u).rank+=o)})}function UE(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),zc(e,"border",o,t)}function Vie(e,t=T$){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n}var T$=65535;function Js(e,t){if(t.length>T$){let n=Vie(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function R$(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return Js(Math.max,t)}function Wie(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function Kie(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function qie(e,t){return t()}var Gie=0;function aj(e){let t=++Gie;return e+(""+t)}function _d(e,t,n=1){t==null&&(t=e,e=0);let r=i=>i<t;n<0&&(r=i=>t<i);let o=[];for(let i=e;r(i);i+=n)o.push(i);return o}function tm(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function vg(e,t){let n;return typeof t=="string"?n=r=>r[t]:n=t,Object.entries(e).reduce((r,[o,i])=>(r[o]=n(i,o),r),{})}function Yie(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}var wg="\0",Xie=class{constructor(){gie(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return HE(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&HE(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Qie)),n=n._prev;return"["+e.join(", ")+"]"}};function HE(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Qie(e,t){if(e!=="_next"&&e!=="_prev")return t}var Jie=Xie,Zie=()=>1;function eae(e,t){if(e.nodeCount()<=1)return[];let n=nae(e,t||Zie);return tae(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function tae(e,t,n){var r;let o=[],i=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)yb(e,t,n,l);for(;l=i.dequeue();)yb(e,t,n,l);if(e.nodeCount()){for(let u=t.length-2;u>0;--u)if(l=(r=t[u])==null?void 0:r.dequeue(),l){o=o.concat(yb(e,t,n,l,!0)||[]);break}}}return o}function yb(e,t,n,r,o){let i=[],a=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(l=>{let u=e.edge(l),f=e.node(l.v);o&&i.push({v:l.v,w:l.w}),f.out-=u,Fv(t,n,f)}),(e.outEdges(r.v)||[]).forEach(l=>{let u=e.edge(l),f=l.w,p=e.node(f);p.in-=u,Fv(t,n,p)}),e.removeNode(r.v),a}function nae(e,t){let n=new _s,r=0,o=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let u=n.edge(l.v,l.w)||0,f=t(l),p=u+f;n.setEdge(l.v,l.w,p);let h=n.node(l.v),g=n.node(l.w);o=Math.max(o,h.out+=f),r=Math.max(r,g.in+=f)});let i=rae(o+r+3).map(()=>new Jie),a=r+1;return n.nodes().forEach(l=>{Fv(i,a,n.node(l))}),{graph:n,buckets:i,zeroIdx:a}}function Fv(e,t,n){var r,o,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(o=e[e.length-1])==null||o.enqueue(n):(r=e[0])==null||r.enqueue(n)}function rae(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function sae(e){(e.graph().acyclicer==="greedy"?eae(e,t(e)):oae(e)).forEach(n=>{let r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,aj("rev"))});function t(n){return r=>n.edge(r).weight}}function oae(e){let t=[],n={},r={};function o(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):o(a.w)}),delete n[i])}return e.nodes().forEach(o),t}function iae(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function aae(e){e.graph().dummyChains=[],e.edges().forEach(t=>lae(e,t))}function lae(e,t){let n=t.v,r=e.node(n).rank,o=t.w,i=e.node(o).rank,a=t.name,l=e.edge(t),u=l.labelRank;if(i===r+1)return;e.removeEdge(t);let f,p,h;for(h=0,++r;r<i;++h,++r)l.points=[],p={width:0,height:0,edgeLabel:l,edgeObj:t,rank:r},f=zc(e,"edge",p,"_d"),r===u&&(p.width=l.width,p.height=l.height,p.dummy="edge-label",p.labelpos=l.labelpos),e.setEdge(n,f,{weight:l.weight},a),h===0&&e.graph().dummyChains.push(f),n=f;e.setEdge(n,o,{weight:l.weight},a)}function cae(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=o,n=e.node(t)})}function lj(e){let t={};function n(r){let o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r),a=i?i.map(u=>u==null?Number.POSITIVE_INFINITY:n(u.w)-e.edge(u).minlen):[],l=Js(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),o.rank=l}e.sources().forEach(n)}function gc(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var A$=uae;function uae(e){let t=new _s({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=e.nodeCount();t.setNode(r,{});let i,a;for(;dae(t,e)<o&&(i=fae(t,e),!!i);)a=t.hasNode(i.v)?gc(e,i):-gc(e,i),pae(t,e,a);return t}function dae(e,t){function n(r){let o=t.nodeEdges(r);o&&o.forEach(i=>{let a=i.v,l=r===a?i.w:a;!e.hasNode(l)&&!gc(t,i)&&(e.setNode(l,{}),e.setEdge(r,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function fae(e,t){return t.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=gc(t,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function pae(e,t,n){e.nodes().forEach(r=>t.node(r).rank+=n)}var{preorder:hae,postorder:mae}=ij,gae=Ia;Ia.initLowLimValues=uj;Ia.initCutValues=cj;Ia.calcCutValue=P$;Ia.leaveEdge=D$;Ia.enterEdge=$$;Ia.exchangeEdges=I$;function Ia(e){e=Bie(e),lj(e);let t=A$(e);uj(t),cj(t,e);let n,r;for(;n=D$(t);)r=$$(t,e,n),I$(t,e,n,r)}function cj(e,t){let n=mae(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>xae(e,t,r))}function xae(e,t,n){let r=e.node(n).parent,o=e.edge(n,r);o.cutvalue=P$(e,t,n)}function P$(e,t,n){let r=e.node(n).parent,o=!0,i=t.edge(n,r),a=0;i||(o=!1,i=t.edge(r,n)),a=i.weight;let l=t.nodeEdges(n);return l&&l.forEach(u=>{let f=u.v===n,p=f?u.w:u.v;if(p!==r){let h=f===o,g=t.edge(u).weight;if(a+=h?g:-g,bae(e,n,p)){let y=e.edge(n,p).cutvalue;a+=h?-y:y}}}),a}function uj(e,t){arguments.length<2&&(t=e.nodes()[0]),_$(e,{},1,t)}function _$(e,t,n,r,o){let i=n,a=e.node(r);t[r]=!0;let l=e.neighbors(r);return l&&l.forEach(u=>{Object.hasOwn(t,u)||(n=_$(e,t,n,u,r))}),a.low=i,a.lim=n++,o?a.parent=o:delete a.parent,n}function D$(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function $$(e,t,n){let r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);let i=e.node(r),a=e.node(o),l=i,u=!1;return i.lim>a.lim&&(l=a,u=!0),t.edges().filter(f=>u===VE(e,e.node(f.v),l)&&u!==VE(e,e.node(f.w),l)).reduce((f,p)=>gc(t,p)<gc(t,f)?p:f)}function I$(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),uj(e),cj(e,t),yae(e,t)}function yae(e,t){let n=e.nodes().find(o=>!e.node(o).parent);if(!n)return;let r=hae(e,[n]);r=r.slice(1),r.forEach(o=>{let i=e.node(o).parent,a=t.edge(o,i),l=!1;a||(a=t.edge(i,o),l=!0),t.node(o).rank=t.node(i).rank+(l?a.minlen:-a.minlen)})}function bae(e,t,n){return e.hasEdge(t,n)}function VE(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var vae=wae;function wae(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":WE(e);break;case"tight-tree":kae(e);break;case"longest-path":jae(e);break;case"none":break;default:WE(e)}}var jae=lj;function kae(e){lj(e),A$(e)}function WE(e){gae(e)}var Nae=Sae;function Sae(e){let t=Eae(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),o=r.edgeObj,i=Cae(e,t,o.v,o.w),a=i.path,l=i.lca,u=0,f=a[u],p=!0;for(;n!==o.w;){if(r=e.node(n),p){for(;(f=a[u])!==l&&e.node(f).maxRank<r.rank;)u++;f===l&&(p=!1)}if(!p){for(;u<a.length-1&&e.node(a[u+1]).minRank<=r.rank;)u++;f=a[u]}f!==void 0&&e.setParent(n,f),n=e.successors(n)[0]}})}function Cae(e,t,n,r){let o=[],i=[],a=Math.min(t[n].low,t[r].low),l=Math.max(t[n].lim,t[r].lim),u;u=n;do u=e.parent(u),o.push(u);while(u&&(t[u].low>a||l>t[u].lim));let f=u,p=r;for(;(p=e.parent(p))!==f;)i.push(p);return{path:o.concat(i.reverse()),lca:f}}function Eae(e){let t={},n=0;function r(o){let i=n;e.children(o).forEach(r),t[o]={low:i,lim:n++}}return e.children(wg).forEach(r),t}function Tae(e){let t=zc(e,"root",{},"_root"),n=Rae(e),r=Object.values(n),o=Js(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=i);let a=Aae(e)+1;e.children(wg).forEach(l=>M$(e,t,i,a,o,n,l)),e.graph().nodeRankFactor=i}function M$(e,t,n,r,o,i,a){var l;let u=e.children(a);if(!u.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let f=UE(e,"_bt"),p=UE(e,"_bb"),h=e.node(a);e.setParent(f,a),h.borderTop=f,e.setParent(p,a),h.borderBottom=p,u.forEach(g=>{var y;M$(e,t,n,r,o,i,g);let k=e.node(g),v=k.borderTop?k.borderTop:g,b=k.borderBottom?k.borderBottom:g,w=k.borderTop?r:2*r,S=v!==b?1:o-((y=i[a])!=null?y:0)+1;e.setEdge(f,v,{weight:w,minlen:S,nestingEdge:!0}),e.setEdge(b,p,{weight:w,minlen:S,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,f,{weight:0,minlen:o+((l=i[a])!=null?l:0)})}function Rae(e){let t={};function n(r,o){let i=e.children(r);i&&i.length&&i.forEach(a=>n(a,o+1)),t[r]=o}return e.children(wg).forEach(r=>n(r,1)),t}function Aae(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Pae(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var _ae=Dae;function Dae(e){function t(n){let r=e.children(n),o=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,a=o.maxRank+1;i<a;++i)KE(e,"borderLeft","_bl",n,o,i),KE(e,"borderRight","_br",n,o,i)}}e.children(wg).forEach(t)}function KE(e,t,n,r,o,i){let a={width:0,height:0,rank:i,borderType:t},l=o[t][i-1],u=zc(e,"border",a,n);o[t][i]=u,e.setParent(u,r),l&&e.setEdge(l,u,{weight:1})}function $ae(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&L$(e)}function Iae(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&Mae(e),(n==="lr"||n==="rl")&&(Lae(e),L$(e))}function L$(e){e.nodes().forEach(t=>qE(e.node(t))),e.edges().forEach(t=>qE(e.edge(t)))}function qE(e){let t=e.width;e.width=e.height,e.height=t}function Mae(e){e.nodes().forEach(t=>bb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(bb),Object.hasOwn(r,"y")&&bb(r)})}function bb(e){e.y=-e.y}function Lae(e){e.nodes().forEach(t=>vb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(vb),Object.hasOwn(r,"x")&&vb(r)})}function vb(e){let t=e.x;e.x=e.y,e.y=t}function Oae(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),r=n.map(l=>e.node(l).rank),o=Js(Math.max,r),i=_d(o+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let u=e.node(l);i[u.rank].push(l);let f=e.successors(l);f&&f.forEach(a)}return n.sort((l,u)=>e.node(l).rank-e.node(u).rank).forEach(a),i}function Fae(e,t){let n=0;for(let r=1;r<t.length;++r)n+=zae(e,t[r-1],t[r]);return n}function zae(e,t,n){let r=Yie(n,n.map((f,p)=>p)),o=t.flatMap(f=>{let p=e.outEdges(f);return p?p.map(h=>({pos:r[h.w],weight:e.edge(h).weight})).sort((h,g)=>h.pos-g.pos):[]}),i=1;for(;i<n.length;)i<<=1;let a=2*i-1;i-=1;let l=new Array(a).fill(0),u=0;return o.forEach(f=>{let p=f.pos+i;l[p]+=f.weight;let h=0;for(;p>0;)p%2&&(h+=l[p+1]),p=p-1>>1,l[p]+=f.weight;u+=f.weight*h}),u}function Bae(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((i,a)=>{let l=e.edge(a),u=e.node(a.v);return{sum:i.sum+l.weight*u.order,weight:i.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function Uae(e,t){let n={};e.forEach((o,i)=>{let a={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(a.barycenter=o.barycenter,a.weight=o.weight),n[o.v]=a}),t.edges().forEach(o=>{let i=n[o.v],a=n[o.w];i!==void 0&&a!==void 0&&(a.indegree++,i.out.push(a))});let r=Object.values(n).filter(o=>!o.indegree);return Hae(r)}function Hae(e){let t=[];function n(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&Vae(o,i)}}function r(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();t.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return t.filter(o=>!o.merged).map(o=>tm(o,["vs","i","barycenter","weight"]))}function Vae(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Wae(e,t){let n=Wie(e,p=>Object.hasOwn(p,"barycenter")),r=n.lhs,o=n.rhs.sort((p,h)=>h.i-p.i),i=[],a=0,l=0,u=0;r.sort(Kae(!!t)),u=GE(i,o,u),r.forEach(p=>{u+=p.vs.length,i.push(p.vs),a+=p.barycenter*p.weight,l+=p.weight,u=GE(i,o,u)});let f={vs:i.flat(1)};return l&&(f.barycenter=a/l,f.weight=l),f}function GE(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Kae(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function O$(e,t,n,r){let o=e.children(t),i=e.node(t),a=i?i.borderLeft:void 0,l=i?i.borderRight:void 0,u={};a&&(o=o.filter(g=>g!==a&&g!==l));let f=Bae(e,o);f.forEach(g=>{if(e.children(g.v).length){let y=O$(e,g.v,n,r);u[g.v]=y,Object.hasOwn(y,"barycenter")&&Gae(g,y)}});let p=Uae(f,n);qae(p,u);let h=Wae(p,r);if(a&&l){h.vs=[a,h.vs,l].flat(1);let g=e.predecessors(a);if(g&&g.length){let y=e.node(g[0]),k=e.predecessors(l),v=e.node(k[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+y.order+v.order)/(h.weight+2),h.weight+=2}}return h}function qae(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function Gae(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function Yae(e,t,n,r){r||(r=e.nodes());let o=Xae(e),i=new _s({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let l=e.node(a),u=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){i.setNode(a),i.setParent(a,u||o);let f=e[n](a);f&&f.forEach(p=>{let h=p.v===a?p.w:p.v,g=i.edge(h,a),y=g!==void 0?g.weight:0;i.setEdge(h,a,{weight:e.edge(p).weight+y})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),i}function Xae(e){let t;for(;e.hasNode(t=aj("_root")););return t}function Qae(e,t,n){let r={},o;n.forEach(i=>{let a=e.parent(i),l,u;for(;a;){if(l=e.parent(a),l?(u=r[l],r[l]=a):(u=o,o=a),u&&u!==a){t.setEdge(u,a);return}a=l}})}function F$(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,F$);return}let n=R$(e),r=YE(e,_d(1,n+1),"inEdges"),o=YE(e,_d(n-1,-1,-1),"outEdges"),i=Oae(e);if(XE(e,i),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,u=t.constraints||[];for(let f=0,p=0;p<4;++f,++p){Jae(f%2?r:o,f%4>=2,u),i=bg(e);let h=Fae(e,i);h<a?(p=0,l=Object.assign({},i),a=h):h===a&&(l=structuredClone(i))}XE(e,l)}function YE(e,t,n){let r=new Map,o=(i,a)=>{r.has(i)||r.set(i,[]),r.get(i).push(a)};for(let i of e.nodes()){let a=e.node(i);if(typeof a.rank=="number"&&o(a.rank,i),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&o(l,i)}return t.map(function(i){return Yae(e,i,n,r.get(i)||[])})}function Jae(e,t,n){let r=new _s;e.forEach(function(o){n.forEach(l=>r.setEdge(l.left,l.right));let i=o.graph().root,a=O$(o,i,r,t);a.vs.forEach((l,u)=>o.node(l).order=u),Qae(o,r,a.vs)})}function XE(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}function Zae(e,t){let n={};function r(o,i){let a=0,l=0,u=o.length,f=i[i.length-1];return i.forEach((p,h)=>{let g=tle(e,p),y=g?e.node(g).order:u;(g||p===f)&&(i.slice(l,h+1).forEach(k=>{let v=e.predecessors(k);v&&v.forEach(b=>{let w=e.node(b),S=w.order;(S<a||y<S)&&!(w.dummy&&e.node(k).dummy)&&z$(n,b,k)})}),l=h+1,a=y)}),i}return t.length&&t.reduce(r),n}function ele(e,t){let n={};function r(i,a,l,u,f){_d(a,l).forEach(p=>{let h=i[p];if(h!==void 0&&e.node(h).dummy){let g=e.predecessors(h);g&&g.forEach(y=>{if(y===void 0)return;let k=e.node(y);k.dummy&&(k.order<u||k.order>f)&&z$(n,y,h)})}})}function o(i,a){let l=-1,u=-1,f=0;return a.forEach((p,h)=>{if(e.node(p).dummy==="border"){let g=e.predecessors(p);if(g&&g.length){let y=g[0];if(y===void 0)return;u=e.node(y).order,r(a,f,h,l,u),f=h,l=u}}r(a,f,a.length,u,i.length)}),a}return t.length&&t.reduce(o),n}function tle(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function z$(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];r||(e[t]=r={}),r[n]=!0}function nle(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function rle(e,t,n,r){let o={},i={},a={};return t.forEach(l=>{l.forEach((u,f)=>{o[u]=u,i[u]=u,a[u]=f})}),t.forEach(l=>{let u=-1;l.forEach(f=>{let p=r(f);if(p&&p.length){let h=p.sort((y,k)=>{let v=a[y],b=a[k];return(v!==void 0?v:0)-(b!==void 0?b:0)}),g=(h.length-1)/2;for(let y=Math.floor(g),k=Math.ceil(g);y<=k;++y){let v=h[y];if(v===void 0)continue;let b=a[v];if(b!==void 0&&i[f]===f&&u<b&&!nle(n,f,v)){let w=o[v];w!==void 0&&(i[v]=f,i[f]=o[f]=w,u=b)}}}})}),{root:o,align:i}}function sle(e,t,n,r,o=!1){let i={},a=ole(e,t,n,o),l=o?"borderLeft":"borderRight";function u(y,k){let v=a.nodes().slice(),b={},w=v.pop();for(;w;){if(b[w])y(w);else{b[w]=!0,v.push(w);for(let S of k(w))v.push(S)}w=v.pop()}}function f(y){let k=a.inEdges(y);k?i[y]=k.reduce((v,b)=>{var w;let S=(w=i[b.v])!=null?w:0,N=a.edge(b);return Math.max(v,S+(N!==void 0?N:0))},0):i[y]=0}function p(y){let k=a.outEdges(y),v=Number.POSITIVE_INFINITY;k&&(v=k.reduce((w,S)=>{let N=i[S.w],C=a.edge(S);return Math.min(w,(N!==void 0?N:0)-(C!==void 0?C:0))},Number.POSITIVE_INFINITY));let b=e.node(y);v!==Number.POSITIVE_INFINITY&&b.borderType!==l&&(i[y]=Math.max(i[y]!==void 0?i[y]:0,v))}function h(y){return a.predecessors(y)||[]}function g(y){return a.successors(y)||[]}return u(f,h),u(p,g),Object.keys(r).forEach(y=>{var k;let v=n[y];v!==void 0&&(i[y]=(k=i[v])!=null?k:0)}),i}function ole(e,t,n,r){let o=new _s,i=e.graph(),a=ule(i.nodesep,i.edgesep,r);return t.forEach(l=>{let u;l.forEach(f=>{let p=n[f];if(p!==void 0){if(o.setNode(p),u!==void 0){let h=n[u];if(h!==void 0){let g=o.edge(h,p);o.setEdge(h,p,Math.max(a(e,f,u),g||0))}}u=f}})}),o}function ile(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([l,u])=>{let f=dle(e,l)/2;o=Math.max(u+f,o),i=Math.min(u-f,i)});let a=o-i;return a<n[0]&&(n=[a,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function ale(e,t){let n=Object.values(t),r=Js(Math.min,n),o=Js(Math.max,n);["u","d"].forEach(i=>{["l","r"].forEach(a=>{let l=i+a,u=e[l];if(!u||u===t)return;let f=Object.values(u),p=r-Js(Math.min,f);a!=="l"&&(p=o-Js(Math.max,f)),p&&(e[l]=vg(u,h=>h+p))})})}function lle(e,t=void 0){let n=e.ul;return n?vg(n,(r,o)=>{var i,a;if(t){let u=t.toLowerCase(),f=e[u];if(f&&f[o]!==void 0)return f[o]}let l=Object.values(e).map(u=>{let f=u[o];return f!==void 0?f:0}).sort((u,f)=>u-f);return(((i=l[1])!=null?i:0)+((a=l[2])!=null?a:0))/2}):{}}function cle(e){let t=bg(e),n=Object.assign(Zae(e,t),ele(e,t)),r={},o;["u","d"].forEach(a=>{o=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(o=o.map(p=>Object.values(p).reverse()));let u=rle(e,o,n,p=>(a==="u"?e.predecessors(p):e.successors(p))||[]),f=sle(e,o,u.root,u.align,l==="r");l==="r"&&(f=vg(f,p=>-p)),r[a+l]=f})});let i=ile(e,r);return ale(r,i),lle(r,e.graph().align)}function ule(e,t,n){return(r,o,i)=>{let a=r.node(o),l=r.node(i),u=0,f;if(u+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":f=-a.width/2;break;case"r":f=a.width/2;break}if(f&&(u+=n?f:-f),f=void 0,u+=(a.dummy?t:e)/2,u+=(l.dummy?t:e)/2,u+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":f=l.width/2;break;case"r":f=-l.width/2;break}return f&&(u+=n?f:-f),u}}function dle(e,t){return e.node(t).width}function fle(e){e=E$(e),ple(e),Object.entries(cle(e)).forEach(([t,n])=>e.node(t).x=n)}function ple(e){let t=bg(e),n=e.graph(),r=n.ranksep,o=n.rankalign,i=0;t.forEach(a=>{let l=a.reduce((u,f)=>{var p;let h=(p=e.node(f).height)!=null?p:0;return u>h?u:h},0);a.forEach(u=>{let f=e.node(u);o==="top"?f.y=i+f.height/2:o==="bottom"?f.y=i+l-f.height/2:f.y=i+l/2}),i+=l+r})}function hle(e,t={}){let n=t.debugTiming?Kie:qie;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>Nle(e));return n(" runLayout",()=>mle(r,n,t)),n(" updateInputGraph",()=>gle(e,r)),r})}function mle(e,t,n){t(" makeSpaceForEdgeLabels",()=>Sle(e)),t(" removeSelfEdges",()=>$le(e)),t(" acyclic",()=>sae(e)),t(" nestingGraph.run",()=>Tae(e)),t(" rank",()=>vae(E$(e))),t(" injectEdgeLabelProxies",()=>Cle(e)),t(" removeEmptyRanks",()=>Hie(e)),t(" nestingGraph.cleanup",()=>Pae(e)),t(" normalizeRanks",()=>Uie(e)),t(" assignRankMinMax",()=>Ele(e)),t(" removeEdgeLabelProxies",()=>Tle(e)),t(" normalize.run",()=>aae(e)),t(" parentDummyChains",()=>Nae(e)),t(" addBorderSegments",()=>_ae(e)),t(" order",()=>F$(e,n)),t(" insertSelfEdges",()=>Ile(e)),t(" adjustCoordinateSystem",()=>$ae(e)),t(" position",()=>fle(e)),t(" positionSelfEdges",()=>Mle(e)),t(" removeBorderNodes",()=>Dle(e)),t(" normalize.undo",()=>cae(e)),t(" fixupEdgeLabelCoords",()=>Ple(e)),t(" undoCoordinateSystem",()=>Iae(e)),t(" translateGraph",()=>Rle(e)),t(" assignNodeIntersects",()=>Ale(e)),t(" reversePoints",()=>_le(e)),t(" acyclic.undo",()=>iae(e))}function gle(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var xle=["nodesep","edgesep","ranksep","marginx","marginy"],yle={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},ble=["acyclicer","ranker","rankdir","align","rankalign"],vle=["width","height","rank"],QE={width:0,height:0},wle=["minlen","weight","width","height","labeloffset"],jle={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},kle=["labelpos"];function Nle(e){let t=new _s({multigraph:!0,compound:!0}),n=jb(e.graph());return t.setGraph(Object.assign({},yle,wb(n,xle),tm(n,ble))),e.nodes().forEach(r=>{let o=jb(e.node(r)),i=wb(o,vle);Object.keys(QE).forEach(l=>{i[l]===void 0&&(i[l]=QE[l])}),t.setNode(r,i);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let o=jb(e.edge(r));t.setEdge(r,Object.assign({},jle,wb(o,wle),tm(o,kle)))}),t}function Sle(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Cle(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),o={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};zc(e,"edge-proxy",o,"_ep")}})}function Ele(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Tle(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Rle(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,l=i.marginy||0;function u(f){let p=f.x,h=f.y,g=f.width,y=f.height;t=Math.min(t,p-g/2),n=Math.max(n,p+g/2),r=Math.min(r,h-y/2),o=Math.max(o,h+y/2)}e.nodes().forEach(f=>u(e.node(f))),e.edges().forEach(f=>{let p=e.edge(f);Object.hasOwn(p,"x")&&u(p)}),t-=a,r-=l,e.nodes().forEach(f=>{let p=e.node(f);p.x-=t,p.y-=r}),e.edges().forEach(f=>{let p=e.edge(f);p.points.forEach(h=>{h.x-=t,h.y-=r}),Object.hasOwn(p,"x")&&(p.x-=t),Object.hasOwn(p,"y")&&(p.y-=r)}),i.width=n-t+a,i.height=o-r+l}function Ale(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),o=e.node(t.w),i,a;n.points?(i=n.points[0],a=n.points[n.points.length-1]):(n.points=[],i=o,a=r),n.points.unshift(BE(r,i)),n.points.push(BE(o,a))})}function Ple(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function _le(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Dle(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),o=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function $le(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Ile(e){bg(e).forEach(t=>{let n=0;t.forEach((r,o)=>{let i=e.node(r);i.order=o+n,(i.selfEdges||[]).forEach(a=>{zc(e,"selfedge",{width:a.label.width,height:a.label.height,rank:i.rank,order:o+ ++n,e:a.e,label:a.label},"_se")}),delete i.selfEdges})})}function Mle(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,o=e.node(r.e.v),i=o.x+o.width/2,a=o.y,l=n.x-i,u=o.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*l/3,y:a-u},{x:i+5*l/6,y:a-u},{x:i+l,y:a},{x:i+5*l/6,y:a+u},{x:i+2*l/3,y:a+u}],r.label.x=n.x,r.label.y=n.y}})}function wb(e,t){return vg(tm(e,t),Number)}function jb(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}/*! For license information please see dagre.esm.js.LEGAL.txt */function Lle(e,t,n={}){const r=new Map;if(e.length===0)return r;const o=n.nodeWidth??150,i=n.nodeHeight??64,a=new y$.Graph;a.setGraph({rankdir:n.direction??"LR",nodesep:n.nodeSep??64,ranksep:n.rankSep??160}),a.setDefaultEdgeLabel(()=>({}));const l=new Set;for(const u of e)l.add(u.id),a.setNode(u.id,{width:o,height:i});for(const u of t)l.has(u.from)&&l.has(u.to)&&a.setEdge(u.from,u.to);hle(a);for(const u of l){const f=a.node(u);f&&r.set(u,{x:f.x-o/2,y:f.y-i/2})}return r}function B$(e){const t=new Map;return e.forEach((n,r)=>{t.has(n.id)||t.set(n.id,r)}),t}const Ole=new Set(["fail","block"]),Fle=new Set(["reopen","unblock"]);function U$(e,t){if(Ole.has(e.command))return"exception";if(Fle.has(e.command))return"recovery";const n=t.get(e.from),r=t.get(e.to);return n!=null&&r!=null&&r<n?"recovery":"forward"}function zle(e,t){const n=B$(t);return e.filter(r=>U$(r,n)!=="recovery").map(r=>({from:r.from,to:r.to}))}function Ble(e){const t=[],n=new Map;for(const r of e){const o=`${r.from}>${r.to}`;let i=n.get(o);i||(i={from:r.from,to:r.to,commands:[]},n.set(o,i),t.push(i)),i.commands.push({rowKey:r.rowKey,command:r.command,requiresReason:r.requiresReason,undefinedRef:r.undefinedRef})}return t}function Ule(e,t){const n=new Set([e]),r=new Set;for(const o of t)(o.from===e||o.to===e)&&(n.add(o.from),n.add(o.to),r.add(o.rowKey));return{nodeIds:n,edgeKeys:r}}function Hle({data:e,selected:t}){const{label:n,statusId:r,color:o,terminal:i,orphan:a,missing:l,dimmed:u}=e;return s.jsxs("div",{className:be("min-w-[120px] rounded-md border px-3 py-2 text-xs shadow-sm transition-[opacity,box-shadow]",l?"border-dashed border-error-foreground/60 bg-error/10 text-error-foreground":a?"border-warning-foreground/70 bg-warning/10":"border-border/70 bg-card",t&&"ring-2 ring-primary/50",u&&"opacity-25"),children:[s.jsx(mc,{type:"target",position:ct.Left,className:"!h-2 !w-2 !bg-muted-foreground"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[!l&&s.jsx("span",{className:"inline-block h-2.5 w-2.5 shrink-0 rounded-full border border-border/50",style:o?{backgroundColor:o}:void 0}),s.jsx("span",{className:"font-medium text-foreground",children:n}),l&&s.jsx(T2,{className:"h-3 w-3 shrink-0","aria-label":"Undefined status"}),a&&!l&&s.jsx(kc,{className:"h-3 w-3 shrink-0 text-warning-foreground","aria-label":"Orphan status"})]}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[s.jsx("span",{children:r}),i&&s.jsxs("span",{className:"inline-flex items-center gap-0.5 text-muted-foreground",title:"Terminal status",children:[s.jsx(D5,{className:"h-2.5 w-2.5"})," terminal"]})]}),l&&s.jsx("div",{className:"mt-1 text-[10px] font-medium",children:"undefined status"}),a&&!l&&s.jsx("div",{className:"mt-1 text-[10px] text-warning-foreground",children:"no incoming edge"}),s.jsx(mc,{type:"source",position:ct.Right,className:"!h-2 !w-2 !bg-muted-foreground"})]})}function Ws(e,t,n){return t?"oklch(var(--error-foreground))":n?"oklch(var(--primary))":e==="exception"?"oklch(var(--warning-foreground))":"oklch(var(--muted-foreground))"}function Vle({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:i,targetPosition:a,data:l}){const u=l,[f,p,h]=Z0({sourceX:t,sourceY:n,sourcePosition:i,targetX:r,targetY:o,targetPosition:a}),g=Ws(u.edgeClass,u.undefinedRef,u.selected),y=u.edgeClass==="recovery",k=`arrow-${u.edgeClass}${u.undefinedRef?"-undef":u.selected?"-sel":""}`,v=r-t,b=o-n,w=Math.hypot(v,b)||1,S=u.from<u.to?1:-1,N=p+-b/w*16*S,C=h+v/w*16*S;return s.jsxs(s.Fragment,{children:[s.jsx(cf,{id:e,path:f,markerEnd:`url(#${k})`,style:{stroke:g,strokeWidth:u.selected?2.5:1.5,strokeDasharray:y?"6 4":void 0,opacity:u.dimmed?.18:1}}),u.showChips&&s.jsx(Ooe,{children:s.jsx("div",{style:{position:"absolute",transform:`translate(-50%, -50%) translate(${N}px, ${C}px)`,pointerEvents:"all"},className:"flex flex-col items-center gap-0.5",children:u.commands.map(R=>{const T=R.rowKey===u.selectedRowKey;return s.jsxs("button",{type:"button",onClick:A=>{A.stopPropagation(),u.onSelectCommand(R.rowKey)},"aria-label":`Edit transition command ${R.command}`,className:be("rounded border px-1 py-0.5 font-mono text-[10px] leading-none shadow-sm transition-colors",R.undefinedRef?"border-error-foreground/70 bg-error/10 text-error-foreground":T?"border-primary bg-primary/10 text-primary":"border-border/60 bg-card text-foreground hover:border-primary/60"),children:[R.command,R.requiresReason?" ⓡ":""]},R.rowKey)})})})]})}const Wle={status:Hle},Kle={transition:Vle};function qle(){const e=[{id:"arrow-forward",color:Ws("forward",!1,!1)},{id:"arrow-exception",color:Ws("exception",!1,!1)},{id:"arrow-recovery",color:Ws("recovery",!1,!1)},{id:"arrow-forward-undef",color:Ws("forward",!0,!1)},{id:"arrow-exception-undef",color:Ws("exception",!0,!1)},{id:"arrow-recovery-undef",color:Ws("recovery",!0,!1)},{id:"arrow-forward-sel",color:Ws("forward",!1,!0)},{id:"arrow-exception-sel",color:Ws("exception",!1,!0)},{id:"arrow-recovery-sel",color:Ws("recovery",!1,!0)}];return s.jsx("svg",{style:{position:"absolute",width:0,height:0},"aria-hidden":!0,children:s.jsx("defs",{children:e.map(({id:t,color:n})=>s.jsx("marker",{id:t,viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:s.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:n})},t))})})}function Gle({onRelayout:e}){const{fitView:t}=xg();return s.jsx(lf,{position:"top-right",children:s.jsxs("button",{type:"button",onClick:()=>{e(),requestAnimationFrame(()=>t({padding:.2}))},className:"shell-action inline-flex items-center gap-1 text-xs",title:"Reset node positions to the automatic layout",children:[s.jsx(F5,{className:"h-3 w-3"}),"Re-layout"]})})}function Yle(e,t,n,r){let o=!1;for(const i of e){const a=U$({from:t,to:n,command:i.command},r);if(a==="exception")return"exception";a==="recovery"&&(o=!0)}return o?"recovery":"forward"}function Xle({nodes:e,edges:t,statuses:n,selectedRowKey:r,focusNodeId:o,editable:i,onSelectEdge:a,onFocusNode:l,onCreateEdge:u,onDeleteEdge:f}){const[p,h,g]=Foe([]),[y,k]=zoe([]),v=m.useRef(new Map),[b,w]=m.useState(0),[S,N]=m.useState(null),[C,R]=m.useState(null),T=m.useRef(null),A=m.useRef(null);m.useEffect(()=>{const H=T.current;if(!H||typeof ResizeObserver>"u")return;let Q=0;const J=new ResizeObserver(()=>{cancelAnimationFrame(Q),Q=requestAnimationFrame(()=>{var Z;return(Z=A.current)==null?void 0:Z.fitView({padding:.2})})});return J.observe(H),()=>{J.disconnect(),cancelAnimationFrame(Q)}},[]);const I=m.useMemo(()=>B$(n),[n]),_=m.useMemo(()=>Ble(t),[t]),z=o??S,O=m.useMemo(()=>z?Ule(z,t):null,[z,t]),B=m.useMemo(()=>JSON.stringify(e.map(H=>[H.id,H.label,H.color??"",H.terminal,H.orphan,H.missing])),[e]);m.useEffect(()=>{const H=Lle(e,zle(t,n),{direction:"LR"}),Q=new Set(e.map(J=>J.id));for(const J of v.current.keys())Q.has(J)||v.current.delete(J);h(e.map(J=>{let Z=v.current.get(J.id);return Z||(Z=H.get(J.id)??{x:0,y:0},v.current.set(J.id,Z)),{id:J.id,type:"status",position:Z,data:{label:J.label,statusId:J.id,color:J.color,terminal:J.terminal,orphan:J.orphan,missing:J.missing,dimmed:!1},draggable:!0,deletable:!1}}))},[B,b,h]),m.useEffect(()=>{h(H=>H.map(Q=>{const J=O?!O.nodeIds.has(Q.id):!1;return Q.data.dimmed===J?Q:{...Q,data:{...Q.data,dimmed:J}}}))},[O,h]);const V=m.useCallback(()=>{v.current.clear(),w(H=>H+1)},[]),$=m.useCallback(H=>a(H),[a]),L=m.useMemo(()=>_.map(H=>`${H.from}>${H.to}:${H.commands.map(Q=>`${Q.rowKey}/${Q.command}/${Q.requiresReason?1:0}/${Q.undefinedRef?1:0}`).join(",")}`).join("|"),[_]);m.useEffect(()=>{k(_.map(H=>{const Q=`${H.from}>${H.to}`,J=H.commands.map(Se=>Se.rowKey),Z=H.commands.some(Se=>Se.undefinedRef),oe=Yle(H.commands,H.from,H.to,I),te=r!=null&&J.includes(r),ue=O?J.some(Se=>O.edgeKeys.has(Se)):!1,ge=O?!ue:!1,Ce=te||ue||C===Q;return{id:Q,source:H.from,target:H.to,type:"transition",selected:te,deletable:i,data:{from:H.from,to:H.to,commands:H.commands,edgeClass:oe,undefinedRef:Z,selected:te,dimmed:ge,showChips:Ce,selectedRowKey:r,onSelectCommand:$}}}))},[L,r,O,C,i,I,k,$]);const U=m.useCallback(H=>{for(const Q of H)Q.type==="position"&&Q.position&&v.current.set(Q.id,Q.position);g(H)},[g]),K=m.useCallback(H=>{i&&H.source&&H.target&&u(H.source,H.target)},[i,u]),D=m.useCallback(H=>{if(!i)return;const Q=[];for(const J of H){const Z=J.data.commands;r&&Z.some(oe=>oe.rowKey===r)?Q.push(r):Q.push(...Z.map(oe=>oe.rowKey))}Q.length&&f(Q)},[i,f,r]),W=m.useCallback((H,Q)=>{const J=Q.data.commands[0];J&&a(J.rowKey)},[a]),M=m.useCallback(({edges:H})=>{if(H.length!==1)return;const Q=H[0].data.commands;if(r&&Q.some(Z=>Z.rowKey===r))return;const J=Q[0];J&&a(J.rowKey)},[a,r]),F=m.useCallback((H,Q)=>l(o===Q.id?null:Q.id),[o,l]),Y=m.useCallback(()=>l(null),[l]);return s.jsxs("div",{ref:T,className:"relative h-full min-h-[420px] w-full overflow-hidden rounded-md border border-border/60 bg-background",children:[s.jsx(qle,{}),s.jsxs(Moe,{onInit:H=>{A.current=H},nodes:p,edges:y,nodeTypes:Wle,edgeTypes:Kle,onNodesChange:U,onConnect:K,onEdgesDelete:D,onEdgeClick:W,onSelectionChange:M,onEdgeMouseEnter:(H,Q)=>R(Q.id),onEdgeMouseLeave:()=>R(null),onNodeClick:F,onNodeMouseEnter:(H,Q)=>N(Q.id),onNodeMouseLeave:()=>N(null),onPaneClick:Y,nodesConnectable:i,deleteKeyCode:i?["Backspace","Delete"]:null,elementsSelectable:!0,fitView:!0,fitViewOptions:{padding:.2},proOptions:{hideAttribution:!1},children:[s.jsx(Woe,{gap:16}),s.jsx(Joe,{showInteractive:!1}),s.jsx(Gle,{onRelayout:V})]})]})}const xc="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";function nm({value:e,onChange:t,statuses:n,ariaLabel:r,disabled:o,className:i,inputRef:a}){const l=n.some(u=>u.id===e);return s.jsxs("select",{ref:a,value:e,onChange:u=>t(u.target.value),disabled:o,"aria-label":r,className:be(xc,"font-mono",i),children:[!l&&e!==""&&s.jsxs("option",{value:e,children:[e," (undefined)"]}),e===""&&s.jsx("option",{value:"",children:"Select a status…"}),n.map(u=>s.jsxs("option",{value:u.id,children:[u.label," (",u.id,")"]},u.id))]})}function H$({id:e,commands:t}){return s.jsx("datalist",{id:e,children:t.map(n=>s.jsx("option",{value:n},n))})}function V$({value:e,onChange:t,listId:n,ariaLabel:r="Command",disabled:o,className:i}){return s.jsx("input",{type:"text",list:n,value:e,onChange:a=>t(a.target.value),disabled:o,placeholder:"command","aria-label":r,className:be(xc,"font-mono",i)})}function W$({checked:e,onChange:t,disabled:n,ariaLabel:r="Requires reason"}){return s.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":r,onClick:()=>t(!e),disabled:n,className:be("relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background",e?"bg-primary":"bg-muted"),children:s.jsx("span",{className:be("pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm transition-transform",e?"translate-x-4":"translate-x-0")})})}const JE="transitions-table-commands";function Qle({value:e,statuses:t,knownCommands:n,selectedRowKey:r,editable:o,issuesByRowKey:i,onChange:a,onSelectRow:l,disabled:u}){var S;const[f,p]=m.useState(new Set),h=nZ(e),g=((S=t[0])==null?void 0:S.id)??"",y=!o||u;function k(N){a(e.map(C=>C.rowKey===N.rowKey?N:C))}function v(N){a(e.filter(C=>C.rowKey!==N))}function b(N){const C={rowKey:B0(),from:N||g,command:n[0]??"",to:g,label:"",description:"",requiresReason:!1};a([...e,C]),l(C.rowKey),p(R=>new Set(R).add(C.rowKey))}function w(N){p(C=>{const R=new Set(C);return R.has(N)?R.delete(N):R.add(N),R})}return e.length===0?s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"surface-panel px-4 py-6 text-center text-sm text-muted-foreground",children:"No transitions defined yet."}),o&&!u&&s.jsxs("button",{type:"button",onClick:()=>b(g),disabled:t.length===0,className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[s.jsx(Tt,{className:"h-3 w-3"}),"Add transition"]})]}):s.jsxs("div",{className:"space-y-4",children:[h.map(N=>{const C=t.find(R=>R.id===N.from);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[s.jsx("span",{className:"inline-block h-2.5 w-2.5 shrink-0 rounded-full border border-border/50",style:C!=null&&C.color?{backgroundColor:C.color}:void 0}),s.jsx("span",{className:"text-foreground",children:(C==null?void 0:C.label)??N.from}),s.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:N.from})]}),!y&&s.jsxs("button",{type:"button",onClick:()=>b(N.from),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":`Add transition from ${N.from}`,children:[s.jsx(Tt,{className:"h-3 w-3"}),"Add"]})]}),s.jsx("div",{className:"space-y-2",children:N.rows.map(R=>{const T=i.get(R.rowKey)??[],A=f.has(R.rowKey),I=R.rowKey===r;return s.jsxs("div",{onClick:()=>l(R.rowKey),className:be("surface-panel px-3 py-2 transition-colors",I&&"ring-2 ring-primary/50"),children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),w(R.rowKey)},"aria-label":A?"Collapse row":"Expand row (label & description)","aria-expanded":A,className:"text-muted-foreground/60 hover:text-muted-foreground",children:A?s.jsx(tr,{className:"h-4 w-4"}):s.jsx(Gv,{className:"h-4 w-4"})}),s.jsx(nm,{value:R.from,onChange:_=>k({...R,from:_}),statuses:t,ariaLabel:"From status",disabled:y,className:"min-w-[8rem] flex-1"}),s.jsx("span",{className:"text-muted-foreground","aria-hidden":!0,children:"—"}),s.jsx(V$,{value:R.command,onChange:_=>k({...R,command:_}),listId:JE,disabled:y,className:"min-w-[7rem] flex-1"}),s.jsx("span",{className:"text-muted-foreground","aria-hidden":!0,children:"→"}),s.jsx(nm,{value:R.to,onChange:_=>k({...R,to:_}),statuses:t,ariaLabel:"To status",disabled:y,className:"min-w-[8rem] flex-1"}),s.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",onClick:_=>_.stopPropagation(),children:[s.jsx(W$,{checked:R.requiresReason,onChange:_=>k({...R,requiresReason:_}),disabled:y}),"reason"]}),T.length>0&&s.jsx("span",{className:"inline-flex items-center text-warning-foreground",title:T.map(_=>_.message).join(`
|
|
690
|
+
`),"aria-label":`${T.length} issue${T.length>1?"s":""}`,children:s.jsx(kc,{className:"h-3.5 w-3.5"})}),!y&&s.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),v(R.rowKey)},className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-error/10 hover:text-error-foreground","aria-label":"Remove transition",children:s.jsx(fn,{className:"h-3.5 w-3.5"})})]}),A&&s.jsxs("div",{className:"mt-2 grid gap-2 pl-6 sm:grid-cols-2",onClick:_=>_.stopPropagation(),children:[s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:"Label (optional)"}),s.jsx("input",{type:"text",value:R.label,onChange:_=>k({...R,label:_.target.value}),disabled:y,placeholder:"label",className:be(xc,"w-full")})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:"Description (optional)"}),s.jsx("input",{type:"text",value:R.description,onChange:_=>k({...R,description:_.target.value}),disabled:y,placeholder:"description",className:be(xc,"w-full")})]})]})]},R.rowKey)})})]},N.from)}),o&&!u&&s.jsxs("button",{type:"button",onClick:()=>b(g),disabled:t.length===0,className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[s.jsx(Tt,{className:"h-3 w-3"}),"Add transition"]}),s.jsx(H$,{id:JE,commands:n})]})}const ZE="transition-inspector-commands";function Jle({transition:e,statuses:t,knownCommands:n,onChange:r,onDelete:o,disabled:i}){const a=m.useRef(null);if(m.useEffect(()=>{var g;e&&!i&&((g=a.current)==null||g.focus())},[e==null?void 0:e.rowKey]),!e)return s.jsx("div",{className:"surface-panel flex h-full min-h-[120px] items-center justify-center px-4 py-6 text-center text-xs text-muted-foreground",children:"Select a transition edge to edit it, or use “Add transition”."});const l=e,u=new Set(t.map(g=>g.id)),f=!u.has(l.from),p=!u.has(l.to);function h(g){r({...l,...g})}return s.jsxs("div",{className:"surface-panel space-y-3 px-4 py-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Edit transition"}),s.jsxs("button",{type:"button",onClick:()=>o(l.rowKey),disabled:i,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-error-foreground hover:bg-error/10","aria-label":"Delete transition",children:[s.jsx(fn,{className:"h-3.5 w-3.5"}),"Delete"]})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"From status"}),s.jsx(nm,{value:l.from,onChange:g=>h({from:g}),statuses:t,ariaLabel:"From status",disabled:i,inputRef:a,className:"w-full"}),f&&s.jsxs("span",{className:"block text-[11px] text-error-foreground",children:["“",l.from,"” is not a defined status"]})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Command"}),s.jsx(V$,{value:l.command,onChange:g=>h({command:g}),listId:ZE,disabled:i,className:"w-full"})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"To status"}),s.jsx(nm,{value:l.to,onChange:g=>h({to:g}),statuses:t,ariaLabel:"To status",disabled:i,className:"w-full"}),p&&s.jsxs("span",{className:"block text-[11px] text-error-foreground",children:["“",l.to,"” is not a defined status"]})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Label (optional)"}),s.jsx("input",{type:"text",value:l.label,onChange:g=>h({label:g.target.value}),disabled:i,placeholder:"label",className:`${xc} w-full`})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Description (optional)"}),s.jsx("textarea",{value:l.description,onChange:g=>h({description:g.target.value}),disabled:i,placeholder:"description",rows:2,className:`${xc} w-full resize-y`})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(W$,{checked:l.requiresReason,onChange:g=>h({requiresReason:g}),disabled:i}),"Requires a reason"]}),s.jsx(H$,{id:ZE,commands:n})]})}function Zle({value:e,onChange:t}){const n=[{id:"table",label:"Table",Icon:o4},{id:"graph",label:"Graph",Icon:L2}];return s.jsx("div",{role:"tablist","aria-label":"Transitions view",className:"inline-flex rounded-md border border-border/70 bg-card/80 p-0.5",children:n.map(({id:r,label:o,Icon:i})=>{const a=e===r;return s.jsxs("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>t(r),className:be("inline-flex items-center gap-1.5 rounded px-2.5 py-1 text-xs transition-colors",a?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground"),children:[s.jsx(i,{className:"h-3.5 w-3.5"}),o]},r)})})}function ece(){return s.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"inline-block h-0.5 w-4 rounded bg-muted-foreground"}),"forward"]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"inline-block h-0.5 w-4 rounded",style:{backgroundColor:"oklch(var(--warning-foreground))"}}),"exception (fail / block)"]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"inline-block h-0 w-4 border-t border-dashed border-muted-foreground"}),"recovery (reopen / unblock)"]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"inline-block h-0.5 w-4 rounded",style:{backgroundColor:"oklch(var(--error-foreground))"}}),"undefined status"]})]})}function tce({issues:e,open:t,onToggle:n,onNavigate:r}){return e.length===0?null:s.jsxs("div",{className:"relative",children:[s.jsxs("button",{type:"button",onClick:n,"aria-expanded":t,className:"inline-flex items-center gap-1 rounded-md border border-warning-foreground/40 bg-warning/10 px-2 py-1 text-xs text-warning-foreground",children:[s.jsx(kc,{className:"h-3.5 w-3.5"}),e.length," issue",e.length>1?"s":""]}),t&&s.jsx("div",{className:"absolute right-0 z-20 mt-1 w-80 rounded-md border border-border/70 bg-card p-2 shadow-lg",children:s.jsx("ul",{className:"max-h-64 space-y-1 overflow-auto text-xs",children:e.map((o,i)=>s.jsx("li",{children:s.jsx("button",{type:"button",onClick:()=>r(o),className:"block w-full rounded px-2 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground",children:o.message})},i))})})]})}function nce({value:e,customizing:t,statuses:n,knownCommands:r,onChange:o,onCustomize:i,disabled:a}){var K;const l=m.useMemo(()=>new Set(n.map(D=>D.id)),[n]),[u,f]=m.useState(null),[p,h]=m.useState("table"),[g,y]=m.useState(null),[k,v]=m.useState(!1),[b,w]=m.useState(!1);m.useEffect(()=>{if(!b)return;const D=W=>{W.key==="Escape"&&w(!1)};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[b]);const S=m.useMemo(()=>Nv(T_()),[]),N=!t&&e.length===0,C=N?S:e,R=!N,T=m.useMemo(()=>sZ(C,n),[C,n]),A=m.useMemo(()=>oZ(C,n),[C,n]),I=m.useMemo(()=>{const D=new Map;for(const W of A){if(!W.rowKey)continue;const M=D.get(W.rowKey);M?M.push(W):D.set(W.rowKey,[W])}return D},[A]),_=R&&t?R_(e,l):[],z=e.find(D=>D.rowKey===u)??null,O=((K=n[0])==null?void 0:K.id)??"";function B(D){o(e.map(W=>W.rowKey===D.rowKey?D:W))}function V(D){const W=new Set(D);o(e.filter(M=>!W.has(M.rowKey))),u&&W.has(u)&&f(null)}function $(D,W){const M={rowKey:B0(),from:D,command:r[0]??"",to:W,label:"",description:"",requiresReason:!1};o([...e,M]),f(M.rowKey)}function L(D){v(!1),D.rowKey?f(D.rowKey):D.statusId&&(h("graph"),y(D.statusId))}const U=N?"Which commands move an assignment between statuses, as a state-machine graph. Showing the built-in defaults.":"Statuses are nodes; commands are labeled directed edges. Edit transitions in the table, or drag node-to-node in the graph.";return s.jsxs(Ve,{title:"Transitions",description:U,actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Zle,{value:p,onChange:h}),s.jsx(tce,{issues:A,open:k,onToggle:()=>v(D=>!D),onNavigate:L}),p==="graph"&&s.jsxs("button",{type:"button",onClick:()=>w(D=>!D),"aria-pressed":b,title:b?"Exit fullscreen":"Fullscreen",className:"shell-action text-xs inline-flex items-center gap-1",children:[b?s.jsx(U1,{className:"h-3 w-3"}):s.jsx(D2,{className:"h-3 w-3"}),b?"Exit":"Fullscreen"]}),N?s.jsx("button",{type:"button",onClick:i,disabled:a,className:"shell-action text-xs",children:"Customize defaults"}):p==="graph"&&s.jsxs("button",{type:"button",onClick:()=>$(O,O),disabled:a||n.length===0,className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[s.jsx(Tt,{className:"h-3 w-3"}),"Add transition"]})]}),children:[_.length>0&&s.jsxs("div",{className:"mb-3 rounded-md border border-error-foreground/30 bg-error/10 px-3 py-2 text-xs text-error-foreground",children:[s.jsx("p",{className:"font-medium",children:"These transitions won't save until fixed:"}),s.jsx("ul",{className:"mt-1 list-disc space-y-0.5 pl-4",children:_.map((D,W)=>s.jsx("li",{children:D},W))})]}),p==="table"?s.jsx(Qle,{value:C,statuses:n,knownCommands:r,selectedRowKey:u,editable:R,issuesByRowKey:I,onChange:o,onSelectRow:f,disabled:a}):s.jsxs("div",{className:be(b?"fixed inset-0 z-50 flex flex-col gap-2 bg-background p-4":"space-y-3"),children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(ece,{}),b&&s.jsxs("button",{type:"button",onClick:()=>w(!1),className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(U1,{className:"h-3 w-3"}),"Exit fullscreen"]})]}),s.jsxs("div",{className:be("relative w-full",b?"min-h-0 flex-1":"h-[72vh] min-h-[520px]"),children:[s.jsx(Xle,{nodes:T.nodes,edges:T.edges,statuses:n,selectedRowKey:u,focusNodeId:g,editable:R&&!a,onSelectEdge:f,onFocusNode:y,onCreateEdge:$,onDeleteEdge:V}),R&&z&&s.jsx("div",{className:"absolute right-3 top-3 z-10 w-80 max-w-[calc(100%-1.5rem)]",children:s.jsxs("div",{className:"relative",children:[s.jsx("button",{type:"button",onClick:()=>f(null),"aria-label":"Close inspector",className:"absolute -right-1 -top-1 z-10 inline-flex h-6 w-6 items-center justify-center rounded-full border border-border/70 bg-card text-muted-foreground shadow hover:text-foreground",children:s.jsx(Nc,{className:"h-3.5 w-3.5"})}),s.jsx(Jle,{transition:z,statuses:n,knownCommands:r,onChange:B,onDelete:D=>V([D]),disabled:a})]})})]})]})]})}function rce(e){const t=[];e.transitions>0&&t.push({tab:"Transitions",count:e.transitions}),e.derive>0&&t.push({tab:"Derive Rules",count:e.derive}),e.facts>0&&t.push({tab:"Facts",count:e.facts});const n=e.transitions+e.derive+e.facts,r=n===0?"Unsaved changes":`Fix errors in ${t.map(o=>o.tab).join(", ")} to save`;return{total:n,offending:t,message:r}}function sce(){var pt;const[e,t]=m.useState(!0),[n,r]=m.useState(null),[o,i]=m.useState(!1),[a,l]=m.useState([]),[u,f]=m.useState(!1),[p,h]=m.useState(null),[g,y]=m.useState(!1),[k,v]=m.useState(new Set),[b,w]=m.useState(new Map),[S,N]=m.useState({open:!1}),[C,R]=m.useState([]),[T,A]=m.useState([]),[I,_]=m.useState({open:!1}),[z,O]=m.useState(()=>rb(Kp)),[B,V]=m.useState(!1),[$,L]=m.useState(!1),[U,K]=m.useState(!1),[D,W]=m.useState([]),[M,F]=m.useState(!1),[Y,H]=m.useState([]),[Q,J]=m.useState("statuses"),Z=m.useCallback(De=>{const Qe=PJ(De);l(Qe),i(De.custom),v(new Set(Qe.map(Je=>Je.id))),w(new Map),R(De.rawFacts??[]),A([]),O(rb(De.derive??Kp)),V(De.deriveCustom??!1),L(!1),K(!1),W(Nv(De.transitions??[])),F(De.transitionsCustom??!1),H(De.knownCommands??[]),y(!1)},[]),oe=m.useCallback(async()=>{try{const De=await fetch("/api/config/statuses");if(!De.ok)throw new Error(`HTTP ${De.status}`);const Qe=await De.json();Z(Qe),r(null)}catch(De){r(De instanceof Error?De.message:"Failed to load config")}finally{t(!1)}},[Z]);m.useEffect(()=>{oe()},[oe]);function te(){setTimeout(()=>h(null),3e3)}const ue=m.useMemo(()=>a.map(De=>({id:De.id,label:De.label,color:De.color,terminal:De.terminal})),[a]),ge=m.useMemo(()=>new Set(a.map(De=>De.id)),[a]),Ce=m.useMemo(()=>KJ(C),[C]),Se=m.useMemo(()=>Qw(Ce),[Ce]),ke=m.useMemo(()=>_J(C),[C]),Be=m.useMemo(()=>{try{return E_(kv(z),a,Se)}catch{return["derive rules are malformed"]}},[z,a,Se]),ie=m.useMemo(()=>M?R_(D,ge):[],[D,M,ge]),ve=ke.length+Be.length+ie.length,ye=m.useCallback(De=>{R(De),y(!0)},[]),Ae=m.useCallback(De=>{O(De),L(!0),K(!1),V(!0),y(!0)},[]),Ue=m.useCallback(()=>{O(rb(Kp)),K(!0),L(!0),V(!1),y(!0)},[]),rt=m.useCallback(De=>{W(De),y(!0)},[]),Oe=m.useCallback(()=>{W(De=>De.length>0?De:Nv(tZ(T_(),ge))),F(!0),y(!0)},[ge]);async function ot(De=T){f(!0),h(null);try{const{body:Qe}=kJ({statuses:a,order:a.map(q=>q.id),pendingResolutions:b,facts:C,factRemovalAcks:De,derive:U?null:$?kv(z):void 0,transitions:M?eZ(D):void 0}),Je=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qe)});if(!Je.ok){const q=await Je.json().catch(()=>null);if(Je.status===409&&(q==null?void 0:q.error)==="unresolved-fact-references"&&q.references){_({open:!0,references:q.references}),f(!1);return}if((q==null?void 0:q.error)==="invalid-derive")throw new Error(`Invalid derive rules: ${(q.problems??[]).join("; ")}`);if((q==null?void 0:q.error)==="invalid-transitions")throw new Error(`Invalid transitions: ${(q.problems??[]).join("; ")}`);if((q==null?void 0:q.error)==="invalid-facts")throw new Error(`Invalid facts: ${(q.problems??[]).join("; ")}`);if(Je.status===409&&(q==null?void 0:q.error)==="unresolved-orphans"){const ne=Array.isArray(q.unresolved)?q.unresolved.map(xe=>xe.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${ne}. Click the trash icon on each row to choose remap or delete.`)}if(Je.status===409&&(q==null?void 0:q.error)==="concurrent-edit"){const ne=q.applied?` (${q.applied.remapped} remapped, ${q.applied.deleted} deleted before the conflict)`:"";h({type:"error",message:`Concurrent edit detected${ne}: ${q.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await oe();return}if(Je.status===500&&(q==null?void 0:q.error)==="config-write-failed"&&(q!=null&&q.applied)){const{remapped:ne,deleted:xe}=q.applied,qe=q.message?`: ${q.message}`:"";h({type:"error",message:`Resolutions applied (${ne} remapped, ${xe} deleted) but the status config write failed${qe}. Click Save again to retry.`}),await oe();return}throw(q==null?void 0:q.error)==="invalid-remap-target"?new Error(`Invalid remap target (${q.reason}): ${q.id} → ${q.target}.`):(q==null?void 0:q.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(q.ids??[]).join(", ")}`):(q==null?void 0:q.error)==="stale-resolution"?new Error(`Stale resolution for id "${q.id??"?"}".`):(q==null?void 0:q.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${q.message??"unknown"}`):(q==null?void 0:q.error)==="remap-write-failed"||(q==null?void 0:q.error)==="delete-failed"||(q==null?void 0:q.error)==="scan-failed"?new Error(`${q.error}: ${q.cause??"unknown"}`):new Error((q==null?void 0:q.error)??`Save failed (HTTP ${Je.status})`)}const ut=await Je.json();Z(ut),mN();const fe=ut.applied?` (${ut.applied.remapped} remapped, ${ut.applied.deleted} deleted)`:"";h({type:"success",message:`Status config saved${fe}`}),te()}catch(Qe){h({type:"error",message:Qe instanceof Error?Qe.message:"Save failed"})}finally{f(!1)}}async function St(){f(!0),h(null);try{const De=await fetch("/api/config/statuses",{method:"DELETE"});if(!De.ok)throw new Error("Reset failed");const Qe=await De.json();Z(Qe),mN(),h({type:"success",message:"Reset to defaults"}),te()}catch(De){h({type:"error",message:De instanceof Error?De.message:"Reset failed"})}finally{f(!1)}}function ht(De,Qe,Je){l(ut=>{const fe=[...ut];return fe[De]={...fe[De],[Qe]:Je},fe}),y(!0)}function it(){const De=`status_${a.length+1}`;l(Qe=>[...Qe,{rowKey:k_(),id:De,label:"New Status",description:"",color:"",terminal:!1}]),y(!0)}function ce(De){l(Qe=>{const Je=Qe.filter(fe=>fe.id!==De),ut=new Set(Je.map(fe=>fe.id));return w(fe=>EC(fe,ut)),Je}),y(!0)}async function me(De){const Qe=a[De].id,Je=NJ(Qe,z,D),ut=SJ(Qe,z);if(!k.has(Qe)){if(Je.length===0){ce(Qe);return}N({open:!0,affected:{id:Qe,count:0,truncated:!1,assignments:[]},pendingId:Qe,ruleReferences:Je,headlineReferences:ut});return}try{const fe=await fetch(`/api/config/statuses/affected/${encodeURIComponent(Qe)}`);if(!fe.ok)throw new Error(`HTTP ${fe.status}`);const q=await fe.json();if(q.count===0&&Je.length===0){ce(Qe);return}N({open:!0,affected:q,pendingId:Qe,ruleReferences:Je,headlineReferences:ut})}catch(fe){h({type:"error",message:`Could not check affected assignments for "${Qe}": ${fe instanceof Error?fe.message:String(fe)}`})}}function Ie(De,Qe){if(!S.open)return;const{pendingId:Je,affected:ut,ruleReferences:fe}=S;if(Je!==De.id){N({open:!1});return}if(!a.some(q=>q.id===Je)){h({type:"error",message:`Row for "${Je}" was already removed — modal action ignored.`}),N({open:!1});return}De.mode==="remap"?(O(q=>CJ(q,Je,Qe)),W(q=>EJ(q,Je,Qe))):(O(q=>TJ(q,Je,Qe)),W(q=>RJ(q,Je))),fe.some(q=>q.section!=="transitions")&&(L(!0),V(!0)),l(q=>{const ne=q.filter(qe=>qe.id!==Je),xe=new Set(ne.map(qe=>qe.id));return w(qe=>{const Fe=EC(qe,xe),lt=new Map(Fe);return ut.count>0&<.set(Je,De),lt}),ne}),y(!0),N({open:!1})}function Pe(){if(!I.open)return;const De=I.references.map(Je=>Je.factName),Qe=Array.from(new Set([...T,...De]));A(Qe),_({open:!1}),ot(Qe)}function We(){N({open:!1})}return e?s.jsx(bt,{label:"Loading workflow..."}):n?s.jsx(Rt,{error:n}):s.jsx(ga,{children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:`flex items-center justify-between rounded-lg border px-4 py-3 text-sm ${o?"border-primary/30 bg-primary/5 text-primary":"border-border/60 bg-muted/30 text-muted-foreground"}`,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Qv,{className:"h-4 w-4"}),o?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),s.jsxs("button",{className:"shell-action text-xs",onClick:St,disabled:u||!o&&!g,children:[s.jsx(vs,{className:"h-3 w-3"}),"Reset to Defaults"]})]}),p&&s.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${p.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:p.message}),s.jsx(Xm,{value:Q,onValueChange:J,items:[{value:"statuses",label:"Statuses",content:s.jsx(jJ,{statuses:a,savedStatusIds:k,onUpdate:ht,onAdd:it,onRemove:me,onReorder:De=>{l(De),y(!0)}})},{value:"transitions",label:"Transitions",problemCount:ie.length,content:s.jsx(nce,{value:D,customizing:M,statuses:ue,knownCommands:Y,onChange:rt,onCustomize:Oe,disabled:u})},{value:"derive",label:"Derive Rules",problemCount:Be.length,content:s.jsx(YJ,{value:z,deriveCustom:B,statuses:ue,acceptedFacts:Ce,onChange:Ae,onReset:Ue,disabled:u})},{value:"facts",label:"Facts",problemCount:ke.length,content:s.jsx(LJ,{rows:C,onChange:ye,saving:u})}]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50",onClick:()=>void ot(),disabled:u||!g||ve>0,children:[s.jsx(Od,{className:"h-3.5 w-3.5"}),u?"Saving...":"Save Configuration"]}),g&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),oe()},disabled:u,children:"Discard Changes"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:rce({transitions:ie.length,derive:Be.length,facts:ke.length}).message})]})]}),S.open&&s.jsx(yJ,{open:S.open,affected:{...S.affected,label:((pt=a.find(De=>De.id===S.affected.id))==null?void 0:pt.label)??S.affected.id},remaining:a.filter(De=>De.id!==S.affected.id&&k.has(De.id)).map(De=>({id:De.id,label:De.label})),ruleReferences:S.ruleReferences,headlineReferences:S.headlineReferences,onResolve:Ie,onCancel:We}),s.jsx(bJ,{open:I.open,references:I.open?I.references:[],onConfirm:Pe,onCancel:()=>{_({open:!1}),f(!1)}})]})})}const Co=e=>`${e.workspace}::${e.id}`;function e2(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function oce(){var fe;const{data:e,loading:t,error:n,refetch:r}=pT(),{toast:o,showToast:i,dismissToast:a}=Tn(),l=Wt(),[u,f]=m.useState(""),p=m.useRef(null);Ai("list:todos");const[h,g]=m.useState(""),[y,k]=m.useState(""),[v,b]=m.useState(""),[w,S]=m.useState("_global"),[N,C]=m.useState(null),[R,T]=m.useState(null),[A,I]=m.useState(new Set),[_,z]=m.useState(!1),O=m.useRef(null),[B,V]=m.useState(null),$=T0("all"),[L,U]=m.useState(null),[K,D]=m.useState(null),W=m.useRef(null);m.useEffect(()=>{let q=!1;return(async()=>{try{const ne=await fetch("/api/projects");if(!ne.ok)return;const xe=await ne.json();q||V(xe.filter(qe=>!qe.archived))}catch{}})(),()=>{q=!0}},[]);async function M(q,ne){q.stopPropagation(),await Jd(ne)&&(C(ne),setTimeout(()=>C(xe=>xe===ne?null:xe),1500))}const F=m.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const q=[];for(const ne of e.workspaces)for(const xe of ne.items)q.push({...xe,workspace:ne.workspace});return q},[e]),Y=m.useMemo(()=>{const q=new Set;for(const ne of F)for(const xe of ne.tags)q.add(xe);return Array.from(q).sort()},[F]),H=m.useMemo(()=>{let q=F;if(u.trim()){const ne=u.toLowerCase();q=q.filter(xe=>xe.description.toLowerCase().includes(ne)||xe.tags.some(qe=>qe.toLowerCase().includes(ne))||xe.id.includes(ne))}return h&&(q=q.filter(ne=>ne.status===h)),y&&(q=q.filter(ne=>ne.tags.includes(y))),q},[F,u,h,y]);m.useEffect(()=>{I(new Set),O.current=null},[u,h,y]);const Q=m.useMemo(()=>H.filter(q=>A.has(Co(q))),[H,A]),J=H.length>0&&Q.length===H.length,Z=Q.length>0&&!J,oe=m.useMemo(()=>{if(Q.length===0)return null;const q=new Set(Q.map(ne=>ne.workspace));return q.size===1?[...q][0]:null},[Q]),te=m.useMemo(()=>{if(!oe||!B)return;const q=B.filter(ne=>ne.workspace===oe);return q.length===1?q[0].slug:void 0},[oe,B]),ue=((fe=Q[0])==null?void 0:fe.description)??"",ge=m.useMemo(()=>{if(oe)return null;const q=new Map;for(const ne of Q)q.has(ne.workspace)||q.set(ne.workspace,[]),q.get(ne.workspace).push(ne.id);return Array.from(q,([ne,xe])=>({workspace:ne,todoIds:xe}))},[Q,oe]),Ce=oe?{kind:"workspace",workspace:oe}:{kind:"aggregate",groups:ge??[]};function Se(q,ne,xe){const qe=Co(q),Fe=!!(xe&&"shiftKey"in xe&&xe.shiftKey),lt=O.current?it.findIndex(mt=>Co(mt)===O.current):-1;if(Fe&<!==-1){const mt=Math.min(lt,ne),vt=Math.max(lt,ne);I(nt=>{const _t=new Set(nt);for(let Bt=mt;Bt<=vt;Bt++){const Ut=it[Bt];Ut&&_t.add(Co(Ut))}return _t})}else I(mt=>{const vt=new Set(mt);return vt.has(qe)?vt.delete(qe):vt.add(qe),vt});O.current=qe}function ke(){I(q=>{const ne=new Set(q);if(J)for(const xe of H)ne.delete(Co(xe));else for(const xe of H)ne.add(Co(xe));return ne})}function Be(){I(new Set),O.current=null}function ie(q){Be(),r(),q!=null&&q.assignmentRef&&l(e2(q.assignmentRef))}const ve=m.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const q={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const ne of e.workspaces)q.open+=ne.counts.open,q.in_progress+=ne.counts.in_progress,q.completed+=ne.counts.completed,q.blocked+=ne.counts.blocked,q.total+=ne.counts.total;return q},[e]);function ye(q){i(q instanceof Error?q.message:"Action failed","error")}async function Ae(){if(v.trim())try{await aw(w,v.trim()),b(""),r(),i("Todo added","success")}catch(q){ye(q)}}async function Ue(q,ne,xe){try{switch(xe){case"open":await xT(q,ne);break;case"in_progress":await gT(q,ne);break;case"completed":await hT(q,ne);break;case"blocked":await mT(q,ne);break}r(),i("Todo updated","success")}catch(qe){ye(qe)}}async function rt(q,ne){try{await yT(q,ne),r(),i("Todo deleted","success")}catch(xe){ye(xe)}}async function Oe(q,ne,xe){try{await bT(q,ne,xe),r(),i("Todo updated","success")}catch(qe){throw ye(qe),qe}}async function ot(q,ne,xe){try{await vT(q,ne,xe),r(),i(xe.length===1?"Attachment added":`${xe.length} attachments added`,"success")}catch(qe){ye(qe)}}async function St(q,ne,xe){try{await wT(q,ne,xe),r(),i("Attachment removed","success")}catch(qe){ye(qe)}}const ht=E0(H),it=ht.filter(q=>!$.isCollapsed(q.config.id)).flatMap(q=>q.items),{hotkeyRowProps:ce}=Ud(it,{scope:"list:todos",bindO:!1,onOpen:q=>T(Co(q))});en({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var q;return(q=p.current)==null?void 0:q.focus()}}),en({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>r()});const[me,Ie]=Rs(),Pe=me.get("focus");m.useEffect(()=>{if(!Pe)return;const q=F.find(xe=>xe.id===Pe);if(!q)return;const ne=eg(q.status);$.isCollapsed(ne)&&$.toggle(ne)},[Pe,F]),m.useEffect(()=>{if(!Pe)return;const q=document.querySelector(`[data-todo-id="${CSS.escape(Pe)}"]`);if(!q)return;q.scrollIntoView({block:"nearest"}),q.classList.add("ring-2","ring-primary/60");const ne=window.setTimeout(()=>{q.classList.remove("ring-2","ring-primary/60"),Ie(xe=>{const qe=new URLSearchParams(xe);return qe.delete("focus"),qe})},1500);return()=>window.clearTimeout(ne)},[Pe,it.length,Ie]);const We=L?H.find(q=>Co(q)===L)??null:null;function pt(q,ne){const xe=W.current;if(xe!=null&&xe.closest(ic)){q.preventDefault();return}q.dataTransfer.effectAllowed="move",q.dataTransfer.setData("text/plain",ne),U(ne)}function De(){U(null),D(null)}function Qe(q,ne){!We||ne.statuses.includes(We.status)||(q.preventDefault(),q.dataTransfer.dropEffect="move",D(ne.id))}function Je(q,ne){K===ne.id&&!q.currentTarget.contains(q.relatedTarget)&&D(null)}function ut(q,ne){q.preventDefault();const xe=We;De(),!(!xe||ne.statuses.includes(xe.status))&&Ue(xe.workspace,xe.id,ne.dropStatus)}return t?s.jsx(bt,{label:"Loading todos..."}):n?s.jsx(Rt,{error:n}):s.jsxs("div",{className:"space-y-4",children:[s.jsx(Nn,{toast:o,onDismiss:a}),s.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(Yn,{label:"Open",value:ve.open,icon:ys}),s.jsx(Yn,{label:"In Progress",value:ve.in_progress,icon:Jv,tone:"info"}),s.jsx(Yn,{label:"Blocked",value:ve.blocked,icon:kc,tone:"warn"}),s.jsx(Yn,{label:"Completed",value:ve.completed,icon:ys,tone:"default"})]}),s.jsx("div",{className:"surface-panel p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("select",{value:w,onChange:q=>S(q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"_global",children:"Global"}),e==null?void 0:e.workspaces.filter(q=>q.workspace!=="_global").map(q=>s.jsx("option",{value:q.workspace,children:q.workspace},q.workspace))]}),s.jsx("input",{type:"text",placeholder:"Add a todo...",value:v,onChange:q=>b(q.target.value),onKeyDown:q=>q.key==="Enter"&&Ae(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),s.jsxs("button",{onClick:Ae,disabled:!v.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[s.jsx(Tt,{className:"h-4 w-4"}),"Add"]})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative flex-1 max-w-sm",children:[s.jsx(Ci,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:p,type:"text",placeholder:"Search todos...",value:u,onChange:q=>f(q.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs("select",{value:h,onChange:q=>g(q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All statuses"}),s.jsx("option",{value:"open",children:"Open"}),s.jsx("option",{value:"in_progress",children:"In Progress"}),s.jsx("option",{value:"completed",children:"Completed"}),s.jsx("option",{value:"blocked",children:"Blocked"})]}),Y.length>0&&s.jsxs("select",{value:y,onChange:q=>k(q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All tags"}),Y.map(q=>s.jsxs("option",{value:q,children:["#",q]},q))]})]}),Q.length>0?s.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[s.jsxs("span",{className:"text-sm font-medium",children:[Q.length," selected",oe?s.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",s.jsx("strong",{children:oe}),")"]}):s.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(Q.map(q=>q.workspace)).size," workspaces"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>z(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),s.jsx("button",{type:"button",onClick:Be,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,H.length>0&&s.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:J,ref:q=>{q&&(q.indeterminate=Z)},onChange:ke,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",H.length,")"]}),s.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),s.jsx("div",{className:"space-y-3",children:(()=>{let q=-1;return ht.map(({config:ne,items:xe})=>{const qe=!$.isCollapsed(ne.id);return s.jsx(C0,{label:ne.label,count:xe.length,expanded:qe,onToggle:()=>$.toggle(ne.id),isDropTarget:K===ne.id,onDragOver:Fe=>Qe(Fe,ne),onDragLeave:Fe=>Je(Fe,ne),onDrop:Fe=>ut(Fe,ne),children:qe&&xe.map(Fe=>{q+=1;const lt=q,mt=Co(Fe),vt=A.has(mt);return s.jsxs("div",{draggable:!0,"data-todo-id":Fe.id,...ce(lt),onMouseDown:nt=>{W.current=nt.target},onDragStart:nt=>pt(nt,mt),onDragEnd:De,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${vt?"ring-1 ring-foreground/20":""} ${L===mt?"opacity-50 shadow-lg":""}`,children:[s.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${Fe.id}`,title:"Select",checked:vt,onChange:()=>{},onClick:nt=>{nt.stopPropagation(),Se(Fe,lt,nt)},className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),s.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(R3,{status:Fe.status,onChange:nt=>Ue(Fe.workspace,Fe.id,nt)})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[s.jsx(P3,{description:Fe.description,status:Fe.status,editing:R===mt,onBeginEdit:()=>T(mt),onEndEdit:()=>T(null),onSave:nt=>Oe(Fe.workspace,Fe.id,nt)}),Fe.tags.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:Fe.tags.map(nt=>`#${nt}`).join(" ")}),Fe.linkedAssignmentRef?s.jsxs(_e,{to:e2(Fe.linkedAssignmentRef),"data-no-drag":!0,className:"inline-flex items-center gap-0.5 rounded-full border border-status-completed-foreground/40 bg-status-completed/30 px-1.5 py-0.5 text-[10px] font-mono text-status-completed-foreground hover:bg-status-completed/50",onClick:nt=>nt.stopPropagation(),children:[s.jsx(lm,{className:"h-2.5 w-2.5"}),Fe.linkedAssignmentRef.includes("/")?Fe.linkedAssignmentRef:`oneoff:${Fe.linkedAssignmentRef.slice(0,8)}`]}):null]}),s.jsx(_3,{item:Fe,attachmentUrl:(nt,_t)=>lw(Fe.workspace,nt,_t),onAdd:nt=>ot(Fe.workspace,Fe.id,nt),onDelete:nt=>St(Fe.workspace,Fe.id,nt)})]}),s.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:Fe.workspace!=="_global"&&s.jsx(_e,{to:`/w/${Fe.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:nt=>nt.stopPropagation(),children:Fe.workspace})}),N===Fe.id?s.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[s.jsx(Nr,{className:"h-3 w-3"})," Copied to clipboard"]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:nt=>M(nt,Fe.id),children:["t:",Fe.id]}),s.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:nt=>M(nt,Fe.id),children:s.jsx(hh,{className:"h-3 w-3"})})]}),s.jsx("button",{onClick:nt=>{nt.stopPropagation(),rt(Fe.workspace,Fe.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${Fe.workspace}-${Fe.id}`)})},ne.id)})})()}),s.jsx(S0,{open:_,selectedIds:Q.map(q=>q.id),scope:Ce,onOpenChange:z,onDone:ie,defaultProject:te,defaultTitle:ue,allowOneOff:!0})]})}const ice={open:{icon:"○",cls:"text-muted-foreground",label:"Open"},in_progress:{icon:"◉",cls:"text-status-in-progress-foreground",label:"In progress"},blocked:{icon:"✕",cls:"text-status-blocked-foreground",label:"Blocked"},completed:{icon:"✓",cls:"text-status-completed-foreground",label:"Completed"},mixed:{icon:"◐",cls:"text-muted-foreground",label:"Mixed"}};function ace({bundle:e}){const t=ice[e.derivedStatus.status],{counts:n}=e.derivedStatus;return s.jsxs("div",{className:"border rounded-md p-3 mb-2 bg-card",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:`text-lg leading-none ${t.cls}`,title:t.label,children:t.icon}),s.jsxs("span",{className:"font-mono text-sm text-muted-foreground",children:["b:",e.id]}),e.slug&&s.jsx("span",{className:"font-medium",children:e.slug}),s.jsxs("span",{className:"ml-auto text-sm text-muted-foreground",children:[n.completed,"/",n.total," done"]})]}),s.jsxs("div",{className:"mt-2 grid gap-1 text-sm",children:[e.branch&&s.jsxs("div",{className:"text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:"Branch:"})," ",s.jsx("code",{className:"font-mono",children:e.branch})]}),e.worktreePath&&s.jsxs("div",{className:"text-muted-foreground truncate",children:[s.jsx("span",{className:"font-medium",children:"Worktree:"})," ",s.jsx("code",{className:"font-mono",children:e.worktreePath})]}),e.planDir&&s.jsxs("div",{className:"text-muted-foreground truncate",children:[s.jsx("span",{className:"font-medium",children:"Plan:"})," ",s.jsx("code",{className:"font-mono",children:e.planDir})]})]}),s.jsx("ul",{className:"mt-2 ml-6 text-sm list-disc",children:e.members.map(r=>s.jsxs("li",{className:r.status==="completed"?"line-through text-muted-foreground":"",children:[s.jsxs("span",{className:"font-mono text-xs text-muted-foreground mr-2",children:["t:",r.id]}),r.description]},r.id))})]})}function lce({bundles:e,title:t="Bundles"}){return e.length===0?null:s.jsxs("section",{className:"mb-6",children:[s.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:[t," (",e.length,")"]}),e.map(n=>s.jsx(ace,{bundle:n},n.id))]})}function cce(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const u=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch bundles")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),Ei(u=>{u.type==="todos-updated"&&!u.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}function uce(){const{workspace:e}=Kt(),t=e||"_global",{data:n,loading:r,error:o,refetch:i}=AO(t),{toast:a,showToast:l,dismissToast:u}=Tn(),{data:f}=cce(t),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,v]=m.useState(""),[b,w]=m.useState(""),[S,N]=m.useState(null),[C,R]=m.useState(!1),[T,A]=m.useState(null),[I,_]=m.useState(null),[z,O]=m.useState(new Set),[B,V]=m.useState(!1),[$,L]=m.useState(!1),[U,K]=m.useState(null),D=m.useRef(null);Ai("list:todos");const W=T0("workspace:"+t),[M,F]=m.useState(null),[Y,H]=m.useState(null),Q=m.useRef(null);async function J(q,ne){q.stopPropagation(),await Jd(ne)&&(A(ne),setTimeout(()=>A(xe=>xe===ne?null:xe),1500))}const Z=m.useMemo(()=>{if(!(n!=null&&n.items))return[];const q=new Set;for(const ne of n.items)for(const xe of ne.tags)q.add(xe);return Array.from(q).sort()},[n]),oe=m.useMemo(()=>{if(!(n!=null&&n.items))return[];let q=n.items;if(p.trim()){const ne=p.toLowerCase();q=q.filter(xe=>xe.description.toLowerCase().includes(ne)||xe.tags.some(qe=>qe.toLowerCase().includes(ne))||xe.id.includes(ne))}return g&&(q=q.filter(ne=>ne.status===g)),k&&(q=q.filter(ne=>ne.tags.includes(k))),q},[n,p,g,k]);m.useEffect(()=>{O(new Set)},[p,g,k,t]);const te=m.useMemo(()=>oe.filter(q=>z.has(q.id)).length,[oe,z]),ue=oe.length>0&&te===oe.length,ge=te>0&&!ue;function Ce(q){O(ne=>{const xe=new Set(ne);return xe.has(q)?xe.delete(q):xe.add(q),xe})}function Se(){O(q=>{const ne=new Set(q);if(ue)for(const xe of oe)ne.delete(xe.id);else for(const xe of oe)ne.add(xe.id);return ne})}function ke(){O(new Set)}const Be=U?[U]:Array.from(z);function ie(){O(new Set),K(null),i()}function ve(){O(new Set),i()}function ye(q){l(q instanceof Error?q.message:"Action failed","error")}async function Ae(){if(b.trim())try{await aw(t,b.trim()),w(""),i()}catch(q){ye(q)}}function Ue(q,ne,xe){q.stopPropagation(),N({id:ne,description:xe})}async function rt(q,ne){try{switch(ne){case"open":await xT(t,q);break;case"in_progress":await gT(t,q);break;case"completed":await hT(t,q);break;case"blocked":await mT(t,q);break}i()}catch(xe){ye(xe)}}async function Oe(q,ne){try{await bT(t,q,ne),i()}catch(xe){throw ye(xe),xe}}async function ot(q,ne){try{await vT(t,q,ne),i()}catch(xe){ye(xe)}}async function St(q,ne){try{await wT(t,q,ne),i()}catch(xe){ye(xe)}}const ht=E0(oe),it=ht.filter(q=>!W.isCollapsed(q.config.id)).flatMap(q=>q.items),{hotkeyRowProps:ce}=Ud(it,{scope:"list:todos",bindO:!1,onOpen:q=>_(q.id)});en({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var q;return(q=D.current)==null?void 0:q.focus()}}),en({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>i()});const[me,Ie]=Rs(),Pe=me.get("focus");m.useEffect(()=>{if(!Pe||!(n!=null&&n.items))return;const q=n.items.find(xe=>xe.id===Pe);if(!q)return;const ne=eg(q.status);W.isCollapsed(ne)&&W.toggle(ne)},[Pe,n==null?void 0:n.items]),m.useEffect(()=>{if(!Pe)return;const q=document.querySelector(`[data-todo-id="${window.CSS.escape(Pe)}"]`);if(!q)return;q.scrollIntoView({block:"nearest"}),q.classList.add("ring-2","ring-primary/60");const ne=window.setTimeout(()=>{q.classList.remove("ring-2","ring-primary/60"),Ie(xe=>{const qe=new URLSearchParams(xe);return qe.delete("focus"),qe})},1500);return()=>window.clearTimeout(ne)},[Pe,it.length,Ie]);const We=M?(n==null?void 0:n.items.find(q=>q.id===M))??null:null;function pt(q,ne){const xe=Q.current;if(xe!=null&&xe.closest(ic)){q.preventDefault();return}q.dataTransfer.effectAllowed="move",q.dataTransfer.setData("text/plain",ne),F(ne)}function De(){F(null),H(null)}function Qe(q,ne){!We||ne.statuses.includes(We.status)||(q.preventDefault(),q.dataTransfer.dropEffect="move",H(ne.id))}function Je(q,ne){Y===ne.id&&!q.currentTarget.contains(q.relatedTarget)&&H(null)}function ut(q,ne){q.preventDefault();const xe=We;De(),!(!xe||ne.statuses.includes(xe.status))&&rt(xe.id,ne.dropStatus)}if(r)return s.jsx(bt,{label:"Loading todos..."});if(o)return s.jsx(Rt,{error:o});const fe=(n==null?void 0:n.counts)||{open:0,in_progress:0,blocked:0,total:0};return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Nn,{toast:a,onDismiss:u}),s.jsx(os,{open:S!==null,title:"Delete todo?",description:`Delete "${(S==null?void 0:S.description)??""}"? This can't be undone.`,confirmLabel:"Delete",destructive:!0,loading:C,onOpenChange:q=>{!q&&!C&&N(null)},onConfirm:async()=>{if(S){R(!0);try{await yT(t,S.id),i(),N(null)}catch(q){ye(q)}finally{R(!1)}}}}),s.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(Yn,{label:"Open",value:fe.open,icon:ys}),s.jsx(Yn,{label:"In Progress",value:fe.in_progress,icon:ys,tone:"info"}),s.jsx(Yn,{label:"Blocked",value:fe.blocked,icon:kc,tone:"warn"}),s.jsx(Yn,{label:"Total",value:fe.total,icon:ys})]}),f&&s.jsx(lce,{bundles:f.bundles}),s.jsx("div",{className:"surface-panel p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",placeholder:"Add a todo...",value:b,onChange:q=>w(q.target.value),onKeyDown:q=>q.key==="Enter"&&Ae(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),s.jsxs("button",{onClick:Ae,disabled:!b.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[s.jsx(Tt,{className:"h-4 w-4"}),"Add"]})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative flex-1 max-w-sm",children:[s.jsx(Ci,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:D,type:"text",placeholder:"Search...",value:p,onChange:q=>h(q.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs("select",{value:g,onChange:q=>y(q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All statuses"}),s.jsx("option",{value:"open",children:"Open"}),s.jsx("option",{value:"in_progress",children:"In Progress"}),s.jsx("option",{value:"completed",children:"Completed"}),s.jsx("option",{value:"blocked",children:"Blocked"})]}),Z.length>0&&s.jsxs("select",{value:k,onChange:q=>v(q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All tags"}),Z.map(q=>s.jsxs("option",{value:q,children:["#",q]},q))]})]}),z.size>0?s.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[s.jsxs("span",{className:"text-sm font-medium",children:[z.size," selected"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>V(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),s.jsx("button",{type:"button",onClick:()=>{K(null),L(!0)},className:"shell-action",children:"Move to…"}),s.jsx("button",{type:"button",onClick:ke,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,oe.length>0&&s.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:ue,ref:q=>{q&&(q.indeterminate=ge)},onChange:Se,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",oe.length,")"]})]}),s.jsx("div",{className:"space-y-3",children:(()=>{let q=-1;return ht.map(({config:ne,items:xe})=>{const qe=!W.isCollapsed(ne.id);return s.jsx(C0,{label:ne.label,count:xe.length,expanded:qe,onToggle:()=>W.toggle(ne.id),isDropTarget:Y===ne.id,onDragOver:Fe=>Qe(Fe,ne),onDragLeave:Fe=>Je(Fe,ne),onDrop:Fe=>ut(Fe,ne),children:qe&&xe.map(Fe=>(q+=1,s.jsx(A3,{item:Fe,copiedId:T,selected:z.has(Fe.id),editing:I===Fe.id,onBeginEdit:lt=>_(lt),onEndEdit:()=>_(null),onPatchDescription:Oe,onAddAttachments:ot,onDeleteAttachment:St,attachmentUrl:(lt,mt)=>lw(t,lt,mt),onToggleSelected:lt=>Ce(lt),onMoveOne:(lt,mt)=>{mt.stopPropagation(),K(lt),L(!0)},onStatusChange:rt,onCopyId:J,onDelete:Ue,hotkeyRowProps:ce(q),onDragOrigin:lt=>{Q.current=lt.target},onDragStart:pt,onDragEnd:De,isDragging:M===Fe.id},Fe.id)))},ne.id)})})()}),s.jsx(S0,{open:B,selectedIds:Array.from(z),scope:{kind:"workspace",workspace:t},onOpenChange:V,onDone:ve}),s.jsx($3,{open:$,selectedIds:Be,scope:{kind:"workspace",workspace:t},onOpenChange:q=>{L(q),q||K(null)},onDone:ie})]})}function K$(){const{views:e}=qd();async function t(i,a,l){const u=e.find(h=>h.id===i.id)??i,f=xP(l,u.workspace).config,p=Dh(u.config,f,u.config);await Eh(i.id,{name:a,config:p})}async function n(i,a,l){const u=e.find(h=>h.id===i.id)??i,f=s0(l,u.workspace).config,p=Dh(u.config,f,u.config);await Eh(i.id,{name:a,config:p})}async function r(i){await rc({name:`${i.name} (copy)`,workspace:i.workspace,config:i.config,entityType:i.entityType})}async function o(i){await V7(i.id)}return{submitEdit:t,submitEditSession:n,duplicate:r,remove:o}}const t2=80,dce={kanban:"Kanban",list:"List",table:"Table"},fce={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function q$({open:e,onOpenChange:t,workspace:n,initialView:r,onSubmit:o}){const i=!!r,a=rs(),l=Bd(),{data:u}=oo(),{data:f}=fm(),[p,h]=m.useState(""),[g,y]=m.useState(bl.viewMode),[k,v]=m.useState([]),[b,w]=m.useState([]),[S,N]=m.useState([]),[C,R]=m.useState([]),[T,A]=m.useState([]),[I,_]=m.useState([]),[z,O]=m.useState("all"),[B,V]=m.useState(null),[$,L]=m.useState(""),[U,K]=m.useState(bl.sortField),[D,W]=m.useState(bl.sortDirection),[M,F]=m.useState(!1),[Y,H]=m.useState(null);function Q(){y(bl.viewMode),v([]),w([]),N([]),R([]),A([]),_([]),O("all"),V(null),L(""),K(bl.sortField),W(bl.sortDirection)}m.useEffect(()=>{if(e)if(H(null),F(!1),r){const ie=r.config.filters;h(r.name),y(r.config.viewMode),v(He(ie.status)),w(He(ie.priority)),N(He(ie.type)),R(He(ie.project)),A(He(ie.assignee)),_(He(ie.tags)),O(ie.activity??"all"),V(Km(ie.dateRange)),L(ie.search??""),K(r.config.sortField),W(r.config.sortDirection)}else h(""),Q()},[e,r]);const J=ie=>ve=>ie?ie==="_ungrouped"?ve.projectWorkspace===null:ve.projectWorkspace===ie:!0,Z=m.useMemo(()=>{const ie=ye=>n?n==="_ungrouped"?ye.workspace===null:ye.workspace===n:!0,ve=(u??[]).filter(ie);return[{value:"__standalone__",label:"No project"},...ve.map(ye=>({value:ye.slug,label:ye.title}))]},[u,n]),oe=m.useMemo(()=>{const ie=new Set,ve=J(n);for(const Ae of(f==null?void 0:f.assignments)??[])ve(Ae)&&Ae.assignee&&ie.add(Ae.assignee);const ye=[{value:"__unassigned__",label:"Unassigned"}];for(const Ae of Array.from(ie).sort())ye.push({value:Ae,label:Ae});return ye},[f,n]),te=m.useMemo(()=>{const ie=new Set,ve=J(n);for(const ye of(f==null?void 0:f.assignments)??[])if(ve(ye))for(const Ae of ye.tags??[])ie.add(Ae);return Array.from(ie).sort().map(ye=>({value:ye,label:ye}))},[f,n]),ue=m.useMemo(()=>a.order.map(ie=>({value:ie,label:es(a,ie)})),[a]),ge=m.useMemo(()=>_H.map(ie=>({value:ie,label:ie[0].toUpperCase()+ie.slice(1)})),[]),Ce=m.useMemo(()=>l.definitions.map(ie=>({value:ie.id,label:Hl(l,ie.id)})),[l]),Se=Nw.map(ie=>({value:ie,label:dce[ie]})),ke=p.trim(),Be=ke.length>0&&ke.length<=t2;return s.jsx(On,{open:e,onOpenChange:t,children:s.jsx(Cn,{className:"max-w-lg",children:s.jsxs("form",{className:"space-y-4",onSubmit:async ie=>{if(ie.preventDefault(),!Be||M)return;F(!0),H(null);const ve={viewMode:g,filters:{status:k,priority:b,type:S,project:C,assignee:T,tags:I,activity:z,dateRange:xa(B),search:$},sortField:U,sortDirection:D};try{await o(ke,ve)}catch(ye){H(ye instanceof Error?ye.message:String(ye)),F(!1)}},children:[s.jsx(sr,{children:s.jsx(En,{children:i?"Edit view":"Create view"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-view-name",children:"Name"}),s.jsx("input",{id:"create-view-name",type:"text",value:p,autoFocus:!0,required:!0,maxLength:t2,onChange:ie=>h(ie.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"View mode"}),s.jsx(Gm,{value:g,onChange:ie=>y(ie),options:Se})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(Vs,{label:"Status",children:s.jsx(kn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:ue,value:k,onChange:v})}),s.jsx(Vs,{label:"Priority",children:s.jsx(kn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:ge,value:b,onChange:w})}),s.jsx(Vs,{label:"Type",children:s.jsx(kn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:Ce,value:S,onChange:N})}),s.jsx(Vs,{label:"Project",children:s.jsx(kn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:Z,value:C,onChange:R})}),s.jsx(Vs,{label:"Assignee",children:s.jsx(kn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:oe,value:T,onChange:A})}),s.jsx(Vs,{label:"Tags",children:s.jsx(kn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:te,value:I,onChange:_})}),s.jsx(Vs,{label:"Activity",children:s.jsxs("select",{value:z,onChange:ie=>O(ie.target.value),className:"editor-input w-full",children:[s.jsx("option",{value:"all",children:"All activity"}),s.jsx("option",{value:"stale",children:"Stale only"}),s.jsx("option",{value:"fresh",children:"Fresh only"})]})}),s.jsx(Vs,{label:"Date range",children:s.jsx(Wm,{className:"w-full",value:B,onChange:V})}),s.jsx(Vs,{label:"Search",className:"sm:col-span-2",children:s.jsx("input",{type:"text",value:$,onChange:ie=>L(ie.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),s.jsx(Vs,{label:"Sort by",className:"sm:col-span-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{value:U,onChange:ie=>K(ie.target.value),className:"editor-input w-full",children:aR.map(ie=>s.jsx("option",{value:ie,children:fce[ie]??ie},ie))}),s.jsx("button",{type:"button",onClick:()=>W(ie=>ie==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:D==="asc"?"Ascending":"Descending",children:D==="asc"?"Asc":"Desc"})]})})]}),Y?s.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:Y}):null,s.jsxs(Hr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:Q,className:"shell-action",disabled:M,children:"Clear all"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:M,children:"Cancel"}),s.jsx("button",{type:"submit",disabled:!Be||M,className:"shell-action shell-action--cta disabled:opacity-50",children:M?"Saving…":i?"Save changes":"Create view"})]})]})]})})})}function Vs({label:e,className:t,children:n}){return s.jsxs("label",{className:`space-y-1 ${t??""}`,children:[s.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const pce={kanban:"Kanban",list:"List",table:"Table"},hce={assignment:"Assignment",session:"Session"},mce={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function n2(){const{workspace:e}=Kt(),{views:t,loading:n}=qd(),{submitEdit:r,submitEditSession:o,duplicate:i,remove:a}=K$(),{toast:l,showToast:u,dismissToast:f}=Tn(),[p,h]=m.useState(null),[g,y]=m.useState(!1),[k,v]=m.useState(!1),[b,w]=m.useState(!1),[S,N]=m.useState(null);async function C(V,$){const{workspace:L,config:U}=xP($,e??null);try{await rc({name:V,workspace:L,config:U}),v(!1),u(`Created view "${V}"`)}catch(K){throw u(K instanceof Error?K.message:"Failed to create saved view"),K}}async function R(V,$){const{workspace:L,config:U}=s0($,e??null);try{await rc({name:V,workspace:L,config:U,entityType:"session"}),w(!1),u(`Created session view "${V}"`)}catch(K){throw u(K instanceof Error?K.message:"Failed to create session view"),K}}async function T(V,$,L){try{await r(V,$,L),N(null),u(`Updated view "${$}"`)}catch(U){throw u(U instanceof Error?U.message:"Failed to update saved view"),U}}async function A(V,$,L){try{await o(V,$,L),N(null),u(`Updated session view "${$}"`)}catch(U){throw u(U instanceof Error?U.message:"Failed to update session view"),U}}async function I(V){try{await i(V),u(`Duplicated "${V.name}"`)}catch($){u($ instanceof Error?$.message:"Failed to duplicate saved view")}}async function _(){if(p){y(!0);try{await a(p),h(null)}catch(V){u(V instanceof Error?V.message:"Failed to delete saved view")}finally{y(!1)}}}const z=s.jsxs("button",{type:"button",onClick:()=>v(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[s.jsx(Tt,{className:"h-4 w-4"}),"Create view"]}),O=s.jsxs("button",{type:"button",onClick:()=>w(!0),className:"shell-action inline-flex items-center gap-1.5",children:[s.jsx(Tt,{className:"h-4 w-4"}),"Create session view"]}),B=(S==null?void 0:S.entityType)==="session";return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Lh,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:s.jsxs("div",{className:"flex items-center gap-2",children:[O,z]})}),n?s.jsx(bt,{label:"Loading saved views…"}):t.length===0?s.jsx(Nt,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:s.jsxs("div",{className:"flex items-center gap-2",children:[O,z]})}):s.jsx(Ve,{children:s.jsx("ul",{className:"divide-y divide-border/60",children:t.map(V=>s.jsx(gce,{view:V,onRequestDelete:()=>h(V),onRequestEdit:()=>N(V),onRequestDuplicate:()=>void I(V)},V.id))})}),s.jsx(q$,{open:k||!B&&S!==null,onOpenChange:V=>{V||(v(!1),B||N(null))},workspace:S&&!B?S.workspace:e??null,initialView:S&&!B?S:null,onSubmit:S&&!B?(V,$)=>T(S,V,$):C}),s.jsx(jP,{open:b||B&&S!==null,onOpenChange:V=>{V||(w(!1),B&&N(null))},workspace:S&&B?S.workspace:e??null,initialView:S&&B?S:null,onSubmit:S&&B?(V,$)=>A(S,V,$):R}),s.jsx(os,{open:p!==null,title:"Delete saved view?",description:p?`Delete '${p.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:g,destructive:!0,onConfirm:_,onOpenChange:V=>{!V&&!g&&h(null)}}),s.jsx(Nn,{toast:l,onDismiss:f})]})}function gce({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:r}){const o=Wt(),i=()=>o(bP(e)),a=wP(e.config.filters),l=e.workspace?gn(e.workspace):null,u=e.entityType??"assignment",f=u==="session",p=f?`limit: ${e.config.limit??"none"} · sort: ${e.config.sortField} ${e.config.sortDirection}`:null;return s.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:i,className:"truncate text-left text-sm font-semibold text-foreground hover:text-primary",title:"Open view",children:e.name}),s.jsx("span",{className:`inline-flex shrink-0 items-center rounded-full border border-border/70 px-2 py-0.5 text-xs font-medium ${mce[u]??"bg-muted text-muted-foreground"}`,children:hce[u]??u}),!f&&s.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:pce[e.config.viewMode]}),l?s.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:l}):null]}),s.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[a,p?` · ${p}`:""]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsx("button",{type:"button",onClick:i,className:"shell-action",children:"Open"}),s.jsx("button",{type:"button",onClick:n,className:"shell-action",children:"Edit"}),s.jsx("button",{type:"button",onClick:r,className:"shell-action",children:"Duplicate"}),s.jsx("button",{type:"button",onClick:t,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}const xce={kanban:"Kanban",list:"List",table:"Table"};function r2(){const{id:e,workspace:t}=Kt(),n=Wt(),{view:r,ready:o,error:i,refetch:a}=ki(e),{submitEdit:l,duplicate:u,remove:f}=K$(),{toast:p,showToast:h,dismissToast:g}=Tn(),[y,k]=m.useState(!1),[v,b]=m.useState(!1),[w,S]=m.useState(!1);if(m.useEffect(()=>{!o||!r||(t??null)!==(r.workspace??null)&&n(bP(r),{replace:!0})},[o,r,t,n]),!o)return s.jsx(bt,{label:"Loading view…"});if(i)return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-6 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i.message}),s.jsx("button",{type:"button",onClick:()=>a(),className:"shell-action mt-3",children:"Retry"})]});if(!r)return s.jsxs("div",{className:"space-y-3",children:[s.jsx(Lh,{title:"View not found",description:"This saved view no longer exists."}),s.jsxs(_e,{to:Zp(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[s.jsx(dh,{className:"h-4 w-4"})," Back to Saved Views"]})]});const N=r.workspace?gn(r.workspace):null;async function C(A,I){const _=r;try{await l(_,A,I),k(!1),h(`Updated view "${A}"`)}catch(z){throw h(z instanceof Error?z.message:"Failed to update saved view"),z}}async function R(){const A=r;try{await u(A),h(`Duplicated "${A.name}"`)}catch(I){h(I instanceof Error?I.message:"Failed to duplicate saved view")}}async function T(){const A=r;S(!0);try{await f(A),b(!1),n(Zp(A.workspace))}catch(I){h(I instanceof Error?I.message:"Failed to delete saved view")}finally{S(!1)}}return s.jsxs("div",{className:"space-y-4",children:[s.jsxs(_e,{to:Zp(r.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[s.jsx(dh,{className:"h-4 w-4"})," Saved Views"]}),s.jsx(Lh,{title:r.name,description:wP(r.config.filters),actions:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:xce[r.config.viewMode]}),N?s.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:N}):null,s.jsx("button",{type:"button",onClick:()=>k(!0),className:"shell-action",children:"Edit"}),s.jsx("button",{type:"button",onClick:()=>void R(),className:"shell-action",children:"Duplicate"}),s.jsx("button",{type:"button",onClick:()=>n(vP(r)),className:"shell-action",children:"Open on board"}),s.jsx("button",{type:"button",onClick:()=>b(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),s.jsx(mP,{view:r}),y?s.jsx(q$,{open:y,onOpenChange:k,workspace:r.workspace,initialView:r,onSubmit:C}):null,s.jsx(os,{open:v,title:"Delete saved view?",description:`Delete '${r.name}'? Any Overview widgets referencing this view will become empty.`,confirmLabel:"Delete",loading:w,destructive:!0,onConfirm:T,onOpenChange:A=>{!A&&!w&&b(!1)}}),s.jsx(Nn,{toast:p,onDismiss:g})]})}function yce(){return s.jsx(n5,{children:s.jsx(n8,{children:s.jsx(PL,{children:s.jsxs(Ge,{element:s.jsx(K8,{}),children:[s.jsx(Ge,{path:"/",element:s.jsx(oV,{})}),s.jsx(Ge,{path:"/inbox",element:s.jsx(fV,{})}),s.jsx(Ge,{path:"/projects",element:s.jsx(rS,{})}),s.jsx(Ge,{path:"/archive",element:s.jsx(_V,{})}),s.jsx(Ge,{path:"/assignments",element:s.jsx(hC,{})}),s.jsx(Ge,{path:"/assignments/new",element:s.jsx(yC,{})}),s.jsx(Ge,{path:"/assignments/:id",element:s.jsx(RX,{})}),s.jsx(Ge,{path:"/assignments/:id/edit",element:s.jsx(Xy,{})}),s.jsx(Ge,{path:"/assignments/:id/plan/edit",element:s.jsx(Qy,{})}),s.jsx(Ge,{path:"/assignments/:id/scratchpad/edit",element:s.jsx(Jy,{})}),s.jsx(Ge,{path:"/assignments/:id/handoff/edit",element:s.jsx(Zy,{})}),s.jsx(Ge,{path:"/assignments/:id/decision-record/edit",element:s.jsx(eb,{})}),s.jsx(Ge,{path:"/servers",element:s.jsx(vC,{})}),s.jsx(Ge,{path:"/inventories",element:s.jsx(wC,{})}),s.jsx(Ge,{path:"/schedules",element:s.jsx(wQ,{})}),s.jsx(Ge,{path:"/usage",element:s.jsx(jC,{})}),s.jsx(Ge,{path:"/agent-sessions",element:s.jsx(kC,{})}),s.jsx(Ge,{path:"/playbooks",element:s.jsx(CQ,{})}),s.jsx(Ge,{path:"/playbooks/create",element:s.jsx(TQ,{})}),s.jsx(Ge,{path:"/playbooks/:slug",element:s.jsx(EQ,{})}),s.jsx(Ge,{path:"/playbooks/:slug/edit",element:s.jsx(RQ,{})}),s.jsx(Ge,{path:"/memories",element:s.jsx(AQ,{})}),s.jsx(Ge,{path:"/memories/new",element:s.jsx(_Q,{})}),s.jsx(Ge,{path:"/projects/:slug/memories/:itemSlug",element:s.jsx(PQ,{})}),s.jsx(Ge,{path:"/projects/:slug/memories/:itemSlug/edit",element:s.jsx(DQ,{})}),s.jsx(Ge,{path:"/resources",element:s.jsx($Q,{})}),s.jsx(Ge,{path:"/resources/new",element:s.jsx(MQ,{})}),s.jsx(Ge,{path:"/projects/:slug/resources/:itemSlug",element:s.jsx(IQ,{})}),s.jsx(Ge,{path:"/projects/:slug/resources/:itemSlug/edit",element:s.jsx(LQ,{})}),s.jsx(Ge,{path:"/todos",element:s.jsx(oce,{})}),s.jsx(Ge,{path:"/views",element:s.jsx(n2,{})}),s.jsx(Ge,{path:"/views/:id",element:s.jsx(r2,{})}),s.jsx(Ge,{path:"/help",element:s.jsx(vV,{})}),s.jsx(Ge,{path:"/settings",element:s.jsx(hJ,{})}),s.jsx(Ge,{path:"/agents",element:s.jsx(CC,{})}),s.jsx(Ge,{path:"/workflow",element:s.jsx(sce,{})}),s.jsx(Ge,{path:"/create/project",element:s.jsx(gC,{})}),s.jsx(Ge,{path:"/projects/:slug",element:s.jsx(sC,{})}),s.jsx(Ge,{path:"/projects/:slug/edit",element:s.jsx(bC,{})}),s.jsx(Ge,{path:"/projects/:slug/create/assignment",element:s.jsx(xC,{})}),s.jsx(Ge,{path:"/projects/:slug/assignments/:aslug",element:s.jsx(cC,{})}),s.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/edit",element:s.jsx(Xy,{})}),s.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:s.jsx(Qy,{})}),s.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:s.jsx(Jy,{})}),s.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:s.jsx(Zy,{})}),s.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:s.jsx(eb,{})}),s.jsx(Ge,{path:"/w/:workspace/projects",element:s.jsx(rS,{})}),s.jsx(Ge,{path:"/w/:workspace/assignments",element:s.jsx(hC,{})}),s.jsx(Ge,{path:"/w/:workspace/assignments/new",element:s.jsx(yC,{})}),s.jsx(Ge,{path:"/w/:workspace/servers",element:s.jsx(vC,{})}),s.jsx(Ge,{path:"/w/:workspace/inventories",element:s.jsx(wC,{})}),s.jsx(Ge,{path:"/w/:workspace/usage",element:s.jsx(jC,{})}),s.jsx(Ge,{path:"/w/:workspace/agent-sessions",element:s.jsx(kC,{})}),s.jsx(Ge,{path:"/w/:workspace/agents",element:s.jsx(CC,{})}),s.jsx(Ge,{path:"/w/:workspace/todos",element:s.jsx(uce,{})}),s.jsx(Ge,{path:"/w/:workspace/views",element:s.jsx(n2,{})}),s.jsx(Ge,{path:"/w/:workspace/views/:id",element:s.jsx(r2,{})}),s.jsx(Ge,{path:"/w/:workspace/create/project",element:s.jsx(gC,{})}),s.jsx(Ge,{path:"/w/:workspace/projects/:slug",element:s.jsx(sC,{})}),s.jsx(Ge,{path:"/w/:workspace/projects/:slug/edit",element:s.jsx(bC,{})}),s.jsx(Ge,{path:"/w/:workspace/projects/:slug/create/assignment",element:s.jsx(xC,{})}),s.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:s.jsx(cC,{})}),s.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:s.jsx(Xy,{})}),s.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:s.jsx(Qy,{})}),s.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:s.jsx(Jy,{})}),s.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:s.jsx(Zy,{})}),s.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:s.jsx(eb,{})})]})})})})}G4();PM.createRoot(document.getElementById("root")).render(s.jsx(m.StrictMode,{children:s.jsx(Y4,{children:s.jsx(yce,{})})}));export{rf as C,wr as R,rW as _,sd as a,vce as b,V0 as d,K_ as e,Dd as g,wce as h,qs as i,Y_ as n,nte as r,Fr as s};
|