syntaur 0.55.1 → 0.57.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-JSKTFkEa.js +1 -0
- package/dashboard/dist/assets/{_baseUniq-DdoY-meB.js → _baseUniq-B4THfRv6.js} +1 -1
- package/dashboard/dist/assets/arc-BT5oCPaC.js +1 -0
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-G7j98lj4.js → architectureDiagram-2XIMDMQ5-C0wRHwPD.js} +3 -3
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-ZufoK2Vf.js → blockDiagram-WCTKOSBZ-yMj3_K19.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-BD1q04gi.js → c4Diagram-IC4MRINW-6fr_jElW.js} +1 -1
- package/dashboard/dist/assets/channel-BZWZQgJF.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-laHJ5e6M.js → chunk-4BX2VUAB-BS0AdM9N.js} +1 -1
- package/dashboard/dist/assets/chunk-55IACEB6-Bf3cMgj4.js +1 -0
- package/dashboard/dist/assets/{chunk-FMBD7UC4-uYEErEfW.js → chunk-FMBD7UC4-BxhOy53m.js} +1 -1
- package/dashboard/dist/assets/chunk-JSJVCQXG-Da4w_8jA.js +1 -0
- package/dashboard/dist/assets/chunk-KX2RTZJC-p3BnTwvF.js +1 -0
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-eOKhRe70.js → chunk-NQ4KR5QH-DfvY-FfQ.js} +2 -2
- package/dashboard/dist/assets/{chunk-QZHKN3VN-BnAHYxL5.js → chunk-QZHKN3VN-BY_yeD01.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-AP91qlj3.js → chunk-WL4C6EOR-yQKlkPsr.js} +4 -4
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-obLZNHbe.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-obLZNHbe.js +1 -0
- package/dashboard/dist/assets/clone-gWuoHRfO.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-CBeQigsM.js → cose-bilkent-S5V4N54A-CDoLPu4r.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-Cgic159r.js → dagre-KLK3FWXG-BsEV2YI1.js} +2 -2
- package/dashboard/dist/assets/diagram-E7M64L7V-CF2uTCw-.js +24 -0
- package/dashboard/dist/assets/diagram-IFDJBPK2-CCbV7q-H.js +43 -0
- package/dashboard/dist/assets/{diagram-P4PSJMXO-DOvoIAgX.js → diagram-P4PSJMXO-C-hmCZ82.js} +2 -2
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-CKzsTtLZ.js → erDiagram-INFDFZHY-Bqmd6M31.js} +3 -3
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-DjJvVw0S.js → flowDiagram-PKNHOUZH-BoHMjR8s.js} +1 -1
- package/dashboard/dist/assets/ganttDiagram-A5KZAMGK-Bwi2K6t0.js +292 -0
- package/dashboard/dist/assets/gitGraphDiagram-K3NZZRJ6-BLg_41tI.js +65 -0
- package/dashboard/dist/assets/{graph-BARSMOR1.js → graph-D5SqATbG.js} +1 -1
- package/dashboard/dist/assets/index-BeL-DOH-.css +1 -0
- package/dashboard/dist/assets/index-CQaTQf_I.js +639 -0
- package/dashboard/dist/assets/infoDiagram-LFFYTUFH-MQGu_WQh.js +2 -0
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-Qbij3q8f.js → ishikawaDiagram-PHBUUO56-Cq2VOOGw.js} +5 -5
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-C88gUC3u.js → journeyDiagram-4ABVD52K-DMgBiVbw.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-BvtgZ4bH.js → kanban-definition-K7BYSVSG-CW553HfT.js} +7 -7
- package/dashboard/dist/assets/{layout-CP_h2sGj.js → layout-CY_IT3u3.js} +1 -1
- package/dashboard/dist/assets/linear-BwR3oULZ.js +1 -0
- package/dashboard/dist/assets/mermaid.core-CmEGzmWo.js +255 -0
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-DFE12FYM.js → mindmap-definition-YRQLILUH-D__wNWPY.js} +3 -3
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-CGEdJrr5.js → pieDiagram-SKSYHLDU-BsFl-giQ.js} +3 -3
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-D-kdhwoV.js → quadrantDiagram-337W2JSQ-C-F2YU1C.js} +4 -4
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-BBUDctiO.js → requirementDiagram-Z7DCOOCP-C0_TmWRh.js} +3 -3
- package/dashboard/dist/assets/sankeyDiagram-WA2Y5GQK-DpoaSHiD.js +10 -0
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-C4JCchCY.js → sequenceDiagram-2WXFIKYE-DBb9oieZ.js} +3 -3
- package/dashboard/dist/assets/stateDiagram-RAJIS63D-Cw5xaaAs.js +1 -0
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-BpeHnq6R.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-BgMghCXE.js → timeline-definition-YZTLITO2-rOhPVhqR.js} +4 -4
- package/dashboard/dist/assets/{treemap-KZPCXAKY-D5Nh6cA1.js → treemap-KZPCXAKY-CD-TOoiS.js} +1 -1
- package/dashboard/dist/assets/vennDiagram-LZ73GAT5-BH78k9Wk.js +34 -0
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-DZaLadME.js → xychartDiagram-JWTSCODW-1hqiJxk_.js} +3 -3
- package/dashboard/dist/index.html +2 -2
- package/dist/dashboard/server.js +290 -23
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +290 -23
- package/dist/index.js.map +1 -1
- package/dist/launch/index.d.ts +25 -0
- package/dist/launch/index.js +187 -1
- 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/_basePickBy-DIHDuMKZ.js +0 -1
- package/dashboard/dist/assets/arc-BQ0d8jWa.js +0 -1
- package/dashboard/dist/assets/channel-Cos6AwFg.js +0 -1
- package/dashboard/dist/assets/chunk-55IACEB6-vugHo86n.js +0 -1
- package/dashboard/dist/assets/chunk-JSJVCQXG-sONfVqmj.js +0 -1
- package/dashboard/dist/assets/chunk-KX2RTZJC-Cdp0hOuK.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-0nGn6D8t.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-0nGn6D8t.js +0 -1
- package/dashboard/dist/assets/clone-DfeUNde6.js +0 -1
- package/dashboard/dist/assets/diagram-E7M64L7V-7nkbIxvu.js +0 -24
- package/dashboard/dist/assets/diagram-IFDJBPK2-DvM5M3fg.js +0 -43
- package/dashboard/dist/assets/ganttDiagram-A5KZAMGK-BlKUEIDZ.js +0 -292
- package/dashboard/dist/assets/gitGraphDiagram-K3NZZRJ6-CD8uhQ3i.js +0 -65
- package/dashboard/dist/assets/index-BJ38AwFL.js +0 -602
- package/dashboard/dist/assets/index-BcoJBSvO.css +0 -1
- package/dashboard/dist/assets/infoDiagram-LFFYTUFH-B1fgVPe-.js +0 -2
- package/dashboard/dist/assets/linear-CJFguXhD.js +0 -1
- package/dashboard/dist/assets/mermaid.core-B_i0YYrl.js +0 -255
- package/dashboard/dist/assets/sankeyDiagram-WA2Y5GQK-BJz2scyH.js +0 -10
- package/dashboard/dist/assets/stateDiagram-RAJIS63D-CQyJ0pwB.js +0 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-B9MsrKVy.js +0 -1
- package/dashboard/dist/assets/vennDiagram-LZ73GAT5-xLpKzIkS.js +0 -34
|
@@ -0,0 +1,639 @@
|
|
|
1
|
+
var jI=Object.defineProperty;var kI=(e,t,n)=>t in e?jI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Rx=(e,t,n)=>kI(e,typeof t!="symbol"?t+"":t,n);function SI(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 bd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Yie(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 Ax={exports:{}},au={},Px={exports:{}},wt={};/**
|
|
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 Wk;function NI(){if(Wk)return wt;Wk=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"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.iterator;function g(V){return V===null||typeof V!="object"?null:(V=h&&V[h]||V["@@iterator"],typeof V=="function"?V:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,w={};function b(V,Y,q){this.props=V,this.context=Y,this.refs=w,this.updater=q||y}b.prototype.isReactComponent={},b.prototype.setState=function(V,Y){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,Y,"setState")},b.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function j(){}j.prototype=b.prototype;function N(V,Y,q){this.props=V,this.context=Y,this.refs=w,this.updater=q||y}var k=N.prototype=new j;k.constructor=N,S(k,b.prototype),k.isPureReactComponent=!0;var C=Array.isArray,I=Object.prototype.hasOwnProperty,T={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function D(V,Y,q){var J,ne={},Q=null,ce=null;if(Y!=null)for(J in Y.ref!==void 0&&(ce=Y.ref),Y.key!==void 0&&(Q=""+Y.key),Y)I.call(Y,J)&&!R.hasOwnProperty(J)&&(ne[J]=Y[J]);var te=arguments.length-2;if(te===1)ne.children=q;else if(1<te){for(var pe=Array(te),be=0;be<te;be++)pe[be]=arguments[be+2];ne.children=pe}if(V&&V.defaultProps)for(J in te=V.defaultProps,te)ne[J]===void 0&&(ne[J]=te[J]);return{$$typeof:e,type:V,key:Q,ref:ce,props:ne,_owner:T.current}}function $(V,Y){return{$$typeof:e,type:V.type,key:Y,ref:V.ref,props:V.props,_owner:V._owner}}function z(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function A(V){var Y={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(q){return Y[q]})}var F=/\/+/g;function W(V,Y){return typeof V=="object"&&V!==null&&V.key!=null?A(""+V.key):Y.toString(36)}function P(V,Y,q,J,ne){var Q=typeof V;(Q==="undefined"||Q==="boolean")&&(V=null);var ce=!1;if(V===null)ce=!0;else switch(Q){case"string":case"number":ce=!0;break;case"object":switch(V.$$typeof){case e:case t:ce=!0}}if(ce)return ce=V,ne=ne(ce),V=J===""?"."+W(ce,0):J,C(ne)?(q="",V!=null&&(q=V.replace(F,"$&/")+"/"),P(ne,Y,q,"",function(be){return be})):ne!=null&&(z(ne)&&(ne=$(ne,q+(!ne.key||ce&&ce.key===ne.key?"":(""+ne.key).replace(F,"$&/")+"/")+V)),Y.push(ne)),1;if(ce=0,J=J===""?".":J+":",C(V))for(var te=0;te<V.length;te++){Q=V[te];var pe=J+W(Q,te);ce+=P(Q,Y,q,pe,ne)}else if(pe=g(V),typeof pe=="function")for(V=pe.call(V),te=0;!(Q=V.next()).done;)Q=Q.value,pe=J+W(Q,te++),ce+=P(Q,Y,q,pe,ne);else if(Q==="object")throw Y=String(V),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return ce}function O(V,Y,q){if(V==null)return V;var J=[],ne=0;return P(V,J,"","",function(Q){return Y.call(q,Q,ne++)}),J}function B(V){if(V._status===-1){var Y=V._result;Y=Y(),Y.then(function(q){(V._status===0||V._status===-1)&&(V._status=1,V._result=q)},function(q){(V._status===0||V._status===-1)&&(V._status=2,V._result=q)}),V._status===-1&&(V._status=0,V._result=Y)}if(V._status===1)return V._result.default;throw V._result}var H={current:null},L={transition:null},U={ReactCurrentDispatcher:H,ReactCurrentBatchConfig:L,ReactCurrentOwner:T};function M(){throw Error("act(...) is not supported in production builds of React.")}return wt.Children={map:O,forEach:function(V,Y,q){O(V,function(){Y.apply(this,arguments)},q)},count:function(V){var Y=0;return O(V,function(){Y++}),Y},toArray:function(V){return O(V,function(Y){return Y})||[]},only:function(V){if(!z(V))throw Error("React.Children.only expected to receive a single React element child.");return V}},wt.Component=b,wt.Fragment=n,wt.Profiler=o,wt.PureComponent=N,wt.StrictMode=r,wt.Suspense=d,wt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U,wt.act=M,wt.cloneElement=function(V,Y,q){if(V==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+V+".");var J=S({},V.props),ne=V.key,Q=V.ref,ce=V._owner;if(Y!=null){if(Y.ref!==void 0&&(Q=Y.ref,ce=T.current),Y.key!==void 0&&(ne=""+Y.key),V.type&&V.type.defaultProps)var te=V.type.defaultProps;for(pe in Y)I.call(Y,pe)&&!R.hasOwnProperty(pe)&&(J[pe]=Y[pe]===void 0&&te!==void 0?te[pe]:Y[pe])}var pe=arguments.length-2;if(pe===1)J.children=q;else if(1<pe){te=Array(pe);for(var be=0;be<pe;be++)te[be]=arguments[be+2];J.children=te}return{$$typeof:e,type:V.type,key:ne,ref:Q,props:J,_owner:ce}},wt.createContext=function(V){return V={$$typeof:a,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},V.Provider={$$typeof:i,_context:V},V.Consumer=V},wt.createElement=D,wt.createFactory=function(V){var Y=D.bind(null,V);return Y.type=V,Y},wt.createRef=function(){return{current:null}},wt.forwardRef=function(V){return{$$typeof:l,render:V}},wt.isValidElement=z,wt.lazy=function(V){return{$$typeof:p,_payload:{_status:-1,_result:V},_init:B}},wt.memo=function(V,Y){return{$$typeof:f,type:V,compare:Y===void 0?null:Y}},wt.startTransition=function(V){var Y=L.transition;L.transition={};try{V()}finally{L.transition=Y}},wt.unstable_act=M,wt.useCallback=function(V,Y){return H.current.useCallback(V,Y)},wt.useContext=function(V){return H.current.useContext(V)},wt.useDebugValue=function(){},wt.useDeferredValue=function(V){return H.current.useDeferredValue(V)},wt.useEffect=function(V,Y){return H.current.useEffect(V,Y)},wt.useId=function(){return H.current.useId()},wt.useImperativeHandle=function(V,Y,q){return H.current.useImperativeHandle(V,Y,q)},wt.useInsertionEffect=function(V,Y){return H.current.useInsertionEffect(V,Y)},wt.useLayoutEffect=function(V,Y){return H.current.useLayoutEffect(V,Y)},wt.useMemo=function(V,Y){return H.current.useMemo(V,Y)},wt.useReducer=function(V,Y,q){return H.current.useReducer(V,Y,q)},wt.useRef=function(V){return H.current.useRef(V)},wt.useState=function(V){return H.current.useState(V)},wt.useSyncExternalStore=function(V,Y,q){return H.current.useSyncExternalStore(V,Y,q)},wt.useTransition=function(){return H.current.useTransition()},wt.version="18.3.1",wt}var qk;function vd(){return qk||(qk=1,Px.exports=NI()),Px.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 Kk;function CI(){if(Kk)return au;Kk=1;var e=vd(),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,d,f){var p,h={},g=null,y=null;f!==void 0&&(g=""+f),d.key!==void 0&&(g=""+d.key),d.ref!==void 0&&(y=d.ref);for(p in d)r.call(d,p)&&!i.hasOwnProperty(p)&&(h[p]=d[p]);if(l&&l.defaultProps)for(p in d=l.defaultProps,d)h[p]===void 0&&(h[p]=d[p]);return{$$typeof:t,type:l,key:g,ref:y,props:h,_owner:o.current}}return au.Fragment=n,au.jsx=a,au.jsxs=a,au}var Gk;function EI(){return Gk||(Gk=1,Ax.exports=CI()),Ax.exports}var s=EI(),m=vd();const $t=bd(m),bE=SI({__proto__:null,default:$t},[m]);var qf={},_x={exports:{}},dr={},Dx={exports:{}},$x={};/**
|
|
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 Yk;function TI(){return Yk||(Yk=1,(function(e){function t(L,U){var M=L.length;L.push(U);e:for(;0<M;){var V=M-1>>>1,Y=L[V];if(0<o(Y,U))L[V]=U,L[M]=Y,M=V;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var U=L[0],M=L.pop();if(M!==U){L[0]=M;e:for(var V=0,Y=L.length,q=Y>>>1;V<q;){var J=2*(V+1)-1,ne=L[J],Q=J+1,ce=L[Q];if(0>o(ne,M))Q<Y&&0>o(ce,ne)?(L[V]=ce,L[Q]=M,V=Q):(L[V]=ne,L[J]=M,V=J);else if(Q<Y&&0>o(ce,M))L[V]=ce,L[Q]=M,V=Q;else break e}}return U}function o(L,U){var M=L.sortIndex-U.sortIndex;return M!==0?M:L.id-U.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 d=[],f=[],p=1,h=null,g=3,y=!1,S=!1,w=!1,b=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(L){for(var U=n(f);U!==null;){if(U.callback===null)r(f);else if(U.startTime<=L)r(f),U.sortIndex=U.expirationTime,t(d,U);else break;U=n(f)}}function C(L){if(w=!1,k(L),!S)if(n(d)!==null)S=!0,B(I);else{var U=n(f);U!==null&&H(C,U.startTime-L)}}function I(L,U){S=!1,w&&(w=!1,j(D),D=-1),y=!0;var M=g;try{for(k(U),h=n(d);h!==null&&(!(h.expirationTime>U)||L&&!A());){var V=h.callback;if(typeof V=="function"){h.callback=null,g=h.priorityLevel;var Y=V(h.expirationTime<=U);U=e.unstable_now(),typeof Y=="function"?h.callback=Y:h===n(d)&&r(d),k(U)}else r(d);h=n(d)}if(h!==null)var q=!0;else{var J=n(f);J!==null&&H(C,J.startTime-U),q=!1}return q}finally{h=null,g=M,y=!1}}var T=!1,R=null,D=-1,$=5,z=-1;function A(){return!(e.unstable_now()-z<$)}function F(){if(R!==null){var L=e.unstable_now();z=L;var U=!0;try{U=R(!0,L)}finally{U?W():(T=!1,R=null)}}else T=!1}var W;if(typeof N=="function")W=function(){N(F)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,O=P.port2;P.port1.onmessage=F,W=function(){O.postMessage(null)}}else W=function(){b(F,0)};function B(L){R=L,T||(T=!0,W())}function H(L,U){D=b(function(){L(e.unstable_now())},U)}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(L){L.callback=null},e.unstable_continueExecution=function(){S||y||(S=!0,B(I))},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(L){switch(g){case 1:case 2:case 3:var U=3;break;default:U=g}var M=g;g=U;try{return L()}finally{g=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(L,U){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var M=g;g=L;try{return U()}finally{g=M}},e.unstable_scheduleCallback=function(L,U,M){var V=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?V+M:V):M=V,L){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,L={id:p++,callback:U,priorityLevel:L,startTime:M,expirationTime:Y,sortIndex:-1},M>V?(L.sortIndex=M,t(f,L),n(d)===null&&L===n(f)&&(w?(j(D),D=-1):w=!0,H(C,M-V))):(L.sortIndex=Y,t(d,L),S||y||(S=!0,B(I))),L},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(L){var U=g;return function(){var M=g;g=U;try{return L.apply(this,arguments)}finally{g=M}}}})($x)),$x}var Xk;function RI(){return Xk||(Xk=1,Dx.exports=TI()),Dx.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 Qk;function AI(){if(Qk)return dr;Qk=1;var e=vd(),t=RI();function n(c){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+c,x=1;x<arguments.length;x++)u+="&args[]="+encodeURIComponent(arguments[x]);return"Minified React error #"+c+"; visit "+u+" 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,u){a(c,u),a(c+"Capture",u)}function a(c,u){for(o[c]=u,c=0;c<u.length;c++)r.add(u[c])}var l=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=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 d.call(h,c)?!0:d.call(p,c)?!1:f.test(c)?h[c]=!0:(p[c]=!0,!1)}function y(c,u,x,v){if(x!==null&&x.type===0)return!1;switch(typeof u){case"function":case"symbol":return!0;case"boolean":return v?!1:x!==null?!x.acceptsBooleans:(c=c.toLowerCase().slice(0,5),c!=="data-"&&c!=="aria-");default:return!1}}function S(c,u,x,v){if(u===null||typeof u>"u"||y(c,u,x,v))return!0;if(v)return!1;if(x!==null)switch(x.type){case 3:return!u;case 4:return u===!1;case 5:return isNaN(u);case 6:return isNaN(u)||1>u}return!1}function w(c,u,x,v,E,_,K){this.acceptsBooleans=u===2||u===3||u===4,this.attributeName=v,this.attributeNamespace=E,this.mustUseProperty=x,this.propertyName=c,this.type=u,this.sanitizeURL=_,this.removeEmptyString=K}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(c){b[c]=new w(c,0,!1,c,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(c){var u=c[0];b[u]=new w(u,1,!1,c[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(c){b[c]=new w(c,2,!1,c.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(c){b[c]=new w(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 w(c,3,!1,c.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(c){b[c]=new w(c,3,!0,c,null,!1,!1)}),["capture","download"].forEach(function(c){b[c]=new w(c,4,!1,c,null,!1,!1)}),["cols","rows","size","span"].forEach(function(c){b[c]=new w(c,6,!1,c,null,!1,!1)}),["rowSpan","start"].forEach(function(c){b[c]=new w(c,5,!1,c.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function N(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 u=c.replace(j,N);b[u]=new w(u,1,!1,c,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(c){var u=c.replace(j,N);b[u]=new w(u,1,!1,c,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(c){var u=c.replace(j,N);b[u]=new w(u,1,!1,c,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(c){b[c]=new w(c,1,!1,c.toLowerCase(),null,!1,!1)}),b.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(c){b[c]=new w(c,1,!1,c.toLowerCase(),null,!0,!0)});function k(c,u,x,v){var E=b.hasOwnProperty(u)?b[u]:null;(E!==null?E.type!==0:v||!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(S(u,x,E,v)&&(x=null),v||E===null?g(u)&&(x===null?c.removeAttribute(u):c.setAttribute(u,""+x)):E.mustUseProperty?c[E.propertyName]=x===null?E.type===3?!1:"":x:(u=E.attributeName,v=E.attributeNamespace,x===null?c.removeAttribute(u):(E=E.type,x=E===3||E===4&&x===!0?"":""+x,v?c.setAttributeNS(v,u,x):c.setAttribute(u,x))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),T=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),A=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),H=Symbol.for("react.offscreen"),L=Symbol.iterator;function U(c){return c===null||typeof c!="object"?null:(c=L&&c[L]||c["@@iterator"],typeof c=="function"?c:null)}var M=Object.assign,V;function Y(c){if(V===void 0)try{throw Error()}catch(x){var u=x.stack.trim().match(/\n( *(at )?)/);V=u&&u[1]||""}return`
|
|
34
|
+
`+V+c}var q=!1;function J(c,u){if(!c||q)return"";q=!0;var x=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(xe){var v=xe}Reflect.construct(c,[],u)}else{try{u.call()}catch(xe){v=xe}c.call(u.prototype)}else{try{throw Error()}catch(xe){v=xe}c()}}catch(xe){if(xe&&v&&typeof xe.stack=="string"){for(var E=xe.stack.split(`
|
|
35
|
+
`),_=v.stack.split(`
|
|
36
|
+
`),K=E.length-1,X=_.length-1;1<=K&&0<=X&&E[K]!==_[X];)X--;for(;1<=K&&0<=X;K--,X--)if(E[K]!==_[X]){if(K!==1||X!==1)do if(K--,X--,0>X||E[K]!==_[X]){var re=`
|
|
37
|
+
`+E[K].replace(" at new "," at ");return c.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",c.displayName)),re}while(1<=K&&0<=X);break}}}finally{q=!1,Error.prepareStackTrace=x}return(c=c?c.displayName||c.name:"")?Y(c):""}function ne(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=J(c.type,!1),c;case 11:return c=J(c.type.render,!1),c;case 1:return c=J(c.type,!0),c;default:return""}}function Q(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 R:return"Fragment";case T:return"Portal";case $:return"Profiler";case D:return"StrictMode";case W:return"Suspense";case P:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case A:return(c.displayName||"Context")+".Consumer";case z:return(c._context.displayName||"Context")+".Provider";case F:var u=c.render;return c=c.displayName,c||(c=u.displayName||u.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case O:return u=c.displayName||null,u!==null?u:Q(c.type)||"Memo";case B:u=c._payload,c=c._init;try{return Q(c(u))}catch{}}return null}function ce(c){var u=c.type;switch(c.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return c=u.render,c=c.displayName||c.name||"",u.displayName||(c!==""?"ForwardRef("+c+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Q(u);case 8:return u===D?"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 u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}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 pe(c){var u=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function be(c){var u=pe(c)?"checked":"value",x=Object.getOwnPropertyDescriptor(c.constructor.prototype,u),v=""+c[u];if(!c.hasOwnProperty(u)&&typeof x<"u"&&typeof x.get=="function"&&typeof x.set=="function"){var E=x.get,_=x.set;return Object.defineProperty(c,u,{configurable:!0,get:function(){return E.call(this)},set:function(K){v=""+K,_.call(this,K)}}),Object.defineProperty(c,u,{enumerable:x.enumerable}),{getValue:function(){return v},setValue:function(K){v=""+K},stopTracking:function(){c._valueTracker=null,delete c[u]}}}}function Ee(c){c._valueTracker||(c._valueTracker=be(c))}function Te(c){if(!c)return!1;var u=c._valueTracker;if(!u)return!0;var x=u.getValue(),v="";return c&&(v=pe(c)?c.checked?"true":"false":c.value),c=v,c!==x?(u.setValue(c),!0):!1}function Se(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,u){var x=u.checked;return M({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:x??c._wrapperState.initialChecked})}function oe(c,u){var x=u.defaultValue==null?"":u.defaultValue,v=u.checked!=null?u.checked:u.defaultChecked;x=te(u.value!=null?u.value:x),c._wrapperState={initialChecked:v,initialValue:x,controlled:u.type==="checkbox"||u.type==="radio"?u.checked!=null:u.value!=null}}function je(c,u){u=u.checked,u!=null&&k(c,"checked",u,!1)}function ke(c,u){je(c,u);var x=te(u.value),v=u.type;if(x!=null)v==="number"?(x===0&&c.value===""||c.value!=x)&&(c.value=""+x):c.value!==""+x&&(c.value=""+x);else if(v==="submit"||v==="reset"){c.removeAttribute("value");return}u.hasOwnProperty("value")?Ue(c,u.type,x):u.hasOwnProperty("defaultValue")&&Ue(c,u.type,te(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(c.defaultChecked=!!u.defaultChecked)}function _e(c,u,x){if(u.hasOwnProperty("value")||u.hasOwnProperty("defaultValue")){var v=u.type;if(!(v!=="submit"&&v!=="reset"||u.value!==void 0&&u.value!==null))return;u=""+c._wrapperState.initialValue,x||u===c.value||(c.value=u),c.defaultValue=u}x=c.name,x!==""&&(c.name=""),c.defaultChecked=!!c._wrapperState.initialChecked,x!==""&&(c.name=x)}function Ue(c,u,x){(u!=="number"||Se(c.ownerDocument)!==c)&&(x==null?c.defaultValue=""+c._wrapperState.initialValue:c.defaultValue!==""+x&&(c.defaultValue=""+x))}var et=Array.isArray;function Me(c,u,x,v){if(c=c.options,u){u={};for(var E=0;E<x.length;E++)u["$"+x[E]]=!0;for(x=0;x<c.length;x++)E=u.hasOwnProperty("$"+c[x].value),c[x].selected!==E&&(c[x].selected=E),E&&v&&(c[x].defaultSelected=!0)}else{for(x=""+te(x),u=null,E=0;E<c.length;E++){if(c[E].value===x){c[E].selected=!0,v&&(c[E].defaultSelected=!0);return}u!==null||c[E].disabled||(u=c[E])}u!==null&&(u.selected=!0)}}function qe(c,u){if(u.dangerouslySetInnerHTML!=null)throw Error(n(91));return M({},u,{value:void 0,defaultValue:void 0,children:""+c._wrapperState.initialValue})}function vt(c,u){var x=u.value;if(x==null){if(x=u.children,u=u.defaultValue,x!=null){if(u!=null)throw Error(n(92));if(et(x)){if(1<x.length)throw Error(n(93));x=x[0]}u=x}u==null&&(u=""),x=u}c._wrapperState={initialValue:te(x)}}function ft(c,u){var x=te(u.value),v=te(u.defaultValue);x!=null&&(x=""+x,x!==c.value&&(c.value=x),u.defaultValue==null&&c.defaultValue!==x&&(c.defaultValue=x)),v!=null&&(c.defaultValue=""+v)}function st(c){var u=c.textContent;u===c._wrapperState.initialValue&&u!==""&&u!==null&&(c.value=u)}function le(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 ee(c,u){return c==null||c==="http://www.w3.org/1999/xhtml"?le(u):c==="http://www.w3.org/2000/svg"&&u==="foreignObject"?"http://www.w3.org/1999/xhtml":c}var ye,ie=(function(c){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(u,x,v,E){MSApp.execUnsafeLocalFunction(function(){return c(u,x,v,E)})}:c})(function(c,u){if(c.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in c)c.innerHTML=u;else{for(ye=ye||document.createElement("div"),ye.innerHTML="<svg>"+u.valueOf().toString()+"</svg>",u=ye.firstChild;c.firstChild;)c.removeChild(c.firstChild);for(;u.firstChild;)c.appendChild(u.firstChild)}});function we(c,u){if(u){var x=c.firstChild;if(x&&x===c.lastChild&&x.nodeType===3){x.nodeValue=u;return}}c.textContent=u}var $e={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},Ce=["Webkit","ms","Moz","O"];Object.keys($e).forEach(function(c){Ce.forEach(function(u){u=u+c.charAt(0).toUpperCase()+c.substring(1),$e[u]=$e[c]})});function se(c,u,x){return u==null||typeof u=="boolean"||u===""?"":x||typeof u!="number"||u===0||$e.hasOwnProperty(c)&&$e[c]?(""+u).trim():u+"px"}function me(c,u){c=c.style;for(var x in u)if(u.hasOwnProperty(x)){var v=x.indexOf("--")===0,E=se(x,u[x],v);x==="float"&&(x="cssFloat"),v?c.setProperty(x,E):c[x]=E}}var Pe=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 Ke(c,u){if(u){if(Pe[c]&&(u.children!=null||u.dangerouslySetInnerHTML!=null))throw Error(n(137,c));if(u.dangerouslySetInnerHTML!=null){if(u.children!=null)throw Error(n(60));if(typeof u.dangerouslySetInnerHTML!="object"||!("__html"in u.dangerouslySetInnerHTML))throw Error(n(61))}if(u.style!=null&&typeof u.style!="object")throw Error(n(62))}}function de(c,u){if(c.indexOf("-")===-1)return typeof u.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 pt=null;function xt(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var jt=null,lt=null,ge=null;function He(c){if(c=qc(c)){if(typeof jt!="function")throw Error(n(280));var u=c.stateNode;u&&(u=af(u),jt(c.stateNode,c.type,u))}}function Je(c){lt?ge?ge.push(c):ge=[c]:lt=c}function It(){if(lt){var c=lt,u=ge;if(ge=lt=null,He(c),u)for(c=0;c<u.length;c++)He(u[c])}}function qt(c,u){return c(u)}function un(){}var Ut=!1;function Un(c,u,x){if(Ut)return c(u,x);Ut=!0;try{return qt(c,u,x)}finally{Ut=!1,(lt!==null||ge!==null)&&(un(),It())}}function St(c,u){var x=c.stateNode;if(x===null)return null;var v=af(x);if(v===null)return null;x=v[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(c=c.type,v=!(c==="button"||c==="input"||c==="select"||c==="textarea")),c=!v;break e;default:c=!1}if(c)return null;if(x&&typeof x!="function")throw Error(n(231,u,typeof x));return x}var $n=!1;if(l)try{var Nt={};Object.defineProperty(Nt,"passive",{get:function(){$n=!0}}),window.addEventListener("test",Nt,Nt),window.removeEventListener("test",Nt,Nt)}catch{$n=!1}function ue(c,u,x,v,E,_,K,X,re){var xe=Array.prototype.slice.call(arguments,3);try{u.apply(x,xe)}catch(Ae){this.onError(Ae)}}var We=!1,ot=null,yt=!1,Gn=null,vr={onError:function(c){We=!0,ot=c}};function rs(c,u,x,v,E,_,K,X,re){We=!1,ot=null,ue.apply(vr,arguments)}function va(c,u,x,v,E,_,K,X,re){if(rs.apply(this,arguments),We){if(We){var xe=ot;We=!1,ot=null}else throw Error(n(198));yt||(yt=!0,Gn=xe)}}function ht(c){var u=c,x=c;if(c.alternate)for(;u.return;)u=u.return;else{c=u;do u=c,(u.flags&4098)!==0&&(x=u.return),c=u.return;while(c)}return u.tag===3?x:null}function yi(c){if(c.tag===13){var u=c.memoizedState;if(u===null&&(c=c.alternate,c!==null&&(u=c.memoizedState)),u!==null)return u.dehydrated}return null}function Co(c){if(ht(c)!==c)throw Error(n(188))}function wa(c){var u=c.alternate;if(!u){if(u=ht(c),u===null)throw Error(n(188));return u!==c?null:c}for(var x=c,v=u;;){var E=x.return;if(E===null)break;var _=E.alternate;if(_===null){if(v=E.return,v!==null){x=v;continue}break}if(E.child===_.child){for(_=E.child;_;){if(_===x)return Co(E),c;if(_===v)return Co(E),u;_=_.sibling}throw Error(n(188))}if(x.return!==v.return)x=E,v=_;else{for(var K=!1,X=E.child;X;){if(X===x){K=!0,x=E,v=_;break}if(X===v){K=!0,v=E,x=_;break}X=X.sibling}if(!K){for(X=_.child;X;){if(X===x){K=!0,x=_,v=E;break}if(X===v){K=!0,v=_,x=E;break}X=X.sibling}if(!K)throw Error(n(189))}}if(x.alternate!==v)throw Error(n(190))}if(x.tag!==3)throw Error(n(188));return x.stateNode.current===x?c:u}function en(c){return c=wa(c),c!==null?ja(c):null}function ja(c){if(c.tag===5||c.tag===6)return c;for(c=c.child;c!==null;){var u=ja(c);if(u!==null)return u;c=c.sibling}return null}var ka=t.unstable_scheduleCallback,Sa=t.unstable_cancelCallback,Ec=t.unstable_shouldYield,Na=t.unstable_requestPaint,Kt=t.unstable_now,Tc=t.unstable_getCurrentPriorityLevel,bi=t.unstable_ImmediatePriority,Ca=t.unstable_UserBlockingPriority,Es=t.unstable_NormalPriority,Eo=t.unstable_LowPriority,Ea=t.unstable_IdlePriority,To=null,tn=null;function Ro(c){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(To,c,void 0,(c.current.flags&128)===128)}catch{}}var In=Math.clz32?Math.clz32:Pc,Rc=Math.log,Ac=Math.LN2;function Pc(c){return c>>>=0,c===0?32:31-(Rc(c)/Ac|0)|0}var Hn=64,Ao=4194304;function Ts(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 zr(c,u){var x=c.pendingLanes;if(x===0)return 0;var v=0,E=c.suspendedLanes,_=c.pingedLanes,K=x&268435455;if(K!==0){var X=K&~E;X!==0?v=Ts(X):(_&=K,_!==0&&(v=Ts(_)))}else K=x&~E,K!==0?v=Ts(K):_!==0&&(v=Ts(_));if(v===0)return 0;if(u!==0&&u!==v&&(u&E)===0&&(E=v&-v,_=u&-u,E>=_||E===16&&(_&4194240)!==0))return u;if((v&4)!==0&&(v|=x&16),u=c.entangledLanes,u!==0)for(c=c.entanglements,u&=v;0<u;)x=31-In(u),E=1<<x,v|=c[x],u&=~E;return v}function Ta(c,u){switch(c){case 1:case 2:case 4:return u+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 u+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 vi(c,u){for(var x=c.suspendedLanes,v=c.pingedLanes,E=c.expirationTimes,_=c.pendingLanes;0<_;){var K=31-In(_),X=1<<K,re=E[K];re===-1?((X&x)===0||(X&v)!==0)&&(E[K]=Ta(X,u)):re<=u&&(c.expiredLanes|=X),_&=~X}}function Zs(c){return c=c.pendingLanes&-1073741825,c!==0?c:c&1073741824?1073741824:0}function wi(){var c=Hn;return Hn<<=1,(Hn&4194240)===0&&(Hn=64),c}function Ot(c){for(var u=[],x=0;31>x;x++)u.push(c);return u}function wr(c,u,x){c.pendingLanes|=u,u!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,u=31-In(u),c[u]=x}function ji(c,u){var x=c.pendingLanes&~u;c.pendingLanes=u,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=u,c.mutableReadLanes&=u,c.entangledLanes&=u,u=c.entanglements;var v=c.eventTimes;for(c=c.expirationTimes;0<x;){var E=31-In(x),_=1<<E;u[E]=0,v[E]=-1,c[E]=-1,x&=~_}}function Po(c,u){var x=c.entangledLanes|=u;for(c=c.entanglements;x;){var v=31-In(x),E=1<<v;E&u|c[v]&u&&(c[v]|=u),x&=~E}}var Mt=0;function _c(c){return c&=-c,1<c?4<c?(c&268435455)!==0?16:536870912:4:1}var Ra,Aa,eo,Dc,$c,ki=!1,Pa=[],Rs=null,pn=null,As=null,to=new Map,Si=new Map,Ps=[],ng="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 _s(c,u){switch(c){case"focusin":case"focusout":Rs=null;break;case"dragenter":case"dragleave":pn=null;break;case"mouseover":case"mouseout":As=null;break;case"pointerover":case"pointerout":to.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":Si.delete(u.pointerId)}}function G(c,u,x,v,E,_){return c===null||c.nativeEvent!==_?(c={blockedOn:u,domEventName:x,eventSystemFlags:v,nativeEvent:_,targetContainers:[E]},u!==null&&(u=qc(u),u!==null&&Aa(u)),c):(c.eventSystemFlags|=v,u=c.targetContainers,E!==null&&u.indexOf(E)===-1&&u.push(E),c)}function Z(c,u,x,v,E){switch(u){case"focusin":return Rs=G(Rs,c,u,x,v,E),!0;case"dragenter":return pn=G(pn,c,u,x,v,E),!0;case"mouseover":return As=G(As,c,u,x,v,E),!0;case"pointerover":var _=E.pointerId;return to.set(_,G(to.get(_)||null,c,u,x,v,E)),!0;case"gotpointercapture":return _=E.pointerId,Si.set(_,G(Si.get(_)||null,c,u,x,v,E)),!0}return!1}function ve(c){var u=Ni(c.target);if(u!==null){var x=ht(u);if(x!==null){if(u=x.tag,u===13){if(u=yi(x),u!==null){c.blockedOn=u,$c(c.priority,function(){eo(x)});return}}else if(u===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 u=c.targetContainers;0<u.length;){var x=Br(c.domEventName,c.eventSystemFlags,u[0],c.nativeEvent);if(x===null){x=c.nativeEvent;var v=new x.constructor(x.type,x);pt=v,x.target.dispatchEvent(v),pt=null}else return u=qc(x),u!==null&&Aa(u),c.blockedOn=x,!1;u.shift()}return!0}function dt(c,u,x){ze(c)&&x.delete(u)}function _t(){ki=!1,Rs!==null&&ze(Rs)&&(Rs=null),pn!==null&&ze(pn)&&(pn=null),As!==null&&ze(As)&&(As=null),to.forEach(dt),Si.forEach(dt)}function Rt(c,u){c.blockedOn===u&&(c.blockedOn=null,ki||(ki=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,_t)))}function Mn(c){function u(E){return Rt(E,c)}if(0<Pa.length){Rt(Pa[0],c);for(var x=1;x<Pa.length;x++){var v=Pa[x];v.blockedOn===c&&(v.blockedOn=null)}}for(Rs!==null&&Rt(Rs,c),pn!==null&&Rt(pn,c),As!==null&&Rt(As,c),to.forEach(u),Si.forEach(u),x=0;x<Ps.length;x++)v=Ps[x],v.blockedOn===c&&(v.blockedOn=null);for(;0<Ps.length&&(x=Ps[0],x.blockedOn===null);)ve(x),x.blockedOn===null&&Ps.shift()}var gn=C.ReactCurrentBatchConfig,dn=!0;function jr(c,u,x,v){var E=Mt,_=gn.transition;gn.transition=null;try{Mt=1,Da(c,u,x,v)}finally{Mt=E,gn.transition=_}}function _a(c,u,x,v){var E=Mt,_=gn.transition;gn.transition=null;try{Mt=4,Da(c,u,x,v)}finally{Mt=E,gn.transition=_}}function Da(c,u,x,v){if(dn){var E=Br(c,u,x,v);if(E===null)bg(c,u,v,no,x),_s(c,v);else if(Z(E,c,u,x,v))v.stopPropagation();else if(_s(c,v),u&4&&-1<ng.indexOf(c)){for(;E!==null;){var _=qc(E);if(_!==null&&Ra(_),_=Br(c,u,x,v),_===null&&bg(c,u,v,no,x),_===E)break;E=_}E!==null&&v.stopPropagation()}else bg(c,u,v,null,x)}}var no=null;function Br(c,u,x,v){if(no=null,c=xt(v),c=Ni(c),c!==null)if(u=ht(c),u===null)c=null;else if(x=u.tag,x===13){if(c=yi(u),c!==null)return c;c=null}else if(x===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;c=null}else u!==c&&(c=null);return no=c,null}function P0(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(Tc()){case bi:return 1;case Ca:return 4;case Es:case Eo:return 16;case Ea:return 536870912;default:return 16}default:return 16}}var _o=null,rg=null,Yd=null;function _0(){if(Yd)return Yd;var c,u=rg,x=u.length,v,E="value"in _o?_o.value:_o.textContent,_=E.length;for(c=0;c<x&&u[c]===E[c];c++);var K=x-c;for(v=1;v<=K&&u[x-v]===E[_-v];v++);return Yd=E.slice(c,1<v?1-v:void 0)}function Xd(c){var u=c.keyCode;return"charCode"in c?(c=c.charCode,c===0&&u===13&&(c=13)):c=u,c===10&&(c=13),32<=c||c===13?c:0}function Qd(){return!0}function D0(){return!1}function kr(c){function u(x,v,E,_,K){this._reactName=x,this._targetInst=E,this.type=v,this.nativeEvent=_,this.target=K,this.currentTarget=null;for(var X in c)c.hasOwnProperty(X)&&(x=c[X],this[X]=x?x(_):_[X]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?Qd:D0,this.isPropagationStopped=D0,this}return M(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var x=this.nativeEvent;x&&(x.preventDefault?x.preventDefault():typeof x.returnValue!="unknown"&&(x.returnValue=!1),this.isDefaultPrevented=Qd)},stopPropagation:function(){var x=this.nativeEvent;x&&(x.stopPropagation?x.stopPropagation():typeof x.cancelBubble!="unknown"&&(x.cancelBubble=!0),this.isPropagationStopped=Qd)},persist:function(){},isPersistent:Qd}),u}var $a={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sg=kr($a),Ic=M({},$a,{view:0,detail:0}),YD=kr(Ic),og,ig,Mc,Jd=M({},Ic,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lg,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!==Mc&&(Mc&&c.type==="mousemove"?(og=c.screenX-Mc.screenX,ig=c.screenY-Mc.screenY):ig=og=0,Mc=c),og)},movementY:function(c){return"movementY"in c?c.movementY:ig}}),$0=kr(Jd),XD=M({},Jd,{dataTransfer:0}),QD=kr(XD),JD=M({},Ic,{relatedTarget:0}),ag=kr(JD),ZD=M({},$a,{animationName:0,elapsedTime:0,pseudoElement:0}),e$=kr(ZD),t$=M({},$a,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),n$=kr(t$),r$=M({},$a,{data:0}),I0=kr(r$),s$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},o$={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"},i$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function a$(c){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(c):(c=i$[c])?!!u[c]:!1}function lg(){return a$}var l$=M({},Ic,{key:function(c){if(c.key){var u=s$[c.key]||c.key;if(u!=="Unidentified")return u}return c.type==="keypress"?(c=Xd(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?o$[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lg,charCode:function(c){return c.type==="keypress"?Xd(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?Xd(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),c$=kr(l$),u$=M({},Jd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),M0=kr(u$),d$=M({},Ic,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lg}),f$=kr(d$),p$=M({},$a,{propertyName:0,elapsedTime:0,pseudoElement:0}),h$=kr(p$),m$=M({},Jd,{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}),g$=kr(m$),x$=[9,13,27,32],cg=l&&"CompositionEvent"in window,Lc=null;l&&"documentMode"in document&&(Lc=document.documentMode);var y$=l&&"TextEvent"in window&&!Lc,L0=l&&(!cg||Lc&&8<Lc&&11>=Lc),O0=" ",F0=!1;function z0(c,u){switch(c){case"keyup":return x$.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function B0(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var Ia=!1;function b$(c,u){switch(c){case"compositionend":return B0(u);case"keypress":return u.which!==32?null:(F0=!0,O0);case"textInput":return c=u.data,c===O0&&F0?null:c;default:return null}}function v$(c,u){if(Ia)return c==="compositionend"||!cg&&z0(c,u)?(c=_0(),Yd=rg=_o=null,Ia=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return L0&&u.locale!=="ko"?null:u.data;default:return null}}var w$={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 U0(c){var u=c&&c.nodeName&&c.nodeName.toLowerCase();return u==="input"?!!w$[c.type]:u==="textarea"}function H0(c,u,x,v){Je(v),u=rf(u,"onChange"),0<u.length&&(x=new sg("onChange","change",null,x,v),c.push({event:x,listeners:u}))}var Oc=null,Fc=null;function j$(c){aj(c,0)}function Zd(c){var u=za(c);if(Te(u))return c}function k$(c,u){if(c==="change")return u}var V0=!1;if(l){var ug;if(l){var dg="oninput"in document;if(!dg){var W0=document.createElement("div");W0.setAttribute("oninput","return;"),dg=typeof W0.oninput=="function"}ug=dg}else ug=!1;V0=ug&&(!document.documentMode||9<document.documentMode)}function q0(){Oc&&(Oc.detachEvent("onpropertychange",K0),Fc=Oc=null)}function K0(c){if(c.propertyName==="value"&&Zd(Fc)){var u=[];H0(u,Fc,c,xt(c)),Un(j$,u)}}function S$(c,u,x){c==="focusin"?(q0(),Oc=u,Fc=x,Oc.attachEvent("onpropertychange",K0)):c==="focusout"&&q0()}function N$(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return Zd(Fc)}function C$(c,u){if(c==="click")return Zd(u)}function E$(c,u){if(c==="input"||c==="change")return Zd(u)}function T$(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var ss=typeof Object.is=="function"?Object.is:T$;function zc(c,u){if(ss(c,u))return!0;if(typeof c!="object"||c===null||typeof u!="object"||u===null)return!1;var x=Object.keys(c),v=Object.keys(u);if(x.length!==v.length)return!1;for(v=0;v<x.length;v++){var E=x[v];if(!d.call(u,E)||!ss(c[E],u[E]))return!1}return!0}function G0(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function Y0(c,u){var x=G0(c);c=0;for(var v;x;){if(x.nodeType===3){if(v=c+x.textContent.length,c<=u&&v>=u)return{node:x,offset:u-c};c=v}e:{for(;x;){if(x.nextSibling){x=x.nextSibling;break e}x=x.parentNode}x=void 0}x=G0(x)}}function X0(c,u){return c&&u?c===u?!0:c&&c.nodeType===3?!1:u&&u.nodeType===3?X0(c,u.parentNode):"contains"in c?c.contains(u):c.compareDocumentPosition?!!(c.compareDocumentPosition(u)&16):!1:!1}function Q0(){for(var c=window,u=Se();u instanceof c.HTMLIFrameElement;){try{var x=typeof u.contentWindow.location.href=="string"}catch{x=!1}if(x)c=u.contentWindow;else break;u=Se(c.document)}return u}function fg(c){var u=c&&c.nodeName&&c.nodeName.toLowerCase();return u&&(u==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||u==="textarea"||c.contentEditable==="true")}function R$(c){var u=Q0(),x=c.focusedElem,v=c.selectionRange;if(u!==x&&x&&x.ownerDocument&&X0(x.ownerDocument.documentElement,x)){if(v!==null&&fg(x)){if(u=v.start,c=v.end,c===void 0&&(c=u),"selectionStart"in x)x.selectionStart=u,x.selectionEnd=Math.min(c,x.value.length);else if(c=(u=x.ownerDocument||document)&&u.defaultView||window,c.getSelection){c=c.getSelection();var E=x.textContent.length,_=Math.min(v.start,E);v=v.end===void 0?_:Math.min(v.end,E),!c.extend&&_>v&&(E=v,v=_,_=E),E=Y0(x,_);var K=Y0(x,v);E&&K&&(c.rangeCount!==1||c.anchorNode!==E.node||c.anchorOffset!==E.offset||c.focusNode!==K.node||c.focusOffset!==K.offset)&&(u=u.createRange(),u.setStart(E.node,E.offset),c.removeAllRanges(),_>v?(c.addRange(u),c.extend(K.node,K.offset)):(u.setEnd(K.node,K.offset),c.addRange(u)))}}for(u=[],c=x;c=c.parentNode;)c.nodeType===1&&u.push({element:c,left:c.scrollLeft,top:c.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<u.length;x++)c=u[x],c.element.scrollLeft=c.left,c.element.scrollTop=c.top}}var A$=l&&"documentMode"in document&&11>=document.documentMode,Ma=null,pg=null,Bc=null,hg=!1;function J0(c,u,x){var v=x.window===x?x.document:x.nodeType===9?x:x.ownerDocument;hg||Ma==null||Ma!==Se(v)||(v=Ma,"selectionStart"in v&&fg(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),Bc&&zc(Bc,v)||(Bc=v,v=rf(pg,"onSelect"),0<v.length&&(u=new sg("onSelect","select",null,u,x),c.push({event:u,listeners:v}),u.target=Ma)))}function ef(c,u){var x={};return x[c.toLowerCase()]=u.toLowerCase(),x["Webkit"+c]="webkit"+u,x["Moz"+c]="moz"+u,x}var La={animationend:ef("Animation","AnimationEnd"),animationiteration:ef("Animation","AnimationIteration"),animationstart:ef("Animation","AnimationStart"),transitionend:ef("Transition","TransitionEnd")},mg={},Z0={};l&&(Z0=document.createElement("div").style,"AnimationEvent"in window||(delete La.animationend.animation,delete La.animationiteration.animation,delete La.animationstart.animation),"TransitionEvent"in window||delete La.transitionend.transition);function tf(c){if(mg[c])return mg[c];if(!La[c])return c;var u=La[c],x;for(x in u)if(u.hasOwnProperty(x)&&x in Z0)return mg[c]=u[x];return c}var ej=tf("animationend"),tj=tf("animationiteration"),nj=tf("animationstart"),rj=tf("transitionend"),sj=new Map,oj="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 Do(c,u){sj.set(c,u),i(u,[c])}for(var gg=0;gg<oj.length;gg++){var xg=oj[gg],P$=xg.toLowerCase(),_$=xg[0].toUpperCase()+xg.slice(1);Do(P$,"on"+_$)}Do(ej,"onAnimationEnd"),Do(tj,"onAnimationIteration"),Do(nj,"onAnimationStart"),Do("dblclick","onDoubleClick"),Do("focusin","onFocus"),Do("focusout","onBlur"),Do(rj,"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 Uc="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(" "),D$=new Set("cancel close invalid load scroll toggle".split(" ").concat(Uc));function ij(c,u,x){var v=c.type||"unknown-event";c.currentTarget=x,va(v,u,void 0,c),c.currentTarget=null}function aj(c,u){u=(u&4)!==0;for(var x=0;x<c.length;x++){var v=c[x],E=v.event;v=v.listeners;e:{var _=void 0;if(u)for(var K=v.length-1;0<=K;K--){var X=v[K],re=X.instance,xe=X.currentTarget;if(X=X.listener,re!==_&&E.isPropagationStopped())break e;ij(E,X,xe),_=re}else for(K=0;K<v.length;K++){if(X=v[K],re=X.instance,xe=X.currentTarget,X=X.listener,re!==_&&E.isPropagationStopped())break e;ij(E,X,xe),_=re}}}if(yt)throw c=Gn,yt=!1,Gn=null,c}function Gt(c,u){var x=u[Ng];x===void 0&&(x=u[Ng]=new Set);var v=c+"__bubble";x.has(v)||(lj(u,c,2,!1),x.add(v))}function yg(c,u,x){var v=0;u&&(v|=4),lj(x,c,v,u)}var nf="_reactListening"+Math.random().toString(36).slice(2);function Hc(c){if(!c[nf]){c[nf]=!0,r.forEach(function(x){x!=="selectionchange"&&(D$.has(x)||yg(x,!1,c),yg(x,!0,c))});var u=c.nodeType===9?c:c.ownerDocument;u===null||u[nf]||(u[nf]=!0,yg("selectionchange",!1,u))}}function lj(c,u,x,v){switch(P0(u)){case 1:var E=jr;break;case 4:E=_a;break;default:E=Da}x=E.bind(null,u,x,c),E=void 0,!$n||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(E=!0),v?E!==void 0?c.addEventListener(u,x,{capture:!0,passive:E}):c.addEventListener(u,x,!0):E!==void 0?c.addEventListener(u,x,{passive:E}):c.addEventListener(u,x,!1)}function bg(c,u,x,v,E){var _=v;if((u&1)===0&&(u&2)===0&&v!==null)e:for(;;){if(v===null)return;var K=v.tag;if(K===3||K===4){var X=v.stateNode.containerInfo;if(X===E||X.nodeType===8&&X.parentNode===E)break;if(K===4)for(K=v.return;K!==null;){var re=K.tag;if((re===3||re===4)&&(re=K.stateNode.containerInfo,re===E||re.nodeType===8&&re.parentNode===E))return;K=K.return}for(;X!==null;){if(K=Ni(X),K===null)return;if(re=K.tag,re===5||re===6){v=_=K;continue e}X=X.parentNode}}v=v.return}Un(function(){var xe=_,Ae=xt(x),De=[];e:{var Re=sj.get(c);if(Re!==void 0){var Ge=sg,Ze=c;switch(c){case"keypress":if(Xd(x)===0)break e;case"keydown":case"keyup":Ge=c$;break;case"focusin":Ze="focus",Ge=ag;break;case"focusout":Ze="blur",Ge=ag;break;case"beforeblur":case"afterblur":Ge=ag;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":Ge=$0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ge=QD;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ge=f$;break;case ej:case tj:case nj:Ge=e$;break;case rj:Ge=h$;break;case"scroll":Ge=YD;break;case"wheel":Ge=g$;break;case"copy":case"cut":case"paste":Ge=n$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ge=M0}var tt=(u&4)!==0,hn=!tt&&c==="scroll",fe=tt?Re!==null?Re+"Capture":null:Re;tt=[];for(var ae=xe,he;ae!==null;){he=ae;var Fe=he.stateNode;if(he.tag===5&&Fe!==null&&(he=Fe,fe!==null&&(Fe=St(ae,fe),Fe!=null&&tt.push(Vc(ae,Fe,he)))),hn)break;ae=ae.return}0<tt.length&&(Re=new Ge(Re,Ze,null,x,Ae),De.push({event:Re,listeners:tt}))}}if((u&7)===0){e:{if(Re=c==="mouseover"||c==="pointerover",Ge=c==="mouseout"||c==="pointerout",Re&&x!==pt&&(Ze=x.relatedTarget||x.fromElement)&&(Ni(Ze)||Ze[ro]))break e;if((Ge||Re)&&(Re=Ae.window===Ae?Ae:(Re=Ae.ownerDocument)?Re.defaultView||Re.parentWindow:window,Ge?(Ze=x.relatedTarget||x.toElement,Ge=xe,Ze=Ze?Ni(Ze):null,Ze!==null&&(hn=ht(Ze),Ze!==hn||Ze.tag!==5&&Ze.tag!==6)&&(Ze=null)):(Ge=null,Ze=xe),Ge!==Ze)){if(tt=$0,Fe="onMouseLeave",fe="onMouseEnter",ae="mouse",(c==="pointerout"||c==="pointerover")&&(tt=M0,Fe="onPointerLeave",fe="onPointerEnter",ae="pointer"),hn=Ge==null?Re:za(Ge),he=Ze==null?Re:za(Ze),Re=new tt(Fe,ae+"leave",Ge,x,Ae),Re.target=hn,Re.relatedTarget=he,Fe=null,Ni(Ae)===xe&&(tt=new tt(fe,ae+"enter",Ze,x,Ae),tt.target=he,tt.relatedTarget=hn,Fe=tt),hn=Fe,Ge&&Ze)t:{for(tt=Ge,fe=Ze,ae=0,he=tt;he;he=Oa(he))ae++;for(he=0,Fe=fe;Fe;Fe=Oa(Fe))he++;for(;0<ae-he;)tt=Oa(tt),ae--;for(;0<he-ae;)fe=Oa(fe),he--;for(;ae--;){if(tt===fe||fe!==null&&tt===fe.alternate)break t;tt=Oa(tt),fe=Oa(fe)}tt=null}else tt=null;Ge!==null&&cj(De,Re,Ge,tt,!1),Ze!==null&&hn!==null&&cj(De,hn,Ze,tt,!0)}}e:{if(Re=xe?za(xe):window,Ge=Re.nodeName&&Re.nodeName.toLowerCase(),Ge==="select"||Ge==="input"&&Re.type==="file")var nt=k$;else if(U0(Re))if(V0)nt=E$;else{nt=N$;var it=S$}else(Ge=Re.nodeName)&&Ge.toLowerCase()==="input"&&(Re.type==="checkbox"||Re.type==="radio")&&(nt=C$);if(nt&&(nt=nt(c,xe))){H0(De,nt,x,Ae);break e}it&&it(c,Re,xe),c==="focusout"&&(it=Re._wrapperState)&&it.controlled&&Re.type==="number"&&Ue(Re,"number",Re.value)}switch(it=xe?za(xe):window,c){case"focusin":(U0(it)||it.contentEditable==="true")&&(Ma=it,pg=xe,Bc=null);break;case"focusout":Bc=pg=Ma=null;break;case"mousedown":hg=!0;break;case"contextmenu":case"mouseup":case"dragend":hg=!1,J0(De,x,Ae);break;case"selectionchange":if(A$)break;case"keydown":case"keyup":J0(De,x,Ae)}var at;if(cg)e:{switch(c){case"compositionstart":var ct="onCompositionStart";break e;case"compositionend":ct="onCompositionEnd";break e;case"compositionupdate":ct="onCompositionUpdate";break e}ct=void 0}else Ia?z0(c,x)&&(ct="onCompositionEnd"):c==="keydown"&&x.keyCode===229&&(ct="onCompositionStart");ct&&(L0&&x.locale!=="ko"&&(Ia||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&Ia&&(at=_0()):(_o=Ae,rg="value"in _o?_o.value:_o.textContent,Ia=!0)),it=rf(xe,ct),0<it.length&&(ct=new I0(ct,c,null,x,Ae),De.push({event:ct,listeners:it}),at?ct.data=at:(at=B0(x),at!==null&&(ct.data=at)))),(at=y$?b$(c,x):v$(c,x))&&(xe=rf(xe,"onBeforeInput"),0<xe.length&&(Ae=new I0("onBeforeInput","beforeinput",null,x,Ae),De.push({event:Ae,listeners:xe}),Ae.data=at))}aj(De,u)})}function Vc(c,u,x){return{instance:c,listener:u,currentTarget:x}}function rf(c,u){for(var x=u+"Capture",v=[];c!==null;){var E=c,_=E.stateNode;E.tag===5&&_!==null&&(E=_,_=St(c,x),_!=null&&v.unshift(Vc(c,_,E)),_=St(c,u),_!=null&&v.push(Vc(c,_,E))),c=c.return}return v}function Oa(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5);return c||null}function cj(c,u,x,v,E){for(var _=u._reactName,K=[];x!==null&&x!==v;){var X=x,re=X.alternate,xe=X.stateNode;if(re!==null&&re===v)break;X.tag===5&&xe!==null&&(X=xe,E?(re=St(x,_),re!=null&&K.unshift(Vc(x,re,X))):E||(re=St(x,_),re!=null&&K.push(Vc(x,re,X)))),x=x.return}K.length!==0&&c.push({event:u,listeners:K})}var $$=/\r\n?/g,I$=/\u0000|\uFFFD/g;function uj(c){return(typeof c=="string"?c:""+c).replace($$,`
|
|
38
|
+
`).replace(I$,"")}function sf(c,u,x){if(u=uj(u),uj(c)!==u&&x)throw Error(n(425))}function of(){}var vg=null,wg=null;function jg(c,u){return c==="textarea"||c==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var kg=typeof setTimeout=="function"?setTimeout:void 0,M$=typeof clearTimeout=="function"?clearTimeout:void 0,dj=typeof Promise=="function"?Promise:void 0,L$=typeof queueMicrotask=="function"?queueMicrotask:typeof dj<"u"?function(c){return dj.resolve(null).then(c).catch(O$)}:kg;function O$(c){setTimeout(function(){throw c})}function Sg(c,u){var x=u,v=0;do{var E=x.nextSibling;if(c.removeChild(x),E&&E.nodeType===8)if(x=E.data,x==="/$"){if(v===0){c.removeChild(E),Mn(u);return}v--}else x!=="$"&&x!=="$?"&&x!=="$!"||v++;x=E}while(x);Mn(u)}function $o(c){for(;c!=null;c=c.nextSibling){var u=c.nodeType;if(u===1||u===3)break;if(u===8){if(u=c.data,u==="$"||u==="$!"||u==="$?")break;if(u==="/$")return null}}return c}function fj(c){c=c.previousSibling;for(var u=0;c;){if(c.nodeType===8){var x=c.data;if(x==="$"||x==="$!"||x==="$?"){if(u===0)return c;u--}else x==="/$"&&u++}c=c.previousSibling}return null}var Fa=Math.random().toString(36).slice(2),Ds="__reactFiber$"+Fa,Wc="__reactProps$"+Fa,ro="__reactContainer$"+Fa,Ng="__reactEvents$"+Fa,F$="__reactListeners$"+Fa,z$="__reactHandles$"+Fa;function Ni(c){var u=c[Ds];if(u)return u;for(var x=c.parentNode;x;){if(u=x[ro]||x[Ds]){if(x=u.alternate,u.child!==null||x!==null&&x.child!==null)for(c=fj(c);c!==null;){if(x=c[Ds])return x;c=fj(c)}return u}c=x,x=c.parentNode}return null}function qc(c){return c=c[Ds]||c[ro],!c||c.tag!==5&&c.tag!==6&&c.tag!==13&&c.tag!==3?null:c}function za(c){if(c.tag===5||c.tag===6)return c.stateNode;throw Error(n(33))}function af(c){return c[Wc]||null}var Cg=[],Ba=-1;function Io(c){return{current:c}}function Yt(c){0>Ba||(c.current=Cg[Ba],Cg[Ba]=null,Ba--)}function Ht(c,u){Ba++,Cg[Ba]=c.current,c.current=u}var Mo={},Yn=Io(Mo),ir=Io(!1),Ci=Mo;function Ua(c,u){var x=c.type.contextTypes;if(!x)return Mo;var v=c.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===u)return v.__reactInternalMemoizedMaskedChildContext;var E={},_;for(_ in x)E[_]=u[_];return v&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=u,c.__reactInternalMemoizedMaskedChildContext=E),E}function ar(c){return c=c.childContextTypes,c!=null}function lf(){Yt(ir),Yt(Yn)}function pj(c,u,x){if(Yn.current!==Mo)throw Error(n(168));Ht(Yn,u),Ht(ir,x)}function hj(c,u,x){var v=c.stateNode;if(u=u.childContextTypes,typeof v.getChildContext!="function")return x;v=v.getChildContext();for(var E in v)if(!(E in u))throw Error(n(108,ce(c)||"Unknown",E));return M({},x,v)}function cf(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Mo,Ci=Yn.current,Ht(Yn,c),Ht(ir,ir.current),!0}function mj(c,u,x){var v=c.stateNode;if(!v)throw Error(n(169));x?(c=hj(c,u,Ci),v.__reactInternalMemoizedMergedChildContext=c,Yt(ir),Yt(Yn),Ht(Yn,c)):Yt(ir),Ht(ir,x)}var so=null,uf=!1,Eg=!1;function gj(c){so===null?so=[c]:so.push(c)}function B$(c){uf=!0,gj(c)}function Lo(){if(!Eg&&so!==null){Eg=!0;var c=0,u=Mt;try{var x=so;for(Mt=1;c<x.length;c++){var v=x[c];do v=v(!0);while(v!==null)}so=null,uf=!1}catch(E){throw so!==null&&(so=so.slice(c+1)),ka(bi,Lo),E}finally{Mt=u,Eg=!1}}return null}var Ha=[],Va=0,df=null,ff=0,Ur=[],Hr=0,Ei=null,oo=1,io="";function Ti(c,u){Ha[Va++]=ff,Ha[Va++]=df,df=c,ff=u}function xj(c,u,x){Ur[Hr++]=oo,Ur[Hr++]=io,Ur[Hr++]=Ei,Ei=c;var v=oo;c=io;var E=32-In(v)-1;v&=~(1<<E),x+=1;var _=32-In(u)+E;if(30<_){var K=E-E%5;_=(v&(1<<K)-1).toString(32),v>>=K,E-=K,oo=1<<32-In(u)+E|x<<E|v,io=_+c}else oo=1<<_|x<<E|v,io=c}function Tg(c){c.return!==null&&(Ti(c,1),xj(c,1,0))}function Rg(c){for(;c===df;)df=Ha[--Va],Ha[Va]=null,ff=Ha[--Va],Ha[Va]=null;for(;c===Ei;)Ei=Ur[--Hr],Ur[Hr]=null,io=Ur[--Hr],Ur[Hr]=null,oo=Ur[--Hr],Ur[Hr]=null}var Sr=null,Nr=null,nn=!1,os=null;function yj(c,u){var x=Kr(5,null,null,0);x.elementType="DELETED",x.stateNode=u,x.return=c,u=c.deletions,u===null?(c.deletions=[x],c.flags|=16):u.push(x)}function bj(c,u){switch(c.tag){case 5:var x=c.type;return u=u.nodeType!==1||x.toLowerCase()!==u.nodeName.toLowerCase()?null:u,u!==null?(c.stateNode=u,Sr=c,Nr=$o(u.firstChild),!0):!1;case 6:return u=c.pendingProps===""||u.nodeType!==3?null:u,u!==null?(c.stateNode=u,Sr=c,Nr=null,!0):!1;case 13:return u=u.nodeType!==8?null:u,u!==null?(x=Ei!==null?{id:oo,overflow:io}:null,c.memoizedState={dehydrated:u,treeContext:x,retryLane:1073741824},x=Kr(18,null,null,0),x.stateNode=u,x.return=c,c.child=x,Sr=c,Nr=null,!0):!1;default:return!1}}function Ag(c){return(c.mode&1)!==0&&(c.flags&128)===0}function Pg(c){if(nn){var u=Nr;if(u){var x=u;if(!bj(c,u)){if(Ag(c))throw Error(n(418));u=$o(x.nextSibling);var v=Sr;u&&bj(c,u)?yj(v,x):(c.flags=c.flags&-4097|2,nn=!1,Sr=c)}}else{if(Ag(c))throw Error(n(418));c.flags=c.flags&-4097|2,nn=!1,Sr=c}}}function vj(c){for(c=c.return;c!==null&&c.tag!==5&&c.tag!==3&&c.tag!==13;)c=c.return;Sr=c}function pf(c){if(c!==Sr)return!1;if(!nn)return vj(c),nn=!0,!1;var u;if((u=c.tag!==3)&&!(u=c.tag!==5)&&(u=c.type,u=u!=="head"&&u!=="body"&&!jg(c.type,c.memoizedProps)),u&&(u=Nr)){if(Ag(c))throw wj(),Error(n(418));for(;u;)yj(c,u),u=$o(u.nextSibling)}if(vj(c),c.tag===13){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(317));e:{for(c=c.nextSibling,u=0;c;){if(c.nodeType===8){var x=c.data;if(x==="/$"){if(u===0){Nr=$o(c.nextSibling);break e}u--}else x!=="$"&&x!=="$!"&&x!=="$?"||u++}c=c.nextSibling}Nr=null}}else Nr=Sr?$o(c.stateNode.nextSibling):null;return!0}function wj(){for(var c=Nr;c;)c=$o(c.nextSibling)}function Wa(){Nr=Sr=null,nn=!1}function _g(c){os===null?os=[c]:os.push(c)}var U$=C.ReactCurrentBatchConfig;function Kc(c,u,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 v=x.stateNode}if(!v)throw Error(n(147,c));var E=v,_=""+c;return u!==null&&u.ref!==null&&typeof u.ref=="function"&&u.ref._stringRef===_?u.ref:(u=function(K){var X=E.refs;K===null?delete X[_]:X[_]=K},u._stringRef=_,u)}if(typeof c!="string")throw Error(n(284));if(!x._owner)throw Error(n(290,c))}return c}function hf(c,u){throw c=Object.prototype.toString.call(u),Error(n(31,c==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":c))}function jj(c){var u=c._init;return u(c._payload)}function kj(c){function u(fe,ae){if(c){var he=fe.deletions;he===null?(fe.deletions=[ae],fe.flags|=16):he.push(ae)}}function x(fe,ae){if(!c)return null;for(;ae!==null;)u(fe,ae),ae=ae.sibling;return null}function v(fe,ae){for(fe=new Map;ae!==null;)ae.key!==null?fe.set(ae.key,ae):fe.set(ae.index,ae),ae=ae.sibling;return fe}function E(fe,ae){return fe=Wo(fe,ae),fe.index=0,fe.sibling=null,fe}function _(fe,ae,he){return fe.index=he,c?(he=fe.alternate,he!==null?(he=he.index,he<ae?(fe.flags|=2,ae):he):(fe.flags|=2,ae)):(fe.flags|=1048576,ae)}function K(fe){return c&&fe.alternate===null&&(fe.flags|=2),fe}function X(fe,ae,he,Fe){return ae===null||ae.tag!==6?(ae=kx(he,fe.mode,Fe),ae.return=fe,ae):(ae=E(ae,he),ae.return=fe,ae)}function re(fe,ae,he,Fe){var nt=he.type;return nt===R?Ae(fe,ae,he.props.children,Fe,he.key):ae!==null&&(ae.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===B&&jj(nt)===ae.type)?(Fe=E(ae,he.props),Fe.ref=Kc(fe,ae,he),Fe.return=fe,Fe):(Fe=Of(he.type,he.key,he.props,null,fe.mode,Fe),Fe.ref=Kc(fe,ae,he),Fe.return=fe,Fe)}function xe(fe,ae,he,Fe){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==he.containerInfo||ae.stateNode.implementation!==he.implementation?(ae=Sx(he,fe.mode,Fe),ae.return=fe,ae):(ae=E(ae,he.children||[]),ae.return=fe,ae)}function Ae(fe,ae,he,Fe,nt){return ae===null||ae.tag!==7?(ae=Mi(he,fe.mode,Fe,nt),ae.return=fe,ae):(ae=E(ae,he),ae.return=fe,ae)}function De(fe,ae,he){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return ae=kx(""+ae,fe.mode,he),ae.return=fe,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case I:return he=Of(ae.type,ae.key,ae.props,null,fe.mode,he),he.ref=Kc(fe,null,ae),he.return=fe,he;case T:return ae=Sx(ae,fe.mode,he),ae.return=fe,ae;case B:var Fe=ae._init;return De(fe,Fe(ae._payload),he)}if(et(ae)||U(ae))return ae=Mi(ae,fe.mode,he,null),ae.return=fe,ae;hf(fe,ae)}return null}function Re(fe,ae,he,Fe){var nt=ae!==null?ae.key:null;if(typeof he=="string"&&he!==""||typeof he=="number")return nt!==null?null:X(fe,ae,""+he,Fe);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case I:return he.key===nt?re(fe,ae,he,Fe):null;case T:return he.key===nt?xe(fe,ae,he,Fe):null;case B:return nt=he._init,Re(fe,ae,nt(he._payload),Fe)}if(et(he)||U(he))return nt!==null?null:Ae(fe,ae,he,Fe,null);hf(fe,he)}return null}function Ge(fe,ae,he,Fe,nt){if(typeof Fe=="string"&&Fe!==""||typeof Fe=="number")return fe=fe.get(he)||null,X(ae,fe,""+Fe,nt);if(typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case I:return fe=fe.get(Fe.key===null?he:Fe.key)||null,re(ae,fe,Fe,nt);case T:return fe=fe.get(Fe.key===null?he:Fe.key)||null,xe(ae,fe,Fe,nt);case B:var it=Fe._init;return Ge(fe,ae,he,it(Fe._payload),nt)}if(et(Fe)||U(Fe))return fe=fe.get(he)||null,Ae(ae,fe,Fe,nt,null);hf(ae,Fe)}return null}function Ze(fe,ae,he,Fe){for(var nt=null,it=null,at=ae,ct=ae=0,Fn=null;at!==null&&ct<he.length;ct++){at.index>ct?(Fn=at,at=null):Fn=at.sibling;var Dt=Re(fe,at,he[ct],Fe);if(Dt===null){at===null&&(at=Fn);break}c&&at&&Dt.alternate===null&&u(fe,at),ae=_(Dt,ae,ct),it===null?nt=Dt:it.sibling=Dt,it=Dt,at=Fn}if(ct===he.length)return x(fe,at),nn&&Ti(fe,ct),nt;if(at===null){for(;ct<he.length;ct++)at=De(fe,he[ct],Fe),at!==null&&(ae=_(at,ae,ct),it===null?nt=at:it.sibling=at,it=at);return nn&&Ti(fe,ct),nt}for(at=v(fe,at);ct<he.length;ct++)Fn=Ge(at,fe,ct,he[ct],Fe),Fn!==null&&(c&&Fn.alternate!==null&&at.delete(Fn.key===null?ct:Fn.key),ae=_(Fn,ae,ct),it===null?nt=Fn:it.sibling=Fn,it=Fn);return c&&at.forEach(function(qo){return u(fe,qo)}),nn&&Ti(fe,ct),nt}function tt(fe,ae,he,Fe){var nt=U(he);if(typeof nt!="function")throw Error(n(150));if(he=nt.call(he),he==null)throw Error(n(151));for(var it=nt=null,at=ae,ct=ae=0,Fn=null,Dt=he.next();at!==null&&!Dt.done;ct++,Dt=he.next()){at.index>ct?(Fn=at,at=null):Fn=at.sibling;var qo=Re(fe,at,Dt.value,Fe);if(qo===null){at===null&&(at=Fn);break}c&&at&&qo.alternate===null&&u(fe,at),ae=_(qo,ae,ct),it===null?nt=qo:it.sibling=qo,it=qo,at=Fn}if(Dt.done)return x(fe,at),nn&&Ti(fe,ct),nt;if(at===null){for(;!Dt.done;ct++,Dt=he.next())Dt=De(fe,Dt.value,Fe),Dt!==null&&(ae=_(Dt,ae,ct),it===null?nt=Dt:it.sibling=Dt,it=Dt);return nn&&Ti(fe,ct),nt}for(at=v(fe,at);!Dt.done;ct++,Dt=he.next())Dt=Ge(at,fe,ct,Dt.value,Fe),Dt!==null&&(c&&Dt.alternate!==null&&at.delete(Dt.key===null?ct:Dt.key),ae=_(Dt,ae,ct),it===null?nt=Dt:it.sibling=Dt,it=Dt);return c&&at.forEach(function(wI){return u(fe,wI)}),nn&&Ti(fe,ct),nt}function hn(fe,ae,he,Fe){if(typeof he=="object"&&he!==null&&he.type===R&&he.key===null&&(he=he.props.children),typeof he=="object"&&he!==null){switch(he.$$typeof){case I:e:{for(var nt=he.key,it=ae;it!==null;){if(it.key===nt){if(nt=he.type,nt===R){if(it.tag===7){x(fe,it.sibling),ae=E(it,he.props.children),ae.return=fe,fe=ae;break e}}else if(it.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===B&&jj(nt)===it.type){x(fe,it.sibling),ae=E(it,he.props),ae.ref=Kc(fe,it,he),ae.return=fe,fe=ae;break e}x(fe,it);break}else u(fe,it);it=it.sibling}he.type===R?(ae=Mi(he.props.children,fe.mode,Fe,he.key),ae.return=fe,fe=ae):(Fe=Of(he.type,he.key,he.props,null,fe.mode,Fe),Fe.ref=Kc(fe,ae,he),Fe.return=fe,fe=Fe)}return K(fe);case T:e:{for(it=he.key;ae!==null;){if(ae.key===it)if(ae.tag===4&&ae.stateNode.containerInfo===he.containerInfo&&ae.stateNode.implementation===he.implementation){x(fe,ae.sibling),ae=E(ae,he.children||[]),ae.return=fe,fe=ae;break e}else{x(fe,ae);break}else u(fe,ae);ae=ae.sibling}ae=Sx(he,fe.mode,Fe),ae.return=fe,fe=ae}return K(fe);case B:return it=he._init,hn(fe,ae,it(he._payload),Fe)}if(et(he))return Ze(fe,ae,he,Fe);if(U(he))return tt(fe,ae,he,Fe);hf(fe,he)}return typeof he=="string"&&he!==""||typeof he=="number"?(he=""+he,ae!==null&&ae.tag===6?(x(fe,ae.sibling),ae=E(ae,he),ae.return=fe,fe=ae):(x(fe,ae),ae=kx(he,fe.mode,Fe),ae.return=fe,fe=ae),K(fe)):x(fe,ae)}return hn}var qa=kj(!0),Sj=kj(!1),mf=Io(null),gf=null,Ka=null,Dg=null;function $g(){Dg=Ka=gf=null}function Ig(c){var u=mf.current;Yt(mf),c._currentValue=u}function Mg(c,u,x){for(;c!==null;){var v=c.alternate;if((c.childLanes&u)!==u?(c.childLanes|=u,v!==null&&(v.childLanes|=u)):v!==null&&(v.childLanes&u)!==u&&(v.childLanes|=u),c===x)break;c=c.return}}function Ga(c,u){gf=c,Dg=Ka=null,c=c.dependencies,c!==null&&c.firstContext!==null&&((c.lanes&u)!==0&&(lr=!0),c.firstContext=null)}function Vr(c){var u=c._currentValue;if(Dg!==c)if(c={context:c,memoizedValue:u,next:null},Ka===null){if(gf===null)throw Error(n(308));Ka=c,gf.dependencies={lanes:0,firstContext:c}}else Ka=Ka.next=c;return u}var Ri=null;function Lg(c){Ri===null?Ri=[c]:Ri.push(c)}function Nj(c,u,x,v){var E=u.interleaved;return E===null?(x.next=x,Lg(u)):(x.next=E.next,E.next=x),u.interleaved=x,ao(c,v)}function ao(c,u){c.lanes|=u;var x=c.alternate;for(x!==null&&(x.lanes|=u),x=c,c=c.return;c!==null;)c.childLanes|=u,x=c.alternate,x!==null&&(x.childLanes|=u),x=c,c=c.return;return x.tag===3?x.stateNode:null}var Oo=!1;function Og(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cj(c,u){c=c.updateQueue,u.updateQueue===c&&(u.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,effects:c.effects})}function lo(c,u){return{eventTime:c,lane:u,tag:0,payload:null,callback:null,next:null}}function Fo(c,u,x){var v=c.updateQueue;if(v===null)return null;if(v=v.shared,(At&2)!==0){var E=v.pending;return E===null?u.next=u:(u.next=E.next,E.next=u),v.pending=u,ao(c,x)}return E=v.interleaved,E===null?(u.next=u,Lg(v)):(u.next=E.next,E.next=u),v.interleaved=u,ao(c,x)}function xf(c,u,x){if(u=u.updateQueue,u!==null&&(u=u.shared,(x&4194240)!==0)){var v=u.lanes;v&=c.pendingLanes,x|=v,u.lanes=x,Po(c,x)}}function Ej(c,u){var x=c.updateQueue,v=c.alternate;if(v!==null&&(v=v.updateQueue,x===v)){var E=null,_=null;if(x=x.firstBaseUpdate,x!==null){do{var K={eventTime:x.eventTime,lane:x.lane,tag:x.tag,payload:x.payload,callback:x.callback,next:null};_===null?E=_=K:_=_.next=K,x=x.next}while(x!==null);_===null?E=_=u:_=_.next=u}else E=_=u;x={baseState:v.baseState,firstBaseUpdate:E,lastBaseUpdate:_,shared:v.shared,effects:v.effects},c.updateQueue=x;return}c=x.lastBaseUpdate,c===null?x.firstBaseUpdate=u:c.next=u,x.lastBaseUpdate=u}function yf(c,u,x,v){var E=c.updateQueue;Oo=!1;var _=E.firstBaseUpdate,K=E.lastBaseUpdate,X=E.shared.pending;if(X!==null){E.shared.pending=null;var re=X,xe=re.next;re.next=null,K===null?_=xe:K.next=xe,K=re;var Ae=c.alternate;Ae!==null&&(Ae=Ae.updateQueue,X=Ae.lastBaseUpdate,X!==K&&(X===null?Ae.firstBaseUpdate=xe:X.next=xe,Ae.lastBaseUpdate=re))}if(_!==null){var De=E.baseState;K=0,Ae=xe=re=null,X=_;do{var Re=X.lane,Ge=X.eventTime;if((v&Re)===Re){Ae!==null&&(Ae=Ae.next={eventTime:Ge,lane:0,tag:X.tag,payload:X.payload,callback:X.callback,next:null});e:{var Ze=c,tt=X;switch(Re=u,Ge=x,tt.tag){case 1:if(Ze=tt.payload,typeof Ze=="function"){De=Ze.call(Ge,De,Re);break e}De=Ze;break e;case 3:Ze.flags=Ze.flags&-65537|128;case 0:if(Ze=tt.payload,Re=typeof Ze=="function"?Ze.call(Ge,De,Re):Ze,Re==null)break e;De=M({},De,Re);break e;case 2:Oo=!0}}X.callback!==null&&X.lane!==0&&(c.flags|=64,Re=E.effects,Re===null?E.effects=[X]:Re.push(X))}else Ge={eventTime:Ge,lane:Re,tag:X.tag,payload:X.payload,callback:X.callback,next:null},Ae===null?(xe=Ae=Ge,re=De):Ae=Ae.next=Ge,K|=Re;if(X=X.next,X===null){if(X=E.shared.pending,X===null)break;Re=X,X=Re.next,Re.next=null,E.lastBaseUpdate=Re,E.shared.pending=null}}while(!0);if(Ae===null&&(re=De),E.baseState=re,E.firstBaseUpdate=xe,E.lastBaseUpdate=Ae,u=E.shared.interleaved,u!==null){E=u;do K|=E.lane,E=E.next;while(E!==u)}else _===null&&(E.shared.lanes=0);_i|=K,c.lanes=K,c.memoizedState=De}}function Tj(c,u,x){if(c=u.effects,u.effects=null,c!==null)for(u=0;u<c.length;u++){var v=c[u],E=v.callback;if(E!==null){if(v.callback=null,v=x,typeof E!="function")throw Error(n(191,E));E.call(v)}}}var Gc={},$s=Io(Gc),Yc=Io(Gc),Xc=Io(Gc);function Ai(c){if(c===Gc)throw Error(n(174));return c}function Fg(c,u){switch(Ht(Xc,u),Ht(Yc,c),Ht($s,Gc),c=u.nodeType,c){case 9:case 11:u=(u=u.documentElement)?u.namespaceURI:ee(null,"");break;default:c=c===8?u.parentNode:u,u=c.namespaceURI||null,c=c.tagName,u=ee(u,c)}Yt($s),Ht($s,u)}function Ya(){Yt($s),Yt(Yc),Yt(Xc)}function Rj(c){Ai(Xc.current);var u=Ai($s.current),x=ee(u,c.type);u!==x&&(Ht(Yc,c),Ht($s,x))}function zg(c){Yc.current===c&&(Yt($s),Yt(Yc))}var an=Io(0);function bf(c){for(var u=c;u!==null;){if(u.tag===13){var x=u.memoizedState;if(x!==null&&(x=x.dehydrated,x===null||x.data==="$?"||x.data==="$!"))return u}else if(u.tag===19&&u.memoizedProps.revealOrder!==void 0){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===c)break;for(;u.sibling===null;){if(u.return===null||u.return===c)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var Bg=[];function Ug(){for(var c=0;c<Bg.length;c++)Bg[c]._workInProgressVersionPrimary=null;Bg.length=0}var vf=C.ReactCurrentDispatcher,Hg=C.ReactCurrentBatchConfig,Pi=0,ln=null,Cn=null,Ln=null,wf=!1,Qc=!1,Jc=0,H$=0;function Xn(){throw Error(n(321))}function Vg(c,u){if(u===null)return!1;for(var x=0;x<u.length&&x<c.length;x++)if(!ss(c[x],u[x]))return!1;return!0}function Wg(c,u,x,v,E,_){if(Pi=_,ln=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,vf.current=c===null||c.memoizedState===null?K$:G$,c=x(v,E),Qc){_=0;do{if(Qc=!1,Jc=0,25<=_)throw Error(n(301));_+=1,Ln=Cn=null,u.updateQueue=null,vf.current=Y$,c=x(v,E)}while(Qc)}if(vf.current=Sf,u=Cn!==null&&Cn.next!==null,Pi=0,Ln=Cn=ln=null,wf=!1,u)throw Error(n(300));return c}function qg(){var c=Jc!==0;return Jc=0,c}function Is(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ln===null?ln.memoizedState=Ln=c:Ln=Ln.next=c,Ln}function Wr(){if(Cn===null){var c=ln.alternate;c=c!==null?c.memoizedState:null}else c=Cn.next;var u=Ln===null?ln.memoizedState:Ln.next;if(u!==null)Ln=u,Cn=c;else{if(c===null)throw Error(n(310));Cn=c,c={memoizedState:Cn.memoizedState,baseState:Cn.baseState,baseQueue:Cn.baseQueue,queue:Cn.queue,next:null},Ln===null?ln.memoizedState=Ln=c:Ln=Ln.next=c}return Ln}function Zc(c,u){return typeof u=="function"?u(c):u}function Kg(c){var u=Wr(),x=u.queue;if(x===null)throw Error(n(311));x.lastRenderedReducer=c;var v=Cn,E=v.baseQueue,_=x.pending;if(_!==null){if(E!==null){var K=E.next;E.next=_.next,_.next=K}v.baseQueue=E=_,x.pending=null}if(E!==null){_=E.next,v=v.baseState;var X=K=null,re=null,xe=_;do{var Ae=xe.lane;if((Pi&Ae)===Ae)re!==null&&(re=re.next={lane:0,action:xe.action,hasEagerState:xe.hasEagerState,eagerState:xe.eagerState,next:null}),v=xe.hasEagerState?xe.eagerState:c(v,xe.action);else{var De={lane:Ae,action:xe.action,hasEagerState:xe.hasEagerState,eagerState:xe.eagerState,next:null};re===null?(X=re=De,K=v):re=re.next=De,ln.lanes|=Ae,_i|=Ae}xe=xe.next}while(xe!==null&&xe!==_);re===null?K=v:re.next=X,ss(v,u.memoizedState)||(lr=!0),u.memoizedState=v,u.baseState=K,u.baseQueue=re,x.lastRenderedState=v}if(c=x.interleaved,c!==null){E=c;do _=E.lane,ln.lanes|=_,_i|=_,E=E.next;while(E!==c)}else E===null&&(x.lanes=0);return[u.memoizedState,x.dispatch]}function Gg(c){var u=Wr(),x=u.queue;if(x===null)throw Error(n(311));x.lastRenderedReducer=c;var v=x.dispatch,E=x.pending,_=u.memoizedState;if(E!==null){x.pending=null;var K=E=E.next;do _=c(_,K.action),K=K.next;while(K!==E);ss(_,u.memoizedState)||(lr=!0),u.memoizedState=_,u.baseQueue===null&&(u.baseState=_),x.lastRenderedState=_}return[_,v]}function Aj(){}function Pj(c,u){var x=ln,v=Wr(),E=u(),_=!ss(v.memoizedState,E);if(_&&(v.memoizedState=E,lr=!0),v=v.queue,Yg($j.bind(null,x,v,c),[c]),v.getSnapshot!==u||_||Ln!==null&&Ln.memoizedState.tag&1){if(x.flags|=2048,eu(9,Dj.bind(null,x,v,E,u),void 0,null),On===null)throw Error(n(349));(Pi&30)!==0||_j(x,u,E)}return E}function _j(c,u,x){c.flags|=16384,c={getSnapshot:u,value:x},u=ln.updateQueue,u===null?(u={lastEffect:null,stores:null},ln.updateQueue=u,u.stores=[c]):(x=u.stores,x===null?u.stores=[c]:x.push(c))}function Dj(c,u,x,v){u.value=x,u.getSnapshot=v,Ij(u)&&Mj(c)}function $j(c,u,x){return x(function(){Ij(u)&&Mj(c)})}function Ij(c){var u=c.getSnapshot;c=c.value;try{var x=u();return!ss(c,x)}catch{return!0}}function Mj(c){var u=ao(c,1);u!==null&&cs(u,c,1,-1)}function Lj(c){var u=Is();return typeof c=="function"&&(c=c()),u.memoizedState=u.baseState=c,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Zc,lastRenderedState:c},u.queue=c,c=c.dispatch=q$.bind(null,ln,c),[u.memoizedState,c]}function eu(c,u,x,v){return c={tag:c,create:u,destroy:x,deps:v,next:null},u=ln.updateQueue,u===null?(u={lastEffect:null,stores:null},ln.updateQueue=u,u.lastEffect=c.next=c):(x=u.lastEffect,x===null?u.lastEffect=c.next=c:(v=x.next,x.next=c,c.next=v,u.lastEffect=c)),c}function Oj(){return Wr().memoizedState}function jf(c,u,x,v){var E=Is();ln.flags|=c,E.memoizedState=eu(1|u,x,void 0,v===void 0?null:v)}function kf(c,u,x,v){var E=Wr();v=v===void 0?null:v;var _=void 0;if(Cn!==null){var K=Cn.memoizedState;if(_=K.destroy,v!==null&&Vg(v,K.deps)){E.memoizedState=eu(u,x,_,v);return}}ln.flags|=c,E.memoizedState=eu(1|u,x,_,v)}function Fj(c,u){return jf(8390656,8,c,u)}function Yg(c,u){return kf(2048,8,c,u)}function zj(c,u){return kf(4,2,c,u)}function Bj(c,u){return kf(4,4,c,u)}function Uj(c,u){if(typeof u=="function")return c=c(),u(c),function(){u(null)};if(u!=null)return c=c(),u.current=c,function(){u.current=null}}function Hj(c,u,x){return x=x!=null?x.concat([c]):null,kf(4,4,Uj.bind(null,u,c),x)}function Xg(){}function Vj(c,u){var x=Wr();u=u===void 0?null:u;var v=x.memoizedState;return v!==null&&u!==null&&Vg(u,v[1])?v[0]:(x.memoizedState=[c,u],c)}function Wj(c,u){var x=Wr();u=u===void 0?null:u;var v=x.memoizedState;return v!==null&&u!==null&&Vg(u,v[1])?v[0]:(c=c(),x.memoizedState=[c,u],c)}function qj(c,u,x){return(Pi&21)===0?(c.baseState&&(c.baseState=!1,lr=!0),c.memoizedState=x):(ss(x,u)||(x=wi(),ln.lanes|=x,_i|=x,c.baseState=!0),u)}function V$(c,u){var x=Mt;Mt=x!==0&&4>x?x:4,c(!0);var v=Hg.transition;Hg.transition={};try{c(!1),u()}finally{Mt=x,Hg.transition=v}}function Kj(){return Wr().memoizedState}function W$(c,u,x){var v=Ho(c);if(x={lane:v,action:x,hasEagerState:!1,eagerState:null,next:null},Gj(c))Yj(u,x);else if(x=Nj(c,u,x,v),x!==null){var E=nr();cs(x,c,v,E),Xj(x,u,v)}}function q$(c,u,x){var v=Ho(c),E={lane:v,action:x,hasEagerState:!1,eagerState:null,next:null};if(Gj(c))Yj(u,E);else{var _=c.alternate;if(c.lanes===0&&(_===null||_.lanes===0)&&(_=u.lastRenderedReducer,_!==null))try{var K=u.lastRenderedState,X=_(K,x);if(E.hasEagerState=!0,E.eagerState=X,ss(X,K)){var re=u.interleaved;re===null?(E.next=E,Lg(u)):(E.next=re.next,re.next=E),u.interleaved=E;return}}catch{}finally{}x=Nj(c,u,E,v),x!==null&&(E=nr(),cs(x,c,v,E),Xj(x,u,v))}}function Gj(c){var u=c.alternate;return c===ln||u!==null&&u===ln}function Yj(c,u){Qc=wf=!0;var x=c.pending;x===null?u.next=u:(u.next=x.next,x.next=u),c.pending=u}function Xj(c,u,x){if((x&4194240)!==0){var v=u.lanes;v&=c.pendingLanes,x|=v,u.lanes=x,Po(c,x)}}var Sf={readContext:Vr,useCallback:Xn,useContext:Xn,useEffect:Xn,useImperativeHandle:Xn,useInsertionEffect:Xn,useLayoutEffect:Xn,useMemo:Xn,useReducer:Xn,useRef:Xn,useState:Xn,useDebugValue:Xn,useDeferredValue:Xn,useTransition:Xn,useMutableSource:Xn,useSyncExternalStore:Xn,useId:Xn,unstable_isNewReconciler:!1},K$={readContext:Vr,useCallback:function(c,u){return Is().memoizedState=[c,u===void 0?null:u],c},useContext:Vr,useEffect:Fj,useImperativeHandle:function(c,u,x){return x=x!=null?x.concat([c]):null,jf(4194308,4,Uj.bind(null,u,c),x)},useLayoutEffect:function(c,u){return jf(4194308,4,c,u)},useInsertionEffect:function(c,u){return jf(4,2,c,u)},useMemo:function(c,u){var x=Is();return u=u===void 0?null:u,c=c(),x.memoizedState=[c,u],c},useReducer:function(c,u,x){var v=Is();return u=x!==void 0?x(u):u,v.memoizedState=v.baseState=u,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:u},v.queue=c,c=c.dispatch=W$.bind(null,ln,c),[v.memoizedState,c]},useRef:function(c){var u=Is();return c={current:c},u.memoizedState=c},useState:Lj,useDebugValue:Xg,useDeferredValue:function(c){return Is().memoizedState=c},useTransition:function(){var c=Lj(!1),u=c[0];return c=V$.bind(null,c[1]),Is().memoizedState=c,[u,c]},useMutableSource:function(){},useSyncExternalStore:function(c,u,x){var v=ln,E=Is();if(nn){if(x===void 0)throw Error(n(407));x=x()}else{if(x=u(),On===null)throw Error(n(349));(Pi&30)!==0||_j(v,u,x)}E.memoizedState=x;var _={value:x,getSnapshot:u};return E.queue=_,Fj($j.bind(null,v,_,c),[c]),v.flags|=2048,eu(9,Dj.bind(null,v,_,x,u),void 0,null),x},useId:function(){var c=Is(),u=On.identifierPrefix;if(nn){var x=io,v=oo;x=(v&~(1<<32-In(v)-1)).toString(32)+x,u=":"+u+"R"+x,x=Jc++,0<x&&(u+="H"+x.toString(32)),u+=":"}else x=H$++,u=":"+u+"r"+x.toString(32)+":";return c.memoizedState=u},unstable_isNewReconciler:!1},G$={readContext:Vr,useCallback:Vj,useContext:Vr,useEffect:Yg,useImperativeHandle:Hj,useInsertionEffect:zj,useLayoutEffect:Bj,useMemo:Wj,useReducer:Kg,useRef:Oj,useState:function(){return Kg(Zc)},useDebugValue:Xg,useDeferredValue:function(c){var u=Wr();return qj(u,Cn.memoizedState,c)},useTransition:function(){var c=Kg(Zc)[0],u=Wr().memoizedState;return[c,u]},useMutableSource:Aj,useSyncExternalStore:Pj,useId:Kj,unstable_isNewReconciler:!1},Y$={readContext:Vr,useCallback:Vj,useContext:Vr,useEffect:Yg,useImperativeHandle:Hj,useInsertionEffect:zj,useLayoutEffect:Bj,useMemo:Wj,useReducer:Gg,useRef:Oj,useState:function(){return Gg(Zc)},useDebugValue:Xg,useDeferredValue:function(c){var u=Wr();return Cn===null?u.memoizedState=c:qj(u,Cn.memoizedState,c)},useTransition:function(){var c=Gg(Zc)[0],u=Wr().memoizedState;return[c,u]},useMutableSource:Aj,useSyncExternalStore:Pj,useId:Kj,unstable_isNewReconciler:!1};function is(c,u){if(c&&c.defaultProps){u=M({},u),c=c.defaultProps;for(var x in c)u[x]===void 0&&(u[x]=c[x]);return u}return u}function Qg(c,u,x,v){u=c.memoizedState,x=x(v,u),x=x==null?u:M({},u,x),c.memoizedState=x,c.lanes===0&&(c.updateQueue.baseState=x)}var Nf={isMounted:function(c){return(c=c._reactInternals)?ht(c)===c:!1},enqueueSetState:function(c,u,x){c=c._reactInternals;var v=nr(),E=Ho(c),_=lo(v,E);_.payload=u,x!=null&&(_.callback=x),u=Fo(c,_,E),u!==null&&(cs(u,c,E,v),xf(u,c,E))},enqueueReplaceState:function(c,u,x){c=c._reactInternals;var v=nr(),E=Ho(c),_=lo(v,E);_.tag=1,_.payload=u,x!=null&&(_.callback=x),u=Fo(c,_,E),u!==null&&(cs(u,c,E,v),xf(u,c,E))},enqueueForceUpdate:function(c,u){c=c._reactInternals;var x=nr(),v=Ho(c),E=lo(x,v);E.tag=2,u!=null&&(E.callback=u),u=Fo(c,E,v),u!==null&&(cs(u,c,v,x),xf(u,c,v))}};function Qj(c,u,x,v,E,_,K){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(v,_,K):u.prototype&&u.prototype.isPureReactComponent?!zc(x,v)||!zc(E,_):!0}function Jj(c,u,x){var v=!1,E=Mo,_=u.contextType;return typeof _=="object"&&_!==null?_=Vr(_):(E=ar(u)?Ci:Yn.current,v=u.contextTypes,_=(v=v!=null)?Ua(c,E):Mo),u=new u(x,_),c.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Nf,c.stateNode=u,u._reactInternals=c,v&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=E,c.__reactInternalMemoizedMaskedChildContext=_),u}function Zj(c,u,x,v){c=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(x,v),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(x,v),u.state!==c&&Nf.enqueueReplaceState(u,u.state,null)}function Jg(c,u,x,v){var E=c.stateNode;E.props=x,E.state=c.memoizedState,E.refs={},Og(c);var _=u.contextType;typeof _=="object"&&_!==null?E.context=Vr(_):(_=ar(u)?Ci:Yn.current,E.context=Ua(c,_)),E.state=c.memoizedState,_=u.getDerivedStateFromProps,typeof _=="function"&&(Qg(c,u,_,x),E.state=c.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(u=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),u!==E.state&&Nf.enqueueReplaceState(E,E.state,null),yf(c,x,E,v),E.state=c.memoizedState),typeof E.componentDidMount=="function"&&(c.flags|=4194308)}function Xa(c,u){try{var x="",v=u;do x+=ne(v),v=v.return;while(v);var E=x}catch(_){E=`
|
|
39
|
+
Error generating stack: `+_.message+`
|
|
40
|
+
`+_.stack}return{value:c,source:u,stack:E,digest:null}}function Zg(c,u,x){return{value:c,source:null,stack:x??null,digest:u??null}}function ex(c,u){try{console.error(u.value)}catch(x){setTimeout(function(){throw x})}}var X$=typeof WeakMap=="function"?WeakMap:Map;function ek(c,u,x){x=lo(-1,x),x.tag=3,x.payload={element:null};var v=u.value;return x.callback=function(){_f||(_f=!0,mx=v),ex(c,u)},x}function tk(c,u,x){x=lo(-1,x),x.tag=3;var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var E=u.value;x.payload=function(){return v(E)},x.callback=function(){ex(c,u)}}var _=c.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(x.callback=function(){ex(c,u),typeof v!="function"&&(Bo===null?Bo=new Set([this]):Bo.add(this));var K=u.stack;this.componentDidCatch(u.value,{componentStack:K!==null?K:""})}),x}function nk(c,u,x){var v=c.pingCache;if(v===null){v=c.pingCache=new X$;var E=new Set;v.set(u,E)}else E=v.get(u),E===void 0&&(E=new Set,v.set(u,E));E.has(x)||(E.add(x),c=uI.bind(null,c,u,x),u.then(c,c))}function rk(c){do{var u;if((u=c.tag===13)&&(u=c.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return c;c=c.return}while(c!==null);return null}function sk(c,u,x,v,E){return(c.mode&1)===0?(c===u?c.flags|=65536:(c.flags|=128,x.flags|=131072,x.flags&=-52805,x.tag===1&&(x.alternate===null?x.tag=17:(u=lo(-1,1),u.tag=2,Fo(x,u,1))),x.lanes|=1),c):(c.flags|=65536,c.lanes=E,c)}var Q$=C.ReactCurrentOwner,lr=!1;function tr(c,u,x,v){u.child=c===null?Sj(u,null,x,v):qa(u,c.child,x,v)}function ok(c,u,x,v,E){x=x.render;var _=u.ref;return Ga(u,E),v=Wg(c,u,x,v,_,E),x=qg(),c!==null&&!lr?(u.updateQueue=c.updateQueue,u.flags&=-2053,c.lanes&=~E,co(c,u,E)):(nn&&x&&Tg(u),u.flags|=1,tr(c,u,v,E),u.child)}function ik(c,u,x,v,E){if(c===null){var _=x.type;return typeof _=="function"&&!jx(_)&&_.defaultProps===void 0&&x.compare===null&&x.defaultProps===void 0?(u.tag=15,u.type=_,ak(c,u,_,v,E)):(c=Of(x.type,null,v,u,u.mode,E),c.ref=u.ref,c.return=u,u.child=c)}if(_=c.child,(c.lanes&E)===0){var K=_.memoizedProps;if(x=x.compare,x=x!==null?x:zc,x(K,v)&&c.ref===u.ref)return co(c,u,E)}return u.flags|=1,c=Wo(_,v),c.ref=u.ref,c.return=u,u.child=c}function ak(c,u,x,v,E){if(c!==null){var _=c.memoizedProps;if(zc(_,v)&&c.ref===u.ref)if(lr=!1,u.pendingProps=v=_,(c.lanes&E)!==0)(c.flags&131072)!==0&&(lr=!0);else return u.lanes=c.lanes,co(c,u,E)}return tx(c,u,x,v,E)}function lk(c,u,x){var v=u.pendingProps,E=v.children,_=c!==null?c.memoizedState:null;if(v.mode==="hidden")if((u.mode&1)===0)u.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ht(Ja,Cr),Cr|=x;else{if((x&1073741824)===0)return c=_!==null?_.baseLanes|x:x,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:c,cachePool:null,transitions:null},u.updateQueue=null,Ht(Ja,Cr),Cr|=c,null;u.memoizedState={baseLanes:0,cachePool:null,transitions:null},v=_!==null?_.baseLanes:x,Ht(Ja,Cr),Cr|=v}else _!==null?(v=_.baseLanes|x,u.memoizedState=null):v=x,Ht(Ja,Cr),Cr|=v;return tr(c,u,E,x),u.child}function ck(c,u){var x=u.ref;(c===null&&x!==null||c!==null&&c.ref!==x)&&(u.flags|=512,u.flags|=2097152)}function tx(c,u,x,v,E){var _=ar(x)?Ci:Yn.current;return _=Ua(u,_),Ga(u,E),x=Wg(c,u,x,v,_,E),v=qg(),c!==null&&!lr?(u.updateQueue=c.updateQueue,u.flags&=-2053,c.lanes&=~E,co(c,u,E)):(nn&&v&&Tg(u),u.flags|=1,tr(c,u,x,E),u.child)}function uk(c,u,x,v,E){if(ar(x)){var _=!0;cf(u)}else _=!1;if(Ga(u,E),u.stateNode===null)Ef(c,u),Jj(u,x,v),Jg(u,x,v,E),v=!0;else if(c===null){var K=u.stateNode,X=u.memoizedProps;K.props=X;var re=K.context,xe=x.contextType;typeof xe=="object"&&xe!==null?xe=Vr(xe):(xe=ar(x)?Ci:Yn.current,xe=Ua(u,xe));var Ae=x.getDerivedStateFromProps,De=typeof Ae=="function"||typeof K.getSnapshotBeforeUpdate=="function";De||typeof K.UNSAFE_componentWillReceiveProps!="function"&&typeof K.componentWillReceiveProps!="function"||(X!==v||re!==xe)&&Zj(u,K,v,xe),Oo=!1;var Re=u.memoizedState;K.state=Re,yf(u,v,K,E),re=u.memoizedState,X!==v||Re!==re||ir.current||Oo?(typeof Ae=="function"&&(Qg(u,x,Ae,v),re=u.memoizedState),(X=Oo||Qj(u,x,X,v,Re,re,xe))?(De||typeof K.UNSAFE_componentWillMount!="function"&&typeof K.componentWillMount!="function"||(typeof K.componentWillMount=="function"&&K.componentWillMount(),typeof K.UNSAFE_componentWillMount=="function"&&K.UNSAFE_componentWillMount()),typeof K.componentDidMount=="function"&&(u.flags|=4194308)):(typeof K.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=v,u.memoizedState=re),K.props=v,K.state=re,K.context=xe,v=X):(typeof K.componentDidMount=="function"&&(u.flags|=4194308),v=!1)}else{K=u.stateNode,Cj(c,u),X=u.memoizedProps,xe=u.type===u.elementType?X:is(u.type,X),K.props=xe,De=u.pendingProps,Re=K.context,re=x.contextType,typeof re=="object"&&re!==null?re=Vr(re):(re=ar(x)?Ci:Yn.current,re=Ua(u,re));var Ge=x.getDerivedStateFromProps;(Ae=typeof Ge=="function"||typeof K.getSnapshotBeforeUpdate=="function")||typeof K.UNSAFE_componentWillReceiveProps!="function"&&typeof K.componentWillReceiveProps!="function"||(X!==De||Re!==re)&&Zj(u,K,v,re),Oo=!1,Re=u.memoizedState,K.state=Re,yf(u,v,K,E);var Ze=u.memoizedState;X!==De||Re!==Ze||ir.current||Oo?(typeof Ge=="function"&&(Qg(u,x,Ge,v),Ze=u.memoizedState),(xe=Oo||Qj(u,x,xe,v,Re,Ze,re)||!1)?(Ae||typeof K.UNSAFE_componentWillUpdate!="function"&&typeof K.componentWillUpdate!="function"||(typeof K.componentWillUpdate=="function"&&K.componentWillUpdate(v,Ze,re),typeof K.UNSAFE_componentWillUpdate=="function"&&K.UNSAFE_componentWillUpdate(v,Ze,re)),typeof K.componentDidUpdate=="function"&&(u.flags|=4),typeof K.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof K.componentDidUpdate!="function"||X===c.memoizedProps&&Re===c.memoizedState||(u.flags|=4),typeof K.getSnapshotBeforeUpdate!="function"||X===c.memoizedProps&&Re===c.memoizedState||(u.flags|=1024),u.memoizedProps=v,u.memoizedState=Ze),K.props=v,K.state=Ze,K.context=re,v=xe):(typeof K.componentDidUpdate!="function"||X===c.memoizedProps&&Re===c.memoizedState||(u.flags|=4),typeof K.getSnapshotBeforeUpdate!="function"||X===c.memoizedProps&&Re===c.memoizedState||(u.flags|=1024),v=!1)}return nx(c,u,x,v,_,E)}function nx(c,u,x,v,E,_){ck(c,u);var K=(u.flags&128)!==0;if(!v&&!K)return E&&mj(u,x,!1),co(c,u,_);v=u.stateNode,Q$.current=u;var X=K&&typeof x.getDerivedStateFromError!="function"?null:v.render();return u.flags|=1,c!==null&&K?(u.child=qa(u,c.child,null,_),u.child=qa(u,null,X,_)):tr(c,u,X,_),u.memoizedState=v.state,E&&mj(u,x,!0),u.child}function dk(c){var u=c.stateNode;u.pendingContext?pj(c,u.pendingContext,u.pendingContext!==u.context):u.context&&pj(c,u.context,!1),Fg(c,u.containerInfo)}function fk(c,u,x,v,E){return Wa(),_g(E),u.flags|=256,tr(c,u,x,v),u.child}var rx={dehydrated:null,treeContext:null,retryLane:0};function sx(c){return{baseLanes:c,cachePool:null,transitions:null}}function pk(c,u,x){var v=u.pendingProps,E=an.current,_=!1,K=(u.flags&128)!==0,X;if((X=K)||(X=c!==null&&c.memoizedState===null?!1:(E&2)!==0),X?(_=!0,u.flags&=-129):(c===null||c.memoizedState!==null)&&(E|=1),Ht(an,E&1),c===null)return Pg(u),c=u.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?((u.mode&1)===0?u.lanes=1:c.data==="$!"?u.lanes=8:u.lanes=1073741824,null):(K=v.children,c=v.fallback,_?(v=u.mode,_=u.child,K={mode:"hidden",children:K},(v&1)===0&&_!==null?(_.childLanes=0,_.pendingProps=K):_=Ff(K,v,0,null),c=Mi(c,v,x,null),_.return=u,c.return=u,_.sibling=c,u.child=_,u.child.memoizedState=sx(x),u.memoizedState=rx,c):ox(u,K));if(E=c.memoizedState,E!==null&&(X=E.dehydrated,X!==null))return J$(c,u,K,v,X,E,x);if(_){_=v.fallback,K=u.mode,E=c.child,X=E.sibling;var re={mode:"hidden",children:v.children};return(K&1)===0&&u.child!==E?(v=u.child,v.childLanes=0,v.pendingProps=re,u.deletions=null):(v=Wo(E,re),v.subtreeFlags=E.subtreeFlags&14680064),X!==null?_=Wo(X,_):(_=Mi(_,K,x,null),_.flags|=2),_.return=u,v.return=u,v.sibling=_,u.child=v,v=_,_=u.child,K=c.child.memoizedState,K=K===null?sx(x):{baseLanes:K.baseLanes|x,cachePool:null,transitions:K.transitions},_.memoizedState=K,_.childLanes=c.childLanes&~x,u.memoizedState=rx,v}return _=c.child,c=_.sibling,v=Wo(_,{mode:"visible",children:v.children}),(u.mode&1)===0&&(v.lanes=x),v.return=u,v.sibling=null,c!==null&&(x=u.deletions,x===null?(u.deletions=[c],u.flags|=16):x.push(c)),u.child=v,u.memoizedState=null,v}function ox(c,u){return u=Ff({mode:"visible",children:u},c.mode,0,null),u.return=c,c.child=u}function Cf(c,u,x,v){return v!==null&&_g(v),qa(u,c.child,null,x),c=ox(u,u.pendingProps.children),c.flags|=2,u.memoizedState=null,c}function J$(c,u,x,v,E,_,K){if(x)return u.flags&256?(u.flags&=-257,v=Zg(Error(n(422))),Cf(c,u,K,v)):u.memoizedState!==null?(u.child=c.child,u.flags|=128,null):(_=v.fallback,E=u.mode,v=Ff({mode:"visible",children:v.children},E,0,null),_=Mi(_,E,K,null),_.flags|=2,v.return=u,_.return=u,v.sibling=_,u.child=v,(u.mode&1)!==0&&qa(u,c.child,null,K),u.child.memoizedState=sx(K),u.memoizedState=rx,_);if((u.mode&1)===0)return Cf(c,u,K,null);if(E.data==="$!"){if(v=E.nextSibling&&E.nextSibling.dataset,v)var X=v.dgst;return v=X,_=Error(n(419)),v=Zg(_,v,void 0),Cf(c,u,K,v)}if(X=(K&c.childLanes)!==0,lr||X){if(v=On,v!==null){switch(K&-K){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&(v.suspendedLanes|K))!==0?0:E,E!==0&&E!==_.retryLane&&(_.retryLane=E,ao(c,E),cs(v,c,E,-1))}return wx(),v=Zg(Error(n(421))),Cf(c,u,K,v)}return E.data==="$?"?(u.flags|=128,u.child=c.child,u=dI.bind(null,c),E._reactRetry=u,null):(c=_.treeContext,Nr=$o(E.nextSibling),Sr=u,nn=!0,os=null,c!==null&&(Ur[Hr++]=oo,Ur[Hr++]=io,Ur[Hr++]=Ei,oo=c.id,io=c.overflow,Ei=u),u=ox(u,v.children),u.flags|=4096,u)}function hk(c,u,x){c.lanes|=u;var v=c.alternate;v!==null&&(v.lanes|=u),Mg(c.return,u,x)}function ix(c,u,x,v,E){var _=c.memoizedState;_===null?c.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:v,tail:x,tailMode:E}:(_.isBackwards=u,_.rendering=null,_.renderingStartTime=0,_.last=v,_.tail=x,_.tailMode=E)}function mk(c,u,x){var v=u.pendingProps,E=v.revealOrder,_=v.tail;if(tr(c,u,v.children,x),v=an.current,(v&2)!==0)v=v&1|2,u.flags|=128;else{if(c!==null&&(c.flags&128)!==0)e:for(c=u.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&hk(c,x,u);else if(c.tag===19)hk(c,x,u);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===u)break e;for(;c.sibling===null;){if(c.return===null||c.return===u)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}v&=1}if(Ht(an,v),(u.mode&1)===0)u.memoizedState=null;else switch(E){case"forwards":for(x=u.child,E=null;x!==null;)c=x.alternate,c!==null&&bf(c)===null&&(E=x),x=x.sibling;x=E,x===null?(E=u.child,u.child=null):(E=x.sibling,x.sibling=null),ix(u,!1,E,x,_);break;case"backwards":for(x=null,E=u.child,u.child=null;E!==null;){if(c=E.alternate,c!==null&&bf(c)===null){u.child=E;break}c=E.sibling,E.sibling=x,x=E,E=c}ix(u,!0,x,null,_);break;case"together":ix(u,!1,null,null,void 0);break;default:u.memoizedState=null}return u.child}function Ef(c,u){(u.mode&1)===0&&c!==null&&(c.alternate=null,u.alternate=null,u.flags|=2)}function co(c,u,x){if(c!==null&&(u.dependencies=c.dependencies),_i|=u.lanes,(x&u.childLanes)===0)return null;if(c!==null&&u.child!==c.child)throw Error(n(153));if(u.child!==null){for(c=u.child,x=Wo(c,c.pendingProps),u.child=x,x.return=u;c.sibling!==null;)c=c.sibling,x=x.sibling=Wo(c,c.pendingProps),x.return=u;x.sibling=null}return u.child}function Z$(c,u,x){switch(u.tag){case 3:dk(u),Wa();break;case 5:Rj(u);break;case 1:ar(u.type)&&cf(u);break;case 4:Fg(u,u.stateNode.containerInfo);break;case 10:var v=u.type._context,E=u.memoizedProps.value;Ht(mf,v._currentValue),v._currentValue=E;break;case 13:if(v=u.memoizedState,v!==null)return v.dehydrated!==null?(Ht(an,an.current&1),u.flags|=128,null):(x&u.child.childLanes)!==0?pk(c,u,x):(Ht(an,an.current&1),c=co(c,u,x),c!==null?c.sibling:null);Ht(an,an.current&1);break;case 19:if(v=(x&u.childLanes)!==0,(c.flags&128)!==0){if(v)return mk(c,u,x);u.flags|=128}if(E=u.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),Ht(an,an.current),v)break;return null;case 22:case 23:return u.lanes=0,lk(c,u,x)}return co(c,u,x)}var gk,ax,xk,yk;gk=function(c,u){for(var x=u.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===u)break;for(;x.sibling===null;){if(x.return===null||x.return===u)return;x=x.return}x.sibling.return=x.return,x=x.sibling}},ax=function(){},xk=function(c,u,x,v){var E=c.memoizedProps;if(E!==v){c=u.stateNode,Ai($s.current);var _=null;switch(x){case"input":E=Be(c,E),v=Be(c,v),_=[];break;case"select":E=M({},E,{value:void 0}),v=M({},v,{value:void 0}),_=[];break;case"textarea":E=qe(c,E),v=qe(c,v),_=[];break;default:typeof E.onClick!="function"&&typeof v.onClick=="function"&&(c.onclick=of)}Ke(x,v);var K;x=null;for(xe in E)if(!v.hasOwnProperty(xe)&&E.hasOwnProperty(xe)&&E[xe]!=null)if(xe==="style"){var X=E[xe];for(K in X)X.hasOwnProperty(K)&&(x||(x={}),x[K]="")}else xe!=="dangerouslySetInnerHTML"&&xe!=="children"&&xe!=="suppressContentEditableWarning"&&xe!=="suppressHydrationWarning"&&xe!=="autoFocus"&&(o.hasOwnProperty(xe)?_||(_=[]):(_=_||[]).push(xe,null));for(xe in v){var re=v[xe];if(X=E!=null?E[xe]:void 0,v.hasOwnProperty(xe)&&re!==X&&(re!=null||X!=null))if(xe==="style")if(X){for(K in X)!X.hasOwnProperty(K)||re&&re.hasOwnProperty(K)||(x||(x={}),x[K]="");for(K in re)re.hasOwnProperty(K)&&X[K]!==re[K]&&(x||(x={}),x[K]=re[K])}else x||(_||(_=[]),_.push(xe,x)),x=re;else xe==="dangerouslySetInnerHTML"?(re=re?re.__html:void 0,X=X?X.__html:void 0,re!=null&&X!==re&&(_=_||[]).push(xe,re)):xe==="children"?typeof re!="string"&&typeof re!="number"||(_=_||[]).push(xe,""+re):xe!=="suppressContentEditableWarning"&&xe!=="suppressHydrationWarning"&&(o.hasOwnProperty(xe)?(re!=null&&xe==="onScroll"&&Gt("scroll",c),_||X===re||(_=[])):(_=_||[]).push(xe,re))}x&&(_=_||[]).push("style",x);var xe=_;(u.updateQueue=xe)&&(u.flags|=4)}},yk=function(c,u,x,v){x!==v&&(u.flags|=4)};function tu(c,u){if(!nn)switch(c.tailMode){case"hidden":u=c.tail;for(var x=null;u!==null;)u.alternate!==null&&(x=u),u=u.sibling;x===null?c.tail=null:x.sibling=null;break;case"collapsed":x=c.tail;for(var v=null;x!==null;)x.alternate!==null&&(v=x),x=x.sibling;v===null?u||c.tail===null?c.tail=null:c.tail.sibling=null:v.sibling=null}}function Qn(c){var u=c.alternate!==null&&c.alternate.child===c.child,x=0,v=0;if(u)for(var E=c.child;E!==null;)x|=E.lanes|E.childLanes,v|=E.subtreeFlags&14680064,v|=E.flags&14680064,E.return=c,E=E.sibling;else for(E=c.child;E!==null;)x|=E.lanes|E.childLanes,v|=E.subtreeFlags,v|=E.flags,E.return=c,E=E.sibling;return c.subtreeFlags|=v,c.childLanes=x,u}function eI(c,u,x){var v=u.pendingProps;switch(Rg(u),u.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qn(u),null;case 1:return ar(u.type)&&lf(),Qn(u),null;case 3:return v=u.stateNode,Ya(),Yt(ir),Yt(Yn),Ug(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(c===null||c.child===null)&&(pf(u)?u.flags|=4:c===null||c.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,os!==null&&(yx(os),os=null))),ax(c,u),Qn(u),null;case 5:zg(u);var E=Ai(Xc.current);if(x=u.type,c!==null&&u.stateNode!=null)xk(c,u,x,v,E),c.ref!==u.ref&&(u.flags|=512,u.flags|=2097152);else{if(!v){if(u.stateNode===null)throw Error(n(166));return Qn(u),null}if(c=Ai($s.current),pf(u)){v=u.stateNode,x=u.type;var _=u.memoizedProps;switch(v[Ds]=u,v[Wc]=_,c=(u.mode&1)!==0,x){case"dialog":Gt("cancel",v),Gt("close",v);break;case"iframe":case"object":case"embed":Gt("load",v);break;case"video":case"audio":for(E=0;E<Uc.length;E++)Gt(Uc[E],v);break;case"source":Gt("error",v);break;case"img":case"image":case"link":Gt("error",v),Gt("load",v);break;case"details":Gt("toggle",v);break;case"input":oe(v,_),Gt("invalid",v);break;case"select":v._wrapperState={wasMultiple:!!_.multiple},Gt("invalid",v);break;case"textarea":vt(v,_),Gt("invalid",v)}Ke(x,_),E=null;for(var K in _)if(_.hasOwnProperty(K)){var X=_[K];K==="children"?typeof X=="string"?v.textContent!==X&&(_.suppressHydrationWarning!==!0&&sf(v.textContent,X,c),E=["children",X]):typeof X=="number"&&v.textContent!==""+X&&(_.suppressHydrationWarning!==!0&&sf(v.textContent,X,c),E=["children",""+X]):o.hasOwnProperty(K)&&X!=null&&K==="onScroll"&&Gt("scroll",v)}switch(x){case"input":Ee(v),_e(v,_,!0);break;case"textarea":Ee(v),st(v);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(v.onclick=of)}v=E,u.updateQueue=v,v!==null&&(u.flags|=4)}else{K=E.nodeType===9?E:E.ownerDocument,c==="http://www.w3.org/1999/xhtml"&&(c=le(x)),c==="http://www.w3.org/1999/xhtml"?x==="script"?(c=K.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild)):typeof v.is=="string"?c=K.createElement(x,{is:v.is}):(c=K.createElement(x),x==="select"&&(K=c,v.multiple?K.multiple=!0:v.size&&(K.size=v.size))):c=K.createElementNS(c,x),c[Ds]=u,c[Wc]=v,gk(c,u,!1,!1),u.stateNode=c;e:{switch(K=de(x,v),x){case"dialog":Gt("cancel",c),Gt("close",c),E=v;break;case"iframe":case"object":case"embed":Gt("load",c),E=v;break;case"video":case"audio":for(E=0;E<Uc.length;E++)Gt(Uc[E],c);E=v;break;case"source":Gt("error",c),E=v;break;case"img":case"image":case"link":Gt("error",c),Gt("load",c),E=v;break;case"details":Gt("toggle",c),E=v;break;case"input":oe(c,v),E=Be(c,v),Gt("invalid",c);break;case"option":E=v;break;case"select":c._wrapperState={wasMultiple:!!v.multiple},E=M({},v,{value:void 0}),Gt("invalid",c);break;case"textarea":vt(c,v),E=qe(c,v),Gt("invalid",c);break;default:E=v}Ke(x,E),X=E;for(_ in X)if(X.hasOwnProperty(_)){var re=X[_];_==="style"?me(c,re):_==="dangerouslySetInnerHTML"?(re=re?re.__html:void 0,re!=null&&ie(c,re)):_==="children"?typeof re=="string"?(x!=="textarea"||re!=="")&&we(c,re):typeof re=="number"&&we(c,""+re):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(o.hasOwnProperty(_)?re!=null&&_==="onScroll"&&Gt("scroll",c):re!=null&&k(c,_,re,K))}switch(x){case"input":Ee(c),_e(c,v,!1);break;case"textarea":Ee(c),st(c);break;case"option":v.value!=null&&c.setAttribute("value",""+te(v.value));break;case"select":c.multiple=!!v.multiple,_=v.value,_!=null?Me(c,!!v.multiple,_,!1):v.defaultValue!=null&&Me(c,!!v.multiple,v.defaultValue,!0);break;default:typeof E.onClick=="function"&&(c.onclick=of)}switch(x){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}}v&&(u.flags|=4)}u.ref!==null&&(u.flags|=512,u.flags|=2097152)}return Qn(u),null;case 6:if(c&&u.stateNode!=null)yk(c,u,c.memoizedProps,v);else{if(typeof v!="string"&&u.stateNode===null)throw Error(n(166));if(x=Ai(Xc.current),Ai($s.current),pf(u)){if(v=u.stateNode,x=u.memoizedProps,v[Ds]=u,(_=v.nodeValue!==x)&&(c=Sr,c!==null))switch(c.tag){case 3:sf(v.nodeValue,x,(c.mode&1)!==0);break;case 5:c.memoizedProps.suppressHydrationWarning!==!0&&sf(v.nodeValue,x,(c.mode&1)!==0)}_&&(u.flags|=4)}else v=(x.nodeType===9?x:x.ownerDocument).createTextNode(v),v[Ds]=u,u.stateNode=v}return Qn(u),null;case 13:if(Yt(an),v=u.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(nn&&Nr!==null&&(u.mode&1)!==0&&(u.flags&128)===0)wj(),Wa(),u.flags|=98560,_=!1;else if(_=pf(u),v!==null&&v.dehydrated!==null){if(c===null){if(!_)throw Error(n(318));if(_=u.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));_[Ds]=u}else Wa(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),_=!1}else os!==null&&(yx(os),os=null),_=!0;if(!_)return u.flags&65536?u:null}return(u.flags&128)!==0?(u.lanes=x,u):(v=v!==null,v!==(c!==null&&c.memoizedState!==null)&&v&&(u.child.flags|=8192,(u.mode&1)!==0&&(c===null||(an.current&1)!==0?En===0&&(En=3):wx())),u.updateQueue!==null&&(u.flags|=4),Qn(u),null);case 4:return Ya(),ax(c,u),c===null&&Hc(u.stateNode.containerInfo),Qn(u),null;case 10:return Ig(u.type._context),Qn(u),null;case 17:return ar(u.type)&&lf(),Qn(u),null;case 19:if(Yt(an),_=u.memoizedState,_===null)return Qn(u),null;if(v=(u.flags&128)!==0,K=_.rendering,K===null)if(v)tu(_,!1);else{if(En!==0||c!==null&&(c.flags&128)!==0)for(c=u.child;c!==null;){if(K=bf(c),K!==null){for(u.flags|=128,tu(_,!1),v=K.updateQueue,v!==null&&(u.updateQueue=v,u.flags|=4),u.subtreeFlags=0,v=x,x=u.child;x!==null;)_=x,c=v,_.flags&=14680066,K=_.alternate,K===null?(_.childLanes=0,_.lanes=c,_.child=null,_.subtreeFlags=0,_.memoizedProps=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null,_.stateNode=null):(_.childLanes=K.childLanes,_.lanes=K.lanes,_.child=K.child,_.subtreeFlags=0,_.deletions=null,_.memoizedProps=K.memoizedProps,_.memoizedState=K.memoizedState,_.updateQueue=K.updateQueue,_.type=K.type,c=K.dependencies,_.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),x=x.sibling;return Ht(an,an.current&1|2),u.child}c=c.sibling}_.tail!==null&&Kt()>Za&&(u.flags|=128,v=!0,tu(_,!1),u.lanes=4194304)}else{if(!v)if(c=bf(K),c!==null){if(u.flags|=128,v=!0,x=c.updateQueue,x!==null&&(u.updateQueue=x,u.flags|=4),tu(_,!0),_.tail===null&&_.tailMode==="hidden"&&!K.alternate&&!nn)return Qn(u),null}else 2*Kt()-_.renderingStartTime>Za&&x!==1073741824&&(u.flags|=128,v=!0,tu(_,!1),u.lanes=4194304);_.isBackwards?(K.sibling=u.child,u.child=K):(x=_.last,x!==null?x.sibling=K:u.child=K,_.last=K)}return _.tail!==null?(u=_.tail,_.rendering=u,_.tail=u.sibling,_.renderingStartTime=Kt(),u.sibling=null,x=an.current,Ht(an,v?x&1|2:x&1),u):(Qn(u),null);case 22:case 23:return vx(),v=u.memoizedState!==null,c!==null&&c.memoizedState!==null!==v&&(u.flags|=8192),v&&(u.mode&1)!==0?(Cr&1073741824)!==0&&(Qn(u),u.subtreeFlags&6&&(u.flags|=8192)):Qn(u),null;case 24:return null;case 25:return null}throw Error(n(156,u.tag))}function tI(c,u){switch(Rg(u),u.tag){case 1:return ar(u.type)&&lf(),c=u.flags,c&65536?(u.flags=c&-65537|128,u):null;case 3:return Ya(),Yt(ir),Yt(Yn),Ug(),c=u.flags,(c&65536)!==0&&(c&128)===0?(u.flags=c&-65537|128,u):null;case 5:return zg(u),null;case 13:if(Yt(an),c=u.memoizedState,c!==null&&c.dehydrated!==null){if(u.alternate===null)throw Error(n(340));Wa()}return c=u.flags,c&65536?(u.flags=c&-65537|128,u):null;case 19:return Yt(an),null;case 4:return Ya(),null;case 10:return Ig(u.type._context),null;case 22:case 23:return vx(),null;case 24:return null;default:return null}}var Tf=!1,Jn=!1,nI=typeof WeakSet=="function"?WeakSet:Set,Xe=null;function Qa(c,u){var x=c.ref;if(x!==null)if(typeof x=="function")try{x(null)}catch(v){fn(c,u,v)}else x.current=null}function lx(c,u,x){try{x()}catch(v){fn(c,u,v)}}var bk=!1;function rI(c,u){if(vg=dn,c=Q0(),fg(c)){if("selectionStart"in c)var x={start:c.selectionStart,end:c.selectionEnd};else e:{x=(x=c.ownerDocument)&&x.defaultView||window;var v=x.getSelection&&x.getSelection();if(v&&v.rangeCount!==0){x=v.anchorNode;var E=v.anchorOffset,_=v.focusNode;v=v.focusOffset;try{x.nodeType,_.nodeType}catch{x=null;break e}var K=0,X=-1,re=-1,xe=0,Ae=0,De=c,Re=null;t:for(;;){for(var Ge;De!==x||E!==0&&De.nodeType!==3||(X=K+E),De!==_||v!==0&&De.nodeType!==3||(re=K+v),De.nodeType===3&&(K+=De.nodeValue.length),(Ge=De.firstChild)!==null;)Re=De,De=Ge;for(;;){if(De===c)break t;if(Re===x&&++xe===E&&(X=K),Re===_&&++Ae===v&&(re=K),(Ge=De.nextSibling)!==null)break;De=Re,Re=De.parentNode}De=Ge}x=X===-1||re===-1?null:{start:X,end:re}}else x=null}x=x||{start:0,end:0}}else x=null;for(wg={focusedElem:c,selectionRange:x},dn=!1,Xe=u;Xe!==null;)if(u=Xe,c=u.child,(u.subtreeFlags&1028)!==0&&c!==null)c.return=u,Xe=c;else for(;Xe!==null;){u=Xe;try{var Ze=u.alternate;if((u.flags&1024)!==0)switch(u.tag){case 0:case 11:case 15:break;case 1:if(Ze!==null){var tt=Ze.memoizedProps,hn=Ze.memoizedState,fe=u.stateNode,ae=fe.getSnapshotBeforeUpdate(u.elementType===u.type?tt:is(u.type,tt),hn);fe.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var he=u.stateNode.containerInfo;he.nodeType===1?he.textContent="":he.nodeType===9&&he.documentElement&&he.removeChild(he.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Fe){fn(u,u.return,Fe)}if(c=u.sibling,c!==null){c.return=u.return,Xe=c;break}Xe=u.return}return Ze=bk,bk=!1,Ze}function nu(c,u,x){var v=u.updateQueue;if(v=v!==null?v.lastEffect:null,v!==null){var E=v=v.next;do{if((E.tag&c)===c){var _=E.destroy;E.destroy=void 0,_!==void 0&&lx(u,x,_)}E=E.next}while(E!==v)}}function Rf(c,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var x=u=u.next;do{if((x.tag&c)===c){var v=x.create;x.destroy=v()}x=x.next}while(x!==u)}}function cx(c){var u=c.ref;if(u!==null){var x=c.stateNode;switch(c.tag){case 5:c=x;break;default:c=x}typeof u=="function"?u(c):u.current=c}}function vk(c){var u=c.alternate;u!==null&&(c.alternate=null,vk(u)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(u=c.stateNode,u!==null&&(delete u[Ds],delete u[Wc],delete u[Ng],delete u[F$],delete u[z$])),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 wk(c){return c.tag===5||c.tag===3||c.tag===4}function jk(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||wk(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 ux(c,u,x){var v=c.tag;if(v===5||v===6)c=c.stateNode,u?x.nodeType===8?x.parentNode.insertBefore(c,u):x.insertBefore(c,u):(x.nodeType===8?(u=x.parentNode,u.insertBefore(c,x)):(u=x,u.appendChild(c)),x=x._reactRootContainer,x!=null||u.onclick!==null||(u.onclick=of));else if(v!==4&&(c=c.child,c!==null))for(ux(c,u,x),c=c.sibling;c!==null;)ux(c,u,x),c=c.sibling}function dx(c,u,x){var v=c.tag;if(v===5||v===6)c=c.stateNode,u?x.insertBefore(c,u):x.appendChild(c);else if(v!==4&&(c=c.child,c!==null))for(dx(c,u,x),c=c.sibling;c!==null;)dx(c,u,x),c=c.sibling}var Vn=null,as=!1;function zo(c,u,x){for(x=x.child;x!==null;)kk(c,u,x),x=x.sibling}function kk(c,u,x){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(To,x)}catch{}switch(x.tag){case 5:Jn||Qa(x,u);case 6:var v=Vn,E=as;Vn=null,zo(c,u,x),Vn=v,as=E,Vn!==null&&(as?(c=Vn,x=x.stateNode,c.nodeType===8?c.parentNode.removeChild(x):c.removeChild(x)):Vn.removeChild(x.stateNode));break;case 18:Vn!==null&&(as?(c=Vn,x=x.stateNode,c.nodeType===8?Sg(c.parentNode,x):c.nodeType===1&&Sg(c,x),Mn(c)):Sg(Vn,x.stateNode));break;case 4:v=Vn,E=as,Vn=x.stateNode.containerInfo,as=!0,zo(c,u,x),Vn=v,as=E;break;case 0:case 11:case 14:case 15:if(!Jn&&(v=x.updateQueue,v!==null&&(v=v.lastEffect,v!==null))){E=v=v.next;do{var _=E,K=_.destroy;_=_.tag,K!==void 0&&((_&2)!==0||(_&4)!==0)&&lx(x,u,K),E=E.next}while(E!==v)}zo(c,u,x);break;case 1:if(!Jn&&(Qa(x,u),v=x.stateNode,typeof v.componentWillUnmount=="function"))try{v.props=x.memoizedProps,v.state=x.memoizedState,v.componentWillUnmount()}catch(X){fn(x,u,X)}zo(c,u,x);break;case 21:zo(c,u,x);break;case 22:x.mode&1?(Jn=(v=Jn)||x.memoizedState!==null,zo(c,u,x),Jn=v):zo(c,u,x);break;default:zo(c,u,x)}}function Sk(c){var u=c.updateQueue;if(u!==null){c.updateQueue=null;var x=c.stateNode;x===null&&(x=c.stateNode=new nI),u.forEach(function(v){var E=fI.bind(null,c,v);x.has(v)||(x.add(v),v.then(E,E))})}}function ls(c,u){var x=u.deletions;if(x!==null)for(var v=0;v<x.length;v++){var E=x[v];try{var _=c,K=u,X=K;e:for(;X!==null;){switch(X.tag){case 5:Vn=X.stateNode,as=!1;break e;case 3:Vn=X.stateNode.containerInfo,as=!0;break e;case 4:Vn=X.stateNode.containerInfo,as=!0;break e}X=X.return}if(Vn===null)throw Error(n(160));kk(_,K,E),Vn=null,as=!1;var re=E.alternate;re!==null&&(re.return=null),E.return=null}catch(xe){fn(E,u,xe)}}if(u.subtreeFlags&12854)for(u=u.child;u!==null;)Nk(u,c),u=u.sibling}function Nk(c,u){var x=c.alternate,v=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:if(ls(u,c),Ms(c),v&4){try{nu(3,c,c.return),Rf(3,c)}catch(tt){fn(c,c.return,tt)}try{nu(5,c,c.return)}catch(tt){fn(c,c.return,tt)}}break;case 1:ls(u,c),Ms(c),v&512&&x!==null&&Qa(x,x.return);break;case 5:if(ls(u,c),Ms(c),v&512&&x!==null&&Qa(x,x.return),c.flags&32){var E=c.stateNode;try{we(E,"")}catch(tt){fn(c,c.return,tt)}}if(v&4&&(E=c.stateNode,E!=null)){var _=c.memoizedProps,K=x!==null?x.memoizedProps:_,X=c.type,re=c.updateQueue;if(c.updateQueue=null,re!==null)try{X==="input"&&_.type==="radio"&&_.name!=null&&je(E,_),de(X,K);var xe=de(X,_);for(K=0;K<re.length;K+=2){var Ae=re[K],De=re[K+1];Ae==="style"?me(E,De):Ae==="dangerouslySetInnerHTML"?ie(E,De):Ae==="children"?we(E,De):k(E,Ae,De,xe)}switch(X){case"input":ke(E,_);break;case"textarea":ft(E,_);break;case"select":var Re=E._wrapperState.wasMultiple;E._wrapperState.wasMultiple=!!_.multiple;var Ge=_.value;Ge!=null?Me(E,!!_.multiple,Ge,!1):Re!==!!_.multiple&&(_.defaultValue!=null?Me(E,!!_.multiple,_.defaultValue,!0):Me(E,!!_.multiple,_.multiple?[]:"",!1))}E[Wc]=_}catch(tt){fn(c,c.return,tt)}}break;case 6:if(ls(u,c),Ms(c),v&4){if(c.stateNode===null)throw Error(n(162));E=c.stateNode,_=c.memoizedProps;try{E.nodeValue=_}catch(tt){fn(c,c.return,tt)}}break;case 3:if(ls(u,c),Ms(c),v&4&&x!==null&&x.memoizedState.isDehydrated)try{Mn(u.containerInfo)}catch(tt){fn(c,c.return,tt)}break;case 4:ls(u,c),Ms(c);break;case 13:ls(u,c),Ms(c),E=c.child,E.flags&8192&&(_=E.memoizedState!==null,E.stateNode.isHidden=_,!_||E.alternate!==null&&E.alternate.memoizedState!==null||(hx=Kt())),v&4&&Sk(c);break;case 22:if(Ae=x!==null&&x.memoizedState!==null,c.mode&1?(Jn=(xe=Jn)||Ae,ls(u,c),Jn=xe):ls(u,c),Ms(c),v&8192){if(xe=c.memoizedState!==null,(c.stateNode.isHidden=xe)&&!Ae&&(c.mode&1)!==0)for(Xe=c,Ae=c.child;Ae!==null;){for(De=Xe=Ae;Xe!==null;){switch(Re=Xe,Ge=Re.child,Re.tag){case 0:case 11:case 14:case 15:nu(4,Re,Re.return);break;case 1:Qa(Re,Re.return);var Ze=Re.stateNode;if(typeof Ze.componentWillUnmount=="function"){v=Re,x=Re.return;try{u=v,Ze.props=u.memoizedProps,Ze.state=u.memoizedState,Ze.componentWillUnmount()}catch(tt){fn(v,x,tt)}}break;case 5:Qa(Re,Re.return);break;case 22:if(Re.memoizedState!==null){Tk(De);continue}}Ge!==null?(Ge.return=Re,Xe=Ge):Tk(De)}Ae=Ae.sibling}e:for(Ae=null,De=c;;){if(De.tag===5){if(Ae===null){Ae=De;try{E=De.stateNode,xe?(_=E.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(X=De.stateNode,re=De.memoizedProps.style,K=re!=null&&re.hasOwnProperty("display")?re.display:null,X.style.display=se("display",K))}catch(tt){fn(c,c.return,tt)}}}else if(De.tag===6){if(Ae===null)try{De.stateNode.nodeValue=xe?"":De.memoizedProps}catch(tt){fn(c,c.return,tt)}}else if((De.tag!==22&&De.tag!==23||De.memoizedState===null||De===c)&&De.child!==null){De.child.return=De,De=De.child;continue}if(De===c)break e;for(;De.sibling===null;){if(De.return===null||De.return===c)break e;Ae===De&&(Ae=null),De=De.return}Ae===De&&(Ae=null),De.sibling.return=De.return,De=De.sibling}}break;case 19:ls(u,c),Ms(c),v&4&&Sk(c);break;case 21:break;default:ls(u,c),Ms(c)}}function Ms(c){var u=c.flags;if(u&2){try{e:{for(var x=c.return;x!==null;){if(wk(x)){var v=x;break e}x=x.return}throw Error(n(160))}switch(v.tag){case 5:var E=v.stateNode;v.flags&32&&(we(E,""),v.flags&=-33);var _=jk(c);dx(c,_,E);break;case 3:case 4:var K=v.stateNode.containerInfo,X=jk(c);ux(c,X,K);break;default:throw Error(n(161))}}catch(re){fn(c,c.return,re)}c.flags&=-3}u&4096&&(c.flags&=-4097)}function sI(c,u,x){Xe=c,Ck(c)}function Ck(c,u,x){for(var v=(c.mode&1)!==0;Xe!==null;){var E=Xe,_=E.child;if(E.tag===22&&v){var K=E.memoizedState!==null||Tf;if(!K){var X=E.alternate,re=X!==null&&X.memoizedState!==null||Jn;X=Tf;var xe=Jn;if(Tf=K,(Jn=re)&&!xe)for(Xe=E;Xe!==null;)K=Xe,re=K.child,K.tag===22&&K.memoizedState!==null?Rk(E):re!==null?(re.return=K,Xe=re):Rk(E);for(;_!==null;)Xe=_,Ck(_),_=_.sibling;Xe=E,Tf=X,Jn=xe}Ek(c)}else(E.subtreeFlags&8772)!==0&&_!==null?(_.return=E,Xe=_):Ek(c)}}function Ek(c){for(;Xe!==null;){var u=Xe;if((u.flags&8772)!==0){var x=u.alternate;try{if((u.flags&8772)!==0)switch(u.tag){case 0:case 11:case 15:Jn||Rf(5,u);break;case 1:var v=u.stateNode;if(u.flags&4&&!Jn)if(x===null)v.componentDidMount();else{var E=u.elementType===u.type?x.memoizedProps:is(u.type,x.memoizedProps);v.componentDidUpdate(E,x.memoizedState,v.__reactInternalSnapshotBeforeUpdate)}var _=u.updateQueue;_!==null&&Tj(u,_,v);break;case 3:var K=u.updateQueue;if(K!==null){if(x=null,u.child!==null)switch(u.child.tag){case 5:x=u.child.stateNode;break;case 1:x=u.child.stateNode}Tj(u,K,x)}break;case 5:var X=u.stateNode;if(x===null&&u.flags&4){x=X;var re=u.memoizedProps;switch(u.type){case"button":case"input":case"select":case"textarea":re.autoFocus&&x.focus();break;case"img":re.src&&(x.src=re.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(u.memoizedState===null){var xe=u.alternate;if(xe!==null){var Ae=xe.memoizedState;if(Ae!==null){var De=Ae.dehydrated;De!==null&&Mn(De)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Jn||u.flags&512&&cx(u)}catch(Re){fn(u,u.return,Re)}}if(u===c){Xe=null;break}if(x=u.sibling,x!==null){x.return=u.return,Xe=x;break}Xe=u.return}}function Tk(c){for(;Xe!==null;){var u=Xe;if(u===c){Xe=null;break}var x=u.sibling;if(x!==null){x.return=u.return,Xe=x;break}Xe=u.return}}function Rk(c){for(;Xe!==null;){var u=Xe;try{switch(u.tag){case 0:case 11:case 15:var x=u.return;try{Rf(4,u)}catch(re){fn(u,x,re)}break;case 1:var v=u.stateNode;if(typeof v.componentDidMount=="function"){var E=u.return;try{v.componentDidMount()}catch(re){fn(u,E,re)}}var _=u.return;try{cx(u)}catch(re){fn(u,_,re)}break;case 5:var K=u.return;try{cx(u)}catch(re){fn(u,K,re)}}}catch(re){fn(u,u.return,re)}if(u===c){Xe=null;break}var X=u.sibling;if(X!==null){X.return=u.return,Xe=X;break}Xe=u.return}}var oI=Math.ceil,Af=C.ReactCurrentDispatcher,fx=C.ReactCurrentOwner,qr=C.ReactCurrentBatchConfig,At=0,On=null,xn=null,Wn=0,Cr=0,Ja=Io(0),En=0,ru=null,_i=0,Pf=0,px=0,su=null,cr=null,hx=0,Za=1/0,uo=null,_f=!1,mx=null,Bo=null,Df=!1,Uo=null,$f=0,ou=0,gx=null,If=-1,Mf=0;function nr(){return(At&6)!==0?Kt():If!==-1?If:If=Kt()}function Ho(c){return(c.mode&1)===0?1:(At&2)!==0&&Wn!==0?Wn&-Wn:U$.transition!==null?(Mf===0&&(Mf=wi()),Mf):(c=Mt,c!==0||(c=window.event,c=c===void 0?16:P0(c.type)),c)}function cs(c,u,x,v){if(50<ou)throw ou=0,gx=null,Error(n(185));wr(c,x,v),((At&2)===0||c!==On)&&(c===On&&((At&2)===0&&(Pf|=x),En===4&&Vo(c,Wn)),ur(c,v),x===1&&At===0&&(u.mode&1)===0&&(Za=Kt()+500,uf&&Lo()))}function ur(c,u){var x=c.callbackNode;vi(c,u);var v=zr(c,c===On?Wn:0);if(v===0)x!==null&&Sa(x),c.callbackNode=null,c.callbackPriority=0;else if(u=v&-v,c.callbackPriority!==u){if(x!=null&&Sa(x),u===1)c.tag===0?B$(Pk.bind(null,c)):gj(Pk.bind(null,c)),L$(function(){(At&6)===0&&Lo()}),x=null;else{switch(_c(v)){case 1:x=bi;break;case 4:x=Ca;break;case 16:x=Es;break;case 536870912:x=Ea;break;default:x=Es}x=Fk(x,Ak.bind(null,c))}c.callbackPriority=u,c.callbackNode=x}}function Ak(c,u){if(If=-1,Mf=0,(At&6)!==0)throw Error(n(327));var x=c.callbackNode;if(el()&&c.callbackNode!==x)return null;var v=zr(c,c===On?Wn:0);if(v===0)return null;if((v&30)!==0||(v&c.expiredLanes)!==0||u)u=Lf(c,v);else{u=v;var E=At;At|=2;var _=Dk();(On!==c||Wn!==u)&&(uo=null,Za=Kt()+500,$i(c,u));do try{lI();break}catch(X){_k(c,X)}while(!0);$g(),Af.current=_,At=E,xn!==null?u=0:(On=null,Wn=0,u=En)}if(u!==0){if(u===2&&(E=Zs(c),E!==0&&(v=E,u=xx(c,E))),u===1)throw x=ru,$i(c,0),Vo(c,v),ur(c,Kt()),x;if(u===6)Vo(c,v);else{if(E=c.current.alternate,(v&30)===0&&!iI(E)&&(u=Lf(c,v),u===2&&(_=Zs(c),_!==0&&(v=_,u=xx(c,_))),u===1))throw x=ru,$i(c,0),Vo(c,v),ur(c,Kt()),x;switch(c.finishedWork=E,c.finishedLanes=v,u){case 0:case 1:throw Error(n(345));case 2:Ii(c,cr,uo);break;case 3:if(Vo(c,v),(v&130023424)===v&&(u=hx+500-Kt(),10<u)){if(zr(c,0)!==0)break;if(E=c.suspendedLanes,(E&v)!==v){nr(),c.pingedLanes|=c.suspendedLanes&E;break}c.timeoutHandle=kg(Ii.bind(null,c,cr,uo),u);break}Ii(c,cr,uo);break;case 4:if(Vo(c,v),(v&4194240)===v)break;for(u=c.eventTimes,E=-1;0<v;){var K=31-In(v);_=1<<K,K=u[K],K>E&&(E=K),v&=~_}if(v=E,v=Kt()-v,v=(120>v?120:480>v?480:1080>v?1080:1920>v?1920:3e3>v?3e3:4320>v?4320:1960*oI(v/1960))-v,10<v){c.timeoutHandle=kg(Ii.bind(null,c,cr,uo),v);break}Ii(c,cr,uo);break;case 5:Ii(c,cr,uo);break;default:throw Error(n(329))}}}return ur(c,Kt()),c.callbackNode===x?Ak.bind(null,c):null}function xx(c,u){var x=su;return c.current.memoizedState.isDehydrated&&($i(c,u).flags|=256),c=Lf(c,u),c!==2&&(u=cr,cr=x,u!==null&&yx(u)),c}function yx(c){cr===null?cr=c:cr.push.apply(cr,c)}function iI(c){for(var u=c;;){if(u.flags&16384){var x=u.updateQueue;if(x!==null&&(x=x.stores,x!==null))for(var v=0;v<x.length;v++){var E=x[v],_=E.getSnapshot;E=E.value;try{if(!ss(_(),E))return!1}catch{return!1}}}if(x=u.child,u.subtreeFlags&16384&&x!==null)x.return=u,u=x;else{if(u===c)break;for(;u.sibling===null;){if(u.return===null||u.return===c)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function Vo(c,u){for(u&=~px,u&=~Pf,c.suspendedLanes|=u,c.pingedLanes&=~u,c=c.expirationTimes;0<u;){var x=31-In(u),v=1<<x;c[x]=-1,u&=~v}}function Pk(c){if((At&6)!==0)throw Error(n(327));el();var u=zr(c,0);if((u&1)===0)return ur(c,Kt()),null;var x=Lf(c,u);if(c.tag!==0&&x===2){var v=Zs(c);v!==0&&(u=v,x=xx(c,v))}if(x===1)throw x=ru,$i(c,0),Vo(c,u),ur(c,Kt()),x;if(x===6)throw Error(n(345));return c.finishedWork=c.current.alternate,c.finishedLanes=u,Ii(c,cr,uo),ur(c,Kt()),null}function bx(c,u){var x=At;At|=1;try{return c(u)}finally{At=x,At===0&&(Za=Kt()+500,uf&&Lo())}}function Di(c){Uo!==null&&Uo.tag===0&&(At&6)===0&&el();var u=At;At|=1;var x=qr.transition,v=Mt;try{if(qr.transition=null,Mt=1,c)return c()}finally{Mt=v,qr.transition=x,At=u,(At&6)===0&&Lo()}}function vx(){Cr=Ja.current,Yt(Ja)}function $i(c,u){c.finishedWork=null,c.finishedLanes=0;var x=c.timeoutHandle;if(x!==-1&&(c.timeoutHandle=-1,M$(x)),xn!==null)for(x=xn.return;x!==null;){var v=x;switch(Rg(v),v.tag){case 1:v=v.type.childContextTypes,v!=null&&lf();break;case 3:Ya(),Yt(ir),Yt(Yn),Ug();break;case 5:zg(v);break;case 4:Ya();break;case 13:Yt(an);break;case 19:Yt(an);break;case 10:Ig(v.type._context);break;case 22:case 23:vx()}x=x.return}if(On=c,xn=c=Wo(c.current,null),Wn=Cr=u,En=0,ru=null,px=Pf=_i=0,cr=su=null,Ri!==null){for(u=0;u<Ri.length;u++)if(x=Ri[u],v=x.interleaved,v!==null){x.interleaved=null;var E=v.next,_=x.pending;if(_!==null){var K=_.next;_.next=E,v.next=K}x.pending=v}Ri=null}return c}function _k(c,u){do{var x=xn;try{if($g(),vf.current=Sf,wf){for(var v=ln.memoizedState;v!==null;){var E=v.queue;E!==null&&(E.pending=null),v=v.next}wf=!1}if(Pi=0,Ln=Cn=ln=null,Qc=!1,Jc=0,fx.current=null,x===null||x.return===null){En=1,ru=u,xn=null;break}e:{var _=c,K=x.return,X=x,re=u;if(u=Wn,X.flags|=32768,re!==null&&typeof re=="object"&&typeof re.then=="function"){var xe=re,Ae=X,De=Ae.tag;if((Ae.mode&1)===0&&(De===0||De===11||De===15)){var Re=Ae.alternate;Re?(Ae.updateQueue=Re.updateQueue,Ae.memoizedState=Re.memoizedState,Ae.lanes=Re.lanes):(Ae.updateQueue=null,Ae.memoizedState=null)}var Ge=rk(K);if(Ge!==null){Ge.flags&=-257,sk(Ge,K,X,_,u),Ge.mode&1&&nk(_,xe,u),u=Ge,re=xe;var Ze=u.updateQueue;if(Ze===null){var tt=new Set;tt.add(re),u.updateQueue=tt}else Ze.add(re);break e}else{if((u&1)===0){nk(_,xe,u),wx();break e}re=Error(n(426))}}else if(nn&&X.mode&1){var hn=rk(K);if(hn!==null){(hn.flags&65536)===0&&(hn.flags|=256),sk(hn,K,X,_,u),_g(Xa(re,X));break e}}_=re=Xa(re,X),En!==4&&(En=2),su===null?su=[_]:su.push(_),_=K;do{switch(_.tag){case 3:_.flags|=65536,u&=-u,_.lanes|=u;var fe=ek(_,re,u);Ej(_,fe);break e;case 1:X=re;var ae=_.type,he=_.stateNode;if((_.flags&128)===0&&(typeof ae.getDerivedStateFromError=="function"||he!==null&&typeof he.componentDidCatch=="function"&&(Bo===null||!Bo.has(he)))){_.flags|=65536,u&=-u,_.lanes|=u;var Fe=tk(_,X,u);Ej(_,Fe);break e}}_=_.return}while(_!==null)}Ik(x)}catch(nt){u=nt,xn===x&&x!==null&&(xn=x=x.return);continue}break}while(!0)}function Dk(){var c=Af.current;return Af.current=Sf,c===null?Sf:c}function wx(){(En===0||En===3||En===2)&&(En=4),On===null||(_i&268435455)===0&&(Pf&268435455)===0||Vo(On,Wn)}function Lf(c,u){var x=At;At|=2;var v=Dk();(On!==c||Wn!==u)&&(uo=null,$i(c,u));do try{aI();break}catch(E){_k(c,E)}while(!0);if($g(),At=x,Af.current=v,xn!==null)throw Error(n(261));return On=null,Wn=0,En}function aI(){for(;xn!==null;)$k(xn)}function lI(){for(;xn!==null&&!Ec();)$k(xn)}function $k(c){var u=Ok(c.alternate,c,Cr);c.memoizedProps=c.pendingProps,u===null?Ik(c):xn=u,fx.current=null}function Ik(c){var u=c;do{var x=u.alternate;if(c=u.return,(u.flags&32768)===0){if(x=eI(x,u,Cr),x!==null){xn=x;return}}else{if(x=tI(x,u),x!==null){x.flags&=32767,xn=x;return}if(c!==null)c.flags|=32768,c.subtreeFlags=0,c.deletions=null;else{En=6,xn=null;return}}if(u=u.sibling,u!==null){xn=u;return}xn=u=c}while(u!==null);En===0&&(En=5)}function Ii(c,u,x){var v=Mt,E=qr.transition;try{qr.transition=null,Mt=1,cI(c,u,x,v)}finally{qr.transition=E,Mt=v}return null}function cI(c,u,x,v){do el();while(Uo!==null);if((At&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 _=x.lanes|x.childLanes;if(ji(c,_),c===On&&(xn=On=null,Wn=0),(x.subtreeFlags&2064)===0&&(x.flags&2064)===0||Df||(Df=!0,Fk(Es,function(){return el(),null})),_=(x.flags&15990)!==0,(x.subtreeFlags&15990)!==0||_){_=qr.transition,qr.transition=null;var K=Mt;Mt=1;var X=At;At|=4,fx.current=null,rI(c,x),Nk(x,c),R$(wg),dn=!!vg,wg=vg=null,c.current=x,sI(x),Na(),At=X,Mt=K,qr.transition=_}else c.current=x;if(Df&&(Df=!1,Uo=c,$f=E),_=c.pendingLanes,_===0&&(Bo=null),Ro(x.stateNode),ur(c,Kt()),u!==null)for(v=c.onRecoverableError,x=0;x<u.length;x++)E=u[x],v(E.value,{componentStack:E.stack,digest:E.digest});if(_f)throw _f=!1,c=mx,mx=null,c;return($f&1)!==0&&c.tag!==0&&el(),_=c.pendingLanes,(_&1)!==0?c===gx?ou++:(ou=0,gx=c):ou=0,Lo(),null}function el(){if(Uo!==null){var c=_c($f),u=qr.transition,x=Mt;try{if(qr.transition=null,Mt=16>c?16:c,Uo===null)var v=!1;else{if(c=Uo,Uo=null,$f=0,(At&6)!==0)throw Error(n(331));var E=At;for(At|=4,Xe=c.current;Xe!==null;){var _=Xe,K=_.child;if((Xe.flags&16)!==0){var X=_.deletions;if(X!==null){for(var re=0;re<X.length;re++){var xe=X[re];for(Xe=xe;Xe!==null;){var Ae=Xe;switch(Ae.tag){case 0:case 11:case 15:nu(8,Ae,_)}var De=Ae.child;if(De!==null)De.return=Ae,Xe=De;else for(;Xe!==null;){Ae=Xe;var Re=Ae.sibling,Ge=Ae.return;if(vk(Ae),Ae===xe){Xe=null;break}if(Re!==null){Re.return=Ge,Xe=Re;break}Xe=Ge}}}var Ze=_.alternate;if(Ze!==null){var tt=Ze.child;if(tt!==null){Ze.child=null;do{var hn=tt.sibling;tt.sibling=null,tt=hn}while(tt!==null)}}Xe=_}}if((_.subtreeFlags&2064)!==0&&K!==null)K.return=_,Xe=K;else e:for(;Xe!==null;){if(_=Xe,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:nu(9,_,_.return)}var fe=_.sibling;if(fe!==null){fe.return=_.return,Xe=fe;break e}Xe=_.return}}var ae=c.current;for(Xe=ae;Xe!==null;){K=Xe;var he=K.child;if((K.subtreeFlags&2064)!==0&&he!==null)he.return=K,Xe=he;else e:for(K=ae;Xe!==null;){if(X=Xe,(X.flags&2048)!==0)try{switch(X.tag){case 0:case 11:case 15:Rf(9,X)}}catch(nt){fn(X,X.return,nt)}if(X===K){Xe=null;break e}var Fe=X.sibling;if(Fe!==null){Fe.return=X.return,Xe=Fe;break e}Xe=X.return}}if(At=E,Lo(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(To,c)}catch{}v=!0}return v}finally{Mt=x,qr.transition=u}}return!1}function Mk(c,u,x){u=Xa(x,u),u=ek(c,u,1),c=Fo(c,u,1),u=nr(),c!==null&&(wr(c,1,u),ur(c,u))}function fn(c,u,x){if(c.tag===3)Mk(c,c,x);else for(;u!==null;){if(u.tag===3){Mk(u,c,x);break}else if(u.tag===1){var v=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Bo===null||!Bo.has(v))){c=Xa(x,c),c=tk(u,c,1),u=Fo(u,c,1),c=nr(),u!==null&&(wr(u,1,c),ur(u,c));break}}u=u.return}}function uI(c,u,x){var v=c.pingCache;v!==null&&v.delete(u),u=nr(),c.pingedLanes|=c.suspendedLanes&x,On===c&&(Wn&x)===x&&(En===4||En===3&&(Wn&130023424)===Wn&&500>Kt()-hx?$i(c,0):px|=x),ur(c,u)}function Lk(c,u){u===0&&((c.mode&1)===0?u=1:(u=Ao,Ao<<=1,(Ao&130023424)===0&&(Ao=4194304)));var x=nr();c=ao(c,u),c!==null&&(wr(c,u,x),ur(c,x))}function dI(c){var u=c.memoizedState,x=0;u!==null&&(x=u.retryLane),Lk(c,x)}function fI(c,u){var x=0;switch(c.tag){case 13:var v=c.stateNode,E=c.memoizedState;E!==null&&(x=E.retryLane);break;case 19:v=c.stateNode;break;default:throw Error(n(314))}v!==null&&v.delete(u),Lk(c,x)}var Ok;Ok=function(c,u,x){if(c!==null)if(c.memoizedProps!==u.pendingProps||ir.current)lr=!0;else{if((c.lanes&x)===0&&(u.flags&128)===0)return lr=!1,Z$(c,u,x);lr=(c.flags&131072)!==0}else lr=!1,nn&&(u.flags&1048576)!==0&&xj(u,ff,u.index);switch(u.lanes=0,u.tag){case 2:var v=u.type;Ef(c,u),c=u.pendingProps;var E=Ua(u,Yn.current);Ga(u,x),E=Wg(null,u,v,c,E,x);var _=qg();return u.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,ar(v)?(_=!0,cf(u)):_=!1,u.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,Og(u),E.updater=Nf,u.stateNode=E,E._reactInternals=u,Jg(u,v,c,x),u=nx(null,u,v,!0,_,x)):(u.tag=0,nn&&_&&Tg(u),tr(null,u,E,x),u=u.child),u;case 16:v=u.elementType;e:{switch(Ef(c,u),c=u.pendingProps,E=v._init,v=E(v._payload),u.type=v,E=u.tag=hI(v),c=is(v,c),E){case 0:u=tx(null,u,v,c,x);break e;case 1:u=uk(null,u,v,c,x);break e;case 11:u=ok(null,u,v,c,x);break e;case 14:u=ik(null,u,v,is(v.type,c),x);break e}throw Error(n(306,v,""))}return u;case 0:return v=u.type,E=u.pendingProps,E=u.elementType===v?E:is(v,E),tx(c,u,v,E,x);case 1:return v=u.type,E=u.pendingProps,E=u.elementType===v?E:is(v,E),uk(c,u,v,E,x);case 3:e:{if(dk(u),c===null)throw Error(n(387));v=u.pendingProps,_=u.memoizedState,E=_.element,Cj(c,u),yf(u,v,null,x);var K=u.memoizedState;if(v=K.element,_.isDehydrated)if(_={element:v,isDehydrated:!1,cache:K.cache,pendingSuspenseBoundaries:K.pendingSuspenseBoundaries,transitions:K.transitions},u.updateQueue.baseState=_,u.memoizedState=_,u.flags&256){E=Xa(Error(n(423)),u),u=fk(c,u,v,x,E);break e}else if(v!==E){E=Xa(Error(n(424)),u),u=fk(c,u,v,x,E);break e}else for(Nr=$o(u.stateNode.containerInfo.firstChild),Sr=u,nn=!0,os=null,x=Sj(u,null,v,x),u.child=x;x;)x.flags=x.flags&-3|4096,x=x.sibling;else{if(Wa(),v===E){u=co(c,u,x);break e}tr(c,u,v,x)}u=u.child}return u;case 5:return Rj(u),c===null&&Pg(u),v=u.type,E=u.pendingProps,_=c!==null?c.memoizedProps:null,K=E.children,jg(v,E)?K=null:_!==null&&jg(v,_)&&(u.flags|=32),ck(c,u),tr(c,u,K,x),u.child;case 6:return c===null&&Pg(u),null;case 13:return pk(c,u,x);case 4:return Fg(u,u.stateNode.containerInfo),v=u.pendingProps,c===null?u.child=qa(u,null,v,x):tr(c,u,v,x),u.child;case 11:return v=u.type,E=u.pendingProps,E=u.elementType===v?E:is(v,E),ok(c,u,v,E,x);case 7:return tr(c,u,u.pendingProps,x),u.child;case 8:return tr(c,u,u.pendingProps.children,x),u.child;case 12:return tr(c,u,u.pendingProps.children,x),u.child;case 10:e:{if(v=u.type._context,E=u.pendingProps,_=u.memoizedProps,K=E.value,Ht(mf,v._currentValue),v._currentValue=K,_!==null)if(ss(_.value,K)){if(_.children===E.children&&!ir.current){u=co(c,u,x);break e}}else for(_=u.child,_!==null&&(_.return=u);_!==null;){var X=_.dependencies;if(X!==null){K=_.child;for(var re=X.firstContext;re!==null;){if(re.context===v){if(_.tag===1){re=lo(-1,x&-x),re.tag=2;var xe=_.updateQueue;if(xe!==null){xe=xe.shared;var Ae=xe.pending;Ae===null?re.next=re:(re.next=Ae.next,Ae.next=re),xe.pending=re}}_.lanes|=x,re=_.alternate,re!==null&&(re.lanes|=x),Mg(_.return,x,u),X.lanes|=x;break}re=re.next}}else if(_.tag===10)K=_.type===u.type?null:_.child;else if(_.tag===18){if(K=_.return,K===null)throw Error(n(341));K.lanes|=x,X=K.alternate,X!==null&&(X.lanes|=x),Mg(K,x,u),K=_.sibling}else K=_.child;if(K!==null)K.return=_;else for(K=_;K!==null;){if(K===u){K=null;break}if(_=K.sibling,_!==null){_.return=K.return,K=_;break}K=K.return}_=K}tr(c,u,E.children,x),u=u.child}return u;case 9:return E=u.type,v=u.pendingProps.children,Ga(u,x),E=Vr(E),v=v(E),u.flags|=1,tr(c,u,v,x),u.child;case 14:return v=u.type,E=is(v,u.pendingProps),E=is(v.type,E),ik(c,u,v,E,x);case 15:return ak(c,u,u.type,u.pendingProps,x);case 17:return v=u.type,E=u.pendingProps,E=u.elementType===v?E:is(v,E),Ef(c,u),u.tag=1,ar(v)?(c=!0,cf(u)):c=!1,Ga(u,x),Jj(u,v,E),Jg(u,v,E,x),nx(null,u,v,!0,c,x);case 19:return mk(c,u,x);case 22:return lk(c,u,x)}throw Error(n(156,u.tag))};function Fk(c,u){return ka(c,u)}function pI(c,u,x,v){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=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kr(c,u,x,v){return new pI(c,u,x,v)}function jx(c){return c=c.prototype,!(!c||!c.isReactComponent)}function hI(c){if(typeof c=="function")return jx(c)?1:0;if(c!=null){if(c=c.$$typeof,c===F)return 11;if(c===O)return 14}return 2}function Wo(c,u){var x=c.alternate;return x===null?(x=Kr(c.tag,u,c.key,c.mode),x.elementType=c.elementType,x.type=c.type,x.stateNode=c.stateNode,x.alternate=c,c.alternate=x):(x.pendingProps=u,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,u=c.dependencies,x.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},x.sibling=c.sibling,x.index=c.index,x.ref=c.ref,x}function Of(c,u,x,v,E,_){var K=2;if(v=c,typeof c=="function")jx(c)&&(K=1);else if(typeof c=="string")K=5;else e:switch(c){case R:return Mi(x.children,E,_,u);case D:K=8,E|=8;break;case $:return c=Kr(12,x,u,E|2),c.elementType=$,c.lanes=_,c;case W:return c=Kr(13,x,u,E),c.elementType=W,c.lanes=_,c;case P:return c=Kr(19,x,u,E),c.elementType=P,c.lanes=_,c;case H:return Ff(x,E,_,u);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case z:K=10;break e;case A:K=9;break e;case F:K=11;break e;case O:K=14;break e;case B:K=16,v=null;break e}throw Error(n(130,c==null?c:typeof c,""))}return u=Kr(K,x,u,E),u.elementType=c,u.type=v,u.lanes=_,u}function Mi(c,u,x,v){return c=Kr(7,c,v,u),c.lanes=x,c}function Ff(c,u,x,v){return c=Kr(22,c,v,u),c.elementType=H,c.lanes=x,c.stateNode={isHidden:!1},c}function kx(c,u,x){return c=Kr(6,c,null,u),c.lanes=x,c}function Sx(c,u,x){return u=Kr(4,c.children!==null?c.children:[],c.key,u),u.lanes=x,u.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},u}function mI(c,u,x,v,E){this.tag=u,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=Ot(0),this.expirationTimes=Ot(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ot(0),this.identifierPrefix=v,this.onRecoverableError=E,this.mutableSourceEagerHydrationData=null}function Nx(c,u,x,v,E,_,K,X,re){return c=new mI(c,u,x,X,re),u===1?(u=1,_===!0&&(u|=8)):u=0,_=Kr(3,null,null,u),c.current=_,_.stateNode=c,_.memoizedState={element:v,isDehydrated:x,cache:null,transitions:null,pendingSuspenseBoundaries:null},Og(_),c}function gI(c,u,x){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:v==null?null:""+v,children:c,containerInfo:u,implementation:x}}function zk(c){if(!c)return Mo;c=c._reactInternals;e:{if(ht(c)!==c||c.tag!==1)throw Error(n(170));var u=c;do{switch(u.tag){case 3:u=u.stateNode.context;break e;case 1:if(ar(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break e}}u=u.return}while(u!==null);throw Error(n(171))}if(c.tag===1){var x=c.type;if(ar(x))return hj(c,x,u)}return u}function Bk(c,u,x,v,E,_,K,X,re){return c=Nx(x,v,!0,c,E,_,K,X,re),c.context=zk(null),x=c.current,v=nr(),E=Ho(x),_=lo(v,E),_.callback=u??null,Fo(x,_,E),c.current.lanes=E,wr(c,E,v),ur(c,v),c}function zf(c,u,x,v){var E=u.current,_=nr(),K=Ho(E);return x=zk(x),u.context===null?u.context=x:u.pendingContext=x,u=lo(_,K),u.payload={element:c},v=v===void 0?null:v,v!==null&&(u.callback=v),c=Fo(E,u,K),c!==null&&(cs(c,E,K,_),xf(c,E,K)),K}function Bf(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 Uk(c,u){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var x=c.retryLane;c.retryLane=x!==0&&x<u?x:u}}function Cx(c,u){Uk(c,u),(c=c.alternate)&&Uk(c,u)}function xI(){return null}var Hk=typeof reportError=="function"?reportError:function(c){console.error(c)};function Ex(c){this._internalRoot=c}Uf.prototype.render=Ex.prototype.render=function(c){var u=this._internalRoot;if(u===null)throw Error(n(409));zf(c,u,null,null)},Uf.prototype.unmount=Ex.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var u=c.containerInfo;Di(function(){zf(null,c,null,null)}),u[ro]=null}};function Uf(c){this._internalRoot=c}Uf.prototype.unstable_scheduleHydration=function(c){if(c){var u=Dc();c={blockedOn:null,target:c,priority:u};for(var x=0;x<Ps.length&&u!==0&&u<Ps[x].priority;x++);Ps.splice(x,0,c),x===0&&ve(c)}};function Tx(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)}function Hf(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11&&(c.nodeType!==8||c.nodeValue!==" react-mount-point-unstable "))}function Vk(){}function yI(c,u,x,v,E){if(E){if(typeof v=="function"){var _=v;v=function(){var xe=Bf(K);_.call(xe)}}var K=Bk(u,v,c,0,null,!1,!1,"",Vk);return c._reactRootContainer=K,c[ro]=K.current,Hc(c.nodeType===8?c.parentNode:c),Di(),K}for(;E=c.lastChild;)c.removeChild(E);if(typeof v=="function"){var X=v;v=function(){var xe=Bf(re);X.call(xe)}}var re=Nx(c,0,!1,null,null,!1,!1,"",Vk);return c._reactRootContainer=re,c[ro]=re.current,Hc(c.nodeType===8?c.parentNode:c),Di(function(){zf(u,re,x,v)}),re}function Vf(c,u,x,v,E){var _=x._reactRootContainer;if(_){var K=_;if(typeof E=="function"){var X=E;E=function(){var re=Bf(K);X.call(re)}}zf(u,K,c,E)}else K=yI(x,u,c,E,v);return Bf(K)}Ra=function(c){switch(c.tag){case 3:var u=c.stateNode;if(u.current.memoizedState.isDehydrated){var x=Ts(u.pendingLanes);x!==0&&(Po(u,x|1),ur(u,Kt()),(At&6)===0&&(Za=Kt()+500,Lo()))}break;case 13:Di(function(){var v=ao(c,1);if(v!==null){var E=nr();cs(v,c,1,E)}}),Cx(c,1)}},Aa=function(c){if(c.tag===13){var u=ao(c,134217728);if(u!==null){var x=nr();cs(u,c,134217728,x)}Cx(c,134217728)}},eo=function(c){if(c.tag===13){var u=Ho(c),x=ao(c,u);if(x!==null){var v=nr();cs(x,c,u,v)}Cx(c,u)}},Dc=function(){return Mt},$c=function(c,u){var x=Mt;try{return Mt=c,u()}finally{Mt=x}},jt=function(c,u,x){switch(u){case"input":if(ke(c,x),u=x.name,x.type==="radio"&&u!=null){for(x=c;x.parentNode;)x=x.parentNode;for(x=x.querySelectorAll("input[name="+JSON.stringify(""+u)+'][type="radio"]'),u=0;u<x.length;u++){var v=x[u];if(v!==c&&v.form===c.form){var E=af(v);if(!E)throw Error(n(90));Te(v),ke(v,E)}}}break;case"textarea":ft(c,x);break;case"select":u=x.value,u!=null&&Me(c,!!x.multiple,u,!1)}},qt=bx,un=Di;var bI={usingClientEntryPoint:!1,Events:[qc,za,af,Je,It,bx]},iu={findFiberByHostInstance:Ni,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},vI={bundleType:iu.bundleType,version:iu.version,rendererPackageName:iu.rendererPackageName,rendererConfig:iu.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=en(c),c===null?null:c.stateNode},findFiberByHostInstance:iu.findFiberByHostInstance||xI,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 Wf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wf.isDisabled&&Wf.supportsFiber)try{To=Wf.inject(vI),tn=Wf}catch{}}return dr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bI,dr.createPortal=function(c,u){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Tx(u))throw Error(n(200));return gI(c,u,null,x)},dr.createRoot=function(c,u){if(!Tx(c))throw Error(n(299));var x=!1,v="",E=Hk;return u!=null&&(u.unstable_strictMode===!0&&(x=!0),u.identifierPrefix!==void 0&&(v=u.identifierPrefix),u.onRecoverableError!==void 0&&(E=u.onRecoverableError)),u=Nx(c,1,!1,null,null,x,!1,v,E),c[ro]=u.current,Hc(c.nodeType===8?c.parentNode:c),new Ex(u)},dr.findDOMNode=function(c){if(c==null)return null;if(c.nodeType===1)return c;var u=c._reactInternals;if(u===void 0)throw typeof c.render=="function"?Error(n(188)):(c=Object.keys(c).join(","),Error(n(268,c)));return c=en(u),c=c===null?null:c.stateNode,c},dr.flushSync=function(c){return Di(c)},dr.hydrate=function(c,u,x){if(!Hf(u))throw Error(n(200));return Vf(null,c,u,!0,x)},dr.hydrateRoot=function(c,u,x){if(!Tx(c))throw Error(n(405));var v=x!=null&&x.hydratedSources||null,E=!1,_="",K=Hk;if(x!=null&&(x.unstable_strictMode===!0&&(E=!0),x.identifierPrefix!==void 0&&(_=x.identifierPrefix),x.onRecoverableError!==void 0&&(K=x.onRecoverableError)),u=Bk(u,null,c,1,x??null,E,!1,_,K),c[ro]=u.current,Hc(c),v)for(c=0;c<v.length;c++)x=v[c],E=x._getVersion,E=E(x._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[x,E]:u.mutableSourceEagerHydrationData.push(x,E);return new Uf(u)},dr.render=function(c,u,x){if(!Hf(u))throw Error(n(200));return Vf(null,c,u,!1,x)},dr.unmountComponentAtNode=function(c){if(!Hf(c))throw Error(n(40));return c._reactRootContainer?(Di(function(){Vf(null,null,c,!1,function(){c._reactRootContainer=null,c[ro]=null})}),!0):!1},dr.unstable_batchedUpdates=bx,dr.unstable_renderSubtreeIntoContainer=function(c,u,x,v){if(!Hf(x))throw Error(n(200));if(c==null||c._reactInternals===void 0)throw Error(n(38));return Vf(c,u,x,!1,v)},dr.version="18.3.1-next-f1338f8080-20240426",dr}var Jk;function vE(){if(Jk)return _x.exports;Jk=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(),_x.exports=AI(),_x.exports}var Zk;function PI(){if(Zk)return qf;Zk=1;var e=vE();return qf.createRoot=e.createRoot,qf.hydrateRoot=e.hydrateRoot,qf}var _I=PI();/**
|
|
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 e1="popstate";function t1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function DI(e={}){function t(r,o){var f;let i=(f=o.state)==null?void 0:f.masked,{pathname:a,search:l,hash:d}=i||r.location;return nb("",{pathname:a,search:l,hash:d},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:qu(o)}return II(t,n,null,e)}function cn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function hs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function $I(){return Math.random().toString(36).substring(2,10)}function n1(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 nb(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?oc(t):t,state:n,key:t&&t.key||r||$I(),unstable_mask:o}}function qu({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 oc(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 II(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:i=!1}=r,a=o.history,l="POP",d=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(),j=b==null?null:b-f;f=b,d&&d({action:l,location:w.location,delta:j})}function g(b,j){l="PUSH";let N=t1(b)?b:nb(w.location,b,j);f=p()+1;let k=n1(N,f),C=w.createHref(N.unstable_mask||N);try{a.pushState(k,"",C)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;o.location.assign(C)}i&&d&&d({action:l,location:w.location,delta:1})}function y(b,j){l="REPLACE";let N=t1(b)?b:nb(w.location,b,j);f=p();let k=n1(N,f),C=w.createHref(N.unstable_mask||N);a.replaceState(k,"",C),i&&d&&d({action:l,location:w.location,delta:0})}function S(b){return MI(b)}let w={get action(){return l},get location(){return e(o,a)},listen(b){if(d)throw new Error("A history only accepts one active listener");return o.addEventListener(e1,h),d=b,()=>{o.removeEventListener(e1,h),d=null}},createHref(b){return t(o,b)},createURL:S,encodeLocation(b){let j=S(b);return{pathname:j.pathname,search:j.search,hash:j.hash}},push:g,replace:y,go(b){return a.go(b)}};return w}function MI(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),cn(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:qu(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function wE(e,t,n="/"){return LI(e,t,n,!1)}function LI(e,t,n,r){let o=typeof t=="string"?oc(t):t,i=bo(o.pathname||"/",n);if(i==null)return null;let a=jE(e);OI(a);let l=null;for(let d=0;l==null&&d<a.length;++d){let f=YI(i);l=KI(a[d],f,r)}return l}function jE(e,t=[],n=[],r="",o=!1){let i=(a,l,d=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)&&d)return;cn(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=Vs([r,p.relativePath]),g=n.concat(p);a.children&&a.children.length>0&&(cn(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),jE(a.children,t,g,h,d)),!(a.path==null&&!a.index)&&t.push({path:h,score:WI(h,a.index),routesMeta:g})};return e.forEach((a,l)=>{var d;if(a.path===""||!((d=a.path)!=null&&d.includes("?")))i(a,l);else for(let f of kE(a.path))i(a,l,!0,f)}),t}function kE(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=kE(r.join("/")),l=[];return l.push(...a.map(d=>d===""?i:[i,d].join("/"))),o&&l.push(...a),l.map(d=>e.startsWith("/")&&d===""?"/":d)}function OI(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:qI(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var FI=/^:[\w-]+$/,zI=3,BI=2,UI=1,HI=10,VI=-2,r1=e=>e==="*";function WI(e,t){let n=e.split("/"),r=n.length;return n.some(r1)&&(r+=VI),t&&(r+=BI),n.filter(o=>!r1(o)).reduce((o,i)=>o+(FI.test(i)?zI:i===""?UI:HI),r)}function qI(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 KI(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",a=[];for(let l=0;l<r.length;++l){let d=r[l],f=l===r.length-1,p=i==="/"?t:t.slice(i.length)||"/",h=Kp({path:d.relativePath,caseSensitive:d.caseSensitive,end:f},p),g=d.route;if(!h&&f&&n&&!r[r.length-1].route.index&&(h=Kp({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},p)),!h)return null;Object.assign(o,h.params),a.push({params:o,pathname:Vs([i,h.pathname]),pathnameBase:ZI(Vs([i,h.pathnameBase])),route:g}),h.pathnameBase!=="/"&&(i=Vs([i,h.pathnameBase]))}return a}function Kp(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=GI(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 S=l[g]||"";a=i.slice(0,i.length-S.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 GI(e,t=!1,n=!0){hs(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,d,f,p)=>{if(r.push({paramName:l,isOptional:d!=null}),d){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 YI(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return hs(!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 bo(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 XI=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function QI(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?oc(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=s1(n.substring(1),"/"):i=s1(n,t)):i=t,{pathname:i,search:eM(r),hash:tM(o)}}function s1(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 Ix(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 JI(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function SE(e){let t=JI(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function xv(e,t,n,r=!1){let o;typeof e=="string"?o=oc(e):(o={...e},cn(!o.pathname||!o.pathname.includes("?"),Ix("?","pathname","search",o)),cn(!o.pathname||!o.pathname.includes("#"),Ix("#","pathname","hash",o)),cn(!o.search||!o.search.includes("#"),Ix("#","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 d=QI(o,l),f=a&&a!=="/"&&a.endsWith("/"),p=(i||a===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(f||p)&&(d.pathname+="/"),d}var Vs=e=>e.join("/").replace(/\/\/+/g,"/"),ZI=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),eM=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,tM=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,nM=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 rM(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function sM(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var NE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function CE(e,t){let n=e;if(typeof n!="string"||!XI.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(NE)try{let i=new URL(window.location.href),a=n.startsWith("//")?new URL(i.protocol+n):new URL(n),l=bo(a.pathname,t);a.origin===i.origin&&l!=null?n=l+a.search+a.hash:o=!0}catch{hs(!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 EE=["POST","PUT","PATCH","DELETE"];new Set(EE);var oM=["GET",...EE];new Set(oM);var ic=m.createContext(null);ic.displayName="DataRouter";var Lh=m.createContext(null);Lh.displayName="DataRouterState";var iM=m.createContext(!1),TE=m.createContext({isTransitioning:!1});TE.displayName="ViewTransition";var aM=m.createContext(new Map);aM.displayName="Fetchers";var lM=m.createContext(null);lM.displayName="Await";var Zr=m.createContext(null);Zr.displayName="Navigation";var wd=m.createContext(null);wd.displayName="Location";var ws=m.createContext({outlet:null,matches:[],isDataRoute:!1});ws.displayName="Route";var yv=m.createContext(null);yv.displayName="RouteError";var RE="REACT_ROUTER_ERROR",cM="REDIRECT",uM="ROUTE_ERROR_RESPONSE";function dM(e){if(e.startsWith(`${RE}:${cM}:{`))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 fM(e){if(e.startsWith(`${RE}:${uM}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new nM(t.status,t.statusText,t.data)}catch{}}function pM(e,{relative:t}={}){cn(jd(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=m.useContext(Zr),{hash:o,pathname:i,search:a}=kd(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:Vs([n,i])),r.createHref({pathname:l,search:a,hash:o})}function jd(){return m.useContext(wd)!=null}function rr(){return cn(jd(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(wd).location}var AE="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function PE(e){m.useContext(Zr).static||m.useLayoutEffect(e)}function zt(){let{isDataRoute:e}=m.useContext(ws);return e?TM():hM()}function hM(){cn(jd(),"useNavigate() may be used only in the context of a <Router> component.");let e=m.useContext(ic),{basename:t,navigator:n}=m.useContext(Zr),{matches:r}=m.useContext(ws),{pathname:o}=rr(),i=JSON.stringify(SE(r)),a=m.useRef(!1);return PE(()=>{a.current=!0}),m.useCallback((d,f={})=>{if(hs(a.current,AE),!a.current)return;if(typeof d=="number"){n.go(d);return}let p=xv(d,JSON.parse(i),o,f.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Vs([t,p.pathname])),(f.replace?n.replace:n.push)(p,f.state,f)},[t,n,i,o,e])}var mM=m.createContext(null);function gM(e){let t=m.useContext(ws).outlet;return m.useMemo(()=>t&&m.createElement(mM.Provider,{value:e},t),[t,e])}function Bt(){let{matches:e}=m.useContext(ws),t=e[e.length-1];return t?t.params:{}}function kd(e,{relative:t}={}){let{matches:n}=m.useContext(ws),{pathname:r}=rr(),o=JSON.stringify(SE(n));return m.useMemo(()=>xv(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function xM(e,t){return _E(e,t)}function _E(e,t,n){var b;cn(jd(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=m.useContext(Zr),{matches:o}=m.useContext(ws),i=o[o.length-1],a=i?i.params:{},l=i?i.pathname:"/",d=i?i.pathnameBase:"/",f=i&&i.route;{let j=f&&f.path||"";$E(l,!f||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${j}">) 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="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let p=rr(),h;if(t){let j=typeof t=="string"?oc(t):t;cn(d==="/"||((b=j.pathname)==null?void 0:b.startsWith(d)),`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 "${d}" but pathname "${j.pathname}" was given in the \`location\` prop.`),h=j}else h=p;let g=h.pathname||"/",y=g;if(d!=="/"){let j=d.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(j.length).join("/")}let S=wE(e,{pathname:y});hs(f||S!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),hs(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.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 w=jM(S&&S.map(j=>Object.assign({},j,{params:Object.assign({},a,j.params),pathname:Vs([d,r.encodeLocation?r.encodeLocation(j.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?d:Vs([d,r.encodeLocation?r.encodeLocation(j.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),o,n);return t&&w?m.createElement(wd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},w):w}function yM(){let e=EM(),t=rM(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 bM=m.createElement(yM,null),DE=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=fM(e.digest);n&&(e=n)}let t=e!==void 0?m.createElement(ws.Provider,{value:this.props.routeContext},m.createElement(yv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?m.createElement(vM,{error:e},t):t}};DE.contextType=iM;var Mx=new WeakMap;function vM({children:e,error:t}){let{basename:n}=m.useContext(Zr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=dM(t.digest);if(r){let o=Mx.get(t);if(o)throw o;let i=CE(r.location,n);if(NE&&!Mx.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 Mx.set(t,a),a}return m.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function wM({routeContext:e,match:t,children:n}){let r=m.useContext(ic);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),m.createElement(ws.Provider,{value:e},n)}function jM(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);cn(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,S=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!y||y[h.route.id]===void 0);if(h.route.lazy||S){n.isStatic&&(a=!0),l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}}let d=n==null?void 0:n.onError,f=r&&d?(p,h)=>{var g,y;d(p,{location:r.location,params:((y=(g=r.matches)==null?void 0:g[0])==null?void 0:y.params)??{},unstable_pattern:sM(r.matches),errorInfo:h})}:void 0;return o.reduceRight((p,h,g)=>{let y,S=!1,w=null,b=null;r&&(y=i&&h.route.id?i[h.route.id]:void 0,w=h.route.errorElement||bM,a&&(l<0&&g===0?($E("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,b=null):l===g&&(S=!0,b=h.route.hydrateFallbackElement||null)));let j=t.concat(o.slice(0,g+1)),N=()=>{let k;return y?k=w:S?k=b:h.route.Component?k=m.createElement(h.route.Component,null):h.route.element?k=h.route.element:k=p,m.createElement(wM,{match:h,routeContext:{outlet:p,matches:j,isDataRoute:r!=null},children:k})};return r&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?m.createElement(DE,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:N(),routeContext:{outlet:null,matches:j,isDataRoute:!0},onError:f}):N()},null)}function bv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kM(e){let t=m.useContext(ic);return cn(t,bv(e)),t}function SM(e){let t=m.useContext(Lh);return cn(t,bv(e)),t}function NM(e){let t=m.useContext(ws);return cn(t,bv(e)),t}function vv(e){let t=NM(e),n=t.matches[t.matches.length-1];return cn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function CM(){return vv("useRouteId")}function EM(){var r;let e=m.useContext(yv),t=SM("useRouteError"),n=vv("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function TM(){let{router:e}=kM("useNavigate"),t=vv("useNavigate"),n=m.useRef(!1);return PE(()=>{n.current=!0}),m.useCallback(async(o,i={})=>{hs(n.current,AE),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var o1={};function $E(e,t,n){!t&&!o1[e]&&(o1[e]=!0,hs(!1,n))}m.memo(RM);function RM({routes:e,future:t,state:n,isStatic:r,onError:o}){return _E(e,void 0,{state:n,isStatic:r,onError:o})}function AM(e){return gM(e.context)}function Qe(e){cn(!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 PM({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:i=!1,unstable_useTransitions:a}){cn(!jd(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),d=m.useMemo(()=>({basename:l,navigator:o,static:i,unstable_useTransitions:a,future:{}}),[l,o,i,a]);typeof n=="string"&&(n=oc(n));let{pathname:f="/",search:p="",hash:h="",state:g=null,key:y="default",unstable_mask:S}=n,w=m.useMemo(()=>{let b=bo(f,l);return b==null?null:{location:{pathname:b,search:p,hash:h,state:g,key:y,unstable_mask:S},navigationType:r}},[l,f,p,h,g,y,r,S]);return hs(w!=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.`),w==null?null:m.createElement(Zr.Provider,{value:d},m.createElement(wd.Provider,{children:t,value:w}))}function _M({children:e,location:t}){return xM(rb(e),t)}function rb(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,rb(r.props.children,i));return}cn(r.type===Qe,`[${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>`),cn(!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=rb(r.props.children,i)),n.push(a)}),n}var kp="get",Sp="application/x-www-form-urlencoded";function Oh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function DM(e){return Oh(e)&&e.tagName.toLowerCase()==="button"}function $M(e){return Oh(e)&&e.tagName.toLowerCase()==="form"}function IM(e){return Oh(e)&&e.tagName.toLowerCase()==="input"}function MM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function LM(e,t){return e.button===0&&(!t||t==="_self")&&!MM(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 OM(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 Kf=null;function FM(){if(Kf===null)try{new FormData(document.createElement("form"),0),Kf=!1}catch{Kf=!0}return Kf}var zM=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Lx(e){return e!=null&&!zM.has(e)?(hs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Sp}"`),null):e}function BM(e,t){let n,r,o,i,a;if($M(e)){let l=e.getAttribute("action");r=l?bo(l,t):null,n=e.getAttribute("method")||kp,o=Lx(e.getAttribute("enctype"))||Sp,i=new FormData(e)}else if(DM(e)||IM(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 d=e.getAttribute("formaction")||l.getAttribute("action");if(r=d?bo(d,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||kp,o=Lx(e.getAttribute("formenctype"))||Lx(l.getAttribute("enctype"))||Sp,i=new FormData(l,e),!FM()){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(Oh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=kp,r=null,o=Sp,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 wv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function UM(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&&bo(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function HM(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 VM(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 WM(e,t,n){let r=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let a=await HM(i,n);return a.links?a.links():[]}return[]}));return YM(r.flat(1).filter(VM).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function i1(e,t,n,r,o,i){let a=(d,f)=>n[f]?d.route.id!==n[f].route.id:!0,l=(d,f)=>{var p;return n[f].pathname!==d.pathname||((p=n[f].route.path)==null?void 0:p.endsWith("*"))&&n[f].params["*"]!==d.params["*"]};return i==="assets"?t.filter((d,f)=>a(d,f)||l(d,f)):i==="data"?t.filter((d,f)=>{var h;let p=r.routes[d.route.id];if(!p||!p.hasLoader)return!1;if(a(d,f)||l(d,f))return!0;if(d.route.shouldRevalidate){let g=d.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:d.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function qM(e,t,{includeHydrateFallback:n}={}){return KM(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 KM(e){return[...new Set(e)]}function GM(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function YM(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let i=JSON.stringify(GM(o));return n.has(i)||(n.add(i),r.push({key:i,link:o})),r},[])}function IE(){let e=m.useContext(ic);return wv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function XM(){let e=m.useContext(Lh);return wv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var jv=m.createContext(void 0);jv.displayName="FrameworkContext";function ME(){let e=m.useContext(jv);return wv(e,"You must render this element inside a <HydratedRouter> element"),e}function QM(e,t){let n=m.useContext(jv),[r,o]=m.useState(!1),[i,a]=m.useState(!1),{onFocus:l,onBlur:d,onMouseEnter:f,onMouseLeave:p,onTouchStart:h}=t,g=m.useRef(null);m.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let w=j=>{j.forEach(N=>{a(N.isIntersecting)})},b=new IntersectionObserver(w,{threshold:.5});return g.current&&b.observe(g.current),()=>{b.disconnect()}}},[e]),m.useEffect(()=>{if(r){let w=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(w)}}},[r]);let y=()=>{o(!0)},S=()=>{o(!1),a(!1)};return n?e!=="intent"?[i,g,{}]:[i,g,{onFocus:lu(l,y),onBlur:lu(d,S),onMouseEnter:lu(f,y),onMouseLeave:lu(p,S),onTouchStart:lu(h,y)}]:[!1,g,{}]}function lu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function JM({page:e,...t}){let{router:n}=IE(),r=m.useMemo(()=>wE(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?m.createElement(eL,{page:e,matches:r,...t}):null}function ZM(e){let{manifest:t,routeModules:n}=ME(),[r,o]=m.useState([]);return m.useEffect(()=>{let i=!1;return WM(e,t,n).then(a=>{i||o(a)}),()=>{i=!0}},[e,t,n]),r}function eL({page:e,matches:t,...n}){let r=rr(),{future:o,manifest:i,routeModules:a}=ME(),{basename:l}=IE(),{loaderData:d,matches:f}=XM(),p=m.useMemo(()=>i1(e,t,f,i,r,"data"),[e,t,f,i,r]),h=m.useMemo(()=>i1(e,t,f,i,r,"assets"),[e,t,f,i,r]),g=m.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,b=!1;if(t.forEach(N=>{var C;let k=i.routes[N.route.id];!k||!k.hasLoader||(!p.some(I=>I.route.id===N.route.id)&&N.route.id in d&&((C=a[N.route.id])!=null&&C.shouldRevalidate)||k.hasClientLoader?b=!0:w.add(N.route.id))}),w.size===0)return[];let j=UM(e,l,o.unstable_trailingSlashAwareDataRequests,"data");return b&&w.size>0&&j.searchParams.set("_routes",t.filter(N=>w.has(N.route.id)).map(N=>N.route.id).join(",")),[j.pathname+j.search]},[l,o.unstable_trailingSlashAwareDataRequests,d,r,i,p,t,e,a]),y=m.useMemo(()=>qM(h,i),[h,i]),S=ZM(h);return m.createElement(m.Fragment,null,g.map(w=>m.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),y.map(w=>m.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),S.map(({key:w,link:b})=>m.createElement("link",{key:w,nonce:n.nonce,...b,crossOrigin:b.crossOrigin??n.crossOrigin})))}function tL(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var nL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{nL&&(window.__reactRouterVersion="7.13.1")}catch{}function rL({basename:e,children:t,unstable_useTransitions:n,window:r}){let o=m.useRef();o.current==null&&(o.current=DI({window:r,v5Compat:!0}));let i=o.current,[a,l]=m.useState({action:i.action,location:i.location}),d=m.useCallback(f=>{n===!1?l(f):m.startTransition(()=>l(f))},[n]);return m.useLayoutEffect(()=>i.listen(d),[i,d]),m.createElement(PM,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,unstable_useTransitions:n})}var LE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ie=m.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:i,replace:a,unstable_mask:l,state:d,target:f,to:p,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...S},w){let{basename:b,navigator:j,unstable_useTransitions:N}=m.useContext(Zr),k=typeof p=="string"&&LE.test(p),C=CE(p,b);p=C.to;let I=pM(p,{relative:o}),T=rr(),R=null;if(l){let O=xv(l,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);b!=="/"&&(O.pathname=O.pathname==="/"?b:Vs([b,O.pathname])),R=j.createHref(O)}let[D,$,z]=QM(r,S),A=aL(p,{replace:a,unstable_mask:l,state:d,target:f,preventScrollReset:h,relative:o,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:N});function F(O){t&&t(O),O.defaultPrevented||A(O)}let W=!(C.isExternal||i),P=m.createElement("a",{...S,...z,href:(W?R:void 0)||C.absoluteURL||I,onClick:W?F:t,ref:tL(w,$),target:f,"data-discover":!k&&n==="render"?"true":void 0});return D&&!k?m.createElement(m.Fragment,null,P,m.createElement(JM,{page:I})):P});Ie.displayName="Link";var sL=m.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:i,to:a,viewTransition:l,children:d,...f},p){let h=kd(a,{relative:f.relative}),g=rr(),y=m.useContext(Lh),{navigator:S,basename:w}=m.useContext(Zr),b=y!=null&&fL(h)&&l===!0,j=S.encodeLocation?S.encodeLocation(h).pathname:h.pathname,N=g.pathname,k=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(N=N.toLowerCase(),k=k?k.toLowerCase():null,j=j.toLowerCase()),k&&w&&(k=bo(k,w)||k);const C=j!=="/"&&j.endsWith("/")?j.length-1:j.length;let I=N===j||!o&&N.startsWith(j)&&N.charAt(C)==="/",T=k!=null&&(k===j||!o&&k.startsWith(j)&&k.charAt(j.length)==="/"),R={isActive:I,isPending:T,isTransitioning:b},D=I?t:void 0,$;typeof r=="function"?$=r(R):$=[r,I?"active":null,T?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let z=typeof i=="function"?i(R):i;return m.createElement(Ie,{...f,"aria-current":D,className:$,ref:p,style:z,to:a,viewTransition:l},typeof d=="function"?d(R):d)});sL.displayName="NavLink";var oL=m.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:i,method:a=kp,action:l,onSubmit:d,relative:f,preventScrollReset:p,viewTransition:h,unstable_defaultShouldRevalidate:g,...y},S)=>{let{unstable_useTransitions:w}=m.useContext(Zr),b=uL(),j=dL(l,{relative:f}),N=a.toLowerCase()==="get"?"get":"post",k=typeof l=="string"&&LE.test(l),C=I=>{if(d&&d(I),I.defaultPrevented)return;I.preventDefault();let T=I.nativeEvent.submitter,R=(T==null?void 0:T.getAttribute("formmethod"))||a,D=()=>b(T||I.currentTarget,{fetcherKey:t,method:R,navigate:n,replace:o,state:i,relative:f,preventScrollReset:p,viewTransition:h,unstable_defaultShouldRevalidate:g});w&&n!==!1?m.startTransition(()=>D()):D()};return m.createElement("form",{ref:S,method:N,action:j,onSubmit:r?d:C,...y,"data-discover":!k&&e==="render"?"true":void 0})});oL.displayName="Form";function iL(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function OE(e){let t=m.useContext(ic);return cn(t,iL(e)),t}function aL(e,{target:t,replace:n,unstable_mask:r,state:o,preventScrollReset:i,relative:a,viewTransition:l,unstable_defaultShouldRevalidate:d,unstable_useTransitions:f}={}){let p=zt(),h=rr(),g=kd(e,{relative:a});return m.useCallback(y=>{if(LM(y,t)){y.preventDefault();let S=n!==void 0?n:qu(h)===qu(g),w=()=>p(e,{replace:S,unstable_mask:r,state:o,preventScrollReset:i,relative:a,viewTransition:l,unstable_defaultShouldRevalidate:d});f?m.startTransition(()=>w()):w()}},[h,p,g,n,r,o,t,e,i,a,l,d,f])}function js(e){hs(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(()=>OM(r.search,n.current?null:t.current),[r.search]),i=zt(),a=m.useCallback((l,d)=>{const f=sb(typeof l=="function"?l(new URLSearchParams(o)):l);n.current=!0,i("?"+f,d)},[i,o]);return[o,a]}var lL=0,cL=()=>`__${String(++lL)}__`;function uL(){let{router:e}=OE("useSubmit"),{basename:t}=m.useContext(Zr),n=CM(),r=e.fetch,o=e.navigate;return m.useCallback(async(i,a={})=>{let{action:l,method:d,encType:f,formData:p,body:h}=BM(i,t);if(a.navigate===!1){let g=a.fetcherKey||cL();await r(g,n,a.action||l,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:h,formMethod:a.method||d,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||d,formEncType:a.encType||f,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,o,t,n])}function dL(e,{relative:t}={}){let{basename:n}=m.useContext(Zr),r=m.useContext(ws);cn(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),i={...kd(e||".",{relative:t})},a=rr();if(e==null){i.search=a.search;let l=new URLSearchParams(i.search),d=l.getAll("index");if(d.some(p=>p==="")){l.delete("index"),d.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:Vs([n,i.pathname])),qu(i)}function fL(e,{relative:t}={}){let n=m.useContext(TE);cn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=OE("useViewTransitionState"),o=kd(e,{relative:t});if(!n.isTransitioning)return!1;let i=bo(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=bo(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Kp(o.pathname,a)!=null||Kp(o.pathname,i)!=null}var mo=vE();const pL=bd(mo);/**
|
|
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 hL=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),FE=(...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 mL={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 gL=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...l},d)=>m.createElement("svg",{ref:d,...mL,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:FE("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 Oe=(e,t)=>{const n=m.forwardRef(({className:r,...o},i)=>m.createElement(gL,{ref:i,iconNode:t,className:FE(`lucide-${hL(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 Fh=Oe("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 Gp=Oe("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 zh=Oe("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 Yp=Oe("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 Bh=Oe("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 zE=Oe("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 Xp=Oe("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 xL=Oe("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 yL=Oe("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 BE=Oe("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 Uh=Oe("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"}]]);/**
|
|
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 bL=Oe("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"}]]);/**
|
|
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 UE=Oe("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"}]]);/**
|
|
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 Lr=Oe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
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 yr=Oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
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 vL=Oe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
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 HE=Oe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
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 VE=Oe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
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 Qp=Oe("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"}]]);/**
|
|
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 kv=Oe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
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 ob=Oe("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
|
|
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 wL=Oe("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"}]]);/**
|
|
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 jL=Oe("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/**
|
|
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 kL=Oe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
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 SL=Oe("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/**
|
|
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 NL=Oe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
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 CL=Oe("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
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 EL=Oe("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"}]]);/**
|
|
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 Sd=Oe("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"}]]);/**
|
|
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 TL=Oe("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"}]]);/**
|
|
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 WE=Oe("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"}]]);/**
|
|
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 Jp=Oe("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"}]]);/**
|
|
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 RL=Oe("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"}]]);/**
|
|
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 AL=Oe("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"}]]);/**
|
|
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 ac=Oe("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"}]]);/**
|
|
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 a1=Oe("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"}]]);/**
|
|
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 PL=Oe("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"}]]);/**
|
|
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 _L=Oe("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"}]]);/**
|
|
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 qE=Oe("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"}]]);/**
|
|
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 DL=Oe("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"}]]);/**
|
|
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 Sv=Oe("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"}]]);/**
|
|
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 $L=Oe("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"}]]);/**
|
|
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 Nv=Oe("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"}]]);/**
|
|
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 IL=Oe("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"}]]);/**
|
|
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 lc=Oe("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"}]]);/**
|
|
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 ML=Oe("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"}]]);/**
|
|
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 LL=Oe("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"}]]);/**
|
|
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 Cv=Oe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
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 ib=Oe("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"}]]);/**
|
|
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 OL=Oe("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"}]]);/**
|
|
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 KE=Oe("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"}]]);/**
|
|
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 FL=Oe("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"}]]);/**
|
|
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 zL=Oe("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"}]]);/**
|
|
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 BL=Oe("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"}]]);/**
|
|
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 UL=Oe("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"}]]);/**
|
|
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 HL=Oe("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"}]]);/**
|
|
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 Ev=Oe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 VL=Oe("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"}]]);/**
|
|
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 WL=Oe("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"}]]);/**
|
|
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 Tv=Oe("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"}]]);/**
|
|
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 qL=Oe("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"}]]);/**
|
|
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 Ox=Oe("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"}]]);/**
|
|
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 GE=Oe("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"}]]);/**
|
|
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 cc=Oe("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"}]]);/**
|
|
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 KL=Oe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 Pt=Oe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 YE=Oe("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"}]]);/**
|
|
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 GL=Oe("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"}]]);/**
|
|
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 YL=Oe("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
|
|
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 Gs=Oe("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"}]]);/**
|
|
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 Hh=Oe("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"}]]);/**
|
|
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 XL=Oe("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"}]]);/**
|
|
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 pi=Oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
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 QL=Oe("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"}]]);/**
|
|
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 JL=Oe("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"}]]);/**
|
|
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 ZL=Oe("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"}]]);/**
|
|
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 e4=Oe("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"}]]);/**
|
|
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 t4=Oe("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"}]]);/**
|
|
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 Xr=Oe("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"}]]);/**
|
|
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 l1=Oe("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"}]]);/**
|
|
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 c1=Oe("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"}]]);/**
|
|
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 Rv=Oe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
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 n4=Oe("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"}]]);/**
|
|
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 XE=Oe("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"}]]);/**
|
|
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 Cl=Oe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
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 jn=Oe("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"}]]);/**
|
|
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 Vh=Oe("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"}]]);/**
|
|
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 r4=Oe("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"}]]);/**
|
|
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 s4=Oe("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"}]]);/**
|
|
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 o4=Oe("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"}]]);/**
|
|
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 Nd=Oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function QE(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=QE(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function i4(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=QE(e))&&(r&&(r+=" "),r+=t);return r}const Av="-",a4=e=>{const t=c4(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const l=a.split(Av);return l[0]===""&&l.length!==1&&l.shift(),JE(l,t)||l4(a)},getConflictingClassGroupIds:(a,l)=>{const d=n[a]||[];return l&&r[a]?[...d,...r[a]]:d}}},JE=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?JE(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Av);return(a=t.validators.find(({validator:l})=>l(i)))==null?void 0:a.classGroupId},u1=/^\[(.+)\]$/,l4=e=>{if(u1.test(e)){const t=u1.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},c4=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return d4(Object.entries(e.classGroups),n).forEach(([i,a])=>{ab(a,r,i,t)}),r},ab=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:d1(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(u4(o)){ab(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,a])=>{ab(a,d1(t,i),n,r)})})},d1=(e,t)=>{let n=e;return t.split(Av).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},u4=e=>e.isThemeGetter,d4=(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,f4=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)}}},ZE="!",p4=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,a=l=>{const d=[];let f=0,p=0,h;for(let b=0;b<l.length;b++){let j=l[b];if(f===0){if(j===o&&(r||l.slice(b,b+i)===t)){d.push(l.slice(p,b)),p=b+i;continue}if(j==="/"){h=b;continue}}j==="["?f++:j==="]"&&f--}const g=d.length===0?l:l.substring(p),y=g.startsWith(ZE),S=y?g.substring(1):g,w=h&&h>p?h-p:void 0;return{modifiers:d,hasImportantModifier:y,baseClassName:S,maybePostfixModifierPosition:w}};return n?l=>n({className:l,parseClassName:a}):a},h4=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},m4=e=>({cache:f4(e.cacheSize),parseClassName:p4(e),...a4(e)}),g4=/\s+/,x4=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],a=e.trim().split(g4);let l="";for(let d=a.length-1;d>=0;d-=1){const f=a[d],{modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:y}=n(f);let S=!!y,w=r(S?g.substring(0,y):g);if(!w){if(!S){l=f+(l.length>0?" "+l:l);continue}if(w=r(g),!w){l=f+(l.length>0?" "+l:l);continue}S=!1}const b=h4(p).join(":"),j=h?b+ZE:b,N=j+w;if(i.includes(N))continue;i.push(N);const k=o(w,S);for(let C=0;C<k.length;++C){const I=k[C];i.push(j+I)}l=f+(l.length>0?" "+l:l)}return l};function y4(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=e2(t))&&(r&&(r+=" "),r+=n);return r}const e2=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=e2(e[r]))&&(n&&(n+=" "),n+=t);return n};function b4(e,...t){let n,r,o,i=a;function a(d){const f=t.reduce((p,h)=>h(p),e());return n=m4(f),r=n.cache.get,o=n.cache.set,i=l,l(d)}function l(d){const f=r(d);if(f)return f;const p=x4(d,n);return o(d,p),p}return function(){return i(y4.apply(null,arguments))}}const Xt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},t2=/^\[(?:([a-z-]+):)?(.+)\]$/i,v4=/^\d+\/\d+$/,w4=new Set(["px","full","screen"]),j4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,k4=/\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$/,S4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,N4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,C4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fo=e=>El(e)||w4.has(e)||v4.test(e),Ko=e=>uc(e,"length",$4),El=e=>!!e&&!Number.isNaN(Number(e)),Fx=e=>uc(e,"number",El),cu=e=>!!e&&Number.isInteger(Number(e)),E4=e=>e.endsWith("%")&&El(e.slice(0,-1)),mt=e=>t2.test(e),Go=e=>j4.test(e),T4=new Set(["length","size","percentage"]),R4=e=>uc(e,T4,n2),A4=e=>uc(e,"position",n2),P4=new Set(["image","url"]),_4=e=>uc(e,P4,M4),D4=e=>uc(e,"",I4),uu=()=>!0,uc=(e,t,n)=>{const r=t2.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},$4=e=>k4.test(e)&&!S4.test(e),n2=()=>!1,I4=e=>N4.test(e),M4=e=>C4.test(e),L4=()=>{const e=Xt("colors"),t=Xt("spacing"),n=Xt("blur"),r=Xt("brightness"),o=Xt("borderColor"),i=Xt("borderRadius"),a=Xt("borderSpacing"),l=Xt("borderWidth"),d=Xt("contrast"),f=Xt("grayscale"),p=Xt("hueRotate"),h=Xt("invert"),g=Xt("gap"),y=Xt("gradientColorStops"),S=Xt("gradientColorStopPositions"),w=Xt("inset"),b=Xt("margin"),j=Xt("opacity"),N=Xt("padding"),k=Xt("saturate"),C=Xt("scale"),I=Xt("sepia"),T=Xt("skew"),R=Xt("space"),D=Xt("translate"),$=()=>["auto","contain","none"],z=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",mt,t],F=()=>[mt,t],W=()=>["",fo,Ko],P=()=>["auto",El,mt],O=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>["start","end","center","between","around","evenly","stretch"],U=()=>["","0",mt],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[El,mt];return{cacheSize:500,separator:":",theme:{colors:[uu],spacing:[fo,Ko],blur:["none","",Go,mt],brightness:V(),borderColor:[e],borderRadius:["none","","full",Go,mt],borderSpacing:F(),borderWidth:W(),contrast:V(),grayscale:U(),hueRotate:V(),invert:U(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[E4,Ko],inset:A(),margin:A(),opacity:V(),padding:F(),saturate:V(),scale:V(),sepia:U(),skew:V(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",mt]}],container:["container"],columns:[{columns:[Go]}],"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:[...O(),mt]}],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:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",cu,mt]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",mt]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",cu,mt]}],"grid-cols":[{"grid-cols":[uu]}],"col-start-end":[{col:["auto",{span:["full",cu,mt]},mt]}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":[uu]}],"row-start-end":[{row:["auto",{span:[cu,mt]},mt]}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",mt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",mt]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...L()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...L(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...L(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[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":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",mt,t]}],"min-w":[{"min-w":[mt,t,"min","max","fit"]}],"max-w":[{"max-w":[mt,t,"none","full","min","max","fit","prose",{screen:[Go]},Go]}],h:[{h:[mt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[mt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[mt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[mt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Go,Ko]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Fx]}],"font-family":[{font:[uu]}],"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",mt]}],"line-clamp":[{"line-clamp":["none",El,Fx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fo,mt]}],"list-image":[{"list-image":["none",mt]}],"list-style-type":[{list:["none","disc","decimal",mt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[j]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[j]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fo,Ko]}],"underline-offset":[{"underline-offset":["auto",fo,mt]}],"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:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mt]}],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",mt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[j]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...O(),A4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",R4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},_4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"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":[j]}],"border-style":[{border:[...B(),"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":[j]}],"divide-style":[{divide:B()}],"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:["",...B()]}],"outline-offset":[{"outline-offset":[fo,mt]}],"outline-w":[{outline:[fo,Ko]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[fo,Ko]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Go,D4]}],"shadow-color":[{shadow:[uu]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",Go,mt]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[h]}],saturate:[{saturate:[k]}],sepia:[{sepia:[I]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[j]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[I]}],"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",mt]}],duration:[{duration:V()}],ease:[{ease:["linear","in","out","in-out",mt]}],delay:[{delay:V()}],animate:[{animate:["none","spin","ping","pulse","bounce",mt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[cu,mt]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"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",mt]}],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",mt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"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",mt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[fo,Ko,Fx]}],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"]}}},O4=b4(L4);function Ne(...e){return O4(i4(e))}function Kn(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 Jr(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 r2(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function s2(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 o2(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 Ul(e){return e.toLocaleString("en-US")}function Hl(e){return`$${e.toFixed(4)}`}function F4(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 Tn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function i2(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function z4(e){let t=i2(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("/usage")?"/usage":t.startsWith("/agent-sessions")?"/agent-sessions":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":null}function a2(e,t){return z4(e)===t}function l2(e){let n=i2(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:Tn(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:Tn(n[1]),path:`${a}/projects/${n[1]}`}),o=Tn(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:Tn(n[3]),path:`${a}/projects/${n[1]}/assignments/${n[3]}`}),o=Tn(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",d=n[2]==="memories"?"/memories":"/resources";r.push({label:l,path:d}),r.push({label:Tn(n[3]),path:`${a}/projects/${n[1]}/${n[2]}/${n[3]}`}),o=Tn(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]==="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]==="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:Tn(n[1]),path:`/playbooks/${n[1]}`}),o="Edit Playbook"):n[1]&&(r.push({label:Tn(n[1]),path:`/playbooks/${n[1]}`}),o=Tn(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 f1({items:e,onNavigate:t}){const n=rr();return s.jsx("nav",{className:"space-y-1",children:e.map(r=>{const o=r.icon,i=a2(n.pathname,r.to)&&!n.pathname.startsWith("/w/");return s.jsxs(Ie,{to:r.to,onClick:t,className:Ne("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition",i?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),children:[s.jsx(o,{className:"h-4 w-4"}),s.jsx("span",{children:r.label})]},r.to)})})}const c2=[{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)"}}],B4=c2.map(e=>e.slug),Zp="default";function u2(e){return typeof e=="string"&&B4.includes(e)}const d2={preset:Zp,custom:!1};let Eu=null,tl=null;function Pv(e){if(!e||typeof e!="object")return d2;const t=e;return{preset:u2(t.preset)?t.preset:Zp,custom:t.custom===!0}}function U4(){return Eu?Promise.resolve(Eu):tl||(tl=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Pv(e);return Eu=t,tl=null,t}).catch(()=>(tl=null,d2)),tl)}async function H4(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=Pv(await t.json());return Eu=n,n}async function V4(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Pv(await e.json());return Eu=t,t}const lb="syntaur-theme",Np="syntaur-preset",f2=m.createContext(null);function cb(){try{const e=window.localStorage.getItem(lb);return e==="light"||e==="dark"?e:null}catch{return null}}function p2(){try{const e=window.localStorage.getItem(Np);return u2(e)?e:Zp}catch{return Zp}}function h2(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function m2(e){document.documentElement.classList.toggle("dark",e==="dark")}function g2(e){document.documentElement.dataset.theme=e}function W4(){typeof document>"u"||(m2(cb()??h2()),g2(p2()))}function q4({children:e}){const[t,n]=m.useState(()=>cb()),[r,o]=m.useState(()=>cb()??h2()),[i,a]=m.useState(()=>p2());m.useEffect(()=>{m2(r)},[r]),m.useEffect(()=>{g2(i)},[i]),m.useEffect(()=>{let p=!1;return U4().then(h=>{if(!p&&h.preset!==i){a(h.preset);try{window.localStorage.setItem(Np,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(Np,p)}catch{}await H4(p)}async function d(){const p=await V4();a(p.preset);try{window.localStorage.setItem(Np,p.preset)}catch{}}const f={resolvedTheme:r,explicitTheme:t,setTheme:p=>{window.localStorage.setItem(lb,p),n(p),o(p)},toggleTheme:()=>{const p=r==="dark"?"light":"dark";window.localStorage.setItem(lb,p),n(p),o(p)},preset:i,setPreset:l,resetPreset:d};return s.jsx(f2.Provider,{value:f,children:e})}function _v(){const e=m.useContext(f2);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Cp=new Set;let pr=null,Tl=null;function K4(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function x2(){pr&&(pr.readyState===WebSocket.OPEN||pr.readyState===WebSocket.CONNECTING)||(pr=new WebSocket(K4()),pr.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of Cp)n(t)}catch{}},pr.onclose=()=>{pr=null,Tl&&clearTimeout(Tl),Tl=setTimeout(x2,2e3)},pr.onerror=()=>{pr==null||pr.close()})}function dc(e){const t=m.useRef(e);t.current=e,m.useEffect(()=>{const n=r=>t.current(r);return Cp.add(n),x2(),()=>{Cp.delete(n),Cp.size===0&&pr&&(Tl&&clearTimeout(Tl),Tl=null,pr.close(),pr=null)}},[])}const Wh=["7d","30d","90d","all","custom"],y2="30d",G4=/^\d{4}-\d{2}-\d{2}$/,Cd=["project","workspace","model","tool"],Y4={"7d":7,"30d":30,"90d":90};function Tu(e){if(typeof e!="string"||!G4.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 p1(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 X4(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function Q4(e,t=new Date){const n=e.window??y2;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:p1(X4(r,-(Y4[n]-1))),until:p1(r)}}function J4(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&&!Wh.includes(n.window)&&t.push(`invalid window: ${String(n.window)}`);for(const r of["since","until"])n[r]!==void 0&&!Tu(n[r])&&t.push(`invalid ${r}: ${String(n[r])} (expected YYYY-MM-DD)`);for(const r of Cd)n[r]!==void 0&&(typeof n[r]!="string"||n[r].length===0)&&t.push(`invalid ${r}: must be a non-empty string`);return Tu(n.since)&&Tu(n.until)&&n.since>n.until&&t.push("since must be on or before until"),{ok:t.length===0,errors:t}}function Ed(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;typeof n.window=="string"&&Wh.includes(n.window)&&(t.window=n.window),Tu(n.since)&&(t.since=n.since),Tu(n.until)&&(t.until=n.until);for(const r of Cd)typeof n[r]=="string"&&n[r].length>0&&(t[r]=n[r]);return t.window!=="custom"&&(delete t.since,delete t.until),t}function ub(e){const t=Ed(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 Cd)t[r]&&n.set(r,t[r]);return n}function Z4(e){const t={};for(const n of["window","since","until",...Cd]){const r=e.get(n);r!==null&&(t[n]=r)}return Ed(t)}function b2(e,t=new Date){const n=Ed(e),{since:r,until:o}=Q4(n,t),i=new URLSearchParams;r&&i.set("since",r),o&&i.set("until",o);for(const a of Cd)n[a]&&i.set(a,n[a]);return i}const eO={"7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",all:"All time",custom:"Custom range"};function h1(e){const t=Ed(e),n=t.window??y2,r=[];return r.push(n==="custom"?`${t.since??"…"} → ${t.until??"…"}`:eO[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 Zt(e,t,n=!0,r=!1){const[o,i]=m.useState(null),[a,l]=m.useState(!0),[d,f]=m.useState(null),[p,h]=m.useState(0),g=n?e:null,y=m.useCallback(()=>{h(w=>w+1)},[]),S=m.useRef(g);return r&&S.current!==g&&(S.current=g,i(null),f(null)),m.useEffect(()=>{if(!g){l(!1),i(null);return}let w=!1;return l(!0),f(null),fetch(g).then(async b=>{if(!b.ok){const j=await b.json().catch(()=>null);throw new Error((j==null?void 0:j.error)||`HTTP ${b.status}`)}return b.json()}).then(b=>{w||(i(b),l(!1))}).catch(b=>{w||(f(b.message),l(!1))}),()=>{w=!0}},[g,p]),dc(w=>{!t||!g||((w.type==="project-updated"||w.type==="assignment-updated")&&y(),w.type==="servers-updated"&&t==="servers"&&y(),w.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&y(),w.type==="playbooks-updated"&&t==="playbooks"&&y(),w.type==="leases-updated"&&t==="inventories"&&y())}),{data:o,loading:a,error:d,refetch:y}}function Xs(e=!0){return Zt("/api/projects","projects",e)}function fa(){return Zt("/api/workspaces","projects")}function mn(){const{workspace:e}=Bt();return e?`/w/${e}`:""}function tO(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 Zt(r,"overview")}function qh(e=!0){return Zt("/api/assignments","assignments",e)}function nO(e=!0){return Zt("/api/archived","assignments",e)}function v2(){return Zt("/api/help")}function w2(e){const t=e?`/api/projects/${e}`:null;return Zt(t,"project")}function rO(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return Zt(n,"assignment")}function sO(e){const t=e?`/api/assignments/${e}`:null;return Zt(t,"assignment")}function j2(e){return Zt(e)}function Dv(e=!0){return Zt("/api/servers","servers",e)}function k2(){return Zt("/api/leases","inventories")}function Kh(){return Zt("/api/agent-sessions","agent-sessions")}function oO(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return Zt(n,"agent-sessions")}function iO(e){const t=e?`/api/assignments/${e}/sessions`:null;return Zt(t,"agent-sessions")}function aO(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return Zt(n,void 0,!0,!0)}function lO(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return Zt(t,void 0,!0,!0)}function $v(e=!0){return Zt("/api/playbooks","playbooks",e)}function cO(e){const t=b2(e).toString(),n=t?`/api/usage?${t}`:"/api/usage";return Zt(n,void 0,!0,!0)}function S2(e=!0){return Zt("/api/usage/facets",void 0,e)}function uO(e){const t=e?`/api/playbooks/${e}`:null;return Zt(t,"playbooks")}function dO(){return Zt("/api/memories","project")}function fO(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return Zt(n,"project")}function pO(){return Zt("/api/resources","project")}function hO(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return Zt(n,"project")}const Gh=["new-workspace","new-project","new-todo","new-assignment"];function mO(e){return typeof e=="string"&&Gh.includes(e)}const gO=["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","[","]"],xO=["mod","ctrl","alt","shift"];function mr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(mr).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 xO)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 yO(e){const t=mr(e);return t?gO.includes(t):!1}const bO={"new-workspace":mr("Mod+Shift+Alt+w"),"new-project":mr("Mod+Shift+Alt+p"),"new-todo":mr("Mod+Shift+Alt+t"),"new-assignment":mr("Mod+Shift+Alt+a")};function vO(e){const t={...bO};for(const n of Gh){const r=e[n];typeof r=="string"&&r.length>0&&(t[n]=r)}return t}function Wi(){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 wO(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 Gf(e,t){const n=wO(t);if(e.key.toLowerCase()!==n.key)return!1;const o=Wi()?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 N2(e){const t=[],n=Wi()?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 mr(a)}function Ws(e){return e.split("+").map(n=>{const r=n.toLowerCase();return r==="mod"?Wi()?"⌘":"Ctrl":r==="shift"?Wi()?"⇧":"Shift":r==="alt"?Wi()?"⌥":"Alt":r==="ctrl"?Wi()?"⌃":"Ctrl":r==="enter"?"↵":r==="escape"?"Esc":r==="arrowup"?"↑":r==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(Wi()?"":"+")}function jO(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const d=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),a(null)}catch(d){a(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),dc(d=>{d.type==="todos-updated"&&!d.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}function C2(e=!0){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const d=await fetch("/api/todos");if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),a(null)}catch(d){a(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[]);return m.useEffect(()=>{if(!e){o(!1);return}l()},[l,e]),dc(d=>{e&&d.type==="todos-updated"&&!d.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}async function Iv(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function E2(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function T2(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function R2(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function A2(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function P2(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function _2(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 Mv(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function D2(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 $2(e,t,n){const r=await fetch(Mv(e,t,n),{method:"DELETE"});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}async function Lv(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 kO(e,t){return await Lv(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function SO(e){return await Lv("/api/todos/promote-bulk",e)}async function NO(e,t,n){await Lv(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const Yh=["assignment","project","todo","server","playbook"],Ji={defaultScope:"all",aliases:{a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},externalIds:!0},I2=["kind","status","tag","tags","assignee","type","project","externalid","jira","title","search"],db="all",M2=/^[a-z][a-z0-9]*$/;function Ov(e){return typeof e=="string"&&Yh.includes(e)}function CO(e){return e==="all"||Ov(e)}function EO(e){if(!e||typeof e!="object")return RO();const t=e,n=CO(t.defaultScope)?t.defaultScope:Ji.defaultScope,r=typeof t.externalIds=="boolean"?t.externalIds:Ji.externalIds;let o;if(t.aliases&&typeof t.aliases=="object"){o={};for(const[i,a]of Object.entries(t.aliases))M2.test(i)&&i!==db&&!I2.includes(i)&&Ov(a)&&(o[i]=a)}else o={...Ji.aliases};return{defaultScope:n,aliases:o,externalIds:r}}function TO(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))M2.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)`),I2.includes(n)&&t.push(`alias key "${n}" collides with the reserved field name "${n}"`),Ov(r)||t.push(`alias "${n}" must map to one of: ${Yh.join(", ")}`);return t.length===0?{ok:!0}:{ok:!1,errors:t}}function RO(){return{defaultScope:Ji.defaultScope,aliases:{...Ji.aliases},externalIds:Ji.externalIds}}const Fv={search:Ji,custom:!1};let yl=null,nl=null,eh=0;const fb=new Set;function L2(e){yl=e;for(const t of fb)t(e)}function zv(e){if(!e||typeof e!="object")return Fv;const t=e;return{search:EO(t.search),custom:t.custom===!0}}function AO(){if(yl)return Promise.resolve(yl);if(nl)return nl;const e=++eh;return nl=fetch("/api/config/search").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{nl=null;const n=zv(t);return e!==eh?yl??n:(yl=n,n)}).catch(()=>(nl=null,Fv)),nl}function Bv(){const[e,t]=m.useState(()=>yl??Fv);return m.useEffect(()=>{let n=!1;return AO().then(r=>{n||t(r)}),fb.add(t),()=>{n=!0,fb.delete(t)}},[]),e}async function PO(e){var r;++eh;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=zv(await t.json());return L2(n),n}async function _O(){++eh;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=zv(await e.json());return L2(t),t}const DO=new Set(["/projects","/assignments","/servers","/todos"]);function Ep(e,t){return DO.has(e)?`${t}${e}`:e}const $O=[{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 IO(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 MO(e){const t=[],n=e.externalIds!==!1,r=i=>n?IO(i):[],o=i=>n?i:void 0;for(const i of $O)t.push({type:"page",id:i.id,title:i.title,keywords:[...i.keywords],route:Ep(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:`${Ep("/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=Ep("/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 Tr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Tp(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function LO(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 zx(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 m1(){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 g1(){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 Bx(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 Li(e,t,n){const r=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!r)return`---
|
|
527
|
+
${t}: ${JSON.stringify(n)}
|
|
528
|
+
---
|
|
529
|
+
${e}`;const o=r[1],i=r[2],a=r[3],l=e.slice(r[0].length),d=JSON.stringify(n),f=new RegExp(`^${t}:\\s*.*$`,"m");let p;return f.test(i)?p=i.replace(f,`${t}: ${d}`):p=`${i}
|
|
530
|
+
${t}: ${d}`,`${o}${p}${a}${l}`}const OO=/^[a-z0-9][a-z0-9-]*$/;function FO(e){const{playbooks:t,projectSlug:n,currentProjectTitle:r,currentProjectWorkspace:o,wsPrefix:i,refetchPlaybooks:a,navigate:l,toggleTheme:d}=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:OO,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 S=await y.json().catch(()=>({}));throw new Error(S.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 m1(),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 S=Tr(y);if(!S)throw new Error("Title must contain at least one alphanumeric character");let w=await Bx("/api/templates/project");w=Li(w,"slug",S),w=Li(w,"title",y),g&&g!=="_ungrouped"&&(w=Li(w,"workspace",g));const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:w})}),j=await b.json().catch(()=>({}));if(!b.ok)throw new Error(j.error||`Failed to create project (HTTP ${b.status})`);const N=g&&g!=="_ungrouped"?`/w/${g}/projects/${j.slug??S}`:`/projects/${j.slug??S}`;h.navigate(N)}}}),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([m1(),g1()]),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 S=y.workspace??"_ungrouped";g.push({value:S,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 Iv(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 g1(),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 k;const g=(p.project??"_standalone").trim()||"_standalone",y=(p.title??"").trim();if(!y)throw new Error("Title is required");const S=Tr(y);if(!S)throw new Error("Title must contain at least one alphanumeric character");if(g==="_standalone"){let C=await Bx("/api/templates/assignment?standalone=1");C=Li(C,"slug",S),C=Li(C,"title",y);const I=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:C})}),T=await I.json().catch(()=>({}));if(!I.ok)throw new Error(T.error||`Failed to create assignment (HTTP ${I.status})`);const R=((k=T==null?void 0:T.assignment)==null?void 0:k.id)??(T==null?void 0:T.id);R?h.navigate(`/assignments/${R}`):h.navigate("/assignments");return}let w=await Bx("/api/templates/assignment");w=Li(w,"slug",S),w=Li(w,"title",y);const b=await fetch(`/api/projects/${encodeURIComponent(g)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:w})}),j=await b.json().catch(()=>({}));if(!b.ok)throw new Error(j.error||`Failed to create assignment (HTTP ${b.status})`);const N=j.slug??S;h.navigate(`/projects/${g}/assignments/${N}`)}}}),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 zx("_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 zx(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 zx(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:()=>LO(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:()=>d()}),f}const zO=["low","medium","high","critical"],Xh={status:{kind:"enum"},priority:{kind:"ordinal",order:zO},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},pinned:{kind:"bool"}};function BO(e,t){return e[t.toLowerCase()]??null}function Rr(e,t,n){return e.get?e.get(n):n[t]??n[t.toLowerCase()]}class Ar extends Error{constructor(t){super(t.map(n=>`${n.message} (at ${n.pos})`).join("; ")),this.errors=t,this.name="CompileError"}}function O2(e){const[t,n,r]=e.split("-").map(a=>parseInt(a,10)),o=new Date(t,n-1,r).getTime(),i=new Date(t,n-1,r+1).getTime();return[o,i]}function pb(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 Ru(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 Ux(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function UO(e){return e==null||e===""}function Rp(e,t,n,r){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?o=>UO(Rr(e,t,o)):o=>Ux(Rr(e,t,o),n.raw);case"substring":return o=>{const i=Rr(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 Ar([{pos:n.pos,message:`Field "${t}" is boolean — use ${t}:true or ${t}:false`}]);const i=o==="true";return a=>{const l=Rr(e,t,a),d=typeof l=="boolean"?l:l==="true"?!0:l==="false"||l===null||l===void 0||l===""?!1:null;return d!==null&&d===i}}case"number":{const o=n.num??Ru(n.raw);if(o===null)throw new Ar([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return i=>Ru(Rr(e,t,i))===o}case"ordinal":return o=>Ux(Rr(e,t,o),n.raw);case"list":return o=>{const i=Rr(e,t,o);return Array.isArray(i)&&i.some(a=>Ux(a,n.raw))};case"timestamp":{if(n.type==="date"){const[o,i]=O2(n.raw);return a=>{const l=pb(Rr(e,t,a));return l!==null&&l>=o&&l<i}}throw new Ar([{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 Ar([{pos:r,message:`Field "${t}" is a duration — use a comparison (e.g. ${t} > 3d)`}])}}function HO(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??Ru(r.raw);if(i===null)throw new Ar([{pos:r.pos,message:`"${r.raw}" is not a number (field "${t}")`}]);return a=>{const l=Ru(Rr(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 Ar([{pos:r.pos,message:`"${r.raw}" is not a valid ${t} (expected one of: ${i.join(", ")})`}]);return l=>{const d=Rr(e,t,l),f=typeof d=="string"?i.findIndex(p=>p.toLowerCase()===d.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,d)=>{const f=pb(Rr(e,t,l));return f!==null&&o(f,d.now+a)}}if(r.type==="date"){const[i,a]=O2(r.raw);return l=>{const d=pb(Rr(e,t,l));if(d===null)return!1;switch(n){case"<":return d<i;case"<=":return d<a;case">":return d>=a;case">=":return d>=i;case"=":return d>=i&&d<a;case"!=":return d<i||d>=a;default:return!1}}}throw new Ar([{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 Ar([{pos:r.pos,message:`Compare duration field "${t}" to a duration literal (e.g. 3d)`}]);const i=r.num??0;return a=>{const l=Ru(Rr(e,t,a));return l!==null&&o(l,i)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return Rp(e,t,r,r.pos);if(n==="!="){const i=Rp(e,t,r,r.pos);return(a,l)=>!i(a,l)}throw new Ar([{pos:r.pos,message:`Field "${t}" does not support ordering comparisons (use ":" or "=").`}])}case"bool":{if(n==="="||n==="!="){const i=Rp(e,t,r,r.pos);return n==="="?i:(a,l)=>!i(a,l)}throw new Ar([{pos:r.pos,message:`Field "${t}" is boolean — use ${t}:true / ${t}:false`}])}}}function VO(e,t){const n=BO(t,e.field);if(!n)throw new Ar([{pos:e.pos,message:`Unknown field "${e.field}"`}]);if(e.op===":"){const r=e.values.map(o=>Rp(n,e.field,o,e.pos));return r.length===1?r[0]:(o,i)=>r.some(a=>a(o,i))}return HO(n,e.field,e.op,e.values[0])}function Au(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return VO(e,t);case"not":{const n=Au(e.child,t);return(r,o)=>!n(r,o)}case"and":{const n=e.children.map(r=>Au(r,t));return(r,o)=>n.every(i=>i(r,o))}case"or":{const n=e.children.map(r=>Au(r,t));return(r,o)=>n.some(i=>i(r,o))}}}class qi extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const WO={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},qO=/[A-Za-z_]/,KO=/[A-Za-z0-9_-]/,GO=/^\d{4}-\d{2}-\d{2}/;function Qh(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 d="";for(;a<e.length&&/[a-z]/i.test(e[a]);)d+=e[a],a++;if(n=a,d.length>0){const f=WO[d.toLowerCase()];if(f===void 0)throw new qi(o,`Unknown duration unit "${d}" (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===`
|
|
531
|
+
`||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 qi(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,d="";for(;l<e.length&&e[l]!==a;)e[l]==="\\"&&l+1<e.length?(d+=e[l+1],l+=2):(d+=e[l],l++);if(l>=e.length)throw new qi(i,"Unterminated string literal");t.push({type:"STRING",text:d,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 qi(i,'Unexpected "+"')}if(/\d/.test(o)){const a=e.slice(n).match(GO);if(a){t.push({type:"DATE",text:a[0],pos:i}),n+=a[0].length;continue}t.push(r(i,0));continue}if(qO.test(o)){let a=n+1;for(;a<e.length&&KO.test(e[a]);)a++;const l=e.slice(n,a),d=l.toLowerCase();d==="and"?t.push({type:"AND",text:l,pos:i}):d==="or"?t.push({type:"OR",text:l,pos:i}):d==="not"?t.push({type:"NOT",text:l,pos:i}):t.push({type:"IDENT",text:l,pos:i}),n=a;continue}throw new qi(i,`Unexpected character "${o}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class Fi extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const YO=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),XO=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class QO{constructor(t){Rx(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 Fi(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 Fi(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(XO.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 Fi(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 Fi(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 Fi(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(!YO.has(t.type))throw new Fi(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 Jh(e){try{const t=Qh(e);return{ast:new QO(t).parseQuery(),errors:[]}}catch(t){if(t instanceof qi||t instanceof Fi)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function Vl(e,t=Xh){const n=Jh(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:Au(n.ast,t),ast:n.ast},errors:[]}}catch(r){if(r instanceof Ar)return{query:null,errors:r.errors};throw r}}function rn(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 x1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Zh(...e){return t=>{let n=!1;const r=e.map(o=>{const i=x1(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():x1(e[o],null)}}}}function Zn(...e){return m.useCallback(Zh(...e),e)}function JO(e,t){const n=m.createContext(t),r=i=>{const{children:a,...l}=i,d=m.useMemo(()=>l,Object.values(l));return s.jsx(n.Provider,{value:d,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 pa(e,t=[]){let n=[];function r(i,a){const l=m.createContext(a),d=n.length;n=[...n,a];const f=h=>{var j;const{scope:g,children:y,...S}=h,w=((j=g==null?void 0:g[e])==null?void 0:j[d])||l,b=m.useMemo(()=>S,Object.values(S));return s.jsx(w.Provider,{value:b,children:y})};f.displayName=i+"Provider";function p(h,g){var w;const y=((w=g==null?void 0:g[e])==null?void 0:w[d])||l,S=m.useContext(y);if(S)return S;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 d=(l==null?void 0:l[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return o.scopeName=e,[r,ZO(o,...t)]}function ZO(...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:d,scopeName:f})=>{const h=d(i)[`__scope${f}`];return{...l,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var ai=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},e5=bE[" useId ".trim().toString()]||(()=>{}),t5=0;function Rl(e){const[t,n]=m.useState(e5());return ai(()=>{n(r=>r??String(t5++))},[e]),e||(t?`radix-${t}`:"")}var n5=bE[" useInsertionEffect ".trim().toString()]||ai;function em({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,a]=r5({defaultProp:t,onChange:n}),l=e!==void 0,d=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=s5(p)?p(e):p;g!==e&&((h=a.current)==null||h.call(a,g))}else i(p)},[l,e,i,a]);return[d,f]}function r5({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),o=m.useRef(n),i=m.useRef(t);return n5(()=>{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 s5(e){return typeof e=="function"}function o5(e){const t=i5(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),d=l.find(l5);if(d){const f=d.props.children,p=l.map(h=>h===d?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 i5(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=u5(o),l=c5(i,o.props);return o.type!==m.Fragment&&(l.ref=r?Zh(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 a5=Symbol("radix.slottable");function l5(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===a5}function c5(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 d=i(...l);return o(...l),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function u5(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 d5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sn=d5.reduce((e,t)=>{const n=o5(`Primitive.${t}`),r=m.forwardRef((o,i)=>{const{asChild:a,...l}=o,d=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(d,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function f5(e,t){e&&mo.flushSync(()=>e.dispatchEvent(t))}function sa(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 p5(e,t=globalThis==null?void 0:globalThis.document){const n=sa(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 h5="DismissableLayer",hb="dismissableLayer.update",m5="dismissableLayer.pointerDownOutside",g5="dismissableLayer.focusOutside",y1,F2=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Uv=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...d}=e,f=m.useContext(F2),[p,h]=m.useState(null),g=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=m.useState({}),S=Zn(t,R=>h(R)),w=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),j=w.indexOf(b),N=p?w.indexOf(p):-1,k=f.layersWithOutsidePointerEventsDisabled.size>0,C=N>=j,I=b5(R=>{const D=R.target,$=[...f.branches].some(z=>z.contains(D));!C||$||(o==null||o(R),a==null||a(R),R.defaultPrevented||l==null||l())},g),T=v5(R=>{const D=R.target;[...f.branches].some(z=>z.contains(D))||(i==null||i(R),a==null||a(R),R.defaultPrevented||l==null||l())},g);return p5(R=>{N===f.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&l&&(R.preventDefault(),l()))},g),m.useEffect(()=>{if(p)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(y1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),b1(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=y1)}},[p,g,n,f]),m.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),b1())},[p,f]),m.useEffect(()=>{const R=()=>y({});return document.addEventListener(hb,R),()=>document.removeEventListener(hb,R)},[]),s.jsx(Sn.div,{...d,ref:S,style:{pointerEvents:k?C?"auto":"none":void 0,...e.style},onFocusCapture:rn(e.onFocusCapture,T.onFocusCapture),onBlurCapture:rn(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:rn(e.onPointerDownCapture,I.onPointerDownCapture)})});Uv.displayName=h5;var x5="DismissableLayerBranch",y5=m.forwardRef((e,t)=>{const n=m.useContext(F2),r=m.useRef(null),o=Zn(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})});y5.displayName=x5;function b5(e,t=globalThis==null?void 0:globalThis.document){const n=sa(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let d=function(){z2(m5,n,f,{discrete:!0})};const f={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}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 v5(e,t=globalThis==null?void 0:globalThis.document){const n=sa(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&z2(g5,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 b1(){const e=new CustomEvent(hb);document.dispatchEvent(e)}function z2(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?f5(o,i):o.dispatchEvent(i)}var Hx="focusScope.autoFocusOnMount",Vx="focusScope.autoFocusOnUnmount",v1={bubbles:!1,cancelable:!0},w5="FocusScope",B2=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[l,d]=m.useState(null),f=sa(o),p=sa(i),h=m.useRef(null),g=Zn(t,w=>d(w)),y=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let w=function(k){if(y.paused||!l)return;const C=k.target;l.contains(C)?h.current=C:ti(h.current,{select:!0})},b=function(k){if(y.paused||!l)return;const C=k.relatedTarget;C!==null&&(l.contains(C)||ti(h.current,{select:!0}))},j=function(k){if(document.activeElement===document.body)for(const I of k)I.removedNodes.length>0&&ti(l)};document.addEventListener("focusin",w),document.addEventListener("focusout",b);const N=new MutationObserver(j);return l&&N.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",b),N.disconnect()}}},[r,l,y.paused]),m.useEffect(()=>{if(l){j1.add(y);const w=document.activeElement;if(!l.contains(w)){const j=new CustomEvent(Hx,v1);l.addEventListener(Hx,f),l.dispatchEvent(j),j.defaultPrevented||(j5(E5(U2(l)),{select:!0}),document.activeElement===w&&ti(l))}return()=>{l.removeEventListener(Hx,f),setTimeout(()=>{const j=new CustomEvent(Vx,v1);l.addEventListener(Vx,p),l.dispatchEvent(j),j.defaultPrevented||ti(w??document.body,{select:!0}),l.removeEventListener(Vx,p),j1.remove(y)},0)}}},[l,f,p,y]);const S=m.useCallback(w=>{if(!n&&!r||y.paused)return;const b=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,j=document.activeElement;if(b&&j){const N=w.currentTarget,[k,C]=k5(N);k&&C?!w.shiftKey&&j===C?(w.preventDefault(),n&&ti(k,{select:!0})):w.shiftKey&&j===k&&(w.preventDefault(),n&&ti(C,{select:!0})):j===N&&w.preventDefault()}},[n,r,y.paused]);return s.jsx(Sn.div,{tabIndex:-1,...a,ref:g,onKeyDown:S})});B2.displayName=w5;function j5(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ti(r,{select:t}),document.activeElement!==n)return}function k5(e){const t=U2(e),n=w1(t,e),r=w1(t.reverse(),e);return[n,r]}function U2(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 w1(e,t){for(const n of e)if(!S5(n,{upTo:t}))return n}function S5(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 N5(e){return e instanceof HTMLInputElement&&"select"in e}function ti(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&N5(e)&&t&&e.select()}}var j1=C5();function C5(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=k1(e,t),e.unshift(t)},remove(t){var n;e=k1(e,t),(n=e[0])==null||n.resume()}}}function k1(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function E5(e){return e.filter(t=>t.tagName!=="A")}var T5="Portal",Hv=m.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,i]=m.useState(!1);ai(()=>i(!0),[]);const a=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?pL.createPortal(s.jsx(Sn.div,{...r,ref:t}),a):null});Hv.displayName=T5;function R5(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var ha=e=>{const{present:t,children:n}=e,r=A5(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=Zn(r.ref,P5(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};ha.displayName="Presence";function A5(e){const[t,n]=m.useState(),r=m.useRef(null),o=m.useRef(e),i=m.useRef("none"),a=e?"mounted":"unmounted",[l,d]=R5(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const f=Yf(r.current);i.current=l==="mounted"?f:"none"},[l]),ai(()=>{const f=r.current,p=o.current;if(p!==e){const g=i.current,y=Yf(f);e?d("MOUNT"):y==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(p&&g!==y?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),ai(()=>{if(t){let f;const p=t.ownerDocument.defaultView??window,h=y=>{const w=Yf(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&w&&(d("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=Yf(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 d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Yf(e){return(e==null?void 0:e.animationName)||"none"}function P5(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 Wx=0;function _5(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??S1()),document.body.insertAdjacentElement("beforeend",e[1]??S1()),Wx++,()=>{Wx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Wx--}},[])}function S1(){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 zs=function(){return zs=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},zs.apply(this,arguments)};function H2(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 D5(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 Ap="right-scroll-bar-position",Pp="width-before-scroll-bar",$5="with-scroll-bars-hidden",I5="--removed-body-scroll-bar-size";function qx(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function M5(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 L5=typeof window<"u"?m.useLayoutEffect:m.useEffect,N1=new WeakMap;function O5(e,t){var n=M5(null,function(r){return e.forEach(function(o){return qx(o,r)})});return L5(function(){var r=N1.get(n);if(r){var o=new Set(r),i=new Set(e),a=n.current;o.forEach(function(l){i.has(l)||qx(l,null)}),i.forEach(function(l){o.has(l)||qx(l,a)})}N1.set(n,e)},[e]),n}function F5(e){return e}function z5(e,t){t===void 0&&(t=F5);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 d=function(){var p=a;a=[],p.forEach(i)},f=function(){return Promise.resolve().then(d)};f(),n={push:function(p){a.push(p),f()},filter:function(p){return a=a.filter(p),n}}}};return o}function B5(e){e===void 0&&(e={});var t=z5(null);return t.options=zs({async:!0,ssr:!1},e),t}var V2=function(e){var t=e.sideCar,n=H2(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,zs({},n))};V2.isSideCarExport=!0;function U5(e,t){return e.useMedium(t),V2}var W2=B5(),Kx=function(){},tm=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:Kx,onWheelCapture:Kx,onTouchMoveCapture:Kx}),o=r[0],i=r[1],a=e.forwardProps,l=e.children,d=e.className,f=e.removeScrollBar,p=e.enabled,h=e.shards,g=e.sideCar,y=e.noRelative,S=e.noIsolation,w=e.inert,b=e.allowPinchZoom,j=e.as,N=j===void 0?"div":j,k=e.gapMode,C=H2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=g,T=O5([n,t]),R=zs(zs({},C),o);return m.createElement(m.Fragment,null,p&&m.createElement(I,{sideCar:W2,removeScrollBar:f,shards:h,noRelative:y,noIsolation:S,inert:w,setCallbacks:i,allowPinchZoom:!!b,lockRef:n,gapMode:k}),a?m.cloneElement(m.Children.only(l),zs(zs({},R),{ref:T})):m.createElement(N,zs({},R,{className:d,ref:T}),l))});tm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};tm.classNames={fullWidth:Pp,zeroRight:Ap};var H5=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function V5(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=H5();return t&&e.setAttribute("nonce",t),e}function W5(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function q5(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var K5=function(){var e=0,t=null;return{add:function(n){e==0&&(t=V5())&&(W5(t,n),q5(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},G5=function(){var e=K5();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},q2=function(){var e=G5(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Y5={left:0,top:0,right:0,gap:0},Gx=function(e){return parseInt(e||"",10)||0},X5=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[Gx(n),Gx(r),Gx(o)]},Q5=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Y5;var t=X5(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])}},J5=q2(),Al="data-scroll-locked",Z5=function(e,t,n,r){var o=e.left,i=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
532
|
+
.`.concat($5,` {
|
|
533
|
+
overflow: hidden `).concat(r,`;
|
|
534
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
535
|
+
}
|
|
536
|
+
body[`).concat(Al,`] {
|
|
537
|
+
overflow: hidden `).concat(r,`;
|
|
538
|
+
overscroll-behavior: contain;
|
|
539
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
540
|
+
padding-left: `.concat(o,`px;
|
|
541
|
+
padding-top: `).concat(i,`px;
|
|
542
|
+
padding-right: `).concat(a,`px;
|
|
543
|
+
margin-left:0;
|
|
544
|
+
margin-top:0;
|
|
545
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
546
|
+
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.`).concat(Ap,` {
|
|
550
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.`).concat(Pp,` {
|
|
554
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.`).concat(Ap," .").concat(Ap,` {
|
|
558
|
+
right: 0 `).concat(r,`;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.`).concat(Pp," .").concat(Pp,` {
|
|
562
|
+
margin-right: 0 `).concat(r,`;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
body[`).concat(Al,`] {
|
|
566
|
+
`).concat(I5,": ").concat(l,`px;
|
|
567
|
+
}
|
|
568
|
+
`)},C1=function(){var e=parseInt(document.body.getAttribute(Al)||"0",10);return isFinite(e)?e:0},eF=function(){m.useEffect(function(){return document.body.setAttribute(Al,(C1()+1).toString()),function(){var e=C1()-1;e<=0?document.body.removeAttribute(Al):document.body.setAttribute(Al,e.toString())}},[])},tF=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;eF();var i=m.useMemo(function(){return Q5(o)},[o]);return m.createElement(J5,{styles:Z5(i,!t,o,n?"":"!important")})},mb=!1;if(typeof window<"u")try{var Xf=Object.defineProperty({},"passive",{get:function(){return mb=!0,!0}});window.addEventListener("test",Xf,Xf),window.removeEventListener("test",Xf,Xf)}catch{mb=!1}var rl=mb?{passive:!1}:!1,nF=function(e){return e.tagName==="TEXTAREA"},K2=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!nF(e)&&n[t]==="visible")},rF=function(e){return K2(e,"overflowY")},sF=function(e){return K2(e,"overflowX")},E1=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=G2(e,r);if(o){var i=Y2(e,r),a=i[1],l=i[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},oF=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},iF=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},G2=function(e,t){return e==="v"?rF(t):sF(t)},Y2=function(e,t){return e==="v"?oF(t):iF(t)},aF=function(e,t){return e==="h"&&t==="rtl"?-1:1},lF=function(e,t,n,r,o){var i=aF(e,window.getComputedStyle(t).direction),a=i*r,l=n.target,d=t.contains(l),f=!1,p=a>0,h=0,g=0;do{if(!l)break;var y=Y2(e,l),S=y[0],w=y[1],b=y[2],j=w-b-i*S;(S||j)&&G2(e,l)&&(h+=j,g+=S);var N=l.parentNode;l=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!d&&l!==document.body||d&&(t.contains(l)||t===l));return(p&&Math.abs(h)<1||!p&&Math.abs(g)<1)&&(f=!0),f},Qf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},T1=function(e){return[e.deltaX,e.deltaY]},R1=function(e){return e&&"current"in e?e.current:e},cF=function(e,t){return e[0]===t[0]&&e[1]===t[1]},uF=function(e){return`
|
|
569
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
570
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
571
|
+
`)},dF=0,sl=[];function fF(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(dF++)[0],i=m.useState(q2)[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 w=D5([e.lockRef.current],(e.shards||[]).map(R1),!0).filter(Boolean);return w.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),w.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=m.useCallback(function(w,b){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!a.current.allowPinchZoom;var j=Qf(w),N=n.current,k="deltaX"in w?w.deltaX:N[0]-j[0],C="deltaY"in w?w.deltaY:N[1]-j[1],I,T=w.target,R=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in w&&R==="h"&&T.type==="range")return!1;var D=window.getSelection(),$=D&&D.anchorNode,z=$?$===T||$.contains(T):!1;if(z)return!1;var A=E1(R,T);if(!A)return!0;if(A?I=R:(I=R==="v"?"h":"v",A=E1(R,T)),!A)return!1;if(!r.current&&"changedTouches"in w&&(k||C)&&(r.current=I),!I)return!0;var F=r.current||I;return lF(F,b,w,F==="h"?k:C)},[]),d=m.useCallback(function(w){var b=w;if(!(!sl.length||sl[sl.length-1]!==i)){var j="deltaY"in b?T1(b):Qf(b),N=t.current.filter(function(I){return I.name===b.type&&(I.target===b.target||b.target===I.shadowParent)&&cF(I.delta,j)})[0];if(N&&N.should){b.cancelable&&b.preventDefault();return}if(!N){var k=(a.current.shards||[]).map(R1).filter(Boolean).filter(function(I){return I.contains(b.target)}),C=k.length>0?l(b,k[0]):!a.current.noIsolation;C&&b.cancelable&&b.preventDefault()}}},[]),f=m.useCallback(function(w,b,j,N){var k={name:w,delta:b,target:j,should:N,shadowParent:pF(j)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(C){return C!==k})},1)},[]),p=m.useCallback(function(w){n.current=Qf(w),r.current=void 0},[]),h=m.useCallback(function(w){f(w.type,T1(w),w.target,l(w,e.lockRef.current))},[]),g=m.useCallback(function(w){f(w.type,Qf(w),w.target,l(w,e.lockRef.current))},[]);m.useEffect(function(){return sl.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",d,rl),document.addEventListener("touchmove",d,rl),document.addEventListener("touchstart",p,rl),function(){sl=sl.filter(function(w){return w!==i}),document.removeEventListener("wheel",d,rl),document.removeEventListener("touchmove",d,rl),document.removeEventListener("touchstart",p,rl)}},[]);var y=e.removeScrollBar,S=e.inert;return m.createElement(m.Fragment,null,S?m.createElement(i,{styles:uF(o)}):null,y?m.createElement(tF,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function pF(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hF=U5(W2,fF);var X2=m.forwardRef(function(e,t){return m.createElement(tm,zs({},e,{ref:t,sideCar:hF}))});X2.classNames=tm.classNames;var mF=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ol=new WeakMap,Jf=new WeakMap,Zf={},Yx=0,Q2=function(e){return e&&(e.host||Q2(e.parentNode))},gF=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Q2(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})},xF=function(e,t,n,r){var o=gF(t,Array.isArray(e)?e:[e]);Zf[n]||(Zf[n]=new WeakMap);var i=Zf[n],a=[],l=new Set,d=new Set(o),f=function(h){!h||l.has(h)||(l.add(h),f(h.parentNode))};o.forEach(f);var p=function(h){!h||d.has(h)||Array.prototype.forEach.call(h.children,function(g){if(l.has(g))p(g);else try{var y=g.getAttribute(r),S=y!==null&&y!=="false",w=(ol.get(g)||0)+1,b=(i.get(g)||0)+1;ol.set(g,w),i.set(g,b),a.push(g),w===1&&S&&Jf.set(g,!0),b===1&&g.setAttribute(n,"true"),S||g.setAttribute(r,"true")}catch(j){console.error("aria-hidden: cannot operate on ",g,j)}})};return p(t),l.clear(),Yx++,function(){a.forEach(function(h){var g=ol.get(h)-1,y=i.get(h)-1;ol.set(h,g),i.set(h,y),g||(Jf.has(h)||h.removeAttribute(r),Jf.delete(h)),y||h.removeAttribute(n)}),Yx--,Yx||(ol=new WeakMap,ol=new WeakMap,Jf=new WeakMap,Zf={})}},yF=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=mF(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),xF(r,o,n,"aria-hidden")):function(){return null}};function bF(e){const t=vF(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),d=l.find(jF);if(d){const f=d.props.children,p=l.map(h=>h===d?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 vF(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=SF(o),l=kF(i,o.props);return o.type!==m.Fragment&&(l.ref=r?Zh(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 wF=Symbol("radix.slottable");function jF(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wF}function kF(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 d=i(...l);return o(...l),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function SF(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 nm="Dialog",[J2,Z2]=pa(nm),[NF,ks]=J2(nm),eT=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,l=m.useRef(null),d=m.useRef(null),[f,p]=em({prop:r,defaultProp:o??!1,onChange:i,caller:nm});return s.jsx(NF,{scope:t,triggerRef:l,contentRef:d,contentId:Rl(),titleId:Rl(),descriptionId:Rl(),open:f,onOpenChange:p,onOpenToggle:m.useCallback(()=>p(h=>!h),[p]),modal:a,children:n})};eT.displayName=nm;var tT="DialogTrigger",nT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ks(tT,n),i=Zn(t,o.triggerRef);return s.jsx(Sn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":qv(o.open),...r,ref:i,onClick:rn(e.onClick,o.onOpenToggle)})});nT.displayName=tT;var Vv="DialogPortal",[CF,rT]=J2(Vv,{forceMount:void 0}),sT=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=ks(Vv,t);return s.jsx(CF,{scope:t,forceMount:n,children:m.Children.map(r,a=>s.jsx(ha,{present:n||i.open,children:s.jsx(Hv,{asChild:!0,container:o,children:a})}))})};sT.displayName=Vv;var th="DialogOverlay",oT=m.forwardRef((e,t)=>{const n=rT(th,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=ks(th,e.__scopeDialog);return i.modal?s.jsx(ha,{present:r||i.open,children:s.jsx(TF,{...o,ref:t})}):null});oT.displayName=th;var EF=bF("DialogOverlay.RemoveScroll"),TF=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ks(th,n);return s.jsx(X2,{as:EF,allowPinchZoom:!0,shards:[o.contentRef],children:s.jsx(Sn.div,{"data-state":qv(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),oa="DialogContent",iT=m.forwardRef((e,t)=>{const n=rT(oa,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=ks(oa,e.__scopeDialog);return s.jsx(ha,{present:r||i.open,children:i.modal?s.jsx(RF,{...o,ref:t}):s.jsx(AF,{...o,ref:t})})});iT.displayName=oa;var RF=m.forwardRef((e,t)=>{const n=ks(oa,e.__scopeDialog),r=m.useRef(null),o=Zn(t,n.contentRef,r);return m.useEffect(()=>{const i=r.current;if(i)return yF(i)},[]),s.jsx(aT,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:rn(e.onCloseAutoFocus,i=>{var a;i.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:rn(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&i.preventDefault()}),onFocusOutside:rn(e.onFocusOutside,i=>i.preventDefault())})}),AF=m.forwardRef((e,t)=>{const n=ks(oa,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return s.jsx(aT,{...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 d,f;(d=e.onInteractOutside)==null||d.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()}})}),aT=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=e,l=ks(oa,n),d=m.useRef(null),f=Zn(t,d);return _5(),s.jsxs(s.Fragment,{children:[s.jsx(B2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:s.jsx(Uv,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":qv(l.open),...a,ref:f,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(_F,{titleId:l.titleId}),s.jsx($F,{contentRef:d,descriptionId:l.descriptionId})]})]})}),Wv="DialogTitle",lT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ks(Wv,n);return s.jsx(Sn.h2,{id:o.titleId,...r,ref:t})});lT.displayName=Wv;var cT="DialogDescription",uT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ks(cT,n);return s.jsx(Sn.p,{id:o.descriptionId,...r,ref:t})});uT.displayName=cT;var dT="DialogClose",fT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ks(dT,n);return s.jsx(Sn.button,{type:"button",...r,ref:t,onClick:rn(e.onClick,()=>o.onOpenChange(!1))})});fT.displayName=dT;function qv(e){return e?"open":"closed"}var pT="DialogTitleWarning",[PF,hT]=JO(pT,{contentName:oa,titleName:Wv,docsSlug:"dialog"}),_F=({titleId:e})=>{const t=hT(pT),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
572
|
+
|
|
573
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
574
|
+
|
|
575
|
+
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},DF="DialogDescriptionWarning",$F=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hT(DF).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},mT=eT,gT=nT,xT=sT,Kv=oT,Gv=iT,Yv=lT,Xv=uT,Qv=fT;const Bn=mT,IF=gT,MF=xT,LF=Qv,yT=m.forwardRef(({className:e,...t},n)=>s.jsx(Kv,{ref:n,className:Ne("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));yT.displayName=Kv.displayName;const _n=m.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(MF,{children:[s.jsx(yT,{}),s.jsx(Gv,{ref:r,className:Ne("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})]}));_n.displayName=Gv.displayName;function sr({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col space-y-2 text-left",e),...t})}function Fr({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Dn=m.forwardRef(({className:e,...t},n)=>s.jsx(Yv,{ref:n,className:Ne("text-lg font-semibold tracking-tight text-foreground",e),...t}));Dn.displayName=Yv.displayName;const es=m.forwardRef(({className:e,...t},n)=>s.jsx(Xv,{ref:n,className:Ne("text-sm leading-6 text-muted-foreground",e),...t}));es.displayName=Xv.displayName;const OF=-1,FF=-40;function Xx(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 d=!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(FF,i*OF)),o=r,i=0,r++,d=!0;break}else i++,r++;if(!d)return-1/0}return n}const A1={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function Jv(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=Xx(r,a.title.toLowerCase())*1,d=a.subtitle?Xx(r,a.subtitle.toLowerCase())*.5:-1/0,f=(h=a.keywords)!=null&&h.length?Xx(r,a.keywords.join(" ").toLowerCase())*.3:-1/0,p=Math.max(l,d,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:(A1[a.type]??99)-(A1[l.type]??99)),i.slice(0,n)}const zF={a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},P1=Symbol("absent");function ep(e){return e.replace(/\s+/g," ").trim()}const _1=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]);function BF(e){const t=e.externalIds;return Array.isArray(t)?t.map(n=>n&&typeof n=="object"?`${n.system}:${n.id}`:"").join(" "):""}function UF(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 Ku={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:P1},type:{kind:"enum",get:e=>e.assignmentType},project:{kind:"string",noneSentinel:!0,get:e=>"project"in e?e.project:P1},externalid:{kind:"substring",get:BF},jira:{kind:"substring",get:UF},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title}};function HF(e,t=zF,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=WF(a,t),d={aqlExpr:l.aqlExpr,fuzzy:l.fuzzy};if(r!=="all"&&!i&&e.trim()!==""&&!VF(l.aqlExpr)){const f=`kind:${r}`;d.aqlExpr=l.aqlExpr?l.explicit?`${f} (${l.aqlExpr})`:`${f} ${l.aqlExpr}`:f}return d}function VF(e){if(!e)return!1;let t;try{t=Qh(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 WF(e,t){let n;try{n=Qh(e)}catch(h){if(h instanceof qi)return{aqlExpr:"",fuzzy:ep(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=ep(GF(e,n,r,t));return Vl(h,Ku).query?{aqlExpr:h,fuzzy:"",explicit:!0}:{aqlExpr:"",fuzzy:ep(e),explicit:!0}}const a=[],l=[];let d=0,f=0;const p=h=>{if(h>f){const g=ep(o(f,h));g&&l.push(g)}};for(;d<r-1;){const h=qF(n,d,t);if(h){p(d),a.push(h.atom),d=h.end,f=d;continue}const g=KF(n,d,r);if(g!==null){const y=o(d,g).trim();if(Vl(y,Ku).query){p(d),a.push(y),d=g,f=d;continue}d=g;continue}d++}return p(r-1),{aqlExpr:a.join(" "),fuzzy:l.join(" "),explicit:!1}}function qF(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 KF(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(Ku,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 d=r+2;d<n;d++)if(e[d].type==="LPAREN")l++;else if(e[d].type==="RPAREN"){if(l--,l===0)return d+1}else if(e[d].type==="EOF")return null;return null}return _1.has(a.type)?r+3:null}if(i.type==="OP"){const a=e[r+2];return a&&_1.has(a.type)?r+3:null}return null}function GF(e,t,n,r){var a;let o="",i=0;for(let l=0;l<n;l++){const d=t[l];d.type==="IDENT"&&Object.prototype.hasOwnProperty.call(r,d.text.toLowerCase())&&((a=t[l+1])==null?void 0:a.type)==="COLON"&&(o+=e.slice(i,d.pos)+`kind:${r[d.text.toLowerCase()]} `,i=t[l+1].pos+1)}return o+=e.slice(i),o}const Zv=["kanban","list","table"],bT=["title","status","priority","assignee","dependencies","created","updated"],YF=["asc","desc"],XF=["comfortable","compact"],QF=["none","status","type","priority","assignee","project"],JF=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function Ve(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 ZF(e,t){const n=Ve(e),r=Ve(t);return n.length===r.length&&n.every(o=>r.includes(o))}const e6={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},Gu={version:1,global:e6,projects:{}};function Qx(e){return e==="table"?"table":"kanban"}function t6(e,t){return t?{...e,...t}:{...e}}function vT(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:t6(n.filters,r.filters)}:n}const n6=/^[A-Za-z_][A-Za-z0-9_-]*$/,r6=new Set(["and","or","not"]);function ew(e){return n6.test(e)&&!r6.has(e.toLowerCase())?e:wT(e)}function wT(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const jT="__unassigned__",kT="__standalone__",s6={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function o6(e){return e.startsWith("older_")?"<":">="}const tw=["status","type","priority","assignee","project","tags"],i6=["created","updated"];function a6(e){var i;const t={};for(const a of tw){const l=Ve(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=l6(o);if(a)r||(r=a);else{const l=c6(o);l&&(t.dateRange=l)}}return r&&(t.activity=r),t}function l6(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function c6(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 Pu(e){const t=a6(e),n=[];for(const r of tw){const o=t[r]??[];o.length&&n.push(u6(r,o))}return t.search&&n.push(`search:${wT(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...f6(t.dateRange)),n.join(" AND ")}function u6(e,t){const n=t.map(r=>d6(e,r));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function d6(e,t){return e==="assignee"&&t===jT||e==="project"&&t===kT?"none":ew(t)}function f6(e){if(e.preset)return[`${e.field} ${o6(e.preset)} -${s6[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function _u(e){const t=Jh(e);if(!t.ast)return null;const n=p6(t.ast);if(n===null)return null;const r={},o=new Set,i=new Map;for(const a of n){const l=h6(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 d=`date:${l.field}`;if(o.has(d)||i.has(l.field))return null;o.add(d),r.dateRange={field:l.field,preset:l.preset};break}case"dateBound":{const d=`date:${l.field}`;if(o.has(d))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 d={field:a};l.from!==void 0&&(d.from=l.from),l.to!==void 0&&(d.to=l.to),r.dateRange=d}return r}function p6(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 h6(e){const t=e.field.toLowerCase();if(e.op===":"){if(tw.includes(t)){const o=t,i=[];for(const a of e.values){const l=b6(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(!i6.includes(t))return null;const n=t;if(e.values.length!==1)return null;const r=e.values[0];return r.type==="duration"?m6(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 m6(e,t,n){if(n.sign!==-1)return null;const r=g6(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=y6(t,r);return o?{kind:"datePreset",field:e,preset:o}:null}function g6(e){return e.replace(/^[-+]/,"")}const x6={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function y6(e,t){return e!==">="&&e!=="<"?null:x6[e][t]??null}function b6(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?jT:e==="project"&&n.toLowerCase()==="none"?kT:n}const v6=new Set(["status","type","tag","assignee","externalid"]),Jx=new Set(["IDENT","STRING","NUMBER","DATE","DURATION","STAR"]),D1=8;function w6(e,t,n){var S,w,b,j,N;let r;try{r=Qh(e)}catch{return[]}const o=r.length,i=k=>{const C=k+1<o?r[k+1].pos:e.length;return r[k].pos+e.slice(r[k].pos,C).replace(/\s+$/,"").length};let a=-1;for(let k=0;k<o-1;k++)if(t>r[k].pos&&t<=i(k)){a=k;break}let l=a>=0?a-1:-1;if(a<0)for(let k=0;k<o-1&&i(k)<=t;k++)l=k;let d=null,f=null,p="";if(a>=0&&r[a].type==="COLON"&&((S=r[a-1])==null?void 0:S.type)==="IDENT"?(d=r[a-1].text.toLowerCase(),f=[t,t]):a>=0&&Jx.has(r[a].type)&&((w=r[a-1])==null?void 0:w.type)==="COLON"&&((b=r[a-2])==null?void 0:b.type)==="IDENT"?(d=r[a-2].text.toLowerCase(),f=[r[a].pos,i(a)],p=r[a].text):a<0&&l>=0&&r[l].type==="COLON"&&((j=r[l-1])==null?void 0:j.type)==="IDENT"&&(d=r[l-1].text.toLowerCase(),f=[t,t]),d!==null){if(!v6.has(d))return[];const k=n.values[d]??[],C=p.toLowerCase(),I=[];for(const T of k)if(!(C&&!T.toLowerCase().startsWith(C))&&T.toLowerCase()!==C&&(I.push({label:T,insert:ew(T),replace:f,kind:"value"}),I.length>=D1))break;return I}if(a>=0&&!Jx.has(r[a].type))return[];if(a>=0&&r[a].type==="IDENT"&&((N=r[a+1])==null?void 0:N.type)==="COLON")return[];if(l>=0){const k=r[l].type;if(!(k==="AND"||k==="OR"||k==="NOT"||k==="MINUS"||k==="LPAREN"||k==="RPAREN"||Jx.has(k)))return[]}const h=(a>=0?r[a].text:"").toLowerCase(),g=a>=0?[r[a].pos,i(a)]:[t,t],y=[];for(const[k,C]of Object.entries(n.aliases))h&&!k.toLowerCase().startsWith(h)||y.push({label:`${k}: (${C})`,insert:`${k}:`,replace:g,kind:"prefix"});for(const k of n.fields)h&&!k.toLowerCase().startsWith(h)||y.push({label:`${k}:`,insert:`${k}:`,replace:g,kind:"field"});return y.slice(0,D1)}const _p={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",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 j6(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 d=l.when==="*"?null:n(l.when);d&&r.push(`phaseLadder rung "${l.phase}": invalid condition — ${d}`)}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 d=n(l.when);d&&r.push(`disposition rule "${l.is}": invalid condition — ${d}`)}const a=e.disposition.map((l,d)=>l.when===null?d:-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 ST={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:_p,deriveCustom:!1,knownCommands:[],factDeclarations:[],rawFacts:[]};let Du=null,zi=null;function k6(){return Du?Promise.resolve(Du):zi||(zi=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Du=e,zi=null,e)).catch(()=>(zi=null,ST)),zi)}function Ss(){const[e,t]=m.useState(()=>Du??ST);return m.useEffect(()=>{k6().then(t)},[]),e}function $1(){Du=null,zi=null}function li(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 NT={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 Dp=null,il=null;function S6(){return Dp?Promise.resolve(Dp):il||(il=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Dp=e,il=null,e)).catch(()=>(il=null,NT)),il)}function Td(){const[e,t]=m.useState(()=>Dp??NT);return m.useEffect(()=>{S6().then(t)},[]),e}function Pl(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 N6(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}const C6={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function E6({entries:e}){const{paletteOpen:t,closePalette:n}=hi(),r=zt(),[o,i]=m.useState(""),[a,l]=m.useState(0),[d,f]=m.useState(0),[p,h]=m.useState(!0),[g,y]=m.useState(0),S=m.useRef(null),w=m.useRef(null),{search:b}=Bv(),j=Ss(),N=Td(),{aqlExpr:k,fuzzy:C}=m.useMemo(()=>HF(o,b.aliases,{defaultScope:b.defaultScope}),[o,b.aliases,b.defaultScope]),I=m.useMemo(()=>{const F=new Set,W=new Set,P=new Set;for(const B of e){for(const H of B.tags??[])F.add(H);B.assignee&&W.add(B.assignee);for(const H of B.externalIds??[])H.id&&(P.add(H.id),H.system&&P.add(`${H.system}:${H.id}`))}const O=Object.keys(Ku);return{aliases:b.aliases,fields:b.externalIds?O:O.filter(B=>B!=="jira"&&B!=="externalid"),values:{status:j.statuses.map(B=>B.id),type:N.definitions.map(B=>B.id),tag:[...F],assignee:[...W],externalid:b.externalIds?[...P]:[]}}},[e,b.aliases,b.externalIds,j.statuses,N.definitions]),T=m.useMemo(()=>w6(o,d,I),[o,d,I]),R=p&&T.length>0&&o.trim()!=="",D=m.useMemo(()=>{let F=e,W=C;if(k){const P=Vl(k,Ku);if(P.query){const O=Date.now(),{predicate:B}=P.query;F=e.filter(H=>B(H,{now:O}))}else W=o}return Jv(W,F,50)},[e,k,C,o]);m.useEffect(()=>{l(0)},[o,t]),m.useEffect(()=>{y(0)},[T]),m.useEffect(()=>{t||(i(""),f(0),h(!0))},[t]),m.useEffect(()=>{var W;const F=(W=S.current)==null?void 0:W.querySelector(`[data-palette-idx="${a}"]`);F==null||F.scrollIntoView({block:"nearest"})},[a]);function $(F){r(F.route),n()}function z(F){const W=o.slice(0,F.replace[0])+F.insert+o.slice(F.replace[1]),P=F.replace[0]+F.insert.length;i(W),f(P),requestAnimationFrame(()=>{const O=w.current;O&&(O.focus(),O.setSelectionRange(P,P))})}function A(F){if(R){if(F.key==="Tab"||F.key==="ArrowRight"&&d>=o.length){F.preventDefault();const W=T[g];W&&z(W);return}if(F.key==="ArrowDown"){F.preventDefault(),y(W=>Math.min(T.length-1,W+1));return}if(F.key==="ArrowUp"){F.preventDefault(),y(W=>Math.max(0,W-1));return}if(F.key==="Enter"){F.preventDefault();const W=D[a];W&&$(W);return}return}if(F.key==="ArrowDown")F.preventDefault(),l(W=>Math.min(D.length-1,W+1));else if(F.key==="ArrowUp")F.preventDefault(),l(W=>Math.max(0,W-1));else if(F.key==="Enter"){F.preventDefault();const W=D[a];W&&$(W)}}return s.jsx(Bn,{open:t,onOpenChange:F=>F?null:n(),children:s.jsxs(_n,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:F=>{R&&(F.preventDefault(),h(!1))},children:[s.jsx(Dn,{className:"sr-only",children:"Command palette"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{ref:w,autoFocus:!0,type:"text",value:o,onChange:F=>{i(F.target.value),f(F.target.selectionStart??F.target.value.length),h(!0)},onSelect:F=>f(F.currentTarget.selectionStart??0),onKeyDown:A,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:ring-0"}),R?s.jsx("div",{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:T.map((F,W)=>{const P=W===g;return s.jsxs("button",{type:"button",onMouseDown:O=>{O.preventDefault(),z(F)},onMouseEnter:()=>y(W),className:`flex w-full items-center justify-between gap-3 px-4 py-1.5 text-left text-sm ${P?"bg-accent text-accent-foreground":"text-foreground"}`,children:[s.jsx("code",{className:"truncate",children:F.label}),s.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:F.kind})]},`${F.kind}-${F.insert}-${W}`)})}):null]}),k?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:k}),C?s.jsxs("span",{children:[" · ranking “",C,"”"]}):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(b.aliases).map(F=>s.jsxs("code",{className:"mr-1",children:[F,":"]},F))," · ",s.jsx("code",{children:"status:"})," ",s.jsx("code",{children:"tag:"})," ",s.jsx("code",{children:"assignee:"})," ",s.jsx("code",{children:"type:"})," ",b.externalIds?s.jsx("code",{children:"jira:"}):null]}):null,s.jsx("div",{ref:S,className:"max-h-[60vh] overflow-y-auto p-1",children:D.length===0?s.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No matches"}):D.map((F,W)=>{const P=W===a;return s.jsxs("button",{type:"button","data-palette-idx":W,onClick:()=>$(F),onMouseEnter:()=>l(W),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${P?"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:C6[F.type]??F.type}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:F.title}),F.subtitle?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:F.subtitle}):null]},F.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.jsx("span",{children:R?"⇥/→ accept · ↑↓ suggestions · Esc close":"↑↓ navigate · ↵ open · Esc close"}),s.jsxs("span",{children:[D.length," result",D.length===1?"":"s"]})]})]})})}function T6({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(vL,{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 R6({step:e,initialValue:t,disabled:n,onSubmit:r}){const[o,i]=m.useState(t??""),[a,l]=m.useState(!1),d=m.useRef(null);m.useEffect(()=>{var S;(S=d.current)==null||S.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(S){if(S.key==="Enter"){if(S.preventDefault(),!g){l(!0);return}r(f)}}return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:d,type:"text",value:o,onChange:S=>{i(S.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:ring-0 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 A6({step:e,disabled:t,onSubmit:n}){const[r,o]=m.useState({phase:"loading"}),[i,a]=m.useState(""),[l,d]=m.useState(0),[f,p]=m.useState(0),h=m.useRef(null),g=m.useRef(null);m.useEffect(()=>{var w;(w=h.current)==null||w.focus()},[]),m.useEffect(()=>{let w=!1;return o({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(b=>{w||o({phase:"loaded",options:b})}).catch(b=>{if(w)return;const j=b instanceof Error?b.message:"Failed to load options";o({phase:"error",message:j})}),()=>{w=!0}},[e,f]);const y=m.useMemo(()=>{if(r.phase!=="loaded")return[];const w=r.options.map(b=>({type:"option",title:b.label,subtitle:b.hint,keywords:[b.value],option:b}));return Jv(i,w,100)},[r,i]);m.useEffect(()=>{d(0)},[y.length]),m.useEffect(()=>{var b;const w=(b=g.current)==null?void 0:b.querySelector(`[data-picker-idx="${l}"]`);w==null||w.scrollIntoView({block:"nearest"})},[l]);function S(w){if(r.phase==="loaded"){if(w.key==="ArrowDown")w.preventDefault(),d(b=>Math.min(y.length-1,b+1));else if(w.key==="ArrowUp")w.preventDefault(),d(b=>Math.max(0,b-1));else if(w.key==="Enter"){w.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:w=>a(w.target.value),onKeyDown:S,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:ring-0 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(w=>w+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((w,b)=>{const j=b===l;return s.jsxs("button",{type:"button","data-picker-idx":b,onClick:()=>n(w.option.value),onMouseEnter:()=>d(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 ${j?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:w.option.label}),w.option.hint?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:w.option.hint}):null]},w.option.value)})})]})}function P6({entries:e}){var J,ne;const t=zt(),{actionsPaletteOpen:n,closeActionsPalette:r,customBindings:o,bindAction:i,findConflict:a,pendingActionKind:l,consumePendingActionKind:d}=hi(),[f,p]=m.useState(""),[h,g]=m.useState(0),[y,S]=m.useState(null),[w,b]=m.useState(""),[j,N]=m.useState(null),[k,C]=m.useState(null),[I,T]=m.useState(!1),[R,D]=m.useState(null),$=m.useRef(null),z=m.useMemo(()=>e.map(Q=>({type:Q.group.toLowerCase(),title:Q.title,subtitle:Q.subtitle,keywords:Q.keywords,action:Q})),[e]),A=m.useMemo(()=>Jv(f,z,50),[f,z]);m.useEffect(()=>{g(0)},[f,n]),m.useEffect(()=>{n||(p(""),S(null),b(""),N(null),C(null),T(!1),D(null))},[n]),m.useEffect(()=>{if(!n||!l)return;const Q=d();if(!Q)return;const ce=e.find(te=>te.bindableKind===Q);ce&&F(ce)},[n,l]),m.useEffect(()=>{var ce;const Q=(ce=$.current)==null?void 0:ce.querySelector(`[data-palette-idx="${h}"]`);Q==null||Q.scrollIntoView({block:"nearest"})},[h]);async function F(Q){if(!I){if(Q.flow&&Q.flow.steps.length>0){N({action:Q,stepIndex:0,values:{}}),D(null);return}if(Q.requiresInput){S(Q),b(""),D(null);return}if(Q.run){T(!0),D(null);try{await Q.run(),r()}catch(ce){D(ce instanceof Error?ce.message:"Action failed")}finally{T(!1)}}}}async function W(Q){if(!j)return;const ce=j.action.flow.steps[j.stepIndex],te={...j.values,[ce.id]:Q};if(j.stepIndex+1<j.action.flow.steps.length){N({action:j.action,stepIndex:j.stepIndex+1,values:te});return}T(!0),D(null);try{await j.action.flow.submit(te,{navigate:t}),r()}catch(pe){D(pe instanceof Error?pe.message:"Action failed")}finally{T(!1)}}function P(){if(j&&!I){if(j.stepIndex===0){N(null),D(null);return}N({action:j.action,stepIndex:j.stepIndex-1,values:j.values}),D(null)}}async function O(){if(I||!(y!=null&&y.requiresInput))return;const Q=w.trim();if(Q){T(!0),D(null);try{await y.requiresInput.runWithInput(Q),r()}catch(ce){D(ce instanceof Error?ce.message:"Action failed")}finally{T(!1)}}}function B(Q){if(Q.key==="ArrowDown")Q.preventDefault(),g(ce=>Math.min(A.length-1,ce+1));else if(Q.key==="ArrowUp")Q.preventDefault(),g(ce=>Math.max(0,ce-1));else if(Q.key==="Enter"&&(Q.metaKey||Q.ctrlKey)){Q.preventDefault();const ce=A[h];ce!=null&&ce.action.bindableKind&&C({action:ce.action,combo:null,conflict:null,saving:!1,error:null})}else if(Q.key==="Enter"){Q.preventDefault();const ce=A[h];ce&&F(ce.action)}}function H(Q){Q.key==="Enter"?(Q.preventDefault(),O()):Q.key==="Escape"&&(Q.preventDefault(),S(null),b(""))}function L(Q){if(!k||Q.key==="Escape"||Q.key==="Enter"&&!k.combo)return;Q.preventDefault(),Q.stopPropagation();const ce=N2(Q.nativeEvent);if(!ce)return;const te=a(ce,k.action.bindableKind);C({...k,combo:ce,conflict:te,error:null})}async function U(){var Q;if(!(!k||!k.combo||!k.action.bindableKind)){if((Q=k.conflict)!=null&&Q.description){C({...k,error:`Reserved: ${k.conflict.description}`});return}C({...k,saving:!0,error:null});try{await i(k.action.bindableKind,k.combo),C(null)}catch(ce){C({...k,saving:!1,error:ce instanceof Error?ce.message:"Failed to save binding"})}}}const M=y!==null,V=j!==null,Y=k!==null,q=j?j.action.flow.steps[j.stepIndex]:null;return s.jsx(Bn,{open:n,onOpenChange:Q=>Q?null:r(),children:s.jsxs(_n,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:Q=>{if(!I){if(Y){Q.preventDefault(),C(null);return}if(V){Q.preventDefault(),P();return}M&&(Q.preventDefault(),S(null),b(""),D(null))}},children:[s.jsx(Dn,{className:"sr-only",children:"Actions palette"}),Y&&k?s.jsxs("div",{onKeyDown:L,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(ib,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),s.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",k.action.title]})]}),s.jsx("div",{className:"px-4 py-6 text-center",children:k.combo?s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:Ws(k.combo)}),(J=k.conflict)!=null&&J.description?s.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",k.conflict.description," (cannot bind)"]}):(ne=k.conflict)!=null&&ne.kind?s.jsxs("div",{className:"text-sm text-amber-500 dark:text-amber-400",children:['Already bound to "',k.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."}),k.error?s.jsx("div",{className:"text-sm text-destructive",children:k.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:k.saving?"Saving…":""})]}),s.jsx("button",{type:"button",className:"sr-only",onClick:()=>void U(),"data-bind-confirm":!0}),s.jsx("input",{type:"hidden",onKeyDown:Q=>{Q.key==="Enter"&&U()}})]}):V&&q&&j?s.jsxs(s.Fragment,{children:[s.jsx(T6,{label:`${j.action.title} · ${q.label}`,onBack:P,disabled:I,stepCounter:{current:j.stepIndex+1,total:j.action.flow.steps.length}}),q.kind==="text"?s.jsx(R6,{step:q,initialValue:j.values[q.id],disabled:I,onSubmit:W}):s.jsx(A6,{step:q,disabled:I,onSubmit:W}),R?s.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:R}):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:I?"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:w,onChange:Q=>b(Q.target.value),onKeyDown:H,placeholder:y.requiresInput.placeholder,disabled:I,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),R?s.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:R}):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:I?"Running…":""})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("input",{autoFocus:!0,type:"text",value:f,onChange:Q=>p(Q.target.value),onKeyDown:B,placeholder:"Run an action: new project, new todo, toggle…",disabled:I,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:ring-0 disabled:opacity-60"}),R?s.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:R}):null,s.jsx("div",{ref:$,className:"max-h-[60vh] overflow-y-auto p-1",children:A.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"}):A.map((Q,ce)=>{const te=ce===h,pe=Q.action.bindableKind,be=pe?o[pe]:void 0;return s.jsxs("button",{type:"button","data-palette-idx":ce,onClick:()=>F(Q.action),onMouseEnter:()=>g(ce),disabled:I,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:Q.action.group}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:Q.action.title}),Q.action.subtitle?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:Q.action.subtitle}):null,be?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:Ws(be)}):null,pe?s.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),C({action:Q.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(ib,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},Q.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:I?"Running…":`${A.length} action${A.length===1?"":"s"}`})]})]})]})})}const _6=[{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 D6(e){const t=mr(e);return t?_6.find(n=>n.combo===t)??null:null}const du={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},$6={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},I6=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function I1(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${Ws(t)} then ${Ws(n)}`}return Ws(e)}function M6(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:r,actionEntries:o}=hi(),i=m.useMemo(()=>{const d=new Set;for(const f of Object.values(r))typeof f=="string"&&f&&d.add(mr(f));return d},[r]),a=m.useMemo(()=>{if(!e)return new Map;const d=n(),f=new Map;for(const p of d){if(i.has(mr(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 d=[];for(const[f,p]of Object.entries(r)){if(!p)continue;const h=o.find(g=>g.bindableKind===f);d.push({kind:f,combo:p,title:h?h.title:f})}return d},[r,o]);return s.jsx(Bn,{open:e,onOpenChange:d=>d?null:t(),children:s.jsxs(_n,{className:"max-w-2xl",children:[s.jsx(Dn,{children:"Keyboard shortcuts"}),s.jsxs(es,{children:["Press Esc to close. ",Ws("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:[I6.map(d=>{const f=a.get(d);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:$6[d]}),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:I1(p.keys)})]},`${d}-${p.keys}-${h}`))})]},d)}),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(d=>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:d.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:I1(d.combo)})]},`custom-${d.kind}`))})]}):null]})]})})}const nw={bindings:{},custom:!1};let $u=null,al=null;const gb=new Set;function CT(e){$u=e;for(const t of gb)t(e)}function rw(e){if(!e||typeof e!="object")return nw;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(!mO(r)||typeof o!="string"||o.trim()==="")continue;const i=mr(o);i&&(n[r]=i)}return{bindings:n,custom:t.custom===!0}}function L6(){return $u?Promise.resolve($u):al||(al=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=rw(e);return $u=t,al=null,t}).catch(()=>(al=null,nw)),al)}function O6(){const[e,t]=m.useState(()=>$u??nw);return m.useEffect(()=>{let n=!1;return L6().then(r=>{n||t(r)}),gb.add(t),()=>{n=!0,gb.delete(t)}},[]),e}async function M1(e){const t={};for(const o of Gh){const i=e[o];if(typeof i!="string")continue;const a=mr(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=rw(await n.json());return CT(r),r}async function F6(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=rw(await e.json());return CT(t),t}const L1=1500;function z6(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const ET=m.createContext(null);function B6({children:e}){const{toggleTheme:t}=_v(),n=rr(),r=zt(),o=z6(n.pathname),[i,a]=m.useState(!1),l=Xs(i),d=qh(i),f=$v(i),p=Dv(i),h=C2(i),{search:g}=Bv(),y=m.useMemo(()=>{var qe,vt,ft,st;const je=l.data??[],ke=((qe=d.data)==null?void 0:qe.assignments)??[],_e=((vt=f.data)==null?void 0:vt.playbooks)??[],Ue=((ft=p.data)==null?void 0:ft.sessions)??[],Me=(((st=h.data)==null?void 0:st.workspaces)??[]).flatMap(le=>le.items.map(ee=>({...ee,workspace:le.workspace})));return MO({projects:je,assignments:ke,playbooks:_e,servers:Ue,todos:Me,wsPrefix:o,externalIds:g.externalIds})},[l.data,d.data,f.data,p.data,h.data,o,g.externalIds]),w=m.useMemo(()=>l2(n.pathname),[n.pathname]).projectSlug,b=m.useMemo(()=>{var je;return w?((je=l.data)==null?void 0:je.find(ke=>ke.slug===w))??null:null},[l.data,w]),j=(b==null?void 0:b.title)??null,N=(b==null?void 0:b.workspace)??null,k=m.useMemo(()=>{var je;return FO({playbooks:((je=f.data)==null?void 0:je.playbooks)??[],projectSlug:w,currentProjectTitle:j,currentProjectWorkspace:N,wsPrefix:o,refetchPlaybooks:f.refetch,navigate:r,toggleTheme:t})},[f.data,f.refetch,w,j,N,o,r,t]),C=m.useRef(new Map),I=m.useRef(["global"]),T=m.useRef({phase:"idle"}),R=m.useRef(null),D=m.useRef(1),[$,z]=m.useState(!1),[A,F]=m.useState(!1),[W,P]=m.useState(!1),[O,B]=m.useState(null);m.useEffect(()=>{($||W)&&a(!0)},[$,W]);const{bindings:H}=O6(),L=m.useMemo(()=>vO(H),[H]),U=m.useCallback(je=>{const ke=D.current++;return C.current.set(ke,{...je,id:ke}),ke},[]),M=m.useCallback(je=>{C.current.delete(je)},[]),V=m.useCallback(je=>{I.current.push(je)},[]),Y=m.useCallback(je=>{const ke=I.current;for(let _e=ke.length-1;_e>=0;_e--)if(ke[_e]===je){ke.splice(_e,1);return}},[]),q=m.useCallback(()=>z(!0),[]),J=m.useCallback(()=>z(!1),[]),ne=m.useCallback(()=>F(!0),[]),Q=m.useCallback(()=>F(!1),[]),ce=m.useCallback(()=>P(!0),[]),te=m.useCallback(()=>{P(!1),B(null)},[]),pe=m.useCallback(()=>Array.from(C.current.values()),[]),be=m.useCallback(()=>{let je=null;return B(ke=>(je=ke,null)),je},[]),Ee=m.useCallback(je=>{B(je),P(!0)},[]),Te=m.useCallback((je,ke)=>{const _e=mr(je);if(!_e)return null;if(yO(_e)){const Ue=D6(_e);return{description:(Ue==null?void 0:Ue.description)??"Reserved built-in shortcut"}}for(const[Ue,et]of Object.entries(L))if(!(ke&&Ue===ke)&&et===_e)return{kind:Ue};return null},[L]),Se=m.useCallback(async(je,ke)=>{const _e=mr(ke);if(!_e)throw new Error("Empty combo");const Ue=Te(_e,je);if(Ue){const Me=Ue.description?`Reserved: ${Ue.description}`:`Already bound to "${Ue.kind}"`;throw new Error(Me)}const et={...H,[je]:_e};return await M1(et),_e},[H,Te]),Be=m.useCallback(async je=>{if(!H[je])return;const ke={...H};delete ke[je],await M1(ke)},[H]);m.useEffect(()=>{T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[n.pathname]),m.useEffect(()=>{function je(Me){if(!(Me instanceof HTMLElement))return!1;const qe=Me.tagName;return!!(qe==="INPUT"||qe==="TEXTAREA"||qe==="SELECT"||Me.isContentEditable||Me.closest('[role="combobox"], [role="textbox"]'))}function ke(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function _e(){const Me=I.current;return Me[Me.length-1]??"global"}function Ue(Me){return Me.scope==="global"?!0:Me.scope===_e()}function et(Me){const qe=Gf(Me,"Mod+k"),vt=Gf(Me,"Mod+Shift+k"),ft=Me.key==="Escape",st=qe||vt||ft;if(ke()&&!st||je(Me.target)&&!st)return;const le=T.current;if(le.phase==="awaiting-second")if(Date.now()-le.startedAt>L1)T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null);else{const ie=Array.from(C.current.values());for(const we of ie){if(!Ue(we))continue;const $e=we.keys.split(" ");if(!($e.length!==2||$e[0]!=="g")&&Gf(Me,$e[1])&&!(we.when&&!we.when())){Me.preventDefault(),T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null),we.handler(Me);return}}T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)}const ee=Array.from(C.current.values());for(const ye of ee){if(!Ue(ye))continue;const ie=ye.keys.split(" ");if(ie.length===1&&Gf(Me,ie[0])&&!(ye.when&&!ye.when())){Me.preventDefault(),ye.handler(Me);return}}Me.key==="g"&&!Me.metaKey&&!Me.ctrlKey&&!Me.altKey&&!Me.shiftKey&&Array.from(C.current.values()).some(ie=>Ue(ie)&&ie.keys.startsWith("g "))&&(Me.preventDefault(),T.current={phase:"awaiting-second",startedAt:Date.now()},R.current!==null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{T.current={phase:"idle"},R.current=null},L1))}return window.addEventListener("keydown",et),()=>{window.removeEventListener("keydown",et),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[]),m.useEffect(()=>{const je=U({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>M(je)},[U,M,t]),m.useEffect(()=>{const je=U({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ne()});return()=>M(je)},[U,M,ne]),m.useEffect(()=>{const je=U({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if($){J();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||q()}});return()=>M(je)},[U,M,q,J,$]),m.useEffect(()=>{const je=U({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(W){te();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||ce()}});return()=>M(je)},[U,M,ce,te,W]),m.useEffect(()=>{const ke=[{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(_e=>U({keys:`g ${_e.suffix}`,scope:"global",description:_e.desc,handler:()=>r(Ep(_e.basePath,o))}));return()=>ke.forEach(M)},[U,M,r,o]),m.useEffect(()=>{const je=[];for(const[ke,_e]of Object.entries(L)){if(!_e)continue;const Ue=k.find(Me=>Me.bindableKind===ke),et=Ue?`Custom: ${Ue.title}`:`Custom: ${ke}`;je.push(U({keys:_e,scope:"global",description:et,handler:()=>{B(ke),P(!0)}}))}return()=>je.forEach(M)},[U,M,L,k]);const oe=m.useMemo(()=>({register:U,unregister:M,pushScope:V,popScope:Y,openPalette:q,closePalette:J,paletteOpen:$,openCheatsheet:ne,closeCheatsheet:Q,cheatsheetOpen:A,openActionsPalette:ce,closeActionsPalette:te,actionsPaletteOpen:W,listBindings:pe,wsPrefix:o,paletteEntries:y,actionEntries:k,userBindings:H,customBindings:L,bindAction:Se,unbindAction:Be,findConflict:Te,openActionsPaletteWithAction:Ee,pendingActionKind:O,consumePendingActionKind:be}),[U,M,V,Y,q,J,$,ne,Q,A,ce,te,W,pe,o,y,k,H,L,Se,Be,Te,Ee,O,be]);return s.jsxs(ET.Provider,{value:oe,children:[e,s.jsx(E6,{entries:y}),s.jsx(P6,{entries:k}),s.jsx(M6,{})]})}function hi(){const e=m.useContext(ET);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Jt({keys:e,handler:t,scope:n="global",description:r,when:o,enabled:i=!0}){const{register:a,unregister:l}=hi(),d=m.useRef(t),f=m.useRef(o);m.useEffect(()=>{d.current=t,f.current=o},[t,o]),m.useEffect(()=>{if(!i)return;const p=a({keys:e,handler:h=>d.current(h),scope:n,description:r,when:f.current?()=>f.current():void 0});return()=>l(p)},[a,l,e,n,r,i])}function mi(e){const{pushScope:t,popScope:n}=hi();m.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function Rd(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 d=Number(l.getAttribute("data-hotkey-row-index"));l.setAttribute("data-hotkey-selected",d===n?"true":"false")}),n>=0){const l=document.querySelector(`[data-hotkey-row-index="${n}"]`);l==null||l.scrollIntoView({block:"nearest"})}},[n,e.length]),Jt({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))}),Jt({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>r(a=>e.length===0?-1:Math.max(0,a<0?0:a-1))}),Jt({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Jt({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 U6({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:r}){const o=mn(),{resolvedTheme:i,toggleTheme:a}=_v(),{openPalette:l}=hi();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(WL,{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((d,f)=>s.jsxs("span",{className:"flex items-center gap-1.5",children:[f>0?s.jsx("span",{children:"/"}):null,s.jsx(Ie,{to:d.path,className:"hover:text-foreground",children:d.label})]},d.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.jsxs("button",{type:"button",onClick:l,className:"shell-action","aria-label":"Open command palette",children:[s.jsx(pi,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:Ws("Mod+k")})]}),s.jsx(Ie,{className:"shell-action",to:"/help",children:"Help"}),s.jsxs(Ie,{className:"shell-action",to:`${o}/create/project`,children:[s.jsx(Pt,{className:"h-4 w-4"}),s.jsx("span",{children:"New Project"})]}),n?s.jsxs(Ie,{className:"shell-action",to:`${o}/projects/${n}/create/assignment`,children:[s.jsx(Pt,{className:"h-4 w-4"}),s.jsx("span",{children:"New Assignment"})]}):null,s.jsxs("button",{type:"button",onClick:a,className:"shell-action","aria-label":"Toggle theme",children:[i==="dark"?s.jsx(n4,{className:"h-4 w-4"}):s.jsx(qL,{className:"h-4 w-4"}),s.jsx("span",{children:i==="dark"?"Light":"Dark"})]})]})]})})}const nh="_ungrouped",H6=256;function V6(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>H6||/[\r\n]/.test(o)||t.has(o)||(t.add(o),n.push(o)))}return n}function W6(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(r=>!n.has(r))}function q6(e,t){return t.includes(e)}const sw={hidden:[],custom:!1};let go=null,Bi=null,Yu=0;const xb=new Set;function TT(e){go=e;for(const t of xb)t(e)}function ow(e){if(!e||typeof e!="object")return sw;const t=e;return{hidden:V6(t.hidden),custom:t.custom===!0}}function K6(){if(go)return Promise.resolve({value:go,ok:!0});if(Bi)return Bi;const e=++Yu;return Bi=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Bi=null;const n=ow(t);return e!==Yu?{value:go??n,ok:!0}:(go=n,{value:n,ok:!0})}).catch(()=>(Bi=null,{value:sw,ok:!1})),Bi}function RT(){const[e,t]=m.useState(()=>go??sw),[n,r]=m.useState(()=>go===null),[o,i]=m.useState(!1),[a,l]=m.useState(0);m.useEffect(()=>{let f=!1;return r(go===null),K6().then(p=>{f||(t(p.value),r(!1),i(!p.ok))}),xb.add(t),()=>{f=!0,xb.delete(t)}},[a]);function d(){G6(),l(f=>f+1)}return{...e,loading:n,error:o,reload:d}}function G6(){go=null,Bi=null,++Yu}async function Y6(e){++Yu;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=ow(await t.json());return TT(n),n}async function X6(){++Yu;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=ow(await e.json());return TT(t),t}var Q6=Symbol("radix.slottable");function J6(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Q6,t}var AT="AlertDialog",[Z6]=pa(AT,[Z2]),ko=Z2(),PT=e=>{const{__scopeAlertDialog:t,...n}=e,r=ko(t);return s.jsx(mT,{...r,...n,modal:!0})};PT.displayName=AT;var ez="AlertDialogTrigger",tz=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=ko(n);return s.jsx(gT,{...o,...r,ref:t})});tz.displayName=ez;var nz="AlertDialogPortal",_T=e=>{const{__scopeAlertDialog:t,...n}=e,r=ko(t);return s.jsx(xT,{...r,...n})};_T.displayName=nz;var rz="AlertDialogOverlay",DT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=ko(n);return s.jsx(Kv,{...o,...r,ref:t})});DT.displayName=rz;var _l="AlertDialogContent",[sz,oz]=Z6(_l),iz=J6("AlertDialogContent"),$T=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=ko(n),a=m.useRef(null),l=Zn(t,a),d=m.useRef(null);return s.jsx(PF,{contentName:_l,titleName:IT,docsSlug:"alert-dialog",children:s.jsx(sz,{scope:n,cancelRef:d,children:s.jsxs(Gv,{role:"alertdialog",...i,...o,ref:l,onOpenAutoFocus:rn(o.onOpenAutoFocus,f=>{var p;f.preventDefault(),(p=d.current)==null||p.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[s.jsx(iz,{children:r}),s.jsx(lz,{contentRef:a})]})})})});$T.displayName=_l;var IT="AlertDialogTitle",MT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=ko(n);return s.jsx(Yv,{...o,...r,ref:t})});MT.displayName=IT;var LT="AlertDialogDescription",OT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=ko(n);return s.jsx(Xv,{...o,...r,ref:t})});OT.displayName=LT;var az="AlertDialogAction",FT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=ko(n);return s.jsx(Qv,{...o,...r,ref:t})});FT.displayName=az;var zT="AlertDialogCancel",BT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=oz(zT,n),i=ko(n),a=Zn(t,o);return s.jsx(Qv,{...i,...r,ref:a})});BT.displayName=zT;var lz=({contentRef:e})=>{const t=`\`${_l}\` requires a description for the component to be accessible for screen reader users.
|
|
576
|
+
|
|
577
|
+
You can add a description to the \`${_l}\` by passing a \`${LT}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
578
|
+
|
|
579
|
+
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 \`${_l}\`. 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.
|
|
580
|
+
|
|
581
|
+
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},cz=PT,uz=_T,UT=DT,HT=$T,VT=FT,WT=BT,qT=MT,KT=OT;const bl=cz,dz=uz,GT=m.forwardRef(({className:e,...t},n)=>s.jsx(UT,{ref:n,className:Ne("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));GT.displayName=UT.displayName;const Ki=m.forwardRef(({className:e,...t},n)=>s.jsxs(dz,{children:[s.jsx(GT,{}),s.jsx(HT,{ref:n,className:Ne("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})]}));Ki.displayName=HT.displayName;function vl({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col space-y-2 text-left",e),...t})}function wl({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Gi=m.forwardRef(({className:e,...t},n)=>s.jsx(qT,{ref:n,className:Ne("text-lg font-semibold tracking-tight text-foreground",e),...t}));Gi.displayName=qT.displayName;const Yi=m.forwardRef(({className:e,...t},n)=>s.jsx(KT,{ref:n,className:Ne("text-sm leading-6 text-muted-foreground",e),...t}));Yi.displayName=KT.displayName;const si=m.forwardRef(({className:e,...t},n)=>s.jsx(VT,{ref:n,className:Ne(e),...t}));si.displayName=VT.displayName;const Xu=m.forwardRef(({className:e,...t},n)=>s.jsx(WT,{ref:n,className:Ne(e),...t}));Xu.displayName=WT.displayName;const fz=[{to:"/",label:"Overview",icon:WE},{to:"/playbooks",label:"Playbooks",icon:BE},{to:"/memories",label:"Memories",icon:bL},{to:"/resources",label:"Resources",icon:FL},{to:"/inventories",label:"Inventories",icon:Uh},{to:"/schedules",label:"Schedules",icon:UE},{to:"/usage",label:"Usage",icon:Sd},{to:"/todos",label:"Todos",icon:Xr},{to:"/views",label:"Saved Views",icon:KE},{to:"/archive",label:"Archive",icon:zh}],pz=[{suffix:"/projects",label:"Projects",icon:Sv},{suffix:"/assignments",label:"Assignments",icon:UL},{suffix:"/servers",label:"Servers",icon:Tv},{suffix:"/inventories",label:"Inventories",icon:Uh},{suffix:"/usage",label:"Usage",icon:Sd},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Fh},{suffix:"/todos",label:"Todos",icon:Xr}],hz=[{to:"/help",label:"Help",icon:zL},{to:"/workflow",label:"Workflow",icon:o4},{to:"/settings",label:"Settings",icon:e4}];function mz({title:e,breadcrumbs:t,projectSlug:n,workspace:r,children:o}){const[i,a]=m.useState(!1);return Jt({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(O1,{activeWorkspace:r})}),i?s.jsx("div",{className:"fixed inset-0 z-40 bg-overlay/40 lg:hidden",children:s.jsxs("div",{className:"h-full max-w-xs border-r border-border/70 bg-sidebar p-4 shadow-2xl",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx(Ie,{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",children:s.jsx(Nd,{className:"h-4 w-4"})})]}),s.jsx(O1,{activeWorkspace:r,onNavigate:()=>a(!1)})]})}):null,s.jsxs("div",{className:"min-w-0",children:[s.jsx(U6,{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 O1({activeWorkspace:e,onNavigate:t}){const{data:n}=fa(),r=(n==null?void 0:n.workspaces)??[],o=(n==null?void 0:n.hasUngrouped)??!1,{hidden:i}=RT(),a=rr(),[l,d]=m.useState(new Set),[f,p]=m.useState(!1),[h,g]=m.useState(""),[y,S]=m.useState(null),[w,b]=m.useState(null),[j,N]=m.useState(null),[k,C]=m.useState(!1),I=zt();function T(z){d(A=>{const F=new Set(A);return F.has(z)?F.delete(z):F.add(z),F})}const R=W6([...r,...o?[nh]:[]],i);async function D(z){if(w){C(!0);try{const A=`/api/workspaces/${encodeURIComponent(w)}${z?"?cascade=true":""}`,F=await fetch(A,{method:"DELETE"});if(F.status===409){const W=await F.json().catch(()=>({}));N((W==null?void 0:W.blockedBy)??{projects:[],standalones:[]});return}if(!F.ok){const W=await F.json().catch(()=>({}));throw new Error(W.error||"Failed to delete workspace")}b(null),N(null)}catch(A){console.error(A),alert(A instanceof Error?A.message:"Failed to delete workspace")}finally{C(!1)}}}async function $(z,A){try{if(z.type==="project"){const F=await fetch(`/api/projects/${encodeURIComponent(z.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:A})});if(!F.ok){const W=await F.json().catch(()=>({}));throw new Error(W.error||"Failed to move project")}return}if(z.type==="standalone-assignment"){const F=await fetch(`/api/assignments/${encodeURIComponent(z.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:A})});if(!F.ok){const W=await F.json().catch(()=>({}));throw new Error(W.error||"Failed to move assignment")}return}if(z.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(F){console.error(F),alert(F instanceof Error?F.message:"Failed to move item")}}return s.jsxs("div",{className:"flex h-full flex-col gap-3",children:[s.jsx("div",{className:"space-y-3",children:s.jsxs(Ie,{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.jsx(f1,{items:fz,onNavigate:t}),s.jsx("div",{className:"border-t border-border/40"}),s.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[R.length===0&&!f&&s.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),R.map(z=>{const A=z==="_ungrouped",F=A?"Ungrouped":Tn(z),W=A?"/w/_ungrouped":`/w/${z}`,P=l.has(z),O=e===z||e===null&&A&&a.pathname.startsWith("/w/_ungrouped"),B=y===z;return s.jsxs("div",{className:`rounded-md transition ${B?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:H=>{H.dataTransfer.types.includes("application/json")&&(H.preventDefault(),H.dataTransfer.dropEffect="move",S(z))},onDragLeave:H=>{H.currentTarget.contains(H.relatedTarget)||S(L=>L===z?null:L)},onDrop:async H=>{try{const L=H.dataTransfer.getData("application/json");if(!L)return;H.preventDefault();let U;try{U=JSON.parse(L)}catch{return}if(!(U!=null&&U.type)||!(U!=null&&U.id))return;await $(U,A?null:z)}finally{S(null)}},children:[s.jsxs("div",{className:"group flex items-center",children:[s.jsxs("button",{type:"button",onClick:()=>T(z),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${O?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[s.jsx(yr,{className:`h-3 w-3 transition-transform ${P?"-rotate-90":""}`}),F]}),A?null:s.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),b(z),N(null)},title:`Delete workspace "${z}"`,"aria-label":`Delete workspace "${z}"`,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(jn,{className:"h-3 w-3"})})]}),!P&&s.jsx("nav",{className:"ml-2 space-y-0.5",children:pz.map(H=>{const L=`${W}${H.suffix}`,U=a2(a.pathname,H.suffix)&&a.pathname.startsWith(W),M=H.icon;return s.jsxs(Ie,{to:L,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${U?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[s.jsx(M,{className:"h-4 w-4"}),s.jsx("span",{children:H.label})]},L)})})]},z)}),f?s.jsx("form",{className:"px-3 py-1.5",onSubmit:z=>{z.preventDefault();const A=h.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");A&&(p(!1),g(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:A})}).then(()=>{t==null||t(),I(`/w/${A}/projects`)}))},children:s.jsx("input",{autoFocus:!0,type:"text",value:h,onChange:z=>g(z.target.value),onKeyDown:z=>{z.key==="Escape"&&(p(!1),g(""))},onBlur:()=>{h.trim()||(p(!1),g(""))},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:()=>p(!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(Pt,{className:"h-3 w-3"}),"New Workspace"]})]}),s.jsx("div",{className:"border-t border-border/40"}),s.jsx(f1,{items:hz,onNavigate:t}),s.jsx(bl,{open:w!==null,onOpenChange:z=>{k||z||(b(null),N(null))},children:s.jsxs(Ki,{children:[s.jsxs(vl,{children:[s.jsx(Gi,{children:j?"Workspace has references":"Delete workspace?"}),s.jsx(Yi,{children:j?s.jsxs(s.Fragment,{children:["The workspace ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:w})," 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:w})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),j?s.jsxs("div",{className:"space-y-2 text-sm",children:[j.projects.length>0?s.jsxs("div",{children:[s.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",j.projects.length,")"]}),s.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:j.projects.map(z=>s.jsx("li",{children:s.jsx(Ie,{to:`/projects/${z}`,className:"hover:underline",children:z})},z))})]}):null,j.standalones.length>0?s.jsxs("div",{children:[s.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",j.standalones.length,")"]}),s.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:j.standalones.map(z=>s.jsx("li",{children:s.jsx(Ie,{to:`/assignments/${z}`,className:"hover:underline",children:z})},z))})]}):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(wl,{children:[s.jsx(Xu,{disabled:k,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),j?s.jsx(si,{disabled:k,onClick:z=>{z.preventDefault(),D(!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:k?"Working…":"Clear references and delete"}):s.jsx(si,{disabled:k,onClick:z=>{z.preventDefault(),D(!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:k?"Working…":"Delete"})]})]})})]})}function gz(){const e=rr(),{workspace:t}=Bt(),{title:n,breadcrumbs:r,projectSlug:o}=l2(e.pathname);return s.jsx(mz,{title:n,breadcrumbs:r,projectSlug:o,workspace:t??null,children:s.jsx(AM,{})})}function xz(){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 rm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function fc(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function iw(e){return"nodeType"in e}function or(e){var t,n;return e?fc(e)?e:iw(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function aw(e){const{Document:t}=or(e);return e instanceof t}function Ad(e){return fc(e)?!1:e instanceof or(e).HTMLElement}function YT(e){return e instanceof or(e).SVGElement}function pc(e){return e?fc(e)?e.document:iw(e)?aw(e)?e:Ad(e)||YT(e)?e.ownerDocument:document:document:document}const ms=rm?m.useLayoutEffect:m.useEffect;function sm(e){const t=m.useRef(e);return ms(()=>{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 yz(){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 Qu(e,t){t===void 0&&(t=[e]);const n=m.useRef(e);return ms(()=>{n.current!==e&&(n.current=e)},t),n}function Pd(e,t){const n=m.useRef();return m.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function rh(e){const t=sm(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 sh(e){const t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}let Zx={};function _d(e,t){return m.useMemo(()=>{if(t)return t;const n=Zx[e]==null?0:Zx[e]+1;return Zx[e]=n,e+"-"+n},[e,t])}function XT(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[d,f]of l){const p=i[d];p!=null&&(i[d]=p+e*f)}return i},{...t})}}const Dl=XT(1),Ju=XT(-1);function bz(e){return"clientX"in e&&"clientY"in e}function om(e){if(!e)return!1;const{KeyboardEvent:t}=or(e.target);return t&&e instanceof t}function vz(e){if(!e)return!1;const{TouchEvent:t}=or(e.target);return t&&e instanceof t}function oh(e){if(vz(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 bz(e)?{x:e.clientX,y:e.clientY}:null}const gs=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[gs.Translate.toString(e),gs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),F1="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function wz(e){return e.matches(F1)?e:e.querySelector(F1)}const jz={display:"none"};function kz(e){let{id:t,value:n}=e;return $t.createElement("div",{id:t,style:jz},n)}function Sz(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 $t.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Nz(){const[e,t]=m.useState("");return{announce:m.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const QT=m.createContext(null);function Cz(e){const t=m.useContext(QT);m.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ez(){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 Tz={draggable:`
|
|
582
|
+
To pick up a draggable item, press the space bar.
|
|
583
|
+
While dragging, use the arrow keys to move the item.
|
|
584
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
585
|
+
`},Rz={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 Az(e){let{announcements:t=Rz,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Tz}=e;const{announce:i,announcement:a}=Nz(),l=_d("DndLiveRegion"),[d,f]=m.useState(!1);if(m.useEffect(()=>{f(!0)},[]),Cz(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])),!d)return null;const p=$t.createElement($t.Fragment,null,$t.createElement(kz,{id:r,value:o.draggable}),$t.createElement(Sz,{id:l,announcement:a}));return n?mo.createPortal(p,n):p}var Rn;(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"})(Rn||(Rn={}));function ih(){}function ci(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function im(){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 xs=Object.freeze({x:0,y:0});function JT(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Pz(e,t){const n=oh(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 ZT(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function _z(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function z1(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 eR(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function B1(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 am=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=B1(t,t.left,t.top),i=[];for(const a of r){const{id:l}=a,d=n.get(l);if(d){const f=JT(B1(d),o);i.push({id:l,data:{droppableContainer:a,value:f}})}}return i.sort(ZT)},Dz=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=z1(t),i=[];for(const a of r){const{id:l}=a,d=n.get(l);if(d){const f=z1(d),p=o.reduce((g,y,S)=>g+JT(f[S],y),0),h=Number((p/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:h}})}}return i.sort(ZT)};function $z(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 d=t.width*t.height,f=e.width*e.height,p=a*l,h=p/(d+f-p);return Number(h.toFixed(4))}return 0}const Iz=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 d=$z(l,t);d>0&&o.push({id:a,data:{droppableContainer:i,value:d}})}}return o.sort(_z)};function Mz(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function tR(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:xs}function Lz(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 Oz=Lz(1);function nR(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 Fz(e,t,n){const r=nR(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,d=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:d+p,bottom:f+h,left:d}}const zz={ignoreTransform:!1};function hc(e,t){t===void 0&&(t=zz);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:p}=or(e).getComputedStyle(e);f&&(n=Fz(n,f,p))}const{top:r,left:o,width:i,height:a,bottom:l,right:d}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:d}}function U1(e){return hc(e,{ignoreTransform:!0})}function Bz(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Uz(e,t){return t===void 0&&(t=or(e).getComputedStyle(e)),t.position==="fixed"}function Hz(e,t){t===void 0&&(t=or(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 lm(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(aw(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ad(o)||YT(o)||n.includes(o))return n;const i=or(e).getComputedStyle(o);return o!==e&&Hz(o,i)&&n.push(o),Uz(o,i)?n:r(o.parentNode)}return e?r(e):n}function rR(e){const[t]=lm(e,1);return t??null}function ey(e){return!rm||!e?null:fc(e)?e:iw(e)?aw(e)||e===pc(e).scrollingElement?window:Ad(e)?e:null:null}function sR(e){return fc(e)?e.scrollX:e.scrollLeft}function oR(e){return fc(e)?e.scrollY:e.scrollTop}function yb(e){return{x:sR(e),y:oR(e)}}var zn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(zn||(zn={}));function iR(e){return!rm||!e?!1:e===document.scrollingElement}function aR(e){const t={x:0,y:0},n=iR(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 Vz={x:.2,y:.2};function Wz(e,t,n,r,o){let{top:i,left:a,right:l,bottom:d}=n;r===void 0&&(r=10),o===void 0&&(o=Vz);const{isTop:f,isBottom:p,isLeft:h,isRight:g}=aR(e),y={x:0,y:0},S={x:0,y:0},w={height:t.height*o.y,width:t.width*o.x};return!f&&i<=t.top+w.height?(y.y=zn.Backward,S.y=r*Math.abs((t.top+w.height-i)/w.height)):!p&&d>=t.bottom-w.height&&(y.y=zn.Forward,S.y=r*Math.abs((t.bottom-w.height-d)/w.height)),!g&&l>=t.right-w.width?(y.x=zn.Forward,S.x=r*Math.abs((t.right-w.width-l)/w.width)):!h&&a<=t.left+w.width&&(y.x=zn.Backward,S.x=r*Math.abs((t.left+w.width-a)/w.width)),{direction:y,speed:S}}function qz(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 lR(e){return e.reduce((t,n)=>Dl(t,yb(n)),xs)}function Kz(e){return e.reduce((t,n)=>t+sR(n),0)}function Gz(e){return e.reduce((t,n)=>t+oR(n),0)}function cR(e,t){if(t===void 0&&(t=hc),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);rR(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Yz=[["x",["left","right"],Kz],["y",["top","bottom"],Gz]];class lw{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=lm(n),o=lR(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,l]of Yz)for(const d of a)Object.defineProperty(this,d,{get:()=>{const f=l(r),p=o[i]-f;return this.rect[d]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Iu{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 Xz(e){const{EventTarget:t}=or(e);return e instanceof t?e:pc(e)}function ty(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 Gr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Gr||(Gr={}));function H1(e){e.preventDefault()}function Qz(e){e.stopPropagation()}var kt;(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"})(kt||(kt={}));const uR={start:[kt.Space,kt.Enter],cancel:[kt.Esc],end:[kt.Space,kt.Enter,kt.Tab]},Jz=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case kt.Right:return{...n,x:n.x+25};case kt.Left:return{...n,x:n.x-25};case kt.Down:return{...n,y:n.y+25};case kt.Up:return{...n,y:n.y-25}}};class mc{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 Iu(pc(n)),this.windowListeners=new Iu(or(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Gr.Resize,this.handleCancel),this.windowListeners.add(Gr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Gr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&cR(r),n(xs)}handleKeyDown(t){if(om(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=uR,coordinateGetter:a=Jz,scrollBehavior:l="smooth"}=o,{code:d}=t;if(i.end.includes(d)){this.handleEnd(t);return}if(i.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:f}=r.current,p=f?{x:f.left,y:f.top}:xs;this.referenceCoordinates||(this.referenceCoordinates=p);const h=a(t,{active:n,context:r.current,currentCoordinates:p});if(h){const g=Ju(h,p),y={x:0,y:0},{scrollableAncestors:S}=r.current;for(const w of S){const b=t.code,{isTop:j,isRight:N,isLeft:k,isBottom:C,maxScroll:I,minScroll:T}=aR(w),R=qz(w),D={x:Math.min(b===kt.Right?R.right-R.width/2:R.right,Math.max(b===kt.Right?R.left:R.left+R.width/2,h.x)),y:Math.min(b===kt.Down?R.bottom-R.height/2:R.bottom,Math.max(b===kt.Down?R.top:R.top+R.height/2,h.y))},$=b===kt.Right&&!N||b===kt.Left&&!k,z=b===kt.Down&&!C||b===kt.Up&&!j;if($&&D.x!==h.x){const A=w.scrollLeft+g.x,F=b===kt.Right&&A<=I.x||b===kt.Left&&A>=T.x;if(F&&!g.y){w.scrollTo({left:A,behavior:l});return}F?y.x=w.scrollLeft-A:y.x=b===kt.Right?w.scrollLeft-I.x:w.scrollLeft-T.x,y.x&&w.scrollBy({left:-y.x,behavior:l});break}else if(z&&D.y!==h.y){const A=w.scrollTop+g.y,F=b===kt.Down&&A<=I.y||b===kt.Up&&A>=T.y;if(F&&!g.x){w.scrollTo({top:A,behavior:l});return}F?y.y=w.scrollTop-A:y.y=b===kt.Down?w.scrollTop-I.y:w.scrollTop-T.y,y.y&&w.scrollBy({top:-y.y,behavior:l});break}}this.handleMove(t,Dl(Ju(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()}}mc.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=uR,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 V1(e){return!!(e&&"distance"in e)}function W1(e){return!!(e&&"delay"in e)}class cw{constructor(t,n,r){var o;r===void 0&&(r=Xz(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=pc(a),this.documentListeners=new Iu(this.document),this.listeners=new Iu(r),this.windowListeners=new Iu(or(a)),this.initialCoordinates=(o=oh(i))!=null?o:xs,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(Gr.Resize,this.handleCancel),this.windowListeners.add(Gr.DragStart,H1),this.windowListeners.add(Gr.VisibilityChange,this.handleCancel),this.windowListeners.add(Gr.ContextMenu,H1),this.documentListeners.add(Gr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(W1(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(V1(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(Gr.Click,Qz,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Gr.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 d=(n=oh(t))!=null?n:xs,f=Ju(o,d);if(!r&&l){if(V1(l)){if(l.tolerance!=null&&ty(f,l.tolerance))return this.handleCancel();if(ty(f,l.distance))return this.handleStart()}if(W1(l)&&ty(f,l.tolerance))return this.handleCancel();this.handlePending(l,f);return}t.cancelable&&t.preventDefault(),a(d)}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===kt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Zz={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class gc extends cw{constructor(t){const{event:n}=t,r=pc(n.target);super(t,Zz,r)}}gc.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 eB={move:{name:"mousemove"},end:{name:"mouseup"}};var bb;(function(e){e[e.RightClick=2]="RightClick"})(bb||(bb={}));class tB extends cw{constructor(t){super(t,eB,pc(t.event.target))}}tB.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===bb.RightClick?!1:(r==null||r({event:n}),!0)}}];const ny={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class nB extends cw{constructor(t){super(t,ny)}static setup(){return window.addEventListener(ny.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ny.move.name,t)};function t(){}}}nB.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 Mu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Mu||(Mu={}));var ah;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ah||(ah={}));function rB(e){let{acceleration:t,activator:n=Mu.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:l=ah.TreeOrder,pointerCoordinates:d,scrollableAncestors:f,scrollableAncestorRects:p,delta:h,threshold:g}=e;const y=oB({delta:h,disabled:!i}),[S,w]=yz(),b=m.useRef({x:0,y:0}),j=m.useRef({x:0,y:0}),N=m.useMemo(()=>{switch(n){case Mu.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Mu.DraggableRect:return o}},[n,o,d]),k=m.useRef(null),C=m.useCallback(()=>{const T=k.current;if(!T)return;const R=b.current.x*j.current.x,D=b.current.y*j.current.y;T.scrollBy(R,D)},[]),I=m.useMemo(()=>l===ah.TreeOrder?[...f].reverse():f,[l,f]);m.useEffect(()=>{if(!i||!f.length||!N){w();return}for(const T of I){if((r==null?void 0:r(T))===!1)continue;const R=f.indexOf(T),D=p[R];if(!D)continue;const{direction:$,speed:z}=Wz(T,D,N,t,g);for(const A of["x","y"])y[A][$[A]]||(z[A]=0,$[A]=0);if(z.x>0||z.y>0){w(),k.current=T,S(C,a),b.current=z,j.current=$;return}}b.current={x:0,y:0},j.current={x:0,y:0},w()},[t,C,r,w,i,a,JSON.stringify(N),JSON.stringify(y),S,f,I,p,JSON.stringify(g)])}const sB={x:{[zn.Backward]:!1,[zn.Forward]:!1},y:{[zn.Backward]:!1,[zn.Forward]:!1}};function oB(e){let{delta:t,disabled:n}=e;const r=sh(t);return Pd(o=>{if(n||!r||!o)return sB;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[zn.Backward]:o.x[zn.Backward]||i.x===-1,[zn.Forward]:o.x[zn.Forward]||i.x===1},y:{[zn.Backward]:o.y[zn.Backward]||i.y===-1,[zn.Forward]:o.y[zn.Forward]||i.y===1}}},[n,t,r])}function iB(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Pd(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function aB(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 Zu;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Zu||(Zu={}));var vb;(function(e){e.Optimized="optimized"})(vb||(vb={}));const q1=new Map;function lB(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=m.useState(null),{frequency:l,measure:d,strategy:f}=o,p=m.useRef(e),h=b(),g=Qu(h),y=m.useCallback(function(j){j===void 0&&(j=[]),!g.current&&a(N=>N===null?j:N.concat(j.filter(k=>!N.includes(k))))},[g]),S=m.useRef(null),w=Pd(j=>{if(h&&!n)return q1;if(!j||j===q1||p.current!==e||i!=null){const N=new Map;for(let k of e){if(!k)continue;if(i&&i.length>0&&!i.includes(k.id)&&k.rect.current){N.set(k.id,k.rect.current);continue}const C=k.node.current,I=C?new lw(d(C),C):null;k.rect.current=I,I&&N.set(k.id,I)}return N}return j},[e,i,n,h,d]);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"||S.current!==null||(S.current=setTimeout(()=>{y(),S.current=null},l))},[l,h,y,...r]),{droppableRects:w,measureDroppableContainers:y,measuringScheduled:i!=null};function b(){switch(f){case Zu.Always:return!1;case Zu.BeforeDragging:return n;default:return!n}}}function uw(e,t){return Pd(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function cB(e,t){return uw(e,t)}function uB(e){let{callback:t,disabled:n}=e;const r=sm(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 cm(e){let{callback:t,disabled:n}=e;const r=sm(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 dB(e){return new lw(hc(e),e)}function K1(e,t,n){t===void 0&&(t=dB);const[r,o]=m.useState(null);function i(){o(d=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=d??n)!=null?f:null}const p=t(e);return JSON.stringify(d)===JSON.stringify(p)?d:p})}const a=uB({callback(d){if(e)for(const f of d){const{type:p,target:h}=f;if(p==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),l=cm({callback:i});return ms(()=>{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 fB(e){const t=uw(e);return tR(e,t)}const G1=[];function pB(e){const t=m.useRef(e),n=Pd(r=>e?r&&r!==G1&&e&&t.current&&e.parentNode===t.current.parentNode?r:lm(e):G1,[e]);return m.useEffect(()=>{t.current=e},[e]),n}function hB(e){const[t,n]=m.useState(null),r=m.useRef(e),o=m.useCallback(i=>{const a=ey(i.target);a&&n(l=>l?(l.set(a,yb(a)),new Map(l)):null)},[]);return m.useEffect(()=>{const i=r.current;if(e!==i){a(i);const l=e.map(d=>{const f=ey(d);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,yb(f)]):null}).filter(d=>d!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(i)};function a(l){l.forEach(d=>{const f=ey(d);f==null||f.removeEventListener("scroll",o)})}},[o,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>Dl(i,a),xs):lR(e):xs,[e,t])}function Y1(e,t){t===void 0&&(t=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},t),m.useEffect(()=>{const r=e!==xs;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Ju(e,n.current):xs}function mB(e){m.useEffect(()=>{if(!rm)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 gB(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 dR(e){return m.useMemo(()=>e?Bz(e):null,[e])}const X1=[];function xB(e,t){t===void 0&&(t=hc);const[n]=e,r=dR(n?or(n):null),[o,i]=m.useState(X1);function a(){i(()=>e.length?e.map(d=>iR(d)?r:new lw(t(d),d)):X1)}const l=cm({callback:a});return ms(()=>{l==null||l.disconnect(),a(),e.forEach(d=>l==null?void 0:l.observe(d))},[e]),o}function fR(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ad(t)?t:e}function yB(e){let{measure:t}=e;const[n,r]=m.useState(null),o=m.useCallback(f=>{for(const{target:p}of f)if(Ad(p)){r(h=>{const g=t(p);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),i=cm({callback:o}),a=m.useCallback(f=>{const p=fR(f);i==null||i.disconnect(),p&&(i==null||i.observe(p)),r(p?t(p):null)},[t,i]),[l,d]=rh(a);return m.useMemo(()=>({nodeRef:l,rect:n,setRef:d}),[n,l,d])}const bB=[{sensor:gc,options:{}},{sensor:mc,options:{}}],vB={current:{}},$p={draggable:{measure:U1},droppable:{measure:U1,strategy:Zu.WhileDragging,frequency:vb.Optimized},dragOverlay:{measure:hc}};class Lu 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 wB={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Lu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ih},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:$p,measureDroppableContainers:ih,windowRect:null,measuringScheduled:!1},pR={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ih,draggableNodes:new Map,over:null,measureDroppableContainers:ih},Dd=m.createContext(pR),hR=m.createContext(wB);function jB(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Lu}}}function kB(e,t){switch(t.type){case Rn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Rn.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 Rn.DragEnd:case Rn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Rn.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Lu(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Rn.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 Lu(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Rn.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Lu(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function SB(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=m.useContext(Dd),i=sh(r),a=sh(n==null?void 0:n.id);return m.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!om(i)||document.activeElement===i.target)return;const l=o.get(a);if(!l)return;const{activatorNode:d,node:f}=l;if(!d.current&&!f.current)return;requestAnimationFrame(()=>{for(const p of[d.current,f.current]){if(!p)continue;const h=wz(p);if(h){h.focus();break}}})}},[r,t,o,a,i]),null}function mR(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function NB(e){return m.useMemo(()=>({draggable:{...$p.draggable,...e==null?void 0:e.draggable},droppable:{...$p.droppable,...e==null?void 0:e.droppable},dragOverlay:{...$p.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 CB(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;ms(()=>{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=tR(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=rR(f);g&&g.scrollBy({top:h.y,left:h.x})}},[t,a,l,r,n])}const um=m.createContext({...xs,scaleX:1,scaleY:1});var ni;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ni||(ni={}));const dm=m.memo(function(t){var n,r,o,i;let{id:a,accessibility:l,autoScroll:d=!0,children:f,sensors:p=bB,collisionDetection:h=Iz,measuring:g,modifiers:y,...S}=t;const w=m.useReducer(kB,void 0,jB),[b,j]=w,[N,k]=Ez(),[C,I]=m.useState(ni.Uninitialized),T=C===ni.Initialized,{draggable:{active:R,nodes:D,translate:$},droppable:{containers:z}}=b,A=R!=null?D.get(R):null,F=m.useRef({initial:null,translated:null}),W=m.useMemo(()=>{var ge;return R!=null?{id:R,data:(ge=A==null?void 0:A.data)!=null?ge:vB,rect:F}:null},[R,A]),P=m.useRef(null),[O,B]=m.useState(null),[H,L]=m.useState(null),U=Qu(S,Object.values(S)),M=_d("DndDescribedBy",a),V=m.useMemo(()=>z.getEnabled(),[z]),Y=NB(g),{droppableRects:q,measureDroppableContainers:J,measuringScheduled:ne}=lB(V,{dragging:T,dependencies:[$.x,$.y],config:Y.droppable}),Q=iB(D,R),ce=m.useMemo(()=>H?oh(H):null,[H]),te=lt(),pe=cB(Q,Y.draggable.measure);CB({activeNode:R!=null?D.get(R):null,config:te.layoutShiftCompensation,initialRect:pe,measure:Y.draggable.measure});const be=K1(Q,Y.draggable.measure,pe),Ee=K1(Q?Q.parentElement:null),Te=m.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:z,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Se=z.getNodeFor((n=Te.current.over)==null?void 0:n.id),Be=yB({measure:Y.dragOverlay.measure}),oe=(r=Be.nodeRef.current)!=null?r:Q,je=T?(o=Be.rect)!=null?o:be:null,ke=!!(Be.nodeRef.current&&Be.rect),_e=fB(ke?null:be),Ue=dR(oe?or(oe):null),et=pB(T?Se??Q:null),Me=xB(et),qe=mR(y,{transform:{x:$.x-_e.x,y:$.y-_e.y,scaleX:1,scaleY:1},activatorEvent:H,active:W,activeNodeRect:be,containerNodeRect:Ee,draggingNodeRect:je,over:Te.current.over,overlayNodeRect:Be.rect,scrollableAncestors:et,scrollableAncestorRects:Me,windowRect:Ue}),vt=ce?Dl(ce,$):null,ft=hB(et),st=Y1(ft),le=Y1(ft,[be]),ee=Dl(qe,st),ye=je?Oz(je,qe):null,ie=W&&ye?h({active:W,collisionRect:ye,droppableRects:q,droppableContainers:V,pointerCoordinates:vt}):null,we=eR(ie,"id"),[$e,Ce]=m.useState(null),se=ke?qe:Dl(qe,le),me=Mz(se,(i=$e==null?void 0:$e.rect)!=null?i:null,be),Pe=m.useRef(null),Ke=m.useCallback((ge,He)=>{let{sensor:Je,options:It}=He;if(P.current==null)return;const qt=D.get(P.current);if(!qt)return;const un=ge.nativeEvent,Ut=new Je({active:P.current,activeNode:qt,event:un,options:It,context:Te,onAbort(St){if(!D.get(St))return;const{onDragAbort:Nt}=U.current,ue={id:St};Nt==null||Nt(ue),N({type:"onDragAbort",event:ue})},onPending(St,$n,Nt,ue){if(!D.get(St))return;const{onDragPending:ot}=U.current,yt={id:St,constraint:$n,initialCoordinates:Nt,offset:ue};ot==null||ot(yt),N({type:"onDragPending",event:yt})},onStart(St){const $n=P.current;if($n==null)return;const Nt=D.get($n);if(!Nt)return;const{onDragStart:ue}=U.current,We={activatorEvent:un,active:{id:$n,data:Nt.data,rect:F}};mo.unstable_batchedUpdates(()=>{ue==null||ue(We),I(ni.Initializing),j({type:Rn.DragStart,initialCoordinates:St,active:$n}),N({type:"onDragStart",event:We}),B(Pe.current),L(un)})},onMove(St){j({type:Rn.DragMove,coordinates:St})},onEnd:Un(Rn.DragEnd),onCancel:Un(Rn.DragCancel)});Pe.current=Ut;function Un(St){return async function(){const{active:Nt,collisions:ue,over:We,scrollAdjustedTranslate:ot}=Te.current;let yt=null;if(Nt&&ot){const{cancelDrop:Gn}=U.current;yt={activatorEvent:un,active:Nt,collisions:ue,delta:ot,over:We},St===Rn.DragEnd&&typeof Gn=="function"&&await Promise.resolve(Gn(yt))&&(St=Rn.DragCancel)}P.current=null,mo.unstable_batchedUpdates(()=>{j({type:St}),I(ni.Uninitialized),Ce(null),B(null),L(null),Pe.current=null;const Gn=St===Rn.DragEnd?"onDragEnd":"onDragCancel";if(yt){const vr=U.current[Gn];vr==null||vr(yt),N({type:Gn,event:yt})}})}}},[D]),de=m.useCallback((ge,He)=>(Je,It)=>{const qt=Je.nativeEvent,un=D.get(It);if(P.current!==null||!un||qt.dndKit||qt.defaultPrevented)return;const Ut={active:un};ge(Je,He.options,Ut)===!0&&(qt.dndKit={capturedBy:He.sensor},P.current=It,Ke(Je,He))},[D,Ke]),pt=aB(p,de);mB(p),ms(()=>{be&&C===ni.Initializing&&I(ni.Initialized)},[be,C]),m.useEffect(()=>{const{onDragMove:ge}=U.current,{active:He,activatorEvent:Je,collisions:It,over:qt}=Te.current;if(!He||!Je)return;const un={active:He,activatorEvent:Je,collisions:It,delta:{x:ee.x,y:ee.y},over:qt};mo.unstable_batchedUpdates(()=>{ge==null||ge(un),N({type:"onDragMove",event:un})})},[ee.x,ee.y]),m.useEffect(()=>{const{active:ge,activatorEvent:He,collisions:Je,droppableContainers:It,scrollAdjustedTranslate:qt}=Te.current;if(!ge||P.current==null||!He||!qt)return;const{onDragOver:un}=U.current,Ut=It.get(we),Un=Ut&&Ut.rect.current?{id:Ut.id,rect:Ut.rect.current,data:Ut.data,disabled:Ut.disabled}:null,St={active:ge,activatorEvent:He,collisions:Je,delta:{x:qt.x,y:qt.y},over:Un};mo.unstable_batchedUpdates(()=>{Ce(Un),un==null||un(St),N({type:"onDragOver",event:St})})},[we]),ms(()=>{Te.current={activatorEvent:H,active:W,activeNode:Q,collisionRect:ye,collisions:ie,droppableRects:q,draggableNodes:D,draggingNode:oe,draggingNodeRect:je,droppableContainers:z,over:$e,scrollableAncestors:et,scrollAdjustedTranslate:ee},F.current={initial:je,translated:ye}},[W,Q,ie,ye,D,oe,je,q,z,$e,et,ee]),rB({...te,delta:$,draggingRect:ye,pointerCoordinates:vt,scrollableAncestors:et,scrollableAncestorRects:Me});const xt=m.useMemo(()=>({active:W,activeNode:Q,activeNodeRect:be,activatorEvent:H,collisions:ie,containerNodeRect:Ee,dragOverlay:Be,draggableNodes:D,droppableContainers:z,droppableRects:q,over:$e,measureDroppableContainers:J,scrollableAncestors:et,scrollableAncestorRects:Me,measuringConfiguration:Y,measuringScheduled:ne,windowRect:Ue}),[W,Q,be,H,ie,Ee,Be,D,z,q,$e,J,et,Me,Y,ne,Ue]),jt=m.useMemo(()=>({activatorEvent:H,activators:pt,active:W,activeNodeRect:be,ariaDescribedById:{draggable:M},dispatch:j,draggableNodes:D,over:$e,measureDroppableContainers:J}),[H,pt,W,be,j,M,D,$e,J]);return $t.createElement(QT.Provider,{value:k},$t.createElement(Dd.Provider,{value:jt},$t.createElement(hR.Provider,{value:xt},$t.createElement(um.Provider,{value:me},f)),$t.createElement(SB,{disabled:(l==null?void 0:l.restoreFocus)===!1})),$t.createElement(Az,{...l,hiddenTextDescribedById:M}));function lt(){const ge=(O==null?void 0:O.autoScrollEnabled)===!1,He=typeof d=="object"?d.enabled===!1:d===!1,Je=T&&!ge&&!He;return typeof d=="object"?{...d,enabled:Je}:{enabled:Je}}}),EB=m.createContext(null),Q1="button",TB="Draggable";function RB(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=_d(TB),{activators:a,activatorEvent:l,active:d,activeNodeRect:f,ariaDescribedById:p,draggableNodes:h,over:g}=m.useContext(Dd),{role:y=Q1,roleDescription:S="draggable",tabIndex:w=0}=o??{},b=(d==null?void 0:d.id)===t,j=m.useContext(b?um:EB),[N,k]=rh(),[C,I]=rh(),T=gB(a,t),R=Qu(n);ms(()=>(h.set(t,{id:t,key:i,node:N,activatorNode:C,data:R}),()=>{const $=h.get(t);$&&$.key===i&&h.delete(t)}),[h,t]);const D=m.useMemo(()=>({role:y,tabIndex:w,"aria-disabled":r,"aria-pressed":b&&y===Q1?!0:void 0,"aria-roledescription":S,"aria-describedby":p.draggable}),[r,y,w,b,S,p.draggable]);return{active:d,activatorEvent:l,activeNodeRect:f,attributes:D,isDragging:b,listeners:r?void 0:T,node:N,over:g,setNodeRef:k,setActivatorNodeRef:I,transform:j}}function gR(){return m.useContext(hR)}const AB="Droppable",PB={timeout:25};function _B(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=_d(AB),{active:a,dispatch:l,over:d,measureDroppableContainers:f}=m.useContext(Dd),p=m.useRef({disabled:n}),h=m.useRef(!1),g=m.useRef(null),y=m.useRef(null),{disabled:S,updateMeasurementsFor:w,timeout:b}={...PB,...o},j=Qu(w??r),N=m.useCallback(()=>{if(!h.current){h.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{f(Array.isArray(j.current)?j.current:[j.current]),y.current=null},b)},[b]),k=cm({callback:N,disabled:S||!a}),C=m.useCallback((D,$)=>{k&&($&&(k.unobserve($),h.current=!1),D&&k.observe(D))},[k]),[I,T]=rh(C),R=Qu(t);return m.useEffect(()=>{!k||!I.current||(k.disconnect(),h.current=!1,k.observe(I.current))},[I,k]),m.useEffect(()=>(l({type:Rn.RegisterDroppable,element:{id:r,key:i,disabled:n,node:I,rect:g,data:R}}),()=>l({type:Rn.UnregisterDroppable,key:i,id:r})),[r]),m.useEffect(()=>{n!==p.current.disabled&&(l({type:Rn.SetDroppableDisabled,id:r,key:i,disabled:n}),p.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:(d==null?void 0:d.id)===r,node:I,over:d,setNodeRef:T}}function DB(e){let{animation:t,children:n}=e;const[r,o]=m.useState(null),[i,a]=m.useState(null),l=sh(n);return!n&&!r&&l&&o(l),ms(()=>{if(!i)return;const d=r==null?void 0:r.key,f=r==null?void 0:r.props.id;if(d==null||f==null){o(null);return}Promise.resolve(t(f,i)).then(()=>{o(null)})},[t,r,i]),$t.createElement($t.Fragment,null,n,r?m.cloneElement(r,{ref:a}):null)}const $B={x:0,y:0,scaleX:1,scaleY:1};function IB(e){let{children:t}=e;return $t.createElement(Dd.Provider,{value:pR},$t.createElement(um.Provider,{value:$B},t))}const MB={position:"fixed",touchAction:"none"},LB=e=>om(e)?"transform 250ms ease":void 0,OB=m.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:i,className:a,rect:l,style:d,transform:f,transition:p=LB}=e;if(!l)return null;const h=o?f:{...f,scaleX:1,scaleY:1},g={...MB,width:l.width,height:l.height,top:l.top,left:l.left,transform:gs.Transform.toString(h),transformOrigin:o&&r?Pz(r,l):void 0,transition:typeof p=="function"?p(r):p,...d};return $t.createElement(n,{className:a,style:g,ref:t},i)}),FB=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:i,className:a}=e;if(i!=null&&i.active)for(const[l,d]of Object.entries(i.active))d!==void 0&&(o[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,d));if(i!=null&&i.dragOverlay)for(const[l,d]of Object.entries(i.dragOverlay))d!==void 0&&r.node.style.setProperty(l,d);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[d,f]of Object.entries(o))n.node.style.setProperty(d,f);a!=null&&a.active&&n.node.classList.remove(a.active)}},zB=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:gs.Transform.toString(t)},{transform:gs.Transform.toString(n)}]},BB={duration:250,easing:"ease",keyframes:zB,sideEffects:FB({styles:{active:{opacity:"0"}}})};function UB(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return sm((i,a)=>{if(t===null)return;const l=n.get(i);if(!l)return;const d=l.node.current;if(!d)return;const f=fR(a);if(!f)return;const{transform:p}=or(a).getComputedStyle(a),h=nR(p);if(!h)return;const g=typeof t=="function"?t:HB(t);return cR(d,o.draggable.measure),g({active:{id:i,data:l.data,node:d,rect:o.draggable.measure(d)},draggableNodes:n,dragOverlay:{node:a,rect:o.dragOverlay.measure(f)},droppableContainers:r,measuringConfiguration:o,transform:h})})}function HB(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...BB,...e};return i=>{let{active:a,dragOverlay:l,transform:d,...f}=i;if(!t)return;const p={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},h={scaleX:d.scaleX!==1?a.rect.width*d.scaleX/l.rect.width:1,scaleY:d.scaleY!==1?a.rect.height*d.scaleY/l.rect.height:1},g={x:d.x-p.x,y:d.y-p.y,...h},y=o({...f,active:a,dragOverlay:l,transform:{initial:d,final:g}}),[S]=y,w=y[y.length-1];if(JSON.stringify(S)===JSON.stringify(w))return;const b=r==null?void 0:r({active:a,dragOverlay:l,...f}),j=l.node.animate(y,{duration:t,easing:n,fill:"forwards"});return new Promise(N=>{j.onfinish=()=>{b==null||b(),N()}})}}let J1=0;function VB(e){return m.useMemo(()=>{if(e!=null)return J1++,J1},[e])}const WB=$t.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:i,modifiers:a,wrapperElement:l="div",className:d,zIndex:f=999}=e;const{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggableNodes:S,droppableContainers:w,dragOverlay:b,over:j,measuringConfiguration:N,scrollableAncestors:k,scrollableAncestorRects:C,windowRect:I}=gR(),T=m.useContext(um),R=VB(h==null?void 0:h.id),D=mR(a,{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggingNodeRect:b.rect,over:j,overlayNodeRect:b.rect,scrollableAncestors:k,scrollableAncestorRects:C,transform:T,windowRect:I}),$=uw(g),z=UB({config:r,draggableNodes:S,droppableContainers:w,measuringConfiguration:N}),A=$?b.setRef:void 0;return $t.createElement(IB,null,$t.createElement(DB,{animation:z},h&&R?$t.createElement(OB,{key:R,id:h.id,ref:A,as:l,activatorEvent:p,adjustScale:t,className:d,transition:i,rect:$,style:{zIndex:f,...o},transform:D},n):null))});function xc(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function qB(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function tp(e){return e!==null&&e>=0}function KB(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 GB(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const dw=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=xc(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}},np={scaleX:1,scaleY:1},fw=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,...np}:null}const d=YB(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-d,...np}:o<n&&o>=a?{x:0,y:l.height+d,...np}:{x:0,y:0,...np}};function YB(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 xR="Sortable",yR=$t.createContext({activeIndex:-1,containerId:xR,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:dw,disabled:{draggable:!1,droppable:!1}});function fm(e){let{children:t,id:n,items:r,strategy:o=dw,disabled:i=!1}=e;const{active:a,dragOverlay:l,droppableRects:d,over:f,measureDroppableContainers:p}=gR(),h=_d(xR,n),g=l.rect!==null,y=m.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),S=a!=null,w=a?y.indexOf(a.id):-1,b=f?y.indexOf(f.id):-1,j=m.useRef(y),N=!KB(y,j.current),k=b!==-1&&w===-1||N,C=GB(i);ms(()=>{N&&S&&p(y)},[N,y,S,p]),m.useEffect(()=>{j.current=y},[y]);const I=m.useMemo(()=>({activeIndex:w,containerId:h,disabled:C,disableTransforms:k,items:y,overIndex:b,useDragOverlay:g,sortedRects:qB(y,d),strategy:o}),[w,h,C.draggable,C.droppable,k,y,b,d,g,o]);return $t.createElement(yR.Provider,{value:I},t)}const XB=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return xc(n,r,o).indexOf(t)},QB=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:d,transition:f}=e;return!f||!r||l!==i&&o===a?!1:n?!0:a!==o&&t===d},JB={duration:200,easing:"ease"},bR="transform",ZB=gs.Transition.toString({property:bR,duration:0,easing:"linear"}),e8={roleDescription:"sortable"};function t8(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=m.useState(null),l=m.useRef(n);return ms(()=>{if(!t&&n!==l.current&&r.current){const d=o.current;if(d){const f=hc(r.current,{ignoreTransform:!0}),p={x:d.left-f.left,y:d.top-f.top,scaleX:d.width/f.width,scaleY:d.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 pm(e){let{animateLayoutChanges:t=QB,attributes:n,disabled:r,data:o,getNewIndex:i=XB,id:a,strategy:l,resizeObserverConfig:d,transition:f=JB}=e;const{items:p,containerId:h,activeIndex:g,disabled:y,disableTransforms:S,sortedRects:w,overIndex:b,useDragOverlay:j,strategy:N}=m.useContext(yR),k=n8(r,y),C=p.indexOf(a),I=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:R,node:D,isOver:$,setNodeRef:z}=_B({id:a,data:I,disabled:k.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...d}}),{active:A,activatorEvent:F,activeNodeRect:W,attributes:P,setNodeRef:O,listeners:B,isDragging:H,over:L,setActivatorNodeRef:U,transform:M}=RB({id:a,data:I,attributes:{...e8,...n},disabled:k.draggable}),V=xz(z,O),Y=!!A,q=Y&&!S&&tp(g)&&tp(b),J=!j&&H,ne=J&&q?M:null,ce=q?ne??(l??N)({rects:w,activeNodeRect:W,activeIndex:g,overIndex:b,index:C}):null,te=tp(g)&&tp(b)?i({id:a,items:p,activeIndex:g,overIndex:b}):C,pe=A==null?void 0:A.id,be=m.useRef({activeId:pe,items:p,newIndex:te,containerId:h}),Ee=p!==be.current.items,Te=t({active:A,containerId:h,isDragging:H,isSorting:Y,id:a,index:C,items:p,newIndex:be.current.newIndex,previousItems:be.current.items,previousContainerId:be.current.containerId,transition:f,wasDragging:be.current.activeId!=null}),Se=t8({disabled:!Te,index:C,node:D,rect:R});return m.useEffect(()=>{Y&&be.current.newIndex!==te&&(be.current.newIndex=te),h!==be.current.containerId&&(be.current.containerId=h),p!==be.current.items&&(be.current.items=p)},[Y,te,h,p]),m.useEffect(()=>{if(pe===be.current.activeId)return;if(pe!=null&&be.current.activeId==null){be.current.activeId=pe;return}const oe=setTimeout(()=>{be.current.activeId=pe},50);return()=>clearTimeout(oe)},[pe]),{active:A,activeIndex:g,attributes:P,data:I,rect:R,index:C,newIndex:te,items:p,isOver:$,isSorting:Y,isDragging:H,listeners:B,node:D,overIndex:b,over:L,setNodeRef:V,setActivatorNodeRef:U,setDroppableNodeRef:z,setDraggableNodeRef:O,transform:Se??ce,transition:Be()};function Be(){if(Se||Ee&&be.current.newIndex===C)return ZB;if(!(J&&!om(F)||!f)&&(Y||Te))return gs.Transition.toString({...f,property:bR})}}function n8(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 lh(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 r8=[kt.Down,kt.Right,kt.Up,kt.Left],vR=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(r8.includes(e.code)){if(e.preventDefault(),!n||!r)return;const d=[];i.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const g=o.get(h.id);if(g)switch(e.code){case kt.Down:r.top<g.top&&d.push(h);break;case kt.Up:r.top>g.top&&d.push(h);break;case kt.Left:r.left>g.left&&d.push(h);break;case kt.Right:r.left<g.left&&d.push(h);break}});const f=Dz({collisionRect:r,droppableRects:o,droppableContainers:d});let p=eR(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,S=g==null?void 0:g.node.current;if(S&&y&&h&&g){const b=lm(S).some((T,R)=>l[R]!==T),j=wR(h,g),N=s8(h,g),k=b||!j?{x:0,y:0}:{x:N?r.width-y.width:0,y:N?r.height-y.height:0},C={x:y.left,y:y.top};return k.x&&k.y?C:Ju(C,k)}}}};function wR(e,t){return!lh(e)||!lh(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function s8(e,t){return!lh(e)||!lh(t)||!wR(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 Tt({title:e="Something went wrong",error:t,action:n}){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}),n?s.jsx("div",{className:"pt-2",children:n}):null]})})}function Ip({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 Ye({title:e,description:t,children:n,className:r,actions:o}){return s.jsxs("section",{className:Ne("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 o8({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(Ye,{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(Ie,{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(Ip,{command:r.command.command,example:r.command.example}):null]})]})},r.title))})})}const ry={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."},Zi={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 i8(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function a8({hero:e,itemsById:t}){const n=mn();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:Zi.emptyStateCleanTitle}),s.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:ry.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(Ie,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:Zi.emptyStateCleanCTA})})]});const r=e.itemId?t[e.itemId]:void 0,o=(r==null?void 0:r.assignmentTitle)??"",i=ry[e.copyKey]??ry[e.kind],a=i8(i,{total:e.total,title:o}),l=r?l8(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:"What needs you today"}),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(Ie,{to:l,className:"shell-action shell-action--cta",children:["Open ",o||"assignment"]})})]})}function l8(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const sy=["title","status","priority","assignee","dependencies","created","updated"],ed=24,jR=60;function c8(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Number.isInteger(t.w)&&t.w>=1&&t.w<=ed&&Number.isInteger(t.h)&&t.h>=1&&t.h<=jR}const u8={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},Z1="2026-05-21T00:00:00Z";function oy(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...u8,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:Z1,updatedAt:Z1}}const oi={version:1,views:[oy("default-recently-updated","Recently updated",{}),oy("default-high-priority","High priority",{priority:"high"}),oy("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 kR(e,t){const n=Ve(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&&_u(a)===null;return r&&(!o||o==="all")&&!i&&!l}function SR(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?kR(e.config,t.slug):!1}}const NR=`syntaur.savedViews.cache.v${oi.version}`;let $l=d8(),Ui=null,pw=null;const wb=new Set,ch=new Set;let CR=0;function ER(){return++CR}function jb(e){return e===CR}function d8(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(NR);if(!e)return null;const t=JSON.parse(e);return t.version!==oi.version?null:t}catch{return null}}function f8(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(NR,JSON.stringify(e))}catch{}}function TR(e){$l=e,pw=null,f8(e);for(const t of wb)t(e);for(const t of ch)t(null)}function p8(e){pw=e;for(const t of ch)t(e)}function RR(e){if(!e||typeof e!="object")return oi;const t=e;return t.version!==oi.version||!Array.isArray(t.views)||!t.dashboard?oi:t}function eS(){if(Ui)return Ui;const e=ER();return Ui=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=RR(t);return jb(e)&&TR(n),Ui=null,$l??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return jb(e)&&p8(n),Ui=null,$l??oi}),Ui}function hw(){const[e,t]=m.useState(()=>$l??oi),[n,r]=m.useState(()=>$l===null),[o,i]=m.useState(!1),[a,l]=m.useState(()=>pw);return m.useEffect(()=>{let f=!1;$l===null&&r(!0),eS().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 wb.add(p),ch.add(h),()=>{f=!0,wb.delete(p),ch.delete(h)}},[]),{file:e,loading:n,ready:o,error:a,refetch:()=>{Ui=null,r(!0),l(null),i(!1),eS()}}}function $d(){const{file:e,loading:t}=hw();return{views:e.views,loading:t}}function AR(){const{file:e,loading:t}=hw();return{layout:e.dashboard,loading:t}}function ui(e){const{file:t,loading:n,ready:r,error:o,refetch:i}=hw();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 hm(e,t,n){const r=ER(),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=RR(await o.json());return jb(r)&&TR(i),i}function Wl(e){return hm("POST","/api/saved-views",e)}function uh(e,t){return hm("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function h8(e){return hm("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function kb(e){return hm("PUT","/api/dashboard",{slots:e})}const m8=["top","right","bottom","left"],di=Math.min,Pr=Math.max,dh=Math.round,rp=Math.floor,qs=e=>({x:e,y:e}),g8={left:"right",right:"left",bottom:"top",top:"bottom"};function Sb(e,t,n){return Pr(e,di(t,n))}function vo(e,t){return typeof e=="function"?e(t):e}function wo(e){return e.split("-")[0]}function yc(e){return e.split("-")[1]}function mw(e){return e==="x"?"y":"x"}function gw(e){return e==="y"?"height":"width"}function Us(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function xw(e){return mw(Us(e))}function x8(e,t,n){n===void 0&&(n=!1);const r=yc(e),o=xw(e),i=gw(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=fh(a)),[a,fh(a)]}function y8(e){const t=fh(e);return[Nb(e),t,Nb(t)]}function Nb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const tS=["left","right"],nS=["right","left"],b8=["top","bottom"],v8=["bottom","top"];function w8(e,t,n){switch(e){case"top":case"bottom":return n?t?nS:tS:t?tS:nS;case"left":case"right":return t?b8:v8;default:return[]}}function j8(e,t,n,r){const o=yc(e);let i=w8(wo(e),n==="start",r);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Nb)))),i}function fh(e){const t=wo(e);return g8[t]+e.slice(t.length)}function k8(e){return{top:0,right:0,bottom:0,left:0,...e}}function PR(e){return typeof e!="number"?k8(e):{top:e,right:e,bottom:e,left:e}}function ph(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 rS(e,t,n){let{reference:r,floating:o}=e;const i=Us(t),a=xw(t),l=gw(a),d=wo(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(d){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(yc(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 S8(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:h="floating",altBoundary:g=!1,padding:y=0}=vo(t,e),S=PR(y),b=l[g?h==="floating"?"reference":"floating":h],j=ph(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:d})),N=h==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},I=ph(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:k,strategy:d}):N);return{top:(j.top-I.top+S.top)/C.y,bottom:(I.bottom-j.bottom+S.bottom)/C.y,left:(j.left-I.left+S.left)/C.x,right:(I.right-j.right+S.right)/C.x}}const N8=50,C8=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:S8},d=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:h}=rS(f,r,d),g=r,y=0;const S={};for(let w=0;w<i.length;w++){const b=i[w];if(!b)continue;const{name:j,fn:N}=b,{x:k,y:C,data:I,reset:T}=await N({x:p,y:h,initialPlacement:r,placement:g,strategy:o,middlewareData:S,rects:f,platform:l,elements:{reference:e,floating:t}});p=k??p,h=C??h,S[j]={...S[j],...I},T&&y<N8&&(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}=rS(f,g,d)),w=-1)}return{x:p,y:h,placement:g,strategy:o,middlewareData:S}},E8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:l,middlewareData:d}=t,{element:f,padding:p=0}=vo(e,t)||{};if(f==null)return{};const h=PR(p),g={x:n,y:r},y=xw(o),S=gw(y),w=await a.getDimensions(f),b=y==="y",j=b?"top":"left",N=b?"bottom":"right",k=b?"clientHeight":"clientWidth",C=i.reference[S]+i.reference[y]-g[y]-i.floating[S],I=g[y]-i.reference[y],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let R=T?T[k]:0;(!R||!await(a.isElement==null?void 0:a.isElement(T)))&&(R=l.floating[k]||i.floating[S]);const D=C/2-I/2,$=R/2-w[S]/2-1,z=di(h[j],$),A=di(h[N],$),F=z,W=R-w[S]-A,P=R/2-w[S]/2+D,O=Sb(F,P,W),B=!d.arrow&&yc(o)!=null&&P!==O&&i.reference[S]/2-(P<F?z:A)-w[S]/2<0,H=B?P<F?P-F:P-W:0;return{[y]:g[y]+H,data:{[y]:O,centerOffset:P-O-H,...B&&{alignmentOffset:H}},reset:B}}}),T8=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:d,elements:f}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...b}=vo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const j=wo(o),N=Us(l),k=wo(l)===l,C=await(d.isRTL==null?void 0:d.isRTL(f.floating)),I=g||(k||!w?[fh(l)]:y8(l)),T=S!=="none";!g&&T&&I.push(...j8(l,w,S,C));const R=[l,...I],D=await d.detectOverflow(t,b),$=[];let z=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&$.push(D[j]),h){const P=x8(o,a,C);$.push(D[P[0]],D[P[1]])}if(z=[...z,{placement:o,overflows:$}],!$.every(P=>P<=0)){var A,F;const P=(((A=i.flip)==null?void 0:A.index)||0)+1,O=R[P];if(O&&(!(h==="alignment"?N!==Us(O):!1)||z.every(L=>Us(L.placement)===N?L.overflows[0]>0:!0)))return{data:{index:P,overflows:z},reset:{placement:O}};let B=(F=z.filter(H=>H.overflows[0]<=0).sort((H,L)=>H.overflows[1]-L.overflows[1])[0])==null?void 0:F.placement;if(!B)switch(y){case"bestFit":{var W;const H=(W=z.filter(L=>{if(T){const U=Us(L.placement);return U===N||U==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(U=>U>0).reduce((U,M)=>U+M,0)]).sort((L,U)=>L[1]-U[1])[0])==null?void 0:W[0];H&&(B=H);break}case"initialPlacement":B=l;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function sS(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function oS(e){return m8.some(t=>e[t]>=0)}const R8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=vo(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=sS(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:oS(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...i,altBoundary:!0}),l=sS(a,n.floating);return{data:{escapedOffsets:l,escaped:oS(l)}}}default:return{}}}}},_R=new Set(["left","top"]);async function A8(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=wo(n),l=yc(n),d=Us(n)==="y",f=_R.has(a)?-1:1,p=i&&d?-1:1,h=vo(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:S}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof S=="number"&&(y=l==="end"?S*-1:S),d?{x:y*p,y:g*f}:{x:g*f,y:y*p}}const P8=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,d=await A8(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+d.x,y:i+d.y,data:{...d,placement:a}}}}},_8=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:d={fn:j=>{let{x:N,y:k}=j;return{x:N,y:k}}},...f}=vo(e,t),p={x:n,y:r},h=await i.detectOverflow(t,f),g=Us(wo(o)),y=mw(g);let S=p[y],w=p[g];if(a){const j=y==="y"?"top":"left",N=y==="y"?"bottom":"right",k=S+h[j],C=S-h[N];S=Sb(k,S,C)}if(l){const j=g==="y"?"top":"left",N=g==="y"?"bottom":"right",k=w+h[j],C=w-h[N];w=Sb(k,w,C)}const b=d.fn({...t,[y]:S,[g]:w});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:a,[g]:l}}}}}},D8=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:d=!0,crossAxis:f=!0}=vo(e,t),p={x:n,y:r},h=Us(o),g=mw(h);let y=p[g],S=p[h];const w=vo(l,t),b=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const k=g==="y"?"height":"width",C=i.reference[g]-i.floating[k]+b.mainAxis,I=i.reference[g]+i.reference[k]-b.mainAxis;y<C?y=C:y>I&&(y=I)}if(f){var j,N;const k=g==="y"?"width":"height",C=_R.has(wo(o)),I=i.reference[h]-i.floating[k]+(C&&((j=a.offset)==null?void 0:j[h])||0)+(C?0:b.crossAxis),T=i.reference[h]+i.reference[k]+(C?0:((N=a.offset)==null?void 0:N[h])||0)-(C?b.crossAxis:0);S<I?S=I:S>T&&(S=T)}return{[g]:y,[h]:S}}}},$8=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:d=()=>{},...f}=vo(e,t),p=await a.detectOverflow(t,f),h=wo(o),g=yc(o),y=Us(o)==="y",{width:S,height:w}=i.floating;let b,j;h==="top"||h==="bottom"?(b=h,j=g===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(j=h,b=g==="end"?"top":"bottom");const N=w-p.top-p.bottom,k=S-p.left-p.right,C=di(w-p[b],N),I=di(S-p[j],k),T=!t.middlewareData.shift;let R=C,D=I;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(D=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=N),T&&!g){const z=Pr(p.left,0),A=Pr(p.right,0),F=Pr(p.top,0),W=Pr(p.bottom,0);y?D=S-2*(z!==0||A!==0?z+A:Pr(p.left,p.right)):R=w-2*(F!==0||W!==0?F+W:Pr(p.top,p.bottom))}await d({...t,availableWidth:D,availableHeight:R});const $=await a.getDimensions(l.floating);return S!==$.width||w!==$.height?{reset:{rects:!0}}:{}}}};function mm(){return typeof window<"u"}function bc(e){return DR(e)?(e.nodeName||"").toLowerCase():"#document"}function Mr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qs(e){var t;return(t=(DR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function DR(e){return mm()?e instanceof Node||e instanceof Mr(e).Node:!1}function ys(e){return mm()?e instanceof Element||e instanceof Mr(e).Element:!1}function So(e){return mm()?e instanceof HTMLElement||e instanceof Mr(e).HTMLElement:!1}function iS(e){return!mm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mr(e).ShadowRoot}function Id(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=bs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function I8(e){return/^(table|td|th)$/.test(bc(e))}function gm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const M8=/transform|translate|scale|rotate|perspective|filter/,L8=/paint|layout|strict|content/,Oi=e=>!!e&&e!=="none";let iy;function yw(e){const t=ys(e)?bs(e):e;return Oi(t.transform)||Oi(t.translate)||Oi(t.scale)||Oi(t.rotate)||Oi(t.perspective)||!bw()&&(Oi(t.backdropFilter)||Oi(t.filter))||M8.test(t.willChange||"")||L8.test(t.contain||"")}function O8(e){let t=fi(e);for(;So(t)&&!ql(t);){if(yw(t))return t;if(gm(t))return null;t=fi(t)}return null}function bw(){return iy==null&&(iy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),iy}function ql(e){return/^(html|body|#document)$/.test(bc(e))}function bs(e){return Mr(e).getComputedStyle(e)}function xm(e){return ys(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fi(e){if(bc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||iS(e)&&e.host||Qs(e);return iS(t)?t.host:t}function $R(e){const t=fi(e);return ql(t)?e.ownerDocument?e.ownerDocument.body:e.body:So(t)&&Id(t)?t:$R(t)}function td(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=$R(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),a=Mr(o);if(i){const l=Cb(a);return t.concat(a,a.visualViewport||[],Id(o)?o:[],l&&n?td(l):[])}else return t.concat(o,td(o,[],n))}function Cb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function IR(e){const t=bs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=So(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=dh(n)!==i||dh(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function vw(e){return ys(e)?e:e.contextElement}function Il(e){const t=vw(e);if(!So(t))return qs(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=IR(t);let a=(i?dh(n.width):n.width)/r,l=(i?dh(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const F8=qs(0);function MR(e){const t=Mr(e);return!bw()||!t.visualViewport?F8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function z8(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mr(e)?!1:t}function ia(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=vw(e);let a=qs(1);t&&(r?ys(r)&&(a=Il(r)):a=Il(e));const l=z8(i,n,r)?MR(i):qs(0);let d=(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=Mr(i),y=r&&ys(r)?Mr(r):r;let S=g,w=Cb(S);for(;w&&r&&y!==S;){const b=Il(w),j=w.getBoundingClientRect(),N=bs(w),k=j.left+(w.clientLeft+parseFloat(N.paddingLeft))*b.x,C=j.top+(w.clientTop+parseFloat(N.paddingTop))*b.y;d*=b.x,f*=b.y,p*=b.x,h*=b.y,d+=k,f+=C,S=Mr(w),w=Cb(S)}}return ph({width:p,height:h,x:d,y:f})}function ym(e,t){const n=xm(e).scrollLeft;return t?t.left+n:ia(Qs(e)).left+n}function LR(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ym(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function B8(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",a=Qs(r),l=t?gm(t.floating):!1;if(r===a||l&&i)return n;let d={scrollLeft:0,scrollTop:0},f=qs(1);const p=qs(0),h=So(r);if((h||!h&&!i)&&((bc(r)!=="body"||Id(a))&&(d=xm(r)),h)){const y=ia(r);f=Il(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const g=a&&!h&&!i?LR(a,d):qs(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+p.x+g.x,y:n.y*f.y-d.scrollTop*f.y+p.y+g.y}}function U8(e){return Array.from(e.getClientRects())}function H8(e){const t=Qs(e),n=xm(e),r=e.ownerDocument.body,o=Pr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Pr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+ym(e);const l=-n.scrollTop;return bs(r).direction==="rtl"&&(a+=Pr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}const aS=25;function V8(e,t){const n=Mr(e),r=Qs(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,d=0;if(o){i=o.width,a=o.height;const p=bw();(!p||p&&t==="fixed")&&(l=o.offsetLeft,d=o.offsetTop)}const f=ym(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,S=Math.abs(r.clientWidth-h.clientWidth-y);S<=aS&&(i-=S)}else f<=aS&&(i+=f);return{width:i,height:a,x:l,y:d}}function W8(e,t){const n=ia(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=So(e)?Il(e):qs(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,d=o*i.x,f=r*i.y;return{width:a,height:l,x:d,y:f}}function lS(e,t,n){let r;if(t==="viewport")r=V8(e,n);else if(t==="document")r=H8(Qs(e));else if(ys(t))r=W8(t,n);else{const o=MR(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ph(r)}function OR(e,t){const n=fi(e);return n===t||!ys(n)||ql(n)?!1:bs(n).position==="fixed"||OR(n,t)}function q8(e,t){const n=t.get(e);if(n)return n;let r=td(e,[],!1).filter(l=>ys(l)&&bc(l)!=="body"),o=null;const i=bs(e).position==="fixed";let a=i?fi(e):e;for(;ys(a)&&!ql(a);){const l=bs(a),d=yw(a);!d&&l.position==="fixed"&&(o=null),(i?!d&&!o:!d&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Id(a)&&!d&&OR(e,a))?r=r.filter(p=>p!==a):o=l,a=fi(a)}return t.set(e,r),r}function K8(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?gm(t)?[]:q8(t,this._c):[].concat(n),r],l=lS(t,a[0],o);let d=l.top,f=l.right,p=l.bottom,h=l.left;for(let g=1;g<a.length;g++){const y=lS(t,a[g],o);d=Pr(y.top,d),f=di(y.right,f),p=di(y.bottom,p),h=Pr(y.left,h)}return{width:f-h,height:p-d,x:h,y:d}}function G8(e){const{width:t,height:n}=IR(e);return{width:t,height:n}}function Y8(e,t,n){const r=So(t),o=Qs(t),i=n==="fixed",a=ia(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const d=qs(0);function f(){d.x=ym(o)}if(r||!r&&!i)if((bc(t)!=="body"||Id(o))&&(l=xm(t)),r){const y=ia(t,!0,i,t);d.x=y.x+t.clientLeft,d.y=y.y+t.clientTop}else o&&f();i&&!r&&o&&f();const p=o&&!r&&!i?LR(o,l):qs(0),h=a.left+l.scrollLeft-d.x-p.x,g=a.top+l.scrollTop-d.y-p.y;return{x:h,y:g,width:a.width,height:a.height}}function ay(e){return bs(e).position==="static"}function cS(e,t){if(!So(e)||bs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qs(e)===n&&(n=n.ownerDocument.body),n}function FR(e,t){const n=Mr(e);if(gm(e))return n;if(!So(e)){let o=fi(e);for(;o&&!ql(o);){if(ys(o)&&!ay(o))return o;o=fi(o)}return n}let r=cS(e,t);for(;r&&I8(r)&&ay(r);)r=cS(r,t);return r&&ql(r)&&ay(r)&&!yw(r)?n:r||O8(e)||n}const X8=async function(e){const t=this.getOffsetParent||FR,n=this.getDimensions,r=await n(e.floating);return{reference:Y8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Q8(e){return bs(e).direction==="rtl"}const J8={convertOffsetParentRelativeRectToViewportRelativeRect:B8,getDocumentElement:Qs,getClippingRect:K8,getOffsetParent:FR,getElementRects:X8,getClientRects:U8,getDimensions:G8,getScale:Il,isElement:ys,isRTL:Q8};function zR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Z8(e,t){let n=null,r;const o=Qs(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,d){l===void 0&&(l=!1),d===void 0&&(d=1),i();const f=e.getBoundingClientRect(),{left:p,top:h,width:g,height:y}=f;if(l||t(),!g||!y)return;const S=rp(h),w=rp(o.clientWidth-(p+g)),b=rp(o.clientHeight-(h+y)),j=rp(p),k={rootMargin:-S+"px "+-w+"px "+-b+"px "+-j+"px",threshold:Pr(0,di(1,d))||1};let C=!0;function I(T){const R=T[0].intersectionRatio;if(R!==d){if(!C)return a();R?a(!1,R):r=setTimeout(()=>{a(!1,1e-7)},1e3)}R===1&&!zR(f,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(I,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,k)}n.observe(e)}return a(!0),i}function e7(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:d=!1}=r,f=vw(e),p=o||i?[...f?td(f):[],...t?td(t):[]]:[];p.forEach(j=>{o&&j.addEventListener("scroll",n,{passive:!0}),i&&j.addEventListener("resize",n)});const h=f&&l?Z8(f,n):null;let g=-1,y=null;a&&(y=new ResizeObserver(j=>{let[N]=j;N&&N.target===f&&y&&t&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var k;(k=y)==null||k.observe(t)})),n()}),f&&!d&&y.observe(f),t&&y.observe(t));let S,w=d?ia(e):null;d&&b();function b(){const j=ia(e);w&&!zR(w,j)&&n(),w=j,S=requestAnimationFrame(b)}return n(),()=>{var j;p.forEach(N=>{o&&N.removeEventListener("scroll",n),i&&N.removeEventListener("resize",n)}),h==null||h(),(j=y)==null||j.disconnect(),y=null,d&&cancelAnimationFrame(S)}}const t7=P8,n7=_8,r7=T8,s7=$8,o7=R8,uS=E8,i7=D8,a7=(e,t,n)=>{const r=new Map,o={platform:J8,...n},i={...o.platform,_c:r};return C8(e,t,{...o,platform:i})};var l7=typeof document<"u",c7=function(){},Mp=l7?m.useLayoutEffect:c7;function hh(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(!hh(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)&&!hh(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function BR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function dS(e,t){const n=BR(e);return Math.round(t*n)/n}function ly(e){const t=m.useRef(e);return Mp(()=>{t.current=e}),t}function u7(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:d,open:f}=e,[p,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=m.useState(r);hh(g,r)||y(r);const[S,w]=m.useState(null),[b,j]=m.useState(null),N=m.useCallback(L=>{L!==T.current&&(T.current=L,w(L))},[]),k=m.useCallback(L=>{L!==R.current&&(R.current=L,j(L))},[]),C=i||S,I=a||b,T=m.useRef(null),R=m.useRef(null),D=m.useRef(p),$=d!=null,z=ly(d),A=ly(o),F=ly(f),W=m.useCallback(()=>{if(!T.current||!R.current)return;const L={placement:t,strategy:n,middleware:g};A.current&&(L.platform=A.current),a7(T.current,R.current,L).then(U=>{const M={...U,isPositioned:F.current!==!1};P.current&&!hh(D.current,M)&&(D.current=M,mo.flushSync(()=>{h(M)}))})},[g,t,n,A,F]);Mp(()=>{f===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,h(L=>({...L,isPositioned:!1})))},[f]);const P=m.useRef(!1);Mp(()=>(P.current=!0,()=>{P.current=!1}),[]),Mp(()=>{if(C&&(T.current=C),I&&(R.current=I),C&&I){if(z.current)return z.current(C,I,W);W()}},[C,I,W,z,$]);const O=m.useMemo(()=>({reference:T,floating:R,setReference:N,setFloating:k}),[N,k]),B=m.useMemo(()=>({reference:C,floating:I}),[C,I]),H=m.useMemo(()=>{const L={position:n,left:0,top:0};if(!B.floating)return L;const U=dS(B.floating,p.x),M=dS(B.floating,p.y);return l?{...L,transform:"translate("+U+"px, "+M+"px)",...BR(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:M}},[n,l,B.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:W,refs:O,elements:B,floatingStyles:H}),[p,W,O,B,H])}const d7=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?uS({element:r.current,padding:o}).fn(n):{}:r?uS({element:r,padding:o}).fn(n):{}}}},f7=(e,t)=>{const n=t7(e);return{name:n.name,fn:n.fn,options:[e,t]}},p7=(e,t)=>{const n=n7(e);return{name:n.name,fn:n.fn,options:[e,t]}},h7=(e,t)=>({fn:i7(e).fn,options:[e,t]}),m7=(e,t)=>{const n=r7(e);return{name:n.name,fn:n.fn,options:[e,t]}},g7=(e,t)=>{const n=s7(e);return{name:n.name,fn:n.fn,options:[e,t]}},x7=(e,t)=>{const n=o7(e);return{name:n.name,fn:n.fn,options:[e,t]}},y7=(e,t)=>{const n=d7(e);return{name:n.name,fn:n.fn,options:[e,t]}};var b7="Arrow",UR=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"})})});UR.displayName=b7;var v7=UR;function w7(e){const[t,n]=m.useState(void 0);return ai(()=>{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 d=i.borderBoxSize,f=Array.isArray(d)?d[0]:d;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 ww="Popper",[HR,VR]=pa(ww),[j7,WR]=HR(ww),qR=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return s.jsx(j7,{scope:t,anchor:r,onAnchorChange:o,children:n})};qR.displayName=ww;var KR="PopperAnchor",GR=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=WR(KR,n),a=m.useRef(null),l=Zn(t,a),d=m.useRef(null);return m.useEffect(()=>{const f=d.current;d.current=(r==null?void 0:r.current)||a.current,f!==d.current&&i.onAnchorChange(d.current)}),r?null:s.jsx(Sn.div,{...o,ref:l})});GR.displayName=KR;var jw="PopperContent",[k7,S7]=HR(jw),YR=m.forwardRef((e,t)=>{var ce,te,pe,be,Ee,Te;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:S,...w}=e,b=WR(jw,n),[j,N]=m.useState(null),k=Zn(t,Se=>N(Se)),[C,I]=m.useState(null),T=w7(C),R=(T==null?void 0:T.width)??0,D=(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},A=Array.isArray(f)?f:[f],F=A.length>0,W={padding:z,boundary:A.filter(C7),altBoundary:F},{refs:P,floatingStyles:O,placement:B,isPositioned:H,middlewareData:L}=u7({strategy:"fixed",placement:$,whileElementsMounted:(...Se)=>e7(...Se,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[f7({mainAxis:o+D,alignmentAxis:a}),d&&p7({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?h7():void 0,...W}),d&&m7({...W}),g7({...W,apply:({elements:Se,rects:Be,availableWidth:oe,availableHeight:je})=>{const{width:ke,height:_e}=Be.reference,Ue=Se.floating.style;Ue.setProperty("--radix-popper-available-width",`${oe}px`),Ue.setProperty("--radix-popper-available-height",`${je}px`),Ue.setProperty("--radix-popper-anchor-width",`${ke}px`),Ue.setProperty("--radix-popper-anchor-height",`${_e}px`)}}),C&&y7({element:C,padding:l}),E7({arrowWidth:R,arrowHeight:D}),g&&x7({strategy:"referenceHidden",...W})]}),[U,M]=JR(B),V=sa(S);ai(()=>{H&&(V==null||V())},[H,V]);const Y=(ce=L.arrow)==null?void 0:ce.x,q=(te=L.arrow)==null?void 0:te.y,J=((pe=L.arrow)==null?void 0:pe.centerOffset)!==0,[ne,Q]=m.useState();return ai(()=>{j&&Q(window.getComputedStyle(j).zIndex)},[j]),s.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:H?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[(be=L.transformOrigin)==null?void 0:be.x,(Ee=L.transformOrigin)==null?void 0:Ee.y].join(" "),...((Te=L.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(k7,{scope:n,placedSide:U,onArrowChange:I,arrowX:Y,arrowY:q,shouldHideArrow:J,children:s.jsx(Sn.div,{"data-side":U,"data-align":M,...w,ref:k,style:{...w.style,animation:H?void 0:"none"}})})})});YR.displayName=jw;var XR="PopperArrow",N7={top:"bottom",right:"left",bottom:"top",left:"right"},QR=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=S7(XR,r),a=N7[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(v7,{...o,ref:n,style:{...o.style,display:"block"}})})});QR.displayName=XR;function C7(e){return e!==null}var E7=e=>({name:"transformOrigin",options:e,fn(t){var b,j,N;const{placement:n,rects:r,middlewareData:o}=t,a=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=a?0:e.arrowWidth,d=a?0:e.arrowHeight,[f,p]=JR(n),h={start:"0%",center:"50%",end:"100%"}[p],g=(((j=o.arrow)==null?void 0:j.x)??0)+l/2,y=(((N=o.arrow)==null?void 0:N.y)??0)+d/2;let S="",w="";return f==="bottom"?(S=a?h:`${g}px`,w=`${-d}px`):f==="top"?(S=a?h:`${g}px`,w=`${r.floating.height+d}px`):f==="right"?(S=`${-d}px`,w=a?h:`${y}px`):f==="left"&&(S=`${r.floating.width+d}px`,w=a?h:`${y}px`),{data:{x:S,y:w}}}});function JR(e){const[t,n="center"]=e.split("-");return[t,n]}var T7=qR,R7=GR,A7=YR,P7=QR,_7=Symbol("radix.slottable");function D7(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=_7,t}var $7=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"}),I7="VisuallyHidden",ZR=m.forwardRef((e,t)=>s.jsx(Sn.span,{...e,ref:t,style:{...$7,...e.style}}));ZR.displayName=I7;var M7=ZR,[bm]=pa("Tooltip",[VR]),vm=VR(),eA="TooltipProvider",L7=700,Eb="tooltip.open",[O7,kw]=bm(eA),tA=e=>{const{__scopeTooltip:t,delayDuration:n=L7,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,a=m.useRef(!0),l=m.useRef(!1),d=m.useRef(0);return m.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),s.jsx(O7,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(d.current),a.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(f=>{l.current=f},[]),disableHoverableContent:o,children:i})};tA.displayName=eA;var nd="Tooltip",[F7,Md]=bm(nd),nA=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=e,d=kw(nd,e.__scopeTooltip),f=vm(t),[p,h]=m.useState(null),g=Rl(),y=m.useRef(0),S=a??d.disableHoverableContent,w=l??d.delayDuration,b=m.useRef(!1),[j,N]=em({prop:r,defaultProp:o??!1,onChange:R=>{R?(d.onOpen(),document.dispatchEvent(new CustomEvent(Eb))):d.onClose(),i==null||i(R)},caller:nd}),k=m.useMemo(()=>j?b.current?"delayed-open":"instant-open":"closed",[j]),C=m.useCallback(()=>{window.clearTimeout(y.current),y.current=0,b.current=!1,N(!0)},[N]),I=m.useCallback(()=>{window.clearTimeout(y.current),y.current=0,N(!1)},[N]),T=m.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{b.current=!0,N(!0),y.current=0},w)},[w,N]);return m.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),s.jsx(T7,{...f,children:s.jsx(F7,{scope:t,contentId:g,open:j,stateAttribute:k,trigger:p,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{d.isOpenDelayedRef.current?T():C()},[d.isOpenDelayedRef,T,C]),onTriggerLeave:m.useCallback(()=>{S?I():(window.clearTimeout(y.current),y.current=0)},[I,S]),onOpen:C,onClose:I,disableHoverableContent:S,children:n})})};nA.displayName=nd;var Tb="TooltipTrigger",rA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Md(Tb,n),i=kw(Tb,n),a=vm(n),l=m.useRef(null),d=Zn(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(R7,{asChild:!0,...a,children:s.jsx(Sn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:d,onPointerMove:rn(e.onPointerMove,g=>{g.pointerType!=="touch"&&!p.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:rn(e.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:rn(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:rn(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:rn(e.onBlur,o.onClose),onClick:rn(e.onClick,o.onClose)})})});rA.displayName=Tb;var Sw="TooltipPortal",[z7,B7]=bm(Sw,{forceMount:void 0}),sA=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Md(Sw,t);return s.jsx(z7,{scope:t,forceMount:n,children:s.jsx(ha,{present:n||i.open,children:s.jsx(Hv,{asChild:!0,container:o,children:r})})})};sA.displayName=Sw;var Kl="TooltipContent",oA=m.forwardRef((e,t)=>{const n=B7(Kl,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,a=Md(Kl,e.__scopeTooltip);return s.jsx(ha,{present:r||a.open,children:a.disableHoverableContent?s.jsx(iA,{side:o,...i,ref:t}):s.jsx(U7,{side:o,...i,ref:t})})}),U7=m.forwardRef((e,t)=>{const n=Md(Kl,e.__scopeTooltip),r=kw(Kl,e.__scopeTooltip),o=m.useRef(null),i=Zn(t,o),[a,l]=m.useState(null),{trigger:d,onClose:f}=n,p=o.current,{onPointerInTransitChange:h}=r,g=m.useCallback(()=>{l(null),h(!1)},[h]),y=m.useCallback((S,w)=>{const b=S.currentTarget,j={x:S.clientX,y:S.clientY},N=K7(j,b.getBoundingClientRect()),k=G7(j,N),C=Y7(w.getBoundingClientRect()),I=Q7([...k,...C]);l(I),h(!0)},[h]);return m.useEffect(()=>()=>g(),[g]),m.useEffect(()=>{if(d&&p){const S=b=>y(b,p),w=b=>y(b,d);return d.addEventListener("pointerleave",S),p.addEventListener("pointerleave",w),()=>{d.removeEventListener("pointerleave",S),p.removeEventListener("pointerleave",w)}}},[d,p,y,g]),m.useEffect(()=>{if(a){const S=w=>{const b=w.target,j={x:w.clientX,y:w.clientY},N=(d==null?void 0:d.contains(b))||(p==null?void 0:p.contains(b)),k=!X7(j,a);N?g():k&&(g(),f())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[d,p,a,f,g]),s.jsx(iA,{...e,ref:i})}),[H7,V7]=bm(nd,{isInside:!1}),W7=D7("TooltipContent"),iA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=e,d=Md(Kl,n),f=vm(n),{onClose:p}=d;return m.useEffect(()=>(document.addEventListener(Eb,p),()=>document.removeEventListener(Eb,p)),[p]),m.useEffect(()=>{if(d.trigger){const h=g=>{const y=g.target;y!=null&&y.contains(d.trigger)&&p()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[d.trigger,p]),s.jsx(Uv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:p,children:s.jsxs(A7,{"data-state":d.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(W7,{children:r}),s.jsx(H7,{scope:n,isInside:!0,children:s.jsx(M7,{id:d.contentId,role:"tooltip",children:o||r})})]})})});oA.displayName=Kl;var aA="TooltipArrow",q7=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=vm(n);return V7(aA,n).isInside?null:s.jsx(P7,{...o,...r,ref:t})});q7.displayName=aA;function K7(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 G7(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 Y7(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 X7(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],d=t[a],f=l.x,p=l.y,h=d.x,g=d.y;p>r!=g>r&&n<(h-f)*(r-p)/(g-p)+f&&(o=!o)}return o}function Q7(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),J7(t)}function J7(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 Z7=tA,eU=nA,tU=rA,nU=sA,lA=oA;const ea=Z7,_r=eU,Dr=tU,hr=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(nU,{children:s.jsx(lA,{ref:r,sideOffset:t,className:Ne("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})}));hr.displayName=lA.displayName;function Nw({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 d(p){a.current&&!a.current.contains(p.target)&&r(!1)}function f(p){p.key==="Escape"&&r(!1)}return document.addEventListener("mousedown",d),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f)}},[n]),e.length===0)return null;function l(d,f){const p=d.icon,h=Ne("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",f&&"pl-8",d.disabled?"opacity-50 cursor-not-allowed":d.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),g=f?d.active?s.jsx(Lr,{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:d.label})]});if(d.disabled){const S=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 d.disabledReason?s.jsxs(_r,{children:[s.jsx(Dr,{asChild:!0,children:S}),s.jsx(hr,{side:"left",children:d.disabledReason})]},d.key):s.jsx("div",{children:S},d.key)}return d.href?s.jsx(Ie,{to:d.href,className:h,onClick:()=>r(!1),children:y},d.key):s.jsx("button",{type:"button",className:h,onClick:()=>{var S;(S=d.onSelect)==null||S.call(d),r(!1)},children:y},d.key)}return s.jsxs("div",{className:"relative",ref:a,children:[s.jsx("button",{type:"button",onClick:()=>r(d=>!d),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:s.jsx(AL,{className:"h-4 w-4"})}),n&&s.jsx("div",{className:Ne("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(ea,{delayDuration:200,children:e.map(d=>{if(d.submenu&&d.submenu.length>0){const f=d.icon,p=o===d.key;return s.jsxs("div",{children:[s.jsxs("button",{type:"button",className:Ne("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:d.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:d.label}),p?s.jsx(yr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):s.jsx(HE,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),p?d.submenu.map(h=>l(h,!0)):null]},d.key)}return l(d,!1)})})})]})}function fS(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const rU={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 sU(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,0,0,0,0).getTime()}function oU(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,23,59,59,999).getTime()}function iU(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=rU[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<sU(i)||a&&o>oU(a))}function aU(e,t,n={}){const{workspace:r,search:o,includeArchived:i}=n;if(e.archived===!0&&!i)return!1;const a=Ve(t.status),l=Ve(t.priority),d=Ve(t.type),f=Ve(t.assignee),p=Ve(t.project),h=Ve(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)||d.length&&!d.includes(e.type??"")||g==="stale"&&!fS(e.updated)||g==="fresh"&&fS(e.updated))return!1;if(f.length){const y=e.assignee??"__unassigned__";if(!f.includes(y))return!1}if(p.length&&!p.some(S=>S==="__standalone__"?e.projectSlug==null:e.projectSlug===S))return!1;if(h.length){const y=e.tags??[];if(!h.some(S=>y.includes(S)))return!1}if(!iU(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 rd(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const pS={critical:0,high:1,medium:2,low:3};function sp(e){return Date.parse(e??"")||0}function Ld(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=(pS[o.priority]??99)-(pS[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=sp(o.created)-sp(i.created);break;case"updated":a=sp(o.updated)-sp(i.updated);break}return n==="asc"?a:-a})}function lU(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 cA(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 d=lU(l);return t.predicate(d,a)})}const wm={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},pinned:{kind:"bool"}};function jm(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 cU(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 Rb(e){const t=[],n=new Map;for(const r of Object.keys(wm))n.set(r,"built-in");for(const r of Object.keys(Xh))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=jm(i==="attestation"?{name:o,type:i}:{name:o,type:i}).registryKeys,d=l.find(f=>n.has(f));if(d!==void 0){const f=n.get(d);f==="built-in"?t.push(`fact "${o}": exported field "${d}" 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 "${d}" collides with fact "${f}"`);continue}for(const f of l)n.set(f,o)}return t}function uU(e){const t=new Set([...Object.keys(wm),...Object.keys(Xh)]),n=[];for(const r of e){const o=jm(r).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(r)}}return n}function uA(e,t){const n=jm(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 Cw(e){const t={...wm};for(const n of e)uA(t,n);return t}function dA(e){const t={...Xh};for(const n of e)uA(t,n);return t}function fA(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","pinned"],n=[];for(const r of e){const o=jm(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 Ct({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 Gl='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function km({columns:e,items:t,getItemId:n,getColumnId:r,renderCard:o,canDrop:i,onMove:a,getExternalDragData:l,onCardContextMenu:d,emptyMessage:f="No cards in this column.",hiddenColumnIds:p,onHideColumn:h,compact:g=!1,dragDisabled:y=!1}){const S=m.useMemo(()=>new Set(p??[]),[p]),w=m.useMemo(()=>e.filter(P=>!S.has(P.id)),[e,S]),b=m.useMemo(()=>e.filter(P=>S.has(P.id)),[e,S]),[j,N]=m.useState(null),[k,C]=m.useState(null),I=m.useRef(null),T=m.useMemo(()=>new Map(t.map(P=>[n(P),P])),[n,t]),R=m.useMemo(()=>w.map(P=>({column:P,items:t.filter(O=>r(O)===P.id)})),[w,r,t]),D=j?T.get(j)??null:null;function $(P){if(!D)return{allowed:!1};const O=r(D);return(i==null?void 0:i({item:D,fromColumnId:O,toColumnId:P}))??{allowed:!0}}function z(){N(null),C(null)}function A(P,O,B){if(y)return;const H=(l==null?void 0:l(O))??null;!a&&!H||(P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",B),H&&P.dataTransfer.setData("application/json",JSON.stringify(H)),a&&N(B))}function F(P,O,B){y||!a||!D||!$(O).allowed||(P.preventDefault(),P.dataTransfer.dropEffect="move",C(L=>(L==null?void 0:L.columnId)===O&&L.index===B?L:{columnId:O,index:B}))}async function W(P,O,B){var V;if(P.preventDefault(),y||!a||!D){z();return}const H=r(D),U=(((V=R.find(Y=>Y.column.id===H))==null?void 0:V.items)??[]).findIndex(Y=>n(Y)===n(D));if(!$(O).allowed||U<0){z();return}if(H===O&&(B===U||B===U+1)){z();return}try{await a({item:D,fromColumnId:H,toColumnId:O,fromIndex:U,toIndex:B})}finally{z()}}return s.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[b.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:"}),b.map(P=>s.jsxs("button",{type:"button",onClick:()=>h(P.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${P.title}" column`,children:[P.title," ×"]},P.id))]}):null,s.jsx("div",{className:Ne("grid min-w-max grid-flow-col gap-4",g?"auto-cols-[minmax(240px,280px)]":"auto-cols-[minmax(300px,360px)]"),children:R.map(({column:P,items:O})=>{const B=$(P.id),H=(k==null?void 0:k.columnId)===P.id;return s.jsxs("section",{className:Ne("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",D&&!B.allowed?"border-dashed opacity-65":"",D&&B.allowed?"border-primary/30 bg-accent/30":"",H?"ring-2 ring-ring/30":""),title:D&&!B.allowed?B.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:Ne("font-semibold uppercase tracking-[0.16em] text-muted-foreground",g?"text-xs":"text-sm"),children:P.title}),P.description&&!g?s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:P.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:O.length}),h?s.jsx("button",{type:"button",onClick:()=>h(P.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 "${P.title}" column`,"aria-label":`Hide column ${P.title}`,children:"×"}):null]})]}),s.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:L=>F(L,P.id,O.length),onDrop:L=>W(L,P.id,O.length),children:[O.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(P):f}):s.jsx(dU,{active:(k==null?void 0:k.columnId)===P.id&&k.index===0,disabled:!!D&&!B.allowed,children:typeof f=="function"?f(P):f}):null,O.map((L,U)=>{const M=n(L),V=j===M;return s.jsxs(m.Fragment,{children:[s.jsx("div",{className:Ne("h-2 rounded-full transition",(k==null?void 0:k.columnId)===P.id&&k.index===U?"bg-primary/70":"bg-transparent"),onDragOver:Y=>F(Y,P.id,U),onDrop:Y=>W(Y,P.id,U)}),s.jsx("div",{draggable:!y&&!!(a||l),onMouseDown:Y=>{I.current=Y.target},onDragStart:Y=>{const q=I.current;if(q!=null&&q.closest(Gl)){Y.preventDefault();return}A(Y,L,M)},onDragEnd:z,onContextMenu:Y=>{if(!d)return;const q=Y.target;q!=null&&q.closest(Gl)||d(L,Y)},className:Ne("transition",!y&&(a||l)?"cursor-grab active:cursor-grabbing":"",V?"scale-[0.98] opacity-50":""),children:o(L,{dragging:V})})]},M)}),O.length>0&&!y?s.jsx("div",{className:Ne("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(k==null?void 0:k.columnId)===P.id&&k.index===O.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",D&&!B.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},P.id)})})]})}function dU({active:e,disabled:t,children:n}){return s.jsx("div",{className:Ne("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 xo="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Ml="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",pA="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",Ab="border-status-review-foreground/30 bg-status-review text-status-review-foreground",hA="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",mA="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",gA="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",Lp=xo,fU={draft:xo,pending:xo,ready_for_planning:xo,ready_to_implement:Ml,in_progress:Ml,blocked:pA,review:Ab,code_review:Ab,completed:hA,failed:mA,active:Ml,stopped:xo,archived:gA};function pU(e){return fU[e]??Lp}const hU={slate:Lp,gray:Lp,grey:Lp};function xA(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function mU(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 gU(e,t){const n=t==null?void 0:t.trim();if(n)if(n.startsWith("#")){const r=mU(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=hU[n.toLowerCase()];if(r)return{className:r}}return{className:pU(e)}}function sd(e,t){const n=e.find(i=>i.id===t),{className:r,style:o}=gU(t,n==null?void 0:n.color);return{label:(n==null?void 0:n.label)??xA(t),className:r,style:o,iconName:n==null?void 0:n.icon}}function Pb(e){return e?!!e.terminal||e.id==="completed"||e.id==="failed":!1}function yA(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)??xA(a),terminal:Pb(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}const bA={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:xo,icon:cc},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:xo,icon:SL},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:xo,icon:WE},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Ml,icon:KL},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Ml,icon:Ev},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:pA,icon:Qp},review:{label:"Review",description:"Ready for inspection or approval.",className:Ab,icon:XL},completed:{label:"Completed",description:"Finished successfully.",className:hA,icon:kv},failed:{label:"Failed",description:"Could not be completed as planned.",className:mA,icon:Qp},active:{label:"Active",description:"The project has active or review work in flight.",className:Ml,icon:ob},stopped:{label:"Stopped",description:"Session ended without completing.",className:xo,icon:jL},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:gA,icon:ob}},vA="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 _b(e){var t;return((t=bA[e])==null?void 0:t.icon)??ob}function kn({status:e,className:t,showIcon:n=!0,progress:r}){var y;const o=Ss(),i=sd(o.statuses,e),a=_b(e),l=i.label,d=((y=o.statuses.find(S=>S.id===e))==null?void 0:y.description)??Od(e),f=r&&r.total>0,p=f?Math.min(1,Math.max(0,r.checked/r.total)):0,h=f?`${l} — ${d} (${r.checked}/${r.total} criteria)`:`${l} — ${d}`,g=n?f?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-p)})]}),s.jsx(a,{className:"h-2.5 w-2.5"})]}):s.jsx(a,{className:"h-3.5 w-3.5 shrink-0"}):null;return s.jsxs("span",{title:h,className:Ne(vA,i.className,t),style:i.style,children:[g,s.jsx("span",{className:"min-w-0 truncate",children:l})]})}function Od(e){var t;return((t=bA[e])==null?void 0:t.description)??`Status: ${e}`}function ma({type:e,className:t,compact:n=!1}){const r=Td();if(!e)return null;const o=N6(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:Ne("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 Fd(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return xU(e)}function xU(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 Qr({value:e,label:t,disabled:n=!1,disabledReason:r,onError:o}){const[i,a]=m.useState(!1);async function l(){n||(await Fd(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(Jp,{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(Lr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):s.jsx(Jp,{className:"h-3 w-3","aria-hidden":"true"})})}function yU(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function bU({items:e,statusOrder:t,sortField:n,sortDirection:r,listSectionVisibility:o,compact:i=!1}){const a=Ss(),[l,d]=m.useState(()=>new Set(o.collapsed));m.useEffect(()=>{d(new Set(o.collapsed))},[o]);const f=p=>{d(h=>{const g=new Set(h);return g.has(p)?g.delete(p):g.add(p),g})};return s.jsx("div",{className:Ne("space-y-2",i?"space-y-1.5":"space-y-3"),children:t.map(p=>{const h=Ld(e.filter(S=>S.status===p),n,r);if(h.length===0)return null;const g=!l.has(p),y=li(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:Ne("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(yr,{className:Ne("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:Ne("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:Ne("divide-y divide-border/40 border-t border-border/40",i?"text-xs":"text-sm"),children:h.map(S=>{const w=yU(S);return s.jsx("li",{children:s.jsxs(Ie,{to:w,className:Ne("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:S.title}),S.projectTitle?s.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:S.projectTitle}):null,s.jsx("span",{className:"shrink-0 text-muted-foreground",children:Kn(S.updated)})]})},`${S.projectSlug??"standalone"}:${S.id}`)})})]},p)})})}function vU(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function wU({items:e,sortField:t,sortDirection:n,tableColumnVisibility:r,compact:o=!1}){const i=new Set(r.hidden);i.delete("title");const a=p=>!i.has(p),l=Ld(e,t,n),d=o?"py-2 pr-3":"py-3 pr-4",f=o?"text-xs":"text-sm";return s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:Ne("w-full text-left",f),children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[a("title")?s.jsx("th",{className:Ne("font-medium",d),children:"Assignment"}):null,a("status")?s.jsx("th",{className:Ne("font-medium",d),children:"Status"}):null,a("priority")?s.jsx("th",{className:Ne("font-medium",d),children:"Priority"}):null,a("assignee")?s.jsx("th",{className:Ne("font-medium",d),children:"Assignee"}):null,a("dependencies")?s.jsx("th",{className:Ne("font-medium",d),children:"Dependencies"}):null,a("created")?s.jsx("th",{className:Ne("font-medium",d),children:"Created"}):null,a("updated")?s.jsx("th",{className:Ne("font-medium",d),children:"Updated"}):null]})}),s.jsx("tbody",{children:l.map(p=>{const h=vU(p),g=`${p.projectSlug??"standalone"}:${p.id}`;return s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[a("title")?s.jsxs("td",{className:d,children:[s.jsx(Ie,{to:h,className:"font-semibold text-foreground hover:text-primary",children:p.title}),p.projectTitle?s.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:p.projectTitle}):null]}):null,a("status")?s.jsx("td",{className:d,children:s.jsx(kn,{status:p.status,className:"max-w-[150px]"})}):null,a("priority")?s.jsx("td",{className:Ne("capitalize text-muted-foreground",d),children:p.priority}):null,a("assignee")?s.jsx("td",{className:Ne("text-muted-foreground",d),children:p.assignee??"Unassigned"}):null,a("dependencies")?s.jsx("td",{className:Ne("text-muted-foreground",d),children:p.dependsOn.length}):null,a("created")?s.jsx("td",{className:Ne("text-muted-foreground",d),children:Kn(p.created)}):null,a("updated")?s.jsx("td",{className:Ne("text-muted-foreground",d),children:Kn(p.updated)}):null]},g)})})]})})}function wA({view:e,compact:t,emptyDescription:n}){const{data:r,loading:o,error:i}=qh(),a=Ss(),l=m.useMemo(()=>a.order.map(p=>({id:p,title:li(a,p),description:Od(p)})),[a]),d=m.useMemo(()=>dA(a.factDeclarations),[a.factDeclarations]),f=m.useMemo(()=>{if(!r)return[];const p=e.config.filters.query??Pu(e.config.filters);let h=null;p.trim()!==""&&(h=Vl(p,d).query);const g=cA(r.assignments,h,{workspace:e.workspace});return Ld(g,e.config.sortField,e.config.sortDirection)},[r,e,d]);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(f.length===0)return s.jsx(Ct,{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(km,{compact:t,dragDisabled:!0,columns:l,items:f,getItemId:p=>p.slug||p.id,getColumnId:p=>p.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:p=>t?s.jsx(jU,{item:p}):s.jsx(kU,{item:p})});case"list":return s.jsx(bU,{items:f,statusOrder:a.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return s.jsx(wU,{items:f,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function jU({item:e}){const t=rd(e);return s.jsxs("div",{className:Ne("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(Ie,{to:t,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(kn,{status:e.status,className:"max-w-[150px]"})]}),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:Kn(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(Qr,{value:e.id})]}):null]})}function kU({item:e}){const t=rd(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(Ie,{to:t,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(kn,{status:e.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[s.jsx(ma,{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:Kn(e.updated)})]})]})}function SU({viewId:e,onPickAnother:t}){const{view:n,loading:r,error:o,refetch:i}=ui(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(wA,{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 jA({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:Zi.recentSessionsEmptyTitle}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:Zi.recentSessionsEmptyHint})]}):s.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>s.jsx("li",{children:s.jsx(NU,{session:t})},t.sessionId))})]})}function NU({session:e}){const t=mn(),[n,r]=m.useState(!1),o=CU(e,t),i=EU(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(Ie,{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," · ",o2(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:Zi.recentSessionsCopyFallbackHint})]}):null]}),s.jsx(Qr,{value:e.path,label:Zi.recentSessionsCopyPathLabel,disabled:a,disabledReason:Zi.recentSessionsCopyPathDisabled,onError:()=>r(!0)})]})}function CU(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function EU(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const TU={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 Hi(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function RU(e,t,n=Date.now()){const r=Hi(e);if(t.preset){const a=TU[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 AU(e,t,n=Date.now()){const{dateRange:r,project:o,agent:i,sessionStatus:a}=t,l=new Set(o??[]),d=new Set(i??[]),f=new Set(a??[]);return e.filter(p=>{if(r&&!RU(p.started,r,n))return!1;if(l.size>0){const h=p.projectSlug??"__standalone__";if(!l.has(h))return!1}if(d.size>0&&!Array.from(d).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 PU(e,t,n){return[...e].sort((o,i)=>{let a=0;switch(t){case"started":a=Hi(o.started)-Hi(i.started);break;case"lastActivity":a=Hi(o.updatedAt)-Hi(i.updatedAt);break;case"projectName":{const l=o.projectSlug??"",d=i.projectSlug??"";a=l.localeCompare(d);break}case"agentName":a=o.agent.localeCompare(i.agent);break;default:a=Hi(o.started)-Hi(i.started);break}return n==="asc"?a:-a})}function _U(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function DU({view:e,emptyDescription:t}){const{data:n,loading:r,error:o}=Kh(),i=m.useMemo(()=>{if(!n)return[];const a=n.sessions??[],{config:l}=e,d=l.filters,f={dateRange:d.dateRange?{...d.dateRange,field:"started"}:void 0,project:Ve(d.project),agent:Ve(d.agent),sessionStatus:Ve(d.sessionStatus),limit:l.limit};let p=AU(a,f);return p=PU(p,l.sortField,l.sortDirection),p=_U(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(Ct,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):s.jsx(jA,{sessions:i})}function $U({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:r,loading:o}=$d(),[i,a]=m.useState(!1),l=m.useRef(null),d=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(yr,{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:Ne("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(Lr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),s.jsx("span",{children:"All sessions"})]}),d.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"my-1 border-t border-border/40"}),d.map(h=>{const g=h.id===e;return s.jsxs("button",{type:"button",onClick:()=>{a(!1),t(h.id)},className:Ne("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(Lr,{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(Pt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:"Create new view…"})]})]})]})}const IU={__unassigned__:"Unassigned",__standalone__:"No project"};function wn({options:e,value:t,onChange:n,allLabel:r="Any",className:o,disabled:i,ariaLabel:a}){const[l,d]=m.useState(!1),f=m.useRef(null),p=m.useRef(null),h=m.useRef([]),g=m.useMemo(()=>{const N=new Set(e.map(C=>C.value)),k=t.filter(C=>!N.has(C)).map(C=>({value:C,label:IU[C]??C}));return[...e,...k]},[e,t]),y=m.useMemo(()=>new Set(t),[t]);m.useEffect(()=>{if(!l)return;function N(k){f.current&&!f.current.contains(k.target)&&d(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),m.useEffect(()=>{var N;l&&((N=h.current[0])==null||N.focus())},[l]);const S=m.useMemo(()=>{if(t.length===0)return r;if(t.length===1){const N=g.find(k=>k.value===t[0]);return N?N.label:t[0]}return`${t.length} selected`},[t,g,r]);function w(N){n(y.has(N)?t.filter(k=>k!==N):[...t,N])}function b(N){var C;const k=Math.max(0,Math.min(N,g.length-1));(C=h.current[k])==null||C.focus()}function j(N){var T;const k=h.current,C=document.activeElement,I=k.findIndex(R=>R===C);N.key==="ArrowDown"?(N.preventDefault(),b(I<0?0:I+1)):N.key==="ArrowUp"?(N.preventDefault(),b(I<0?g.length-1:I-1)):N.key==="Home"?(N.preventDefault(),b(0)):N.key==="End"?(N.preventDefault(),b(g.length-1)):N.key==="Escape"&&(N.preventDefault(),d(!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:()=>d(N=>!N),onKeyDown:N=>{!l&&(N.key==="ArrowDown"||N.key==="ArrowUp")&&(N.preventDefault(),d(!0))},className:Ne("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:S}),s.jsx(yr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),l?s.jsxs("div",{role:"menu","aria-label":a,onKeyDown:j,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(N=>N.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((N,k)=>{const C=y.has(N.value);return s.jsxs("button",{ref:I=>{h.current[k]=I},type:"button",role:"menuitemcheckbox","aria-checked":C,tabIndex:-1,onClick:()=>w(N.value),className:Ne("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:Ne("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(Lr,{className:"h-3 w-3"}):null}),s.jsx("span",{className:"truncate",children:N.label})]},N.value)})]}):null]})}const hS={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"},MU=["updated","created"];function Sm({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",d=!!(e&&!e.preset&&(e.from||e.to)),[f,p]=m.useState(d);m.useEffect(()=>p(d),[d]),m.useEffect(()=>{if(!o)return;function j(k){a.current&&!a.current.contains(k.target)&&i(!1)}function N(k){k.key==="Escape"&&i(!1)}return document.addEventListener("mousedown",j),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("keydown",N)}},[o]);const h=!!(e&&(e.preset||e.from||e.to)),g=m.useMemo(()=>!h||!e?"Any date":e.preset?`${l}: ${hS[e.preset]??e.preset}`:`${l}: ${e.from||"…"} → ${e.to||"…"}`,[h,e,l]);function y(j){t(e?{...e,field:j}:{field:j,preset:"",from:"",to:""})}function S(j){p(!1),t({field:l,preset:j,from:"",to:""})}function w(){p(!1),t(null)}function b(j,N){const k={field:l,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...k,[j]:N})}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(j=>!j),className:Ne("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(yr,{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:MU.map(j=>s.jsx("button",{type:"button","aria-pressed":l===j,onClick:()=>y(j),className:Ne("rounded-sm px-2.5 py-1 text-xs font-medium capitalize transition",l===j?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:j},j))}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(cy,{label:"Any date",selected:!h,onClick:w}),JF.map(j=>s.jsx(cy,{label:hS[j],selected:(e==null?void 0:e.preset)===j,onClick:()=>S(j)},j)),s.jsx(cy,{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:j=>b("from",j.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:j=>b("to",j.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function cy({label:e,selected:t,onClick:n}){return s.jsxs("button",{type:"button",onClick:n,className:Ne("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(Lr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const LU=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function OU(e,t){const n={};for(const[r,o]of Object.entries(e))LU.has(r)||(n[r]=o);return{...n,...t}}function mh(e,t,n){return{...e,viewMode:t.viewMode,filters:OU(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 FU(e,t){var g,y;const n={},r=Ve(e.status);r.length&&(n.status=r);const o=Ve(e.type);o.length&&(n.type=o);const i=Ve(e.priority);i.length&&(n.priority=i);const a=Ve(e.assignee);a.length&&(n.assignee=a);const l=Ve(e.tags);if(l.length&&(n.tags=l),t&&t!=="all")n.project=[t];else{const S=Ve(e.project);S.length&&(n.project=S)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const d=Ve(e.sessionStatus);d.length&&(n.sessionStatus=d);const f=Ve(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 Yl(e){const t={viewMode:e.state.viewMode,filters:FU(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 ll={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},op={sortField:"started",sortDirection:"desc"};function kA(e,t){const{config:n}=Yl({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 Ew(e,t){const{config:n}=Yl({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 ta(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 Nm(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function SA(e,t){var r,o,i,a,l,d,f,p,h,g,y,S,w,b,j;const{config:n}=e;if((r=t.setViewMode)==null||r.call(t,n.viewMode),(o=t.setStatusFilter)==null||o.call(t,Ve(n.filters.status)),(i=t.setTypeFilter)==null||i.call(t,Ve(n.filters.type)),(a=t.setPriorityFilter)==null||a.call(t,Ve(n.filters.priority)),(l=t.setAssigneeFilter)==null||l.call(t,Ve(n.filters.assignee)),(d=t.setProjectFilter)==null||d.call(t,Ve(n.filters.project)),(f=t.setTagsFilter)==null||f.call(t,Ve(n.filters.tags)),(p=t.setDateRange)==null||p.call(t,Nm(n.filters.dateRange)),(h=t.setSearch)==null||h.call(t,n.filters.search??""),(g=t.setQuery)==null||g.call(t,n.filters.query??Pu(n.filters)),t.setActivityFilter){const N=n.filters.activity??"all";t.setActivityFilter(N==="fresh"||N==="stale"?N:"all")}(y=t.setSortField)==null||y.call(t,n.sortField),(S=t.setSortDirection)==null||S.call(t,n.sortDirection),(w=t.setListSectionVisibility)==null||w.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(b=t.setKanbanColumnVisibility)==null||b.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(j=t.setTableColumnVisibility)==null||j.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function Op(e){return e?`/w/${e}/views`:"/views"}function NA(e){return`${Op(e.workspace)}/${encodeURIComponent(e.id)}`}function CA(e){const t=e.workspace?`/w/${e.workspace}`:"",n=Ve(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&kR(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const zU=["critical","high","medium","low"],BU={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 UU(e){if(e.preset)return`${e.field} ${BU[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function EA(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&_u(t)===null)return`query: ${t}`;const n=[];for(const a of["status","priority","type","assignee","project","tags"]){const l=Ve(e[a]);l.length&&n.push(`${a}=${l.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(UU(e.dateRange));const r=(i=e.search)==null?void 0:i.trim();return r&&n.push(`search="${r}"`),n.join(" · ")||"no filters"}const mS=80,HU=["started","lastActivity","projectName","agentName"],VU={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},WU=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function TA({open:e,onOpenChange:t,initialView:n,onSubmit:r}){const o=!!n,{data:i}=Xs(),{data:a}=Kh(),[l,d]=m.useState(""),[f,p]=m.useState([]),[h,g]=m.useState([]),[y,S]=m.useState([]),[w,b]=m.useState(null),[j,N]=m.useState(op.sortField),[k,C]=m.useState(op.sortDirection),[I,T]=m.useState(""),[R,D]=m.useState(!1),[$,z]=m.useState(null);function A(){p([]),g([]),S([]),b(null),N(op.sortField),C(op.sortDirection),T("")}m.useEffect(()=>{if(e)if(z(null),D(!1),n){const L=n.config.filters;d(n.name),p(Ve(L.project)),g(Ve(L.agent)),S(Ve(L.sessionStatus)),b(Nm(L.dateRange)),N(n.config.sortField),C(n.config.sortDirection),T(n.config.limit!==void 0?String(n.config.limit):"")}else d(""),A()},[e,n]);const F=m.useMemo(()=>[{value:"__standalone__",label:"No project"},...(i??[]).map(U=>({value:U.slug,label:U.title}))],[i]),W=m.useMemo(()=>{const L=new Set;for(const U of(a==null?void 0:a.sessions)??[])U.agent&&L.add(U.agent);return Array.from(L).sort().map(U=>({value:U,label:U}))},[a]),P=l.trim(),O=P.length>0&&P.length<=mS,B=I.trim()===""?void 0:parseInt(I.trim(),10),H=I.trim()===""||Number.isFinite(B)&&B!==void 0&&B>0&&B<=500;return s.jsx(Bn,{open:e,onOpenChange:t,children:s.jsx(_n,{className:"max-w-lg",children:s.jsxs("form",{className:"space-y-4",onSubmit:async L=>{if(L.preventDefault(),!O||!H||R)return;D(!0),z(null);const U=ta(w),M=U?{...U,field:"started"}:void 0,V={filters:{project:f,agent:h,sessionStatus:y,dateRange:M},sortField:j,sortDirection:k,limit:B};try{await r(P,V)}catch(Y){z(Y instanceof Error?Y.message:String(Y)),D(!1)}},children:[s.jsx(sr,{children:s.jsx(Dn,{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:mS,onChange:L=>d(L.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(cl,{label:"Date range (session start)",children:s.jsx(Sm,{className:"w-full",value:w,onChange:b})}),s.jsx(cl,{label:"Project",children:s.jsx(wn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:F,value:f,onChange:p})}),s.jsx(cl,{label:"Agent",children:s.jsx(wn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:W,value:h,onChange:g})}),s.jsx(cl,{label:"Session status",children:s.jsx(wn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:WU,value:y,onChange:S})}),s.jsx(cl,{label:"Sort by",className:"sm:col-span-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{value:j,onChange:L=>N(L.target.value),className:"editor-input w-full",children:HU.map(L=>s.jsx("option",{value:L,children:VU[L]??L},L))}),s.jsx("button",{type:"button",onClick:()=>C(L=>L==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:k==="asc"?"Ascending":"Descending",children:k==="asc"?"Asc":"Desc"})]})}),s.jsxs(cl,{label:"Max results",className:"sm:col-span-2",children:[s.jsx("input",{type:"number",min:1,max:500,value:I,onChange:L=>T(L.target.value),placeholder:"No limit",className:"editor-input w-full"}),H?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(Fr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:A,className:"shell-action",disabled:R,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:R,children:"Cancel"}),s.jsx("button",{type:"submit",disabled:!O||!H||R,className:"shell-action shell-action--cta disabled:opacity-50",children:R?"Saving…":o?"Save changes":"Create view"})]})]})]})})})}function cl({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 qU=4e3;function gi(){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},qU)},[]);return m.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:o,dismissToast:r}}function ga({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:Ne("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)})}function uy({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 KU({viewId:e,slotId:t,onPickAnother:n}){const{data:r,loading:o,error:i}=Kh(),{view:a,loading:l,ready:d}=ui(e??null),{layout:f}=AR(),{showToast:p}=gi(),[h,g]=m.useState(!1),y=m.useCallback(async b=>{if(!t)return;const j=f.slots.map(N=>N.id===t?{...N,widget:b?{kind:"agent-sessions",viewId:b}:{kind:"agent-sessions"}}:N);try{await kb(j)}catch(N){p(N instanceof Error?N.message:"Failed to update widget")}},[f,t,p]);async function S(b,j){const{workspace:N,config:k}=Ew(j,null);try{const I=(await Wl({name:b,workspace:N,config:k,entityType:"session"})).views.find(T=>T.name===b&&T.entityType==="session");I&&await y(I.id),g(!1),p(`Created session view "${b}"`)}catch(C){throw p(C instanceof Error?C.message:"Failed to create session view"),C}}let w;return e?l&&!d?w=s.jsx(bt,{label:"Loading view…"}):a?a.entityType!=="session"?w=s.jsx(uy,{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}):w=s.jsx(DU,{view:a,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):w=s.jsx(uy,{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?w=s.jsx(bt,{label:"Loading sessions…"}):i?w=s.jsx(uy,{title:"Couldn't load sessions",message:i}):w=s.jsx(jA,{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($U,{activeViewId:e??null,onSelectView:b=>void y(b),onCreateNew:()=>g(!0)})}):null,w,s.jsx(TA,{open:h,onOpenChange:g,workspace:null,onSubmit:S})]})}const GU=5;function YU(){const{data:e,loading:t,error:n}=k2();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,GU);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(Ie,{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,d=i.members.length,f=a.display_name??a.slug;return s.jsx("li",{children:s.jsxs(Ie,{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,"/",d," leased"]})]})},a.slug)})})]})}function XU(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 gS({filters:e,metric:t}){const n=e??{},{data:r,loading:o,error:i}=cO(n),a=t==="cost"?"Spend":"Token Usage",l=`/usage?${ub(n).toString()}`;let d;if(o&&!r)d=s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"});else if(i&&!r)d=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)d=s.jsx("p",{className:"text-sm text-muted-foreground",children:"No usage for these filters."});else{const{tokens:f,cost:p}=XU(r),h=t==="cost"?{label:"Total spend",value:Hl(p)}:{label:"Total tokens",value:Ul(f)},g=t==="cost"?{label:"Tokens",value:Ul(f)}:{label:"Spend",value:Hl(p)};d=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(xS,{label:h.label,value:h.value,emphasize:!0}),s.jsx(xS,{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:h1(n),children:h1(n)})]}),s.jsx(Ie,{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:d})]})}function xS({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 QU={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"};function JU(e){return e.kind==="token-usage"||e.kind==="spend"?e.filters??{}:{}}const ul="bg-background border border-border rounded px-2 py-1 text-sm text-foreground";function yS({config:e,open:t,onSave:n,onCancel:r}){const o=e.kind==="spend"?"Configure Spend":"Configure Token Usage",{data:i}=Xs(),{data:a}=fa(),{data:l}=S2(t),[d,f]=m.useState("30d"),[p,h]=m.useState(""),[g,y]=m.useState(""),[S,w]=m.useState(""),[b,j]=m.useState(""),[N,k]=m.useState(""),[C,I]=m.useState(""),[T,R]=m.useState(!1),[D,$]=m.useState(null);m.useEffect(()=>{if(!t)return;const O=JU(e);f(O.window??"30d"),h(O.since??""),y(O.until??""),w(O.project??""),j(O.workspace??""),k(O.model??""),I(O.tool??""),R(!1),$(null)},[t,e]);function z(){return Ed({window:d,since:d==="custom"?p:void 0,until:d==="custom"?g:void 0,project:S||void 0,workspace:b||void 0,model:N||void 0,tool:C||void 0})}async function A(O){if(O.preventDefault(),T)return;const B=z(),H=J4(B);if(!H.ok){$(H.errors.join("; "));return}R(!0),$(null);const L=e.kind==="token-usage"?{kind:"token-usage",filters:B}:e.kind==="spend"?{kind:"spend",filters:B}:e;try{await n(L)}catch(U){$(U instanceof Error?U.message:String(U)),R(!1)}}const F=(i==null?void 0:i.map(O=>O.slug))??[],W=(a==null?void 0:a.workspaces)??[],P=(a==null?void 0:a.hasUngrouped)??!1;return s.jsx(Bn,{open:t,onOpenChange:O=>{O||r()},children:s.jsx(_n,{className:"max-w-md",children:s.jsxs("form",{onSubmit:A,children:[s.jsx(sr,{children:s.jsx(Dn,{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:Wh.map(O=>s.jsx("button",{type:"button",onClick:()=>f(O),className:"rounded px-2.5 py-1 text-sm border "+(O===d?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:QU[O]},O))})]}),d==="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:O=>h(O.target.value),className:ul})]}),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:O=>y(O.target.value),className:ul})]})]}):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:O=>{j(O.target.value),O.target.value&&w("")},className:ul,children:[s.jsx("option",{value:"",children:"All workspaces"}),P?s.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,W.map(O=>s.jsx("option",{value:O,children:O},O))]})]}),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:S,onChange:O=>{w(O.target.value),O.target.value&&j("")},className:ul,children:[s.jsx("option",{value:"",children:"All projects"}),F.map(O=>s.jsx("option",{value:O,children:O},O))]})]}),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:N,onChange:O=>k(O.target.value),className:ul,children:[s.jsx("option",{value:"",children:"All models"}),((l==null?void 0:l.models)??[]).map(O=>s.jsx("option",{value:O,children:O},O))]})]}),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:O=>I(O.target.value),className:ul,children:[s.jsx("option",{value:"",children:"All tools"}),((l==null?void 0:l.tools)??[]).map(O=>s.jsx("option",{value:O,children:O},O))]})]})]}),D?s.jsx("p",{className:"text-xs text-destructive",role:"alert",children:D}):null]}),s.jsxs(Fr,{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 Tw={"saved-view":{title:"Saved view",icon:KE,render:(e,t)=>e.kind!=="saved-view"?null:m.createElement(SU,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Fh,render:(e,t)=>e.kind!=="agent-sessions"?null:m.createElement(KU,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:Uh,render:()=>m.createElement(YU)},"token-usage":{title:"Token Usage",icon:LL,render:e=>e.kind!=="token-usage"?null:m.createElement(gS,{filters:e.filters,metric:"tokens"}),ConfigEditor:yS},spend:{title:"Spend",icon:Sd,render:e=>e.kind!=="spend"?null:m.createElement(gS,{filters:e.filters,metric:"cost"}),ConfigEditor:yS}},RA=50,Db=16,ZU=2,Xi=6,gh=11,$b={w:6,h:2};function Fp(e,t,n){return Math.min(Math.max(e,t),n)}const e9=[{minWidth:1280,columns:24},{minWidth:1024,columns:16},{minWidth:768,columns:12},{minWidth:640,columns:6},{minWidth:0,columns:1}];function t9(e){if(!Number.isFinite(e)||e<0)return 1;for(const t of e9)if(e>=t.minWidth)return t.columns;return 1}function zp(e,t){return t<=0?1:Fp(Math.round(e/ed*t),1,t)}function Ib(e){if(c8(e))return e;switch(e){case"small":return{w:8,h:Xi};case"wide":return{w:16,h:Xi};case"tall":return{w:8,h:gh};case"large":return{w:16,h:gh};default:return{w:8,h:Xi}}}function n9(e,t){return t>0?Math.round(e/t):0}function r9(e,t=RA){return Math.round(e/t)}const s9=[{label:"Third",w:8,h:Xi},{label:"Half",w:12,h:Xi},{label:"Two-thirds",w:16,h:Xi},{label:"Full",w:24,h:Xi},{label:"Half tall",w:12,h:gh},{label:"Full tall",w:24,h:gh}];function o9({slot:e,activeColumns:t,colWidthPx:n,onReplace:r,onRemove:o,onRemoveSlot:i,onResize:a,onConfigChange:l}){const[d,f]=m.useState(!1),[p,h]=m.useState(null),g=m.useRef(null),{attributes:y,listeners:S,setNodeRef:w,setActivatorNodeRef:b,transform:j,transition:N,isDragging:k}=pm({id:e.id}),C=Ib(e.size),I=p?p.renderW:zp(C.w,t),T=p?p.h:C.h,R={transform:gs.Translate.toString(j),transition:N,zIndex:k?50:void 0,position:k?"relative":void 0,gridColumn:`span ${I}`,gridRow:`span ${T}`};function D(B){g.current=null;try{B.currentTarget.releasePointerCapture(B.pointerId)}catch{}h(null)}function $(B){return{onPointerDown:H=>{if(g.current)return;H.preventDefault(),H.stopPropagation(),H.currentTarget.setPointerCapture(H.pointerId);const L=zp(C.w,t);g.current={pointerId:H.pointerId,startX:H.clientX,startY:H.clientY,startRenderW:L,startH:C.h,axis:B,lastRenderW:L,lastH:C.h},h({renderW:L,h:C.h})},onPointerMove:H=>{const L=g.current;if(!L||H.pointerId!==L.pointerId)return;let U=L.startRenderW,M=L.startH;(L.axis==="w"||L.axis==="both")&&(U=Fp(L.startRenderW+n9(H.clientX-L.startX,n),1,t)),(L.axis==="h"||L.axis==="both")&&(M=Fp(L.startH+r9(H.clientY-L.startY),ZU,jR)),L.lastRenderW=U,L.lastH=M,h({renderW:U,h:M})},onPointerUp:H=>{const L=g.current;if(!L||H.pointerId!==L.pointerId)return;const U=Ib(e.size),V={w:L.axis==="h"?U.w:Fp(Math.round(L.lastRenderW/t*ed),1,ed),h:L.lastH};D(H),(V.w!==U.w||V.h!==U.h)&&a(V)},onPointerCancel:H=>{const L=g.current;L&&H.pointerId===L.pointerId&&D(H)},onLostPointerCapture:H=>{const L=g.current;L&&H.pointerId===L.pointerId&&D(H)}}}const z="absolute z-10 touch-none rounded-sm bg-transparent transition hover:bg-primary/30",A=s.jsxs(s.Fragment,{children:[t>1?s.jsx("div",{"aria-hidden":"true",className:Ne(z,"right-0 top-0 h-full w-1.5 cursor-ew-resize"),...$("w")}):null,s.jsx("div",{"aria-hidden":"true",className:Ne(z,"bottom-0 left-0 h-1.5 w-full cursor-ns-resize"),...$("h")}),t>1?s.jsx("div",{"aria-hidden":"true",className:Ne(z,"bottom-0 right-0 h-3 w-3 cursor-nwse-resize"),...$("both")}):null]}),F=s.jsx("button",{ref:b,...y,...S,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(lc,{className:"h-4 w-4","aria-hidden":"true"})});if(e.widget===null)return s.jsxs("div",{ref:w,style:{...R,gridColumn:`span ${zp($b.w,t)}`,gridRow:`span ${$b.h}`},className:Ne("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",k&&"opacity-0"),children:[s.jsx("div",{className:"absolute left-2 top-2",children:F}),s.jsx("button",{type:"button","aria-label":"Remove slot",onClick:i,onPointerDown:B=>B.stopPropagation(),className:"absolute right-2 top-2 z-10 text-muted-foreground/50 transition hover:text-destructive",children:s.jsx(jn,{className:"h-4 w-4"})}),s.jsxs("button",{type:"button",onClick:r,className:"shell-action inline-flex items-center gap-2",children:[s.jsx(Pt,{className:"h-4 w-4"}),"Add widget"]})]});const W=Tw[e.widget.kind];if(!W)return s.jsxs("div",{ref:w,style:R,className:Ne("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",k&&"opacity-0"),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[F,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]})]}),A]});const P=W.icon,O=W.ConfigEditor;return s.jsxs("div",{ref:w,style:R,className:Ne("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",k&&"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:[F,s.jsx(P,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:s.jsx(a9,{slot:e,fallback:W.title})})]}),s.jsx(Nw,{items:[{key:"replace",label:"Replace…",icon:GL,onSelect:r},...W.ConfigEditor?[{key:"configure",label:"Configure…",icon:ZL,onSelect:()=>f(!0)}]:[],{key:"size",label:"Size",icon:VL,submenu:s9.map(B=>({key:`size-${B.label}`,label:B.label,active:C.w===B.w&&C.h===B.h,onSelect:()=>a({w:B.w,h:B.h})}))},{key:"remove",label:"Remove",icon:jn,destructive:!0,onSelect:o}]})]}),s.jsx("div",{children:W.render(e.widget,{slotId:e.id,onPickAnother:r})}),O?s.jsx(O,{config:e.widget,open:d,onSave:async B=>{await l(B),f(!1)},onCancel:()=>f(!1)}):null,A]})}function i9({slot:e,activeColumns:t,colWidthPx:n}){const r=e.widget?Tw[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?$b:Ib(e.size),l=zp(a.w,t),d=n>0?l*n+(l-1)*Db: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:d?`${Math.max(d,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(lc,{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 a9({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}=ui(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 l9=["agent-sessions","inventories","token-usage","spend"];function c9({open:e,onOpenChange:t,onSelect:n}){const{views:r,loading:o}=$d();function i(a){n(a),t(!1)}return s.jsx(Bn,{open:e,onOpenChange:t,children:s.jsxs(_n,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:"Add a widget"}),s.jsx(es,{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:l9.map(a=>{const l=Tw[a],d=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(d,{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(Ie,{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 u9=(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 d=a[l+r],f=d===void 0?null:n.droppableRects.get(d),p=n.collisionRect;return!f||!p?t:{x:f.left+(f.width-p.width)/2,y:f.top+(f.height-p.height)/2}};function d9(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 f9(e,t){const n={id:d9(e),widget:null};return[...e,n]}function p9(e,t){return e.filter(n=>n.id!==t)}function h9(){const{data:e,error:t,refetch:n}=tO(),{data:r}=v2(),{layout:o}=AR(),[i,a]=m.useState(!1),[l,d]=m.useState(null),[f,p]=m.useState(null),[h,g]=m.useState(o.slots),[y,S]=m.useState(null),w=m.useRef(null),[b,j]=m.useState(ed),[N,k]=m.useState(0);m.useEffect(()=>{const H=w.current;if(!H)return;const L=new ResizeObserver(U=>{for(const M of U){const V=M.contentRect.width,Y=t9(V),q=Y>0?(V-(Y-1)*Db)/Y:0;j(Y),k(q)}});return L.observe(H),()=>L.disconnect()},[]),m.useEffect(()=>{g(o.slots)},[o.slots]);const C=im(ci(gc,{activationConstraint:{distance:8}}),ci(mc,{coordinateGetter:u9}));mi("list:overview"),Jt({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const I=m.useCallback(H=>{d(H),a(!0)},[]),T=m.useCallback(async(H,L)=>{p(null),g(H);try{await kb(H)}catch(U){g(L),p(U instanceof Error?U.message:String(U))}},[]),R=m.useCallback(H=>{if(l===null)return;const L=h.map((U,M)=>M===l?{...U,widget:H}:U);d(null),T(L,h)},[h,l,T]),D=m.useCallback(H=>{const L=h.map((U,M)=>M===H?{...U,widget:null,size:void 0}:U);T(L,h)},[h,T]),$=m.useCallback(H=>{const L=p9(h,H);T(L,h)},[h,T]),z=m.useCallback(()=>{const H=f9(h);T(H,h)},[h,T]),A=m.useCallback((H,L)=>{const U=h.map((M,V)=>V===H?{...M,size:L}:M);T(U,h)},[h,T]),F=m.useCallback(H=>{const{active:L,over:U}=H;if(S(null),!U||L.id===U.id)return;const M=h.findIndex(q=>q.id===L.id),V=h.findIndex(q=>q.id===U.id);if(M===-1||V===-1)return;const Y=xc(h,M,V);T(Y,h)},[h,T]),W=m.useCallback(H=>{S(String(H.active.id))},[]),P=h.find(H=>H.id===y)??null,O=m.useCallback(async(H,L)=>{const U=h,M=h.map((V,Y)=>Y===H?{...V,widget:L}:V);p(null),g(M);try{await kb(M)}catch(V){g(U);const Y=V instanceof Error?V.message:String(V);throw p(Y),V instanceof Error?V:new Error(Y)}},[h]),B={};if(e)for(const H of Object.keys(e.segments))for(const L of e.segments[H].items)B[L.id]=L;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(a8,{hero:e.hero,itemsById:B}):t?s.jsx(Tt,{error:t}):s.jsx(bt,{label:"Loading overview…"}),e!=null&&e.firstRun?s.jsx(o8,{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(dm,{sensors:C,collisionDetection:am,onDragStart:W,onDragCancel:()=>S(null),onDragEnd:F,children:[s.jsx(fm,{items:h.map(H=>H.id),strategy:dw,children:s.jsx("div",{ref:w,style:{display:"grid",gridTemplateColumns:`repeat(${b}, minmax(0, 1fr))`,gridAutoRows:`${RA}px`,gridAutoFlow:"dense",gap:`${Db}px`},children:h.map((H,L)=>s.jsx(o9,{slot:H,index:L,activeColumns:b,colWidthPx:N,onReplace:()=>I(L),onRemove:()=>D(L),onRemoveSlot:()=>$(H.id),onResize:U=>A(L,U),onConfigChange:U=>O(L,U)},H.id))})}),s.jsx(WB,{dropAnimation:null,children:P?s.jsx(i9,{slot:P,activeColumns:b,colWidthPx:N}):null})]}),s.jsxs("button",{type:"button",onClick:z,className:"shell-action inline-flex items-center gap-2",children:[s.jsx(Pt,{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(Tv,{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(c9,{open:i,onOpenChange:H=>{a(H),H||d(null)},onSelect:R})]})}function m9({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 g9(){const{data:e,loading:t,error:n}=v2(),{openCheatsheet:r}=hi();return t?s.jsx(bt,{label:"Loading help…"}):n||!e?s.jsx(Tt,{error:n||"Help content is unavailable."}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(Ye,{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. ",Ws("Mod+k")," opens the command palette."]})]})}),s.jsx(Ye,{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(Ye,{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(Ip,{command:o.command.command,description:o.command.description,example:o.command.example}):null,o.href?s.jsx(Ie,{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(Ye,{title:"Core Concepts",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(o=>s.jsx(m9,{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(Ye,{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(kn,{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(Ye,{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(Ye,{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(Ie,{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(Ye,{title:"CLI Quick Reference",children:s.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(o=>s.jsx(Ip,{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(Ye,{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(Ye,{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(Ip,{command:o.command.command,example:o.command.example}):null,o.href?s.jsx(Ie,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})})]})]})}function Rw({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 Cm=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(pi,{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"})]}));Cm.displayName="SearchInput";function Em({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:Ne("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 x9={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"},bS=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function xh({progress:e,className:t,showLegend:n=!1}){const r=Ss(),o=m.useMemo(()=>{let a=0;return(r.order.length>0?r.order:Object.keys(e).filter(d=>d!=="total")).map(d=>({key:d,className:x9[d]??bS[a++%bS.length]}))},[r.order,e]),i=o.filter(a=>(e[a.key]??0)>0);return s.jsxs("div",{className:Ne("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:`${Tn(a.key)}: ${e[a.key]??0}`},a.key))}),n?s.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:o.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:Ne("h-2 w-2 rounded-full",a.className)}),s.jsx("span",{children:Tn(a.key)}),s.jsx("span",{className:"font-medium text-foreground",children:e[a.key]??0})]},a.key))}):null]})}const y9=["pending","active","blocked","failed","completed"],Aw=y9,b9=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function AA(e){return e&&e.length>0?e:[...b9]}function v9(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 w9=220,ip=8;function PA({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)??w9,d=(a==null?void 0:a.offsetHeight)??0,f=Math.max(ip,window.innerWidth-l-ip),p=Math.max(ip,window.innerHeight-d-ip);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 d(){n()}return document.addEventListener("mousedown",a),document.addEventListener("keydown",l),document.addEventListener("contextmenu",a),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",l),document.removeEventListener("contextmenu",a),window.removeEventListener("scroll",d,!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(ea,{delayDuration:200,children:t.map(a=>{const l=a.icon,d=Ne("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:d,children:f})});return a.disabledReason?s.jsxs(_r,{children:[s.jsx(Dr,{asChild:!0,children:p}),s.jsx(hr,{side:"left",children:a.disabledReason})]},a.key):s.jsx("div",{children:p},a.key)}return a.href?s.jsx(Ie,{to:a.href,className:d,onClick:()=>n(),children:f},a.key):s.jsx("button",{type:"button",className:d,onClick:()=>{var p;(p=a.onSelect)==null||p.call(a),n()},children:f},a.key)})})})}const j9="__ungrouped__";function Pw({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}=fa(),[d,f]=m.useState(n),[p,h]=m.useState(!1),[g,y]=m.useState(null);m.useEffect(()=>{e&&(f(n),y(null))},[e,n]);const S=m.useMemo(()=>[...((a==null?void 0:a.workspaces)??[]).map(N=>({key:N,label:N,value:N})),{key:j9,label:"Ungrouped",value:null}],[a]),w=!p&&d!==n;async function b(){if(w){h(!0),y(null);try{await r(d),t(!1)}catch(j){y(j instanceof Error?j.message:"Failed to move item")}finally{h(!1)}}}return s.jsx(Bn,{open:e,onOpenChange:j=>p?void 0:t(j),children:s.jsxs(_n,{children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:o}),s.jsx(es,{children:i})]}),s.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:l&&S.length===0?s.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[s.jsx(Ev,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):S.map(j=>{const N=j.value===n,k=j.value===d;return s.jsxs("button",{type:"button",disabled:N||p,onClick:()=>f(j.value),className:Ne("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",N?"cursor-not-allowed bg-foreground/5 text-muted-foreground":k?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[s.jsxs("span",{className:Ne("block min-w-0 truncate",j.value===null?"italic text-muted-foreground":""),children:[j.label,N?s.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),k?s.jsx(Lr,{className:"h-4 w-4 text-foreground"}):null]},j.key)})}),g?s.jsx("p",{className:"text-sm text-destructive",role:"alert",children:g}):null,s.jsxs(Fr,{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:!w,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:p?"Moving…":"Move"})]})]})})}function vS(){const{workspace:e}=Bt(),t=mn(),n=zt(),{data:r,loading:o,error:i,refetch:a}=Xs(),l=m.useRef(null);mi("list:projects");const[d,f]=m.useState(""),[p,h]=m.useState("all"),[g,y]=m.useState("all"),[S,w]=m.useState("updated"),[b,j]=js(),N=b.get("view"),k=N==="table"||N==="kanban"?N:"cards",C=L=>{j(U=>{const M=new URLSearchParams(U);return L==="cards"?M.delete("view"):M.set("view",L),M})},[I,T]=m.useState({}),[R,D]=m.useState(null),[$,z]=m.useState(null),A=m.useMemo(()=>r?r.filter(L=>{if(e){if(e==="_ungrouped"){if(L.workspace!==null)return!1}else if(L.workspace!==e)return!1}return p!=="all"&&L.status!==p||g!=="all"&&!L.tags.includes(g)?!1:d.trim()?`${L.title} ${L.tags.join(" ")} ${L.slug}`.toLowerCase().includes(d.toLowerCase()):!0}).sort((L,U)=>N9(L,U,S)):[],[r,d,p,g,S,e]),F=A.map(L=>`${L.slug}:${L.status}`).join("|");m.useEffect(()=>{T(C9(A))},[F,S]);const W=m.useMemo(()=>{const L=new Map(A.map(U=>[U.slug,U]));return Aw.flatMap(U=>(I[U]??A.filter(V=>V.status===U).map(V=>V.slug)).map(V=>L.get(V)).filter(V=>!!V))},[A,I]),{visibleItems:P,visibleIndexByKey:O}=m.useMemo(()=>{const L=k==="kanban"?W:A,U=new Map;return L.forEach((M,V)=>U.set(M.slug,V)),{visibleItems:L,visibleIndexByKey:U}},[k,A,W]),{hotkeyRowProps:B}=Rd(P,{scope:"list:projects",onOpen:L=>n(`${t}/projects/${L.slug}`)});if(Jt({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var L;return(L=l.current)==null?void 0:L.focus()}}),Jt({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>a()}),o)return s.jsx(bt,{label:"Loading projects…"});if(i||!r)return s.jsx(Tt,{error:i||"Project list is unavailable."});const H=Array.from(new Set(r.flatMap(L=>L.tags))).sort();return s.jsxs("div",{className:"space-y-5",children:[s.jsxs(Rw,{children:[s.jsx(Cm,{ref:l,value:d,onChange:f,placeholder:"Search by project title or tag"}),s.jsxs("select",{value:p,onChange:L=>h(L.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:g,onChange:L=>y(L.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"all",children:"All tags"}),H.map(L=>s.jsx("option",{value:L,children:L},L))]}),s.jsxs("select",{value:S,onChange:L=>w(L.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(Em,{value:k,onChange:L=>C(L),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),A.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(Ie,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),s.jsx(Ie,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):s.jsx(Ct,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:s.jsx(Ie,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):k==="cards"?s.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:A.map((L,U)=>s.jsxs(Ie,{to:`${t}/projects/${L.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...B(U),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:L.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Kn(L.updated)]})]}),s.jsx(kn,{status:L.status})]}),s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsx(xh,{progress:L.progress,showLegend:!0}),s.jsx("div",{className:"flex flex-wrap gap-2",children:L.tags.map(M=>s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:M},M))}),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:L.needsAttention.blockedCount+L.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:L.progress.total})]})]})]})]},L.slug))}):k==="table"?s.jsx(Ye,{title:`${A.length} project${A.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:A.map((L,U)=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",...B(U),children:[s.jsxs("td",{className:"py-4 pr-4",children:[s.jsx(Ie,{to:`${t}/projects/${L.slug}`,className:"font-semibold text-foreground hover:text-primary",children:L.title}),s.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:L.tags.map(M=>s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:M},M))})]}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx(kn,{status:L.status})}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx("div",{className:"min-w-[220px]",children:s.jsx(xh,{progress:L.progress})})}),s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:L.needsAttention.blockedCount+L.needsAttention.failedCount}),s.jsx("td",{className:"py-4 text-muted-foreground",children:Kn(L.updated)})]},L.slug))})]})})}):s.jsx(km,{columns:S9,items:W,getItemId:L=>L.slug,getColumnId:L=>L.status,canDrop:({fromColumnId:L,toColumnId:U})=>({allowed:!0,reason:L===U?void 0:"This will set a manual status override on the project."}),onMove:({item:L,fromColumnId:U,toColumnId:M,fromIndex:V,toIndex:Y})=>{if(U===M){const q=I[U]??A.filter(J=>J.status===U).map(J=>J.slug);T(J=>({...J,[U]:v9(q,V,Y)}));return}fetch(`/api/projects/${L.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:M})}).then(()=>{window.location.reload()})},getExternalDragData:L=>({type:"project",id:L.slug}),onCardContextMenu:(L,U)=>{U.preventDefault(),D({project:L,anchor:{x:U.clientX,y:U.clientY}})},emptyMessage:L=>`No ${L.title.toLowerCase()} projects.`,renderCard:(L,{dragging:U})=>{const M=O.get(L.slug)??-1;return s.jsx("div",{...M>=0?B(M):{},children:s.jsx(E9,{project:L,dragging:U})})}}),s.jsx(PA,{anchor:(R==null?void 0:R.anchor)??null,items:R?[{key:"edit",label:"Edit",icon:cc,onSelect:()=>n(`${t}/projects/${R.project.slug}`)},{key:"move",label:"Move to workspace…",icon:Bh,onSelect:()=>z(R.project)}]:[],onClose:()=>D(null)}),s.jsx(Pw,{open:$!==null,onOpenChange:L=>{L||z(null)},currentWorkspace:($==null?void 0:$.workspace)??null,title:"Move project to workspace",onSubmit:async L=>{if(!$)return;const U=await fetch(`/api/projects/${encodeURIComponent($.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:L})});if(!U.ok){const M=await U.json().catch(()=>({}));throw new Error(M.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(Cv,{className:"mt-0.5 h-4 w-4"}),s.jsxs("p",{children:["Project status is derived from assignment state by default.",k==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const k9={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},S9=Aw.map(e=>({id:e,title:k9[e],description:Od(e)}));function N9(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return wS(t)-wS(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function wS(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function C9(e){return Object.fromEntries(Aw.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function E9({project:e,dragging:t}){const n=mn();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(Ie,{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 ",Kn(e.updated)]})]}),s.jsx(kn,{status:e.status})]}),s.jsx("div",{className:"mt-4",children:s.jsx(xh,{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 yh({title:e,description:t,actions:n,className:r}){return s.jsxs("div",{className:Ne("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 T9(){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(zh,{className:"h-3 w-3"}),"Archived"]})}function jS(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function R9(){const{data:e,loading:t,error:n,refetch:r}=nO(),[o,i]=m.useState(null),[a,l]=m.useState(null),[d,f]=m.useState({}),{toast:p,showToast:h,dismissToast:g}=gi();async function y(k,C,I){i(C),l(null);try{const T=await fetch(k,{method:"POST",headers:{"Content-Type":"application/json"}});if(!T.ok){const R=await T.json().catch(()=>null);throw new Error((R==null?void 0:R.error)||`HTTP ${T.status}`)}r(),h(I,"success")}catch(T){l(T instanceof Error?T.message:"Restore failed")}finally{i(null)}}function S(k){return y(`/api/projects/${k.slug}/unarchive`,`project:${k.slug}`,"Project restored")}function w(k){const C=k.projectSlug?`/api/projects/${k.projectSlug}/assignments/${k.slug}/unarchive`:`/api/assignments/${k.id}/unarchive`;return y(C,`assignment:${k.id}`,"Assignment restored")}if(t)return s.jsx(bt,{label:"Loading archived content…"});if(n)return s.jsx(Tt,{error:n});const b=(e==null?void 0:e.projects)??[],j=(e==null?void 0:e.assignments)??[],N=b.length===0&&j.length===0;return s.jsxs("div",{className:"space-y-6",children:[s.jsx(ga,{toast:p,onDismiss:g}),s.jsx(yh,{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,N?s.jsx(Ct,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):s.jsxs(s.Fragment,{children:[b.length>0&&s.jsx(Ye,{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(k=>{const C=d[k.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(I=>({...I,[k.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(yr,{className:"h-4 w-4"}):s.jsx(HE,{className:"h-4 w-4"}),s.jsx(Sv,{className:"h-4 w-4 text-muted-foreground"}),k.title,s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",k.assignments.length," assignment",k.assignments.length===1?"":"s",")"]})]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",k.archivedAt?Jr(k.archivedAt):"with no timestamp",k.archivedReason?` · ${k.archivedReason}`:""]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx(Ie,{to:`/projects/${k.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:()=>S(k),disabled:o===`project:${k.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(Gp,{className:"h-3 w-3"}),"Restore"]})]})]}),C&&k.assignments.length>0&&s.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:k.assignments.map(I=>s.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx(Ie,{to:jS(I),className:"text-foreground hover:text-foreground/80",children:I.title}),s.jsx(kn,{status:I.status,showIcon:!1}),s.jsx("span",{className:"text-xs text-muted-foreground",children:I.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},I.id))})]},k.slug)})})}),j.length>0&&s.jsx(Ye,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:s.jsx("ul",{className:"divide-y divide-border",children:j.map(k=>s.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[s.jsx(Ie,{to:jS(k),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:k.title}),s.jsx(kn,{status:k.status,showIcon:!1}),s.jsx(T9,{}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[k.projectTitle??"Standalone"," · Archived"," ",k.archivedAt?Jr(k.archivedAt):"with no timestamp",k.archivedReason?` · ${k.archivedReason}`:""]}),s.jsxs("button",{type:"button",onClick:()=>w(k),disabled:o===`assignment:${k.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(Gp,{className:"h-3 w-3"}),"Restore"]})]},k.id))})})]})]})}const kS="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",SS="block min-w-0 truncate";function _w({externalIds:e,className:t}){return e.length===0?null:s.jsx("span",{className:Ne("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:Ne(kS,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[s.jsx("span",{className:SS,children:o}),s.jsx(ac,{className:"h-2.5 w-2.5 shrink-0"})]},i):s.jsx("span",{className:kS,title:o,children:s.jsx("span",{className:SS,children:o})},i)})})}const A9={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 qn({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]}),l=Ne(A9[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(Ie,{to:i,className:l,children:a}):s.jsx("article",{className:l,children:a})}function NS(e){const t=P9(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),d=l.find(D9);if(d){const f=d.props.children,p=l.map(h=>h===d?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 P9(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=I9(o),l=$9(i,o.props);return o.type!==m.Fragment&&(l.ref=r?Zh(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 _9=Symbol("radix.slottable");function D9(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_9}function $9(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 d=i(...l);return o(...l),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function I9(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 M9(e){const t=e+"CollectionProvider",[n,r]=pa(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=w=>{const{scope:b,children:j}=w,N=$t.useRef(null),k=$t.useRef(new Map).current;return s.jsx(o,{scope:b,itemMap:k,collectionRef:N,children:j})};a.displayName=t;const l=e+"CollectionSlot",d=NS(l),f=$t.forwardRef((w,b)=>{const{scope:j,children:N}=w,k=i(l,j),C=Zn(b,k.collectionRef);return s.jsx(d,{ref:C,children:N})});f.displayName=l;const p=e+"CollectionItemSlot",h="data-radix-collection-item",g=NS(p),y=$t.forwardRef((w,b)=>{const{scope:j,children:N,...k}=w,C=$t.useRef(null),I=Zn(b,C),T=i(p,j);return $t.useEffect(()=>(T.itemMap.set(C,{ref:C,...k}),()=>void T.itemMap.delete(C))),s.jsx(g,{[h]:"",ref:I,children:N})});y.displayName=p;function S(w){const b=i(e+"CollectionConsumer",w);return $t.useCallback(()=>{const N=b.collectionRef.current;if(!N)return[];const k=Array.from(N.querySelectorAll(`[${h}]`));return Array.from(b.itemMap.values()).sort((T,R)=>k.indexOf(T.ref.current)-k.indexOf(R.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:f,ItemSlot:y},S,r]}var L9=m.createContext(void 0);function _A(e){const t=m.useContext(L9);return e||t||"ltr"}var dy="rovingFocusGroup.onEntryFocus",O9={bubbles:!1,cancelable:!0},zd="RovingFocusGroup",[Mb,DA,F9]=M9(zd),[z9,$A]=pa(zd,[F9]),[B9,U9]=z9(zd),IA=m.forwardRef((e,t)=>s.jsx(Mb.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Mb.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(H9,{...e,ref:t})})}));IA.displayName=zd;var H9=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...h}=e,g=m.useRef(null),y=Zn(t,g),S=_A(i),[w,b]=em({prop:a,defaultProp:l??null,onChange:d,caller:zd}),[j,N]=m.useState(!1),k=sa(f),C=DA(n),I=m.useRef(!1),[T,R]=m.useState(0);return m.useEffect(()=>{const D=g.current;if(D)return D.addEventListener(dy,k),()=>D.removeEventListener(dy,k)},[k]),s.jsx(B9,{scope:n,orientation:r,dir:S,loop:o,currentTabStopId:w,onItemFocus:m.useCallback(D=>b(D),[b]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>R(D=>D+1),[]),onFocusableItemRemove:m.useCallback(()=>R(D=>D-1),[]),children:s.jsx(Sn.div,{tabIndex:j||T===0?-1:0,"data-orientation":r,...h,ref:y,style:{outline:"none",...e.style},onMouseDown:rn(e.onMouseDown,()=>{I.current=!0}),onFocus:rn(e.onFocus,D=>{const $=!I.current;if(D.target===D.currentTarget&&$&&!j){const z=new CustomEvent(dy,O9);if(D.currentTarget.dispatchEvent(z),!z.defaultPrevented){const A=C().filter(B=>B.focusable),F=A.find(B=>B.active),W=A.find(B=>B.id===w),O=[F,W,...A].filter(Boolean).map(B=>B.ref.current);OA(O,p)}}I.current=!1}),onBlur:rn(e.onBlur,()=>N(!1))})})}),MA="RovingFocusGroupItem",LA=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:a,...l}=e,d=Rl(),f=i||d,p=U9(MA,n),h=p.currentTabStopId===f,g=DA(n),{onFocusableItemAdd:y,onFocusableItemRemove:S,currentTabStopId:w}=p;return m.useEffect(()=>{if(r)return y(),()=>S()},[r,y,S]),s.jsx(Mb.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:rn(e.onMouseDown,b=>{r?p.onItemFocus(f):b.preventDefault()}),onFocus:rn(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:rn(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){p.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const j=q9(b,p.orientation,p.dir);if(j!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let k=g().filter(C=>C.focusable).map(C=>C.ref.current);if(j==="last")k.reverse();else if(j==="prev"||j==="next"){j==="prev"&&k.reverse();const C=k.indexOf(b.currentTarget);k=p.loop?K9(k,C+1):k.slice(C+1)}setTimeout(()=>OA(k))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:w!=null}):a})})});LA.displayName=MA;var V9={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function W9(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function q9(e,t,n){const r=W9(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return V9[r]}function OA(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function K9(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var G9=IA,Y9=LA,Tm="Tabs",[X9]=pa(Tm,[$A]),FA=$A(),[Q9,Dw]=X9(Tm),zA=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:d="automatic",...f}=e,p=_A(l),[h,g]=em({prop:r,onChange:o,defaultProp:i??"",caller:Tm});return s.jsx(Q9,{scope:n,baseId:Rl(),value:h,onValueChange:g,orientation:a,dir:p,activationMode:d,children:s.jsx(Sn.div,{dir:p,"data-orientation":a,...f,ref:t})})});zA.displayName=Tm;var BA="TabsList",UA=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Dw(BA,n),a=FA(n);return s.jsx(G9,{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})})});UA.displayName=BA;var HA="TabsTrigger",VA=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,a=Dw(HA,n),l=FA(n),d=KA(a.baseId,r),f=GA(a.baseId,r),p=r===a.value;return s.jsx(Y9,{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:d,...i,ref:t,onMouseDown:rn(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?a.onValueChange(r):h.preventDefault()}),onKeyDown:rn(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&a.onValueChange(r)}),onFocus:rn(e.onFocus,()=>{const h=a.activationMode!=="manual";!p&&!o&&h&&a.onValueChange(r)})})})});VA.displayName=HA;var WA="TabsContent",qA=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...a}=e,l=Dw(WA,n),d=KA(l.baseId,r),f=GA(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(ha,{present:o||p,children:({present:g})=>s.jsx(Sn.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":d,hidden:!g,id:f,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:g&&i})})});qA.displayName=WA;function KA(e,t){return`${e}-trigger-${t}`}function GA(e,t){return`${e}-content-${t}`}var YA=zA,XA=UA,Lb=VA,Ob=qA;function Rm({value:e,onValueChange:t,items:n,className:r}){return s.jsxs(YA,{value:e,onValueChange:t,className:r,children:[s.jsx(XA,{className:"scrollbar-none flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(o=>s.jsxs(Lb,{value:o.value,className:Ne("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:o.label}),typeof o.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:o.count}):null,o.problemCount&&o.problemCount>0?s.jsx("span",{className:"rounded-full bg-destructive/15 px-2 py-0.5 text-xs text-destructive","aria-label":`${o.problemCount} ${o.problemCount===1?"error":"errors"}`,title:`${o.problemCount} ${o.problemCount===1?"error":"errors"}`,children:o.problemCount}):null]},o.value))}),n.map(o=>s.jsx(Ob,{value:o.value,className:"pt-3",children:o.content},o.value))]})}const J9="modulepreload",Z9=function(e){return"/"+e},CS={},eH=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]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=a(n.map(f=>{if(f=Z9(f),f in CS)return;CS[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":J9,p||(g.as="script"),g.crossOrigin="",g.href=f,d&&g.setAttribute("nonce",d),document.head.appendChild(g),p)return new Promise((y,S)=>{g.addEventListener("load",y),g.addEventListener("error",()=>S(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 tH({definition:e,className:t,nodeRoutes:n={}}){const r=m.useRef(null),[o,i]=m.useState(null),[a,l]=m.useState(!0),d=zt(),f=document.documentElement.classList.contains("dark")?"dark":"default";return m.useEffect(()=>{let p=!1;async function h(){if(r.current)try{const g=(await eH(async()=>{const{default:w}=await import("./mermaid.core-CmEGzmWo.js").then(b=>b.bs);return{default:w}},[])).default;if(g.initialize({startOnLoad:!1,theme:"base",themeVariables:nH(f==="dark")}),p)return;const y=`mermaid-${Date.now()}`,{svg:S}=await g.render(y,e);if(p||!r.current)return;r.current.innerHTML=S,rH(r.current,n,d),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,d,n,f]),o?s.jsxs("div",{className:Ne("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:Ne("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 nH(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"),d=n("--muted"),f=n("--muted-foreground"),p=n("--secondary");return{background:r,primaryColor:r,primaryTextColor:o,primaryBorderColor:i,secondaryColor:d,secondaryTextColor:o,secondaryBorderColor:i,tertiaryColor:d,tertiaryTextColor:f,tertiaryBorderColor:i,lineColor:e?f:i,textColor:o,mainBkg:r,nodeBkg:r,nodeTextColor:o,nodeBorder:i,clusterBkg:d,clusterBorder:i,edgeLabelBackground:r,titleColor:o,activeTaskBkgColor:a,activeTaskBorderColor:a,altBackground:d,labelColor:o,errorBkgColor:p,errorTextColor:l}}function rH(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",d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l())})}}function sH(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const oH=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iH=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aH={};function ES(e,t){return(aH.jsx?iH:oH).test(e)}const lH=/[ \t\n\f\r]/g;function cH(e){return typeof e=="object"?e.type==="text"?TS(e.value):!1:TS(e)}function TS(e){return e.replace(lH,"")===""}class Bd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Bd.prototype.normal={};Bd.prototype.property={};Bd.prototype.space=void 0;function QA(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Bd(n,r,t)}function Fb(e){return e.toLowerCase()}class br{constructor(t,n){this.attribute=n,this.property=t}}br.prototype.attribute="";br.prototype.booleanish=!1;br.prototype.boolean=!1;br.prototype.commaOrSpaceSeparated=!1;br.prototype.commaSeparated=!1;br.prototype.defined=!1;br.prototype.mustUseProperty=!1;br.prototype.number=!1;br.prototype.overloadedBoolean=!1;br.prototype.property="";br.prototype.spaceSeparated=!1;br.prototype.space=void 0;let uH=0;const gt=xa(),bn=xa(),zb=xa(),Le=xa(),Vt=xa(),Ll=xa(),Er=xa();function xa(){return 2**++uH}const Bb=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:bn,commaOrSpaceSeparated:Er,commaSeparated:Ll,number:Le,overloadedBoolean:zb,spaceSeparated:Vt},Symbol.toStringTag,{value:"Module"})),fy=Object.keys(Bb);class $w extends br{constructor(t,n,r,o){let i=-1;if(super(t,n),RS(this,"space",o),typeof r=="number")for(;++i<fy.length;){const a=fy[i];RS(this,fy[i],(r&Bb[a])===Bb[a])}}}$w.prototype.defined=!0;function RS(e,t,n){n&&(e[t]=n)}function vc(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new $w(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Fb(r)]=r,n[Fb(i.attribute)]=r}return new Bd(t,n,e.space)}const JA=vc({properties:{ariaActiveDescendant:null,ariaAtomic:bn,ariaAutoComplete:null,ariaBusy:bn,ariaChecked:bn,ariaColCount:Le,ariaColIndex:Le,ariaColSpan:Le,ariaControls:Vt,ariaCurrent:null,ariaDescribedBy:Vt,ariaDetails:null,ariaDisabled:bn,ariaDropEffect:Vt,ariaErrorMessage:null,ariaExpanded:bn,ariaFlowTo:Vt,ariaGrabbed:bn,ariaHasPopup:null,ariaHidden:bn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Vt,ariaLevel:Le,ariaLive:null,ariaModal:bn,ariaMultiLine:bn,ariaMultiSelectable:bn,ariaOrientation:null,ariaOwns:Vt,ariaPlaceholder:null,ariaPosInSet:Le,ariaPressed:bn,ariaReadOnly:bn,ariaRelevant:null,ariaRequired:bn,ariaRoleDescription:Vt,ariaRowCount:Le,ariaRowIndex:Le,ariaRowSpan:Le,ariaSelected:bn,ariaSetSize:Le,ariaSort:null,ariaValueMax:Le,ariaValueMin:Le,ariaValueNow:Le,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ZA(e,t){return t in e?e[t]:t}function eP(e,t){return ZA(e,t.toLowerCase())}const dH=vc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ll,acceptCharset:Vt,accessKey:Vt,action:null,allow:null,allowFullScreen:gt,allowPaymentRequest:gt,allowUserMedia:gt,alt:null,as:null,async:gt,autoCapitalize:null,autoComplete:Vt,autoFocus:gt,autoPlay:gt,blocking:Vt,capture:null,charSet:null,checked:gt,cite:null,className:Vt,cols:Le,colSpan:null,content:null,contentEditable:bn,controls:gt,controlsList:Vt,coords:Le|Ll,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gt,defer:gt,dir:null,dirName:null,disabled:gt,download:zb,draggable:bn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gt,formTarget:null,headers:Vt,height:Le,hidden:zb,high:Le,href:null,hrefLang:null,htmlFor:Vt,httpEquiv:Vt,id:null,imageSizes:null,imageSrcSet:null,inert:gt,inputMode:null,integrity:null,is:null,isMap:gt,itemId:null,itemProp:Vt,itemRef:Vt,itemScope:gt,itemType:Vt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gt,low:Le,manifest:null,max:null,maxLength:Le,media:null,method:null,min:null,minLength:Le,multiple:gt,muted:gt,name:null,nonce:null,noModule:gt,noValidate:gt,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:gt,optimum:Le,pattern:null,ping:Vt,placeholder:null,playsInline:gt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gt,referrerPolicy:null,rel:Vt,required:gt,reversed:gt,rows:Le,rowSpan:Le,sandbox:Vt,scope:null,scoped:gt,seamless:gt,selected:gt,shadowRootClonable:gt,shadowRootDelegatesFocus:gt,shadowRootMode:null,shape:null,size:Le,sizes:null,slot:null,span:Le,spellCheck:bn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Le,step:null,style:null,tabIndex:Le,target:null,title:null,translate:null,type:null,typeMustMatch:gt,useMap:null,value:bn,width:Le,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Vt,axis:null,background:null,bgColor:null,border:Le,borderColor:null,bottomMargin:Le,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gt,declare:gt,event:null,face:null,frame:null,frameBorder:null,hSpace:Le,leftMargin:Le,link:null,longDesc:null,lowSrc:null,marginHeight:Le,marginWidth:Le,noResize:gt,noHref:gt,noShade:gt,noWrap:gt,object:null,profile:null,prompt:null,rev:null,rightMargin:Le,rules:null,scheme:null,scrolling:bn,standby:null,summary:null,text:null,topMargin:Le,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Le,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gt,disableRemotePlayback:gt,prefix:null,property:null,results:Le,security:null,unselectable:null},space:"html",transform:eP}),fH=vc({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:Er,accentHeight:Le,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Le,amplitude:Le,arabicForm:null,ascent:Le,attributeName:null,attributeType:null,azimuth:Le,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Le,by:null,calcMode:null,capHeight:Le,className:Vt,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:Le,diffuseConstant:Le,direction:null,display:null,dur:null,divisor:Le,dominantBaseline:null,download:gt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Le,enableBackground:null,end:null,event:null,exponent:Le,externalResourcesRequired:null,fill:null,fillOpacity:Le,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:Ll,g2:Ll,glyphName:Ll,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Le,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Le,horizOriginX:Le,horizOriginY:Le,id:null,ideographic:Le,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Le,k:Le,k1:Le,k2:Le,k3:Le,k4:Le,kernelMatrix:Er,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Le,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:Le,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:Le,overlineThickness:Le,paintOrder:null,panose1:null,path:null,pathLength:Le,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Vt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Le,pointsAtY:Le,pointsAtZ:Le,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Er,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Er,rev:Er,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Er,requiredFeatures:Er,requiredFonts:Er,requiredFormats:Er,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:Le,specularExponent:Le,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Le,strikethroughThickness:Le,string:null,stroke:null,strokeDashArray:Er,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Le,strokeOpacity:Le,strokeWidth:null,style:null,surfaceScale:Le,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Er,tabIndex:Le,tableValues:null,target:null,targetX:Le,targetY:Le,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Er,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Le,underlineThickness:Le,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Le,values:null,vAlphabetic:Le,vMathematical:Le,vectorEffect:null,vHanging:Le,vIdeographic:Le,version:null,vertAdvY:Le,vertOriginX:Le,vertOriginY:Le,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Le,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ZA}),tP=vc({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()}}),nP=vc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:eP}),rP=vc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),pH={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"},hH=/[A-Z]/g,AS=/-[a-z]/g,mH=/^data[-\w.:]+$/i;function gH(e,t){const n=Fb(t);let r=t,o=br;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&mH.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(AS,yH);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!AS.test(i)){let a=i.replace(hH,xH);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}o=$w}return new o(r,t)}function xH(e){return"-"+e.toLowerCase()}function yH(e){return e.charAt(1).toUpperCase()}const bH=QA([JA,dH,tP,nP,rP],"html"),Iw=QA([JA,fH,tP,nP,rP],"svg");function vH(e){return e.join(" ").trim()}var dl={},py,PS;function wH(){if(PS)return py;PS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
|
|
586
|
+
`,f="/",p="*",h="",g="comment",y="declaration";function S(b,j){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];j=j||{};var N=1,k=1;function C(P){var O=P.match(t);O&&(N+=O.length);var B=P.lastIndexOf(d);k=~B?P.length-B:k+P.length}function I(){var P={line:N,column:k};return function(O){return O.position=new T(P),$(),O}}function T(P){this.start=P,this.end={line:N,column:k},this.source=j.source}T.prototype.content=b;function R(P){var O=new Error(j.source+":"+N+":"+k+": "+P);if(O.reason=P,O.filename=j.source,O.line=N,O.column=k,O.source=b,!j.silent)throw O}function D(P){var O=P.exec(b);if(O){var B=O[0];return C(B),b=b.slice(B.length),O}}function $(){D(n)}function z(P){var O;for(P=P||[];O=A();)O!==!1&&P.push(O);return P}function A(){var P=I();if(!(f!=b.charAt(0)||p!=b.charAt(1))){for(var O=2;h!=b.charAt(O)&&(p!=b.charAt(O)||f!=b.charAt(O+1));)++O;if(O+=2,h===b.charAt(O-1))return R("End of comment missing");var B=b.slice(2,O-2);return k+=2,C(B),b=b.slice(O),k+=2,P({type:g,comment:B})}}function F(){var P=I(),O=D(r);if(O){if(A(),!D(o))return R("property missing ':'");var B=D(i),H=P({type:y,property:w(O[0].replace(e,h)),value:B?w(B[0].replace(e,h)):h});return D(a),H}}function W(){var P=[];z(P);for(var O;O=F();)O!==!1&&(P.push(O),z(P));return P}return $(),W()}function w(b){return b?b.replace(l,h):h}return py=S,py}var _S;function jH(){if(_S)return dl;_S=1;var e=dl&&dl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(dl,"__esModule",{value:!0}),dl.default=n;const t=e(wH());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(d=>{if(d.type!=="declaration")return;const{property:f,value:p}=d;l?o(f,p,d):p&&(i=i||{},i[f]=p)}),i}return dl}var fu={},DS;function kH(){if(DS)return fu;DS=1,Object.defineProperty(fu,"__esModule",{value:!0}),fu.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,"-")},d=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 fu.camelCase=d,fu}var pu,$S;function SH(){if($S)return pu;$S=1;var e=pu&&pu.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(jH()),n=kH();function r(o,i){var a={};return!o||typeof o!="string"||(0,t.default)(o,function(l,d){l&&d&&(a[(0,n.camelCase)(l,i)]=d)}),a}return r.default=r,pu=r,pu}var NH=SH();const CH=bd(NH),sP=oP("end"),Mw=oP("start");function oP(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 EH(e){const t=Mw(e),n=sP(e);if(t&&n)return{start:t,end:n}}function Ou(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?IS(e.position):"start"in e||"end"in e?IS(e):"line"in e||"column"in e?Ub(e):""}function Ub(e){return MS(e&&e.line)+":"+MS(e&&e.column)}function IS(e){return Ub(e&&e.start)+"-"+Ub(e&&e.end)}function MS(e){return e&&typeof e=="number"?e:1}class er 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 d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.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=Ou(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}}er.prototype.file="";er.prototype.name="";er.prototype.reason="";er.prototype.message="";er.prototype.stack="";er.prototype.column=void 0;er.prototype.line=void 0;er.prototype.ancestors=void 0;er.prototype.cause=void 0;er.prototype.fatal=void 0;er.prototype.place=void 0;er.prototype.ruleId=void 0;er.prototype.source=void 0;const Lw={}.hasOwnProperty,TH=new Map,RH=/[A-Z]/g,AH=new Set(["table","tbody","thead","tfoot","tr"]),PH=new Set(["td","th"]),iP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function _H(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=zH(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=FH(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"?Iw:bH,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=aP(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function aP(e,t,n){if(t.type==="element")return DH(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return $H(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return MH(e,t,n);if(t.type==="mdxjsEsm")return IH(e,t);if(t.type==="root")return LH(e,t,n);if(t.type==="text")return OH(e,t)}function DH(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=Iw,e.schema=o),e.ancestors.push(t);const i=cP(e,t.tagName,!1),a=BH(e,t);let l=Fw(e,t);return AH.has(t.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!cH(d):!0})),lP(e,a,i,t),Ow(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function $H(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)}od(e,t.position)}function IH(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);od(e,t.position)}function MH(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=Iw,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:cP(e,t.name,!0),a=UH(e,t),l=Fw(e,t);return lP(e,a,i,t),Ow(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function LH(e,t,n){const r={};return Ow(r,Fw(e,t)),e.create(t,e.Fragment,r,n)}function OH(e,t){return t.value}function lP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ow(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function FH(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 zH(e,t){return n;function n(r,o,i,a){const l=Array.isArray(i.children),d=Mw(r);return t(o,i,a,l,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function BH(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&Lw.call(t.properties,o)){const i=HH(e,o,t.properties[o]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&PH.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 UH(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 od(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 od(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function Fw(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:TH;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const d=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(d){const f=o.get(d)||0;a=d+"-"+f,o.set(d,f+1)}}const l=aP(e,i,a);l!==void 0&&n.push(l)}return n}function HH(e,t,n){const r=gH(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?sH(n):vH(n)),r.property==="style"){let o=typeof n=="object"?n:VH(e,String(n));return e.stylePropertyNameCase==="css"&&(o=WH(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?pH[r.property]||r.property:r.attribute,n]}}function VH(e,t){try{return CH(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new er("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=iP+"#cannot-parse-style-attribute",o}}function cP(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=ES(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=ES(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return Lw.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);od(e)}function od(e,t){const n=new er("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=iP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function WH(e){const t={};let n;for(n in e)Lw.call(e,n)&&(t[qH(n)]=e[n]);return t}function qH(e){let t=e.replace(RH,KH);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function KH(e){return"-"+e.toLowerCase()}const hy={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"]},GH={};function YH(e,t){const n=GH,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return uP(e,r,o)}function uP(e,t,n){if(XH(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 LS(e.children,t,n)}return Array.isArray(e)?LS(e,t,n):""}function LS(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=uP(e[o],t,n);return r.join("")}function XH(e){return!!(e&&typeof e=="object")}const OS=document.createElement("i");function zw(e){const t="&"+e+";";OS.innerHTML=t;const n=OS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ys(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 Yr(e,t){return e.length>0?(Ys(e,e.length,0,t),e):t}const FS={}.hasOwnProperty;function QH(e){const t={};let n=-1;for(;++n<e.length;)JH(t,e[n]);return t}function JH(e,t){let n;for(n in t){const o=(FS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){FS.call(o,a)||(o[a]=[]);const l=i[a];ZH(o[a],Array.isArray(l)?l:l?[l]:[])}}}function ZH(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ys(e,0,0,r)}function dP(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 Ol(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Bs=xi(/[A-Za-z]/),Ir=xi(/[\dA-Za-z]/),eV=xi(/[#-'*+\--9=?A-Z^-~]/);function Hb(e){return e!==null&&(e<32||e===127)}const Vb=xi(/\d/),tV=xi(/[\dA-Fa-f]/),nV=xi(/[!-/:-@[-`{-~]/);function ut(e){return e!==null&&e<-2}function xr(e){return e!==null&&(e<0||e===32)}function Lt(e){return e===-2||e===-1||e===32}const rV=xi(new RegExp("\\p{P}|\\p{S}","u")),sV=xi(/\s/);function xi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function wc(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Ir(e.charCodeAt(n+1))&&Ir(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 Wt(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(d){return Lt(d)?(e.enter(n),l(d)):t(d)}function l(d){return Lt(d)&&i++<o?(e.consume(d),l):(e.exit(n),t(d))}}const oV={tokenize:iV};function iV(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"),Wt(e,t,"linePrefix")}function o(l){return e.enter("paragraph"),i(l)}function i(l){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return ut(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const aV={tokenize:lV},zS={tokenize:cV};function lV(e){const t=this,n=[];let r=0,o,i,a;return l;function l(k){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,d,f)(k)}return f(k)}function d(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&N();const C=t.events.length;let I=C,T;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){T=t.events[I][1].end;break}j(r);let R=C;for(;R<t.events.length;)t.events[R][1].end={...T},R++;return Ys(t.events,I+1,0,t.events.slice(C)),t.events.length=R,f(k)}return l(k)}function f(k){if(r===n.length){if(!o)return g(k);if(o.currentConstruct&&o.currentConstruct.concrete)return S(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(zS,p,h)(k)}function p(k){return o&&N(),j(r),g(k)}function h(k){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,S(k)}function g(k){return t.containerState={},e.attempt(zS,y,S)(k)}function y(k){return r++,n.push([t.currentConstruct,t.containerState]),g(k)}function S(k){if(k===null){o&&N(),j(0),e.consume(k);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),w(k)}function w(k){if(k===null){b(e.exit("chunkFlow"),!0),j(0),e.consume(k);return}return ut(k)?(e.consume(k),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(k),w)}function b(k,C){const I=t.sliceStream(k);if(C&&I.push(null),k.previous=i,i&&(i.next=k),i=k,o.defineSkip(k.start),o.write(I),t.parser.lazy[k.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 R=t.events.length;let D=R,$,z;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if($){z=t.events[D][1].end;break}$=!0}for(j(r),T=R;T<t.events.length;)t.events[T][1].end={...z},T++;Ys(t.events,D+1,0,t.events.slice(R)),t.events.length=T}}function j(k){let C=n.length;for(;C-- >k;){const I=n[C];t.containerState=I[1],I[0].exit.call(t,e)}n.length=k}function N(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function cV(e,t,n){return Wt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function BS(e){if(e===null||xr(e)||sV(e))return 1;if(rV(e))return 2}function Bw(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 Wb={name:"attention",resolveAll:uV,tokenize:dV};function uV(e,t){let n=-1,r,o,i,a,l,d,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;d=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};US(h,-d),US(g,d),a={type:d>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},i={type:d>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:d>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=Yr(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Yr(f,[["enter",o,t],["enter",a,t],["exit",a,t],["enter",i,t]]),f=Yr(f,Bw(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=Yr(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=Yr(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Ys(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 dV(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=BS(r);let i;return a;function a(d){return i=d,e.enter("attentionSequence"),l(d)}function l(d){if(d===i)return e.consume(d),l;const f=e.exit("attentionSequence"),p=BS(d),h=!p||p===2&&o||n.includes(d),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(d)}}function US(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const fV={name:"autolink",tokenize:pV};function pV(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 Bs(y)?(e.consume(y),a):y===64?n(y):f(y)}function a(y){return y===43||y===45||y===46||Ir(y)?(r=1,l(y)):f(y)}function l(y){return y===58?(e.consume(y),r=0,d):(y===43||y===45||y===46||Ir(y))&&r++<32?(e.consume(y),l):(r=0,f(y))}function d(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||Hb(y)?n(y):(e.consume(y),d)}function f(y){return y===64?(e.consume(y),p):eV(y)?(e.consume(y),f):n(y)}function p(y){return Ir(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||Ir(y))&&r++<63){const S=y===45?g:h;return e.consume(y),S}return n(y)}}const Am={partial:!0,tokenize:hV};function hV(e,t,n){return r;function r(i){return Lt(i)?Wt(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||ut(i)?t(i):n(i)}}const fP={continuation:{tokenize:gV},exit:xV,name:"blockQuote",tokenize:mV};function mV(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 Lt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function gV(e,t,n){const r=this;return o;function o(a){return Lt(a)?Wt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(fP,t,n)(a)}}function xV(e){e.exit("blockQuote")}const pP={name:"characterEscape",tokenize:yV};function yV(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 nV(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const hP={name:"characterReference",tokenize:bV};function bV(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"),d}function d(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),i=31,a=Ir,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=tV,p):(e.enter("characterReferenceValue"),i=7,a=Vb,p(h))}function p(h){if(h===59&&o){const g=e.exit("characterReferenceValue");return a===Ir&&!zw(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 HS={partial:!0,tokenize:wV},VS={concrete:!0,name:"codeFenced",tokenize:vV};function vV(e,t,n){const r=this,o={partial:!0,tokenize:I};let i=0,a=0,l;return d;function d(T){return f(T)}function f(T){const R=r.events[r.events.length-1];return i=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[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"),Lt(T)?Wt(e,h,"whitespace")(T):h(T))}function h(T){return T===null||ut(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(HS,w,C)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||ut(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):Lt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Wt(e,y,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),g)}function y(T){return T===null||ut(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(T))}function S(T){return T===null||ut(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===l?n(T):(e.consume(T),S)}function w(T){return e.attempt(o,C,b)(T)}function b(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),j}function j(T){return i>0&&Lt(T)?Wt(e,N,"linePrefix",i+1)(T):N(T)}function N(T){return T===null||ut(T)?e.check(HS,w,C)(T):(e.enter("codeFlowValue"),k(T))}function k(T){return T===null||ut(T)?(e.exit("codeFlowValue"),N(T)):(e.consume(T),k)}function C(T){return e.exit("codeFenced"),t(T)}function I(T,R,D){let $=0;return z;function z(O){return T.enter("lineEnding"),T.consume(O),T.exit("lineEnding"),A}function A(O){return T.enter("codeFencedFence"),Lt(O)?Wt(T,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):F(O)}function F(O){return O===l?(T.enter("codeFencedFenceSequence"),W(O)):D(O)}function W(O){return O===l?($++,T.consume(O),W):$>=a?(T.exit("codeFencedFenceSequence"),Lt(O)?Wt(T,P,"whitespace")(O):P(O)):D(O)}function P(O){return O===null||ut(O)?(T.exit("codeFencedFence"),R(O)):D(O)}}}function wV(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:kV},jV={partial:!0,tokenize:SV};function kV(e,t,n){const r=this;return o;function o(f){return e.enter("codeIndented"),Wt(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?d(f):ut(f)?e.attempt(jV,a,d)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||ut(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),l)}function d(f){return e.exit("codeIndented"),t(f)}}function SV(e,t,n){const r=this;return o;function o(a){return r.parser.lazy[r.now().line]?n(a):ut(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):Wt(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):ut(a)?o(a):n(a)}}const NV={name:"codeText",previous:EV,resolve:CV,tokenize:TV};function CV(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 EV(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function TV(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"),d(h))}function d(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),d):h===96?(i=e.enter("codeTextSequence"),o=0,p(h)):ut(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||ut(h)?(e.exit("codeTextData"),d(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 RV{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&&hu(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),hu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),hu(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);hu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);hu(this.left,n.reverse())}}}function hu(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 mP(e){const t={};let n=-1,r,o,i,a,l,d,f;const p=new RV(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"&&(d=r[1]._tokenizer.events,i=0,i<d.length&&d[i][1].type==="lineEndingBlank"&&(i+=2),i<d.length&&d[i][1].type==="content"))for(;++i<d.length&&d[i][1].type!=="content";)d[i][1].type==="chunkText"&&(d[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,AV(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 Ys(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function AV(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,d=[],f={};let p,h,g=-1,y=n,S=0,w=0;const b=[w];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&&(w=g+1,b.push(w),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 j=l.slice(b[g],b[g+1]),N=i.pop();d.push([N,N+j.length-1]),e.splice(N,2,j)}for(d.reverse(),g=-1;++g<d.length;)f[S+d[g][0]]=S+d[g][1],S+=d[g][1]-d[g][0]-1;return f}const PV={resolve:DV,tokenize:$V},_V={partial:!0,tokenize:IV};function DV(e){return mP(e),e}function $V(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):ut(l)?e.check(_V,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 IV(e,t,n){const r=this;return o;function o(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Wt(e,i,"linePrefix")}function i(a){if(a===null||ut(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 gP(e,t,n,r,o,i,a,l,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return h;function h(j){return j===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(j),e.exit(i),g):j===null||j===32||j===41||Hb(j)?n(j):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(j))}function g(j){return j===62?(e.enter(i),e.consume(j),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===62?(e.exit("chunkString"),e.exit(l),g(j)):j===null||j===60||ut(j)?n(j):(e.consume(j),j===92?S:y)}function S(j){return j===60||j===62||j===92?(e.consume(j),y):y(j)}function w(j){return!p&&(j===null||j===41||xr(j))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(j)):p<f&&j===40?(e.consume(j),p++,w):j===41?(e.consume(j),p--,w):j===null||j===32||j===40||Hb(j)?n(j):(e.consume(j),j===92?b:w)}function b(j){return j===40||j===41||j===92?(e.consume(j),w):w(j)}}function xP(e,t,n,r,o,i){const a=this;let l=0,d;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&&!d||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):ut(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||ut(y)||l++>999?(e.exit("chunkString"),p(y)):(e.consume(y),d||(d=!Lt(y)),y===92?g:h)}function g(y){return y===91||y===92||y===93?(e.consume(y),l++,h):h(y)}}function yP(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,d):n(g)}function d(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),d(a)):g===null?n(g):ut(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Wt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===a||g===null||ut(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 Fu(e,t){let n;return r;function r(o){return ut(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Lt(o)?Wt(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const MV={name:"definition",tokenize:OV},LV={partial:!0,tokenize:FV};function OV(e,t,n){const r=this;let o;return i;function i(y){return e.enter("definition"),a(y)}function a(y){return xP.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function l(y){return o=Ol(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),d):n(y)}function d(y){return xr(y)?Fu(e,f)(y):f(y)}function f(y){return gP(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function p(y){return e.attempt(LV,h,h)(y)}function h(y){return Lt(y)?Wt(e,g,"whitespace")(y):g(y)}function g(y){return y===null||ut(y)?(e.exit("definition"),r.parser.defined.push(o),t(y)):n(y)}}function FV(e,t,n){return r;function r(l){return xr(l)?Fu(e,o)(l):n(l)}function o(l){return yP(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Lt(l)?Wt(e,a,"whitespace")(l):a(l)}function a(l){return l===null||ut(l)?t(l):n(l)}}const zV={name:"hardBreakEscape",tokenize:BV};function BV(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return ut(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const UV={name:"headingAtx",resolve:HV,tokenize:VV};function HV(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"},Ys(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function VV(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||xr(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||ut(p)?(e.exit("atxHeading"),t(p)):Lt(p)?Wt(e,l,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),l(p))}function f(p){return p===null||p===35||xr(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),f)}}const WV=["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"],WS=["pre","script","style","textarea"],qV={concrete:!0,name:"htmlFlow",resolveTo:YV,tokenize:XV},KV={partial:!0,tokenize:JV},GV={partial:!0,tokenize:QV};function YV(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 XV(e,t,n){const r=this;let o,i,a,l,d;return f;function f(q){return p(q)}function p(q){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(q),h}function h(q){return q===33?(e.consume(q),g):q===47?(e.consume(q),i=!0,w):q===63?(e.consume(q),o=3,r.interrupt?t:M):Bs(q)?(e.consume(q),a=String.fromCharCode(q),b):n(q)}function g(q){return q===45?(e.consume(q),o=2,y):q===91?(e.consume(q),o=5,l=0,S):Bs(q)?(e.consume(q),o=4,r.interrupt?t:M):n(q)}function y(q){return q===45?(e.consume(q),r.interrupt?t:M):n(q)}function S(q){const J="CDATA[";return q===J.charCodeAt(l++)?(e.consume(q),l===J.length?r.interrupt?t:F:S):n(q)}function w(q){return Bs(q)?(e.consume(q),a=String.fromCharCode(q),b):n(q)}function b(q){if(q===null||q===47||q===62||xr(q)){const J=q===47,ne=a.toLowerCase();return!J&&!i&&WS.includes(ne)?(o=1,r.interrupt?t(q):F(q)):WV.includes(a.toLowerCase())?(o=6,J?(e.consume(q),j):r.interrupt?t(q):F(q)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(q):i?N(q):k(q))}return q===45||Ir(q)?(e.consume(q),a+=String.fromCharCode(q),b):n(q)}function j(q){return q===62?(e.consume(q),r.interrupt?t:F):n(q)}function N(q){return Lt(q)?(e.consume(q),N):z(q)}function k(q){return q===47?(e.consume(q),z):q===58||q===95||Bs(q)?(e.consume(q),C):Lt(q)?(e.consume(q),k):z(q)}function C(q){return q===45||q===46||q===58||q===95||Ir(q)?(e.consume(q),C):I(q)}function I(q){return q===61?(e.consume(q),T):Lt(q)?(e.consume(q),I):k(q)}function T(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(e.consume(q),d=q,R):Lt(q)?(e.consume(q),T):D(q)}function R(q){return q===d?(e.consume(q),d=null,$):q===null||ut(q)?n(q):(e.consume(q),R)}function D(q){return q===null||q===34||q===39||q===47||q===60||q===61||q===62||q===96||xr(q)?I(q):(e.consume(q),D)}function $(q){return q===47||q===62||Lt(q)?k(q):n(q)}function z(q){return q===62?(e.consume(q),A):n(q)}function A(q){return q===null||ut(q)?F(q):Lt(q)?(e.consume(q),A):n(q)}function F(q){return q===45&&o===2?(e.consume(q),B):q===60&&o===1?(e.consume(q),H):q===62&&o===4?(e.consume(q),V):q===63&&o===3?(e.consume(q),M):q===93&&o===5?(e.consume(q),U):ut(q)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(KV,Y,W)(q)):q===null||ut(q)?(e.exit("htmlFlowData"),W(q)):(e.consume(q),F)}function W(q){return e.check(GV,P,Y)(q)}function P(q){return e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),O}function O(q){return q===null||ut(q)?W(q):(e.enter("htmlFlowData"),F(q))}function B(q){return q===45?(e.consume(q),M):F(q)}function H(q){return q===47?(e.consume(q),a="",L):F(q)}function L(q){if(q===62){const J=a.toLowerCase();return WS.includes(J)?(e.consume(q),V):F(q)}return Bs(q)&&a.length<8?(e.consume(q),a+=String.fromCharCode(q),L):F(q)}function U(q){return q===93?(e.consume(q),M):F(q)}function M(q){return q===62?(e.consume(q),V):q===45&&o===2?(e.consume(q),M):F(q)}function V(q){return q===null||ut(q)?(e.exit("htmlFlowData"),Y(q)):(e.consume(q),V)}function Y(q){return e.exit("htmlFlow"),t(q)}}function QV(e,t,n){const r=this;return o;function o(a){return ut(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 JV(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Am,t,n)}}const ZV={name:"htmlText",tokenize:eW};function eW(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),d}function d(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),I):M===63?(e.consume(M),k):Bs(M)?(e.consume(M),D):n(M)}function f(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),i=0,S):Bs(M)?(e.consume(M),N):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):ut(M)?(a=h,H(M)):(e.consume(M),h)}function g(M){return M===45?(e.consume(M),y):h(M)}function y(M){return M===62?B(M):M===45?g(M):h(M)}function S(M){const V="CDATA[";return M===V.charCodeAt(i++)?(e.consume(M),i===V.length?w:S):n(M)}function w(M){return M===null?n(M):M===93?(e.consume(M),b):ut(M)?(a=w,H(M)):(e.consume(M),w)}function b(M){return M===93?(e.consume(M),j):w(M)}function j(M){return M===62?B(M):M===93?(e.consume(M),j):w(M)}function N(M){return M===null||M===62?B(M):ut(M)?(a=N,H(M)):(e.consume(M),N)}function k(M){return M===null?n(M):M===63?(e.consume(M),C):ut(M)?(a=k,H(M)):(e.consume(M),k)}function C(M){return M===62?B(M):k(M)}function I(M){return Bs(M)?(e.consume(M),T):n(M)}function T(M){return M===45||Ir(M)?(e.consume(M),T):R(M)}function R(M){return ut(M)?(a=R,H(M)):Lt(M)?(e.consume(M),R):B(M)}function D(M){return M===45||Ir(M)?(e.consume(M),D):M===47||M===62||xr(M)?$(M):n(M)}function $(M){return M===47?(e.consume(M),B):M===58||M===95||Bs(M)?(e.consume(M),z):ut(M)?(a=$,H(M)):Lt(M)?(e.consume(M),$):B(M)}function z(M){return M===45||M===46||M===58||M===95||Ir(M)?(e.consume(M),z):A(M)}function A(M){return M===61?(e.consume(M),F):ut(M)?(a=A,H(M)):Lt(M)?(e.consume(M),A):$(M)}function F(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),o=M,W):ut(M)?(a=F,H(M)):Lt(M)?(e.consume(M),F):(e.consume(M),P)}function W(M){return M===o?(e.consume(M),o=void 0,O):M===null?n(M):ut(M)?(a=W,H(M)):(e.consume(M),W)}function P(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||xr(M)?$(M):(e.consume(M),P)}function O(M){return M===47||M===62||xr(M)?$(M):n(M)}function B(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function H(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),L}function L(M){return Lt(M)?Wt(e,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):U(M)}function U(M){return e.enter("htmlTextData"),a(M)}}const Uw={name:"labelEnd",resolveAll:sW,resolveTo:oW,tokenize:iW},tW={tokenize:aW},nW={tokenize:lW},rW={tokenize:cW};function sW(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&&Ys(e,0,e.length,n),e}function oW(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 d={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",d,t],["enter",f,t]],l=Yr(l,e.slice(i+1,i+r+3)),l=Yr(l,[["enter",p,t]]),l=Yr(l,Bw(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Yr(l,[["exit",p,t],e[a-2],e[a-1],["exit",f,t]]),l=Yr(l,e.slice(a+1)),l=Yr(l,[["exit",d,t]]),Ys(e,i,e.length,l),e}function iW(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(Ol(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),d):n(g)}function d(g){return g===40?e.attempt(tW,p,a?p:h)(g):g===91?e.attempt(nW,p,a?f:h)(g):a?p(g):h(g)}function f(g){return e.attempt(rW,p,h)(g)}function p(g){return t(g)}function h(g){return i._balanced=!0,n(g)}}function aW(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 xr(h)?Fu(e,i)(h):i(h)}function i(h){return h===41?p(h):gP(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return xr(h)?Fu(e,d)(h):p(h)}function l(h){return n(h)}function d(h){return h===34||h===39||h===40?yP(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):p(h)}function f(h){return xr(h)?Fu(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 lW(e,t,n){const r=this;return o;function o(l){return xP.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Ol(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function cW(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 uW={name:"labelStartImage",resolveAll:Uw.resolveAll,tokenize:dW};function dW(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 fW={name:"labelStartLink",resolveAll:Uw.resolveAll,tokenize:pW};function pW(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 gy={name:"lineEnding",tokenize:hW};function hW(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Wt(e,t,"linePrefix")}}const Bp={name:"thematicBreak",tokenize:mW};function mW(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"),d(f)):r>=3&&(f===null||ut(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===o?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),Lt(f)?Wt(e,l,"whitespace")(f):l(f))}}const fr={continuation:{tokenize:bW},exit:wW,name:"list",tokenize:yW},gW={partial:!0,tokenize:jW},xW={partial:!0,tokenize:vW};function yW(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 S=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Vb(y)){if(r.containerState.type||(r.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Bp,n,f)(y):f(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(y)}return n(y)}function d(y){return Vb(y)&&++a<10?(e.consume(y),d):(!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(Am,r.interrupt?n:p,e.attempt(gW,g,h))}function p(y){return r.containerState.initialBlankLine=!0,i++,g(y)}function h(y){return Lt(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 bW(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Am,o,i);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Wt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Lt(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(xW,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Wt(e,e.attempt(fr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function vW(e,t,n){const r=this;return Wt(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 wW(e){e.exit(this.containerState.type)}function jW(e,t,n){const r=this;return Wt(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!Lt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const qS={name:"setextUnderline",resolveTo:kW,tokenize:SW};function kW(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 SW(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"),Lt(f)?Wt(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||ut(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const NW={tokenize:CW};function CW(e){const t=this,n=e.attempt(Am,r,e.attempt(this.parser.constructs.flowInitial,o,Wt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(PV,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 EW={resolveAll:vP()},TW=bP("string"),RW=bP("text");function bP(e){return{resolveAll:vP(e==="text"?AW: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),d}function d(p){return f(p)?(n.exit("data"),i(p)):(n.consume(p),d)}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 vP(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 AW(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,d;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)d=!0,l++;else if(f!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const f={type:n===e.length||d||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 PW={42:fr,43:fr,45:fr,48:fr,49:fr,50:fr,51:fr,52:fr,53:fr,54:fr,55:fr,56:fr,57:fr,62:fP},_W={91:MV},DW={[-2]:my,[-1]:my,32:my},$W={35:UV,42:Bp,45:[qS,Bp],60:qV,61:qS,95:Bp,96:VS,126:VS},IW={38:hP,92:pP},MW={[-5]:gy,[-4]:gy,[-3]:gy,33:uW,38:hP,42:Wb,60:[fV,ZV],91:fW,92:[zV,pP],93:Uw,95:Wb,96:NV},LW={null:[Wb,EW]},OW={null:[42,95]},FW={null:[]},zW=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:OW,contentInitial:_W,disable:FW,document:PW,flow:$W,flowInitial:DW,insideSpan:LW,string:IW,text:MW},Symbol.toStringTag,{value:"Module"}));function BW(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 d={attempt:R(I),check:R(T),consume:N,enter:k,exit:C,interrupt:R(T,{interrupt:!0})},f={code:null,containerState:{},defineSkip:w,events:[],now:S,parser:e,previous:null,sliceSerialize:g,sliceStream:y,write:h};let p=t.tokenize.call(f,d);return t.resolveAll&&i.push(t),f;function h(A){return a=Yr(a,A),b(),a[a.length-1]!==null?[]:(D(t,0),f.events=Bw(i,f.events,f),f.events)}function g(A,F){return HW(y(A),F)}function y(A){return UW(a,A)}function S(){const{_bufferIndex:A,_index:F,line:W,column:P,offset:O}=r;return{_bufferIndex:A,_index:F,line:W,column:P,offset:O}}function w(A){o[A.line]=A.column,z()}function b(){let A;for(;r._index<a.length;){const F=a[r._index];if(typeof F=="string")for(A=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===A&&r._bufferIndex<F.length;)j(F.charCodeAt(r._bufferIndex));else j(F)}}function j(A){p=p(A)}function N(A){ut(A)?(r.line++,r.column=1,r.offset+=A===-3?2:1,z()):A!==-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=A}function k(A,F){const W=F||{};return W.type=A,W.start=S(),f.events.push(["enter",W,f]),l.push(W),W}function C(A){const F=l.pop();return F.end=S(),f.events.push(["exit",F,f]),F}function I(A,F){D(A,F.from)}function T(A,F){F.restore()}function R(A,F){return W;function W(P,O,B){let H,L,U,M;return Array.isArray(P)?Y(P):"tokenize"in P?Y([P]):V(P);function V(Q){return ce;function ce(te){const pe=te!==null&&Q[te],be=te!==null&&Q.null,Ee=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(be)?be:be?[be]:[]];return Y(Ee)(te)}}function Y(Q){return H=Q,L=0,Q.length===0?B:q(Q[L])}function q(Q){return ce;function ce(te){return M=$(),U=Q,Q.partial||(f.currentConstruct=Q),Q.name&&f.parser.constructs.disable.null.includes(Q.name)?ne():Q.tokenize.call(F?Object.assign(Object.create(f),F):f,d,J,ne)(te)}}function J(Q){return A(U,M),O}function ne(Q){return M.restore(),++L<H.length?q(H[L]):B}}}function D(A,F){A.resolveAll&&!i.includes(A)&&i.push(A),A.resolve&&Ys(f.events,F,f.events.length-F,A.resolve(f.events.slice(F),f)),A.resolveTo&&(f.events=A.resolveTo(f.events,f))}function $(){const A=S(),F=f.previous,W=f.currentConstruct,P=f.events.length,O=Array.from(l);return{from:P,restore:B};function B(){r=A,f.previous=F,f.currentConstruct=W,f.events.length=P,l=O,z()}}function z(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function UW(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 HW(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=`
|
|
587
|
+
`;break}case-3:{a=`\r
|
|
588
|
+
`;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 VW(e){const r={constructs:QH([zW,...(e||{}).extensions||[]]),content:o(oV),defined:[],document:o(aV),flow:o(NW),lazy:{},string:o(TW),text:o(RW)};return r;function o(i){return a;function a(l){return BW(r,i,l)}}}function WW(e){for(;!mP(e););return e}const KS=/[\0\t\n\r]/g;function qW(){let e=1,t="",n=!0,r;return o;function o(i,a,l){const d=[];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(KS.lastIndex=h,f=KS.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)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),h<g&&(d.push(i.slice(h,g)),e+=g-h),y){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}h=g+1}return l&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const KW=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function GW(e){return e.replace(KW,YW)}function YW(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return dP(n.slice(i?2:1),i?16:10)}return zw(n)||e}const wP={}.hasOwnProperty;function XW(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),QW(n)(WW(VW(n).document().write(qW()(e,t,!0))))}function QW(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ue),autolinkProtocol:$,autolinkEmail:$,atxHeading:i(oe),blockQuote:i(be),characterEscape:$,characterReference:$,codeFenced:i(Ee),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Ee,a),codeText:i(Te,a),codeTextData:$,data:$,codeFlowValue:$,definition:i(Se),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Be),hardBreakEscape:i(je),hardBreakTrailing:i(je),htmlFlow:i(ke,a),htmlFlowData:$,htmlText:i(ke,a),htmlTextData:$,image:i(_e),label:a,link:i(Ue),listItem:i(Me),listItemValue:g,listOrdered:i(et,h),listUnordered:i(et),paragraph:i(qe),reference:q,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(oe),strong:i(vt),thematicBreak:i(st)},exit:{atxHeading:d(),atxHeadingSequence:I,autolink:d(),autolinkEmail:pe,autolinkProtocol:te,blockQuote:d(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:ne,characterReferenceMarkerNumeric:ne,characterReferenceValue:Q,characterReference:ce,codeFenced:d(b),codeFencedFence:w,codeFencedFenceInfo:y,codeFencedFenceMeta:S,codeFlowValue:z,codeIndented:d(j),codeText:d(O),codeTextData:z,data:z,definition:d(),definitionDestinationString:C,definitionLabelString:N,definitionTitleString:k,emphasis:d(),hardBreakEscape:d(F),hardBreakTrailing:d(F),htmlFlow:d(W),htmlFlowData:z,htmlText:d(P),htmlTextData:z,image:d(H),label:U,labelText:L,lineEnding:A,link:d(B),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:J,resourceDestinationString:M,resourceTitleString:V,resource:Y,setextHeading:d(D),setextHeadingLineSequence:R,setextHeadingText:T,strong:d(),thematicBreak:d()}};jP(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(le){let ee={type:"root",children:[]};const ye={stack:[ee],tokenStack:[],config:t,enter:l,exit:f,buffer:a,resume:p,data:n},ie=[];let we=-1;for(;++we<le.length;)if(le[we][1].type==="listOrdered"||le[we][1].type==="listUnordered")if(le[we][0]==="enter")ie.push(we);else{const $e=ie.pop();we=o(le,$e,we)}for(we=-1;++we<le.length;){const $e=t[le[we][0]];wP.call($e,le[we][1].type)&&$e[le[we][1].type].call(Object.assign({sliceSerialize:le[we][2].sliceSerialize},ye),le[we][1])}if(ye.tokenStack.length>0){const $e=ye.tokenStack[ye.tokenStack.length-1];($e[1]||GS).call(ye,void 0,$e[0])}for(ee.position={start:Yo(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:Yo(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)ee=t.transforms[we](ee)||ee;return ee}function o(le,ee,ye){let ie=ee-1,we=-1,$e=!1,Ce,se,me,Pe;for(;++ie<=ye;){const Ke=le[ie];switch(Ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ke[0]==="enter"?we++:we--,Pe=void 0;break}case"lineEndingBlank":{Ke[0]==="enter"&&(Ce&&!Pe&&!we&&!me&&(me=ie),Pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pe=void 0}if(!we&&Ke[0]==="enter"&&Ke[1].type==="listItemPrefix"||we===-1&&Ke[0]==="exit"&&(Ke[1].type==="listUnordered"||Ke[1].type==="listOrdered")){if(Ce){let de=ie;for(se=void 0;de--;){const pt=le[de];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;se&&(le[se][1].type="lineEndingBlank",$e=!0),pt[1].type="lineEnding",se=de}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}me&&(!se||me<se)&&(Ce._spread=!0),Ce.end=Object.assign({},se?le[se][1].start:Ke[1].end),le.splice(se||ie,0,["exit",Ce,Ke[2]]),ie++,ye++}if(Ke[1].type==="listItemPrefix"){const de={type:"listItem",_spread:!1,start:Object.assign({},Ke[1].start),end:void 0};Ce=de,le.splice(ie,0,["enter",de,Ke[2]]),ie++,ye++,me=void 0,Pe=!0}}}return le[ee][1]._spread=$e,ye}function i(le,ee){return ye;function ye(ie){l.call(this,le(ie),ie),ee&&ee.call(this,ie)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(le,ee,ye){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([ee,ye||void 0]),le.position={start:Yo(ee.start),end:void 0}}function d(le){return ee;function ee(ye){le&&le.call(this,ye),f.call(this,ye)}}function f(le,ee){const ye=this.stack.pop(),ie=this.tokenStack.pop();if(ie)ie[0].type!==le.type&&(ee?ee.call(this,le,ie[0]):(ie[1]||GS).call(this,le,ie[0]));else throw new Error("Cannot close `"+le.type+"` ("+Ou({start:le.start,end:le.end})+"): it’s not open");ye.position.end=Yo(le.end)}function p(){return YH(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(le){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function y(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=le}function S(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=le}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.value=le.replace(/(\r?\n|\r)$/g,"")}function N(le){const ee=this.resume(),ye=this.stack[this.stack.length-1];ye.label=ee,ye.identifier=Ol(this.sliceSerialize(le)).toLowerCase()}function k(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.title=le}function C(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.url=le}function I(le){const ee=this.stack[this.stack.length-1];if(!ee.depth){const ye=this.sliceSerialize(le).length;ee.depth=ye}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function R(le){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function $(le){const ye=this.stack[this.stack.length-1].children;let ie=ye[ye.length-1];(!ie||ie.type!=="text")&&(ie=ft(),ie.position={start:Yo(le.start),end:void 0},ye.push(ie)),this.stack.push(ie)}function z(le){const ee=this.stack.pop();ee.value+=this.sliceSerialize(le),ee.position.end=Yo(le.end)}function A(le){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ye=ee.children[ee.children.length-1];ye.position.end=Yo(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&($.call(this,le),z.call(this,le))}function F(){this.data.atHardBreak=!0}function W(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.value=le}function P(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.value=le}function O(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.value=le}function B(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ee,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function H(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ee,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function L(le){const ee=this.sliceSerialize(le),ye=this.stack[this.stack.length-2];ye.label=GW(ee),ye.identifier=Ol(ee).toLowerCase()}function U(){const le=this.stack[this.stack.length-1],ee=this.resume(),ye=this.stack[this.stack.length-1];if(this.data.inReference=!0,ye.type==="link"){const ie=le.children;ye.children=ie}else ye.alt=ee}function M(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.url=le}function V(){const le=this.resume(),ee=this.stack[this.stack.length-1];ee.title=le}function Y(){this.data.inReference=void 0}function q(){this.data.referenceType="collapsed"}function J(le){const ee=this.resume(),ye=this.stack[this.stack.length-1];ye.label=ee,ye.identifier=Ol(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function ne(le){this.data.characterReferenceType=le.type}function Q(le){const ee=this.sliceSerialize(le),ye=this.data.characterReferenceType;let ie;ye?(ie=dP(ee,ye==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ie=zw(ee);const we=this.stack[this.stack.length-1];we.value+=ie}function ce(le){const ee=this.stack.pop();ee.position.end=Yo(le.end)}function te(le){z.call(this,le);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(le)}function pe(le){z.call(this,le);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(le)}function be(){return{type:"blockquote",children:[]}}function Ee(){return{type:"code",lang:null,meta:null,value:""}}function Te(){return{type:"inlineCode",value:""}}function Se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Be(){return{type:"emphasis",children:[]}}function oe(){return{type:"heading",depth:0,children:[]}}function je(){return{type:"break"}}function ke(){return{type:"html",value:""}}function _e(){return{type:"image",title:null,url:"",alt:null}}function Ue(){return{type:"link",title:null,url:"",children:[]}}function et(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function Me(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function qe(){return{type:"paragraph",children:[]}}function vt(){return{type:"strong",children:[]}}function ft(){return{type:"text",value:""}}function st(){return{type:"thematicBreak"}}}function Yo(e){return{line:e.line,column:e.column,offset:e.offset}}function jP(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?jP(e,r):JW(e,r)}}function JW(e,t){let n;for(n in t)if(wP.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 GS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ou({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ou({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ou({start:t.start,end:t.end})+") is still open")}function ZW(e){const t=this;t.parser=n;function n(r){return XW(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function eq(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 tq(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
589
|
+
`}]}function nq(e,t){const n=t.value?t.value+`
|
|
590
|
+
`:"",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 rq(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sq(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oq(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=wc(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 d={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,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function iq(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 aq(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function kP(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 lq(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kP(e,t);const o={src:wc(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 cq(e,t){const n={src:wc(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 uq(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 dq(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kP(e,t);const o={href:wc(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 fq(e,t){const n={href:wc(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 pq(e,t,n){const r=e.all(t),o=n?hq(n):SP(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:`
|
|
591
|
+
`}),p.type==="element"&&p.tagName==="p"&&!o?a.push(...p.children):a.push(p)}const d=r[r.length-1];d&&(o||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
|
|
592
|
+
`});const f={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,f),e.applyData(t,f)}function hq(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=SP(n[r])}return t}function SP(e){const t=e.spread;return t??e.children.length>1}function mq(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 gq(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xq(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function yq(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bq(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=Mw(t.children[1]),d=sP(t.children[t.children.length-1]);l&&d&&(a.position={start:l,end:d}),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 vq(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 d=-1;const f=[];for(;++d<l;){const h=t.children[d],g={},y=a?a[d]:void 0;y&&(g.align=y);let S={type:"element",tagName:i,properties:g,children:[]};h&&(S.children=e.all(h),e.patch(h,S),S=e.applyData(h,S)),f.push(S)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,p),e.applyData(t,p)}function wq(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const YS=9,XS=32;function jq(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const i=[];for(;r;)i.push(QS(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(QS(t.slice(o),o>0,!1)),i.join("")}function QS(e,t,n){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===YS||i===XS;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(o-1);for(;i===YS||i===XS;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function kq(e,t){const n={type:"text",value:jq(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Sq(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Nq={blockquote:eq,break:tq,code:nq,delete:rq,emphasis:sq,footnoteReference:oq,heading:iq,html:aq,imageReference:lq,image:cq,inlineCode:uq,linkReference:dq,link:fq,listItem:pq,list:mq,paragraph:gq,root:xq,strong:yq,table:bq,tableCell:wq,tableRow:vq,text:kq,thematicBreak:Sq,toml:ap,yaml:ap,definition:ap,footnoteDefinition:ap};function ap(){}const NP=-1,Pm=0,zu=1,bh=2,Hw=3,Vw=4,Ww=5,qw=6,CP=7,EP=8,JS=typeof self=="object"?self:globalThis,Cq=(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 Pm:case NP:return n(a,o);case zu:{const l=n([],o);for(const d of a)l.push(r(d));return l}case bh:{const l=n({},o);for(const[d,f]of a)l[r(d)]=r(f);return l}case Hw:return n(new Date(a),o);case Vw:{const{source:l,flags:d}=a;return n(new RegExp(l,d),o)}case Ww:{const l=n(new Map,o);for(const[d,f]of a)l.set(r(d),r(f));return l}case qw:{const l=n(new Set,o);for(const d of a)l.add(r(d));return l}case CP:{const{name:l,message:d}=a;return n(new JS[l](d),o)}case EP: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 JS[i](a),o)};return r},ZS=e=>Cq(new Map,e)(0),fl="",{toString:Eq}={},{keys:Tq}=Object,mu=e=>{const t=typeof e;if(t!=="object"||!e)return[Pm,t];const n=Eq.call(e).slice(8,-1);switch(n){case"Array":return[zu,fl];case"Object":return[bh,fl];case"Date":return[Hw,fl];case"RegExp":return[Vw,fl];case"Map":return[Ww,fl];case"Set":return[qw,fl];case"DataView":return[zu,n]}return n.includes("Array")?[zu,n]:n.includes("Error")?[CP,n]:[bh,n]},lp=([e,t])=>e===Pm&&(t==="function"||t==="symbol"),Rq=(e,t,n,r)=>{const o=(a,l)=>{const d=r.push(a)-1;return n.set(l,d),d},i=a=>{if(n.has(a))return n.get(a);let[l,d]=mu(a);switch(l){case Pm:{let p=a;switch(d){case"bigint":l=EP,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return o([NP],a)}return o([l,p],a)}case zu:{if(d){let g=a;return d==="DataView"?g=new Uint8Array(a.buffer):d==="ArrayBuffer"&&(g=new Uint8Array(a)),o([d,[...g]],a)}const p=[],h=o([l,p],a);for(const g of a)p.push(i(g));return h}case bh:{if(d)switch(d){case"BigInt":return o([d,a.toString()],a);case"Boolean":case"Number":case"String":return o([d,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const p=[],h=o([l,p],a);for(const g of Tq(a))(e||!lp(mu(a[g])))&&p.push([i(g),i(a[g])]);return h}case Hw:return o([l,a.toISOString()],a);case Vw:{const{source:p,flags:h}=a;return o([l,{source:p,flags:h}],a)}case Ww:{const p=[],h=o([l,p],a);for(const[g,y]of a)(e||!(lp(mu(g))||lp(mu(y))))&&p.push([i(g),i(y)]);return h}case qw:{const p=[],h=o([l,p],a);for(const g of a)(e||!lp(mu(g)))&&p.push(i(g));return h}}const{message:f}=a;return o([l,{name:d,message:f}],a)};return i},eN=(e,{json:t,lossy:n}={})=>{const r=[];return Rq(!(t||n),!!t,new Map,r)(e),r},vh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ZS(eN(e,t)):structuredClone(e):(e,t)=>ZS(eN(e,t));function Aq(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 Pq(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function _q(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Aq,r=e.options.footnoteBackLabel||Pq,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const p=e.all(f),h=String(f.identifier).toUpperCase(),g=wc(h.toLowerCase());let y=0;const S=[],w=e.footnoteCounts.get(h);for(;w!==void 0&&++y<=w;){S.length>0&&S.push({type:"text",value:" "});let N=typeof n=="string"?n:n(d,y);typeof N=="string"&&(N={type:"text",value:N}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+g+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,y),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const b=p[p.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const N=b.children[b.children.length-1];N&&N.type==="text"?N.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...S)}else p.push(...S);const j={type:"element",tagName:"li",properties:{id:t+"fn-"+g},children:e.wrap(p,!0)};e.patch(f,j),l.push(j)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...vh(a),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
593
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
594
|
+
`}]}}const TP=(function(e){if(e==null)return Mq;if(typeof e=="function")return _m(e);if(typeof e=="object")return Array.isArray(e)?Dq(e):$q(e);if(typeof e=="string")return Iq(e);throw new Error("Expected function, string, or object as test")});function Dq(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=TP(e[n]);return _m(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function $q(e){const t=e;return _m(n);function n(r){const o=r;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function Iq(e){return _m(t);function t(n){return n&&n.type===e}}function _m(e){return t;function t(n,r,o){return!!(Lq(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function Mq(){return!0}function Lq(e){return e!==null&&typeof e=="object"&&"type"in e}const RP=[],Oq=!0,tN=!1,Fq="skip";function zq(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const i=TP(o),a=r?-1:1;l(e,void 0,[])();function l(d,f,p){const h=d&&typeof d=="object"?d:{};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 ("+(d.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=RP,S,w,b;if((!t||i(d,f,p[p.length-1]||void 0))&&(y=Bq(n(d,p)),y[0]===tN))return y;if("children"in d&&d.children){const j=d;if(j.children&&y[0]!==Fq)for(w=(r?j.children.length:-1)+a,b=p.concat(j);w>-1&&w<j.children.length;){const N=j.children[w];if(S=l(N,w,b)(),S[0]===tN)return S;w=typeof S[1]=="number"?S[1]:w+a}}return y}}}function Bq(e){return Array.isArray(e)?e:typeof e=="number"?[Oq,e]:e==null?RP:[e]}function AP(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),zq(e,i,l,o);function l(d,f){const p=f[f.length-1],h=p?p.children.indexOf(d):void 0;return a(d,h,p)}}const qb={}.hasOwnProperty,Uq={};function Hq(e,t){const n=t||Uq,r=new Map,o=new Map,i=new Map,a={...Nq,...n.handlers},l={all:f,applyData:Wq,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:a,one:d,options:n,patch:Vq,wrap:Kq};return AP(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 d(p,h){const g=p.type,y=l.handlers[g];if(qb.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:w,...b}=p,j=vh(b);return j.children=l.all(p),j}return vh(p)}return(l.options.unknownHandler||qq)(l,p,h)}function f(p){const h=[];if("children"in p){const g=p.children;let y=-1;for(;++y<g.length;){const S=l.one(g[y],p);if(S){if(y&&g[y-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=nN(S.value)),!Array.isArray(S)&&S.type==="element")){const w=S.children[0];w&&w.type==="text"&&(w.value=nN(w.value))}Array.isArray(S)?h.push(...S):h.push(S)}}}return h}}function Vq(e,t){e.position&&(t.position=EH(e))}function Wq(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,vh(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function qq(e,t){const n=t.data||{},r="value"in t&&!(qb.call(n,"hProperties")||qb.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 Kq(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
595
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
596
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
597
|
+
`}),n}function nN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function rN(e,t){const n=Hq(e,t),r=n.one(e,void 0),o=_q(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
|
|
598
|
+
`},o),i}function Gq(e,t){return e&&"run"in e?async function(n,r){const o=rN(n,{file:r,...t});await e.run(o,r)}:function(n,r){return rN(n,{file:r,...e||t})}}function sN(e){if(e)throw e}var xy,oN;function Yq(){if(oN)return xy;oN=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 xy=function d(){var f,p,h,g,y,S,w=arguments[0],b=1,j=arguments.length,N=!1;for(typeof w=="boolean"&&(N=w,w=arguments[1]||{},b=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});b<j;++b)if(f=arguments[b],f!=null)for(p in f)h=l(w,p),g=l(f,p),w!==g&&(N&&g&&(i(g)||(y=o(g)))?(y?(y=!1,S=h&&o(h)?h:[]):S=h&&i(h)?h:{},a(w,{name:p,newValue:d(N,S,g)})):typeof g<"u"&&a(w,{name:p,newValue:g}));return w},xy}var Xq=Yq();const yy=bd(Xq);function Kb(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 Qq(){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(d,...f){const p=e[++i];let h=-1;if(d){a(d);return}for(;++h<o.length;)(f[h]===null||f[h]===void 0)&&(f[h]=o[h]);o=f,p?Jq(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 Jq(e,t){let n;return r;function r(...a){const l=e.length>a.length;let d;l&&a.push(o);try{d=e.apply(this,a)}catch(f){const p=f;if(l&&n)throw p;return o(p)}l||(d&&d.then&&typeof d.then=="function"?d.then(i,o):d instanceof Error?o(d):i(d))}function o(a,...l){n||(n=!0,t(a,...l))}function i(a){o(null,a)}}const Os={basename:Zq,dirname:eK,extname:tK,join:nK,sep:"/"};function Zq(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ud(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 eK(e){if(Ud(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 tK(e){Ud(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 nK(...e){let t=-1,n;for(;++t<e.length;)Ud(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":rK(n)}function rK(e){Ud(e);const t=e.codePointAt(0)===47;let n=sK(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function sK(e,t){let n="",r=0,o=-1,i=0,a=-1,l,d;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(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),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 Ud(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const oK={cwd:iK};function iK(){return"/"}function Gb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function aK(e){if(typeof e=="string")e=new URL(e);else if(!Gb(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 lK(e)}function lK(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 by=["history","path","basename","stem","extname","dirname"];class PP{constructor(t){let n;t?Gb(t)?n={path:t}:typeof t=="string"||cK(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":oK.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<by.length;){const i=by[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)by.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Os.basename(this.path):void 0}set basename(t){wy(t,"basename"),vy(t,"basename"),this.path=Os.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Os.dirname(this.path):void 0}set dirname(t){iN(this.basename,"dirname"),this.path=Os.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Os.extname(this.path):void 0}set extname(t){if(vy(t,"extname"),iN(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=Os.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Gb(t)&&(t=aK(t)),wy(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Os.basename(this.path,this.extname):void 0}set stem(t){wy(t,"stem"),vy(t,"stem"),this.path=Os.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 er(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 vy(e,t){if(e&&e.includes(Os.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Os.sep+"`")}function wy(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function iN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function cK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const uK=(function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),dK={}.hasOwnProperty;class Kw extends uK{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=Qq()}copy(){const t=new Kw;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(yy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Sy("data",this.frozen),this.namespace[t]=n,this):dK.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Sy("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=cp(t),r=this.parser||this.Parser;return jy("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),jy("process",this.parser||this.Parser),ky("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,a){const l=cp(t),d=r.parse(l);r.run(d,l,function(p,h,g){if(p||!h||!g)return f(p);const y=h,S=r.stringify(y,g);hK(S)?g.value=S:g.result=S,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(),jy("processSync",this.parser||this.Parser),ky("processSync",this.compiler||this.Compiler),this.process(t,o),lN("processSync","process",n),r;function o(i,a){n=!0,sN(i),r=a}}run(t,n,r){aN(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 d=cp(n);o.run(t,d,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),lN("runSync","run",r),o;function i(a,l){sN(a),o=l,r=!0}}stringify(t,n){this.freeze();const r=cp(n),o=this.compiler||this.Compiler;return ky("stringify",o),aN(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Sy("use",this.frozen),t!=null)if(typeof t=="function")d(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")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...h]=f;d(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=yy(!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 d(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,...S]=p;const w=r[g][1];Kb(w)&&Kb(y)&&(y=yy(!0,w,y)),r[g]=[f,y,...S]}}}}const fK=new Kw().freeze();function jy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ky(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Sy(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 aN(e){if(!Kb(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function lN(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function cp(e){return pK(e)?e:new PP(e)}function pK(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function hK(e){return typeof e=="string"||mK(e)}function mK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const gK="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",cN=[],uN={allowDangerousHtml:!0},xK=/^(https?|ircs?|mailto|xmpp)$/i,yK=[{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 bK(e){const t=vK(e),n=wK(e);return jK(t.runSync(t.parse(n),n),e)}function vK(e){const t=e.rehypePlugins||cN,n=e.remarkPlugins||cN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...uN}:uN;return fK().use(ZW).use(n).use(Gq,r).use(t)}function wK(e){const t=e.children||"",n=new PP;return typeof t=="string"&&(n.value=t),n}function jK(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,d=t.urlTransform||kK;for(const p of yK)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+gK+p.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),AP(e,f),_H(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 hy)if(Object.hasOwn(hy,y)&&Object.hasOwn(p.properties,y)){const S=p.properties[y],w=hy[y];(w===null||w.includes(p.tagName))&&(p.properties[y]=d(String(S||""),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 kK(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||xK.test(e.slice(0,t))?e:""}function vn({content:e,className:t,emptyState:n="No markdown content yet."}){const r=e.replace(/<!--[\s\S]*?-->/g,"");return r.trim()?s.jsx("div",{className:Ne("prose-syntaur max-w-none",t),children:s.jsx(bK,{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 ts(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function SK(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 d=await fetch(ts(e));if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),a(null)}catch(d){a(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),dc(d=>{d.type==="todos-updated"&&d.projectSlug===e&&l()}),{data:t,loading:r,error:i,refetch:l}}async function NK(e,t,n){await fetch(ts(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function CK(e,t,n){await fetch(`${ts(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function EK(e,t,n){await fetch(`${ts(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function TK(e,t,n){await fetch(`${ts(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function RK(e,t){await fetch(`${ts(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function AK(e,t){await fetch(`${ts(e)}/${t}`,{method:"DELETE"})}async function PK(e,t,n){const r=await fetch(`${ts(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 _P(e,t,n){return`${ts(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function _K(e,t,n){for(const r of n){const o=await fetch(`${ts(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 DK(e,t,n){const r=await fetch(_P(e,t,n),{method:"DELETE"});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}async function DP(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 $K(e,t){return await DP(`${ts(e)}/promote`,t)}async function IK(e,t,n){await DP(`${ts(e)}/${t}/move`,{to:n})}const dN=[{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 $P({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=dN.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:dN.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 IP({item:e,copiedId:t,selected:n,editing:r,onBeginEdit:o,onEndEdit:i,onPatchDescription:a,onAddAttachments:l,onDeleteAttachment:d,attachmentUrl:f,onToggleSelected:p,onMoveOne:h,onStatusChange:g,onCopyId:y,onDelete:S,hotkeyRowProps:w,onDragOrigin:b,onDragStart:j,onDragEnd:N,isDragging:k}){return s.jsxs("div",{draggable:!0,"data-todo-id":e.id,...w??{},onMouseDown:b,onDragStart:C=>j(C,e.id),onDragEnd:N,className:`surface-panel flex items-start gap-3 px-3 py-2 cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${k?"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($P,{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(MP,{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(zK,{item:e})]}),s.jsx(LP,{item:e,attachmentUrl:f,onAdd:C=>l(e.id,C),onDelete:C=>d(e.id,C)})]}),t===e.id?s.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[s.jsx(Lr,{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(Jp,{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(Bh,{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=>S(C,e.id,e.description),children:s.jsx(jn,{className:"h-3 w-3"})})]})]})}function MP({description:e,status:t,editing:n,onBeginEdit:r,onEndEdit:o,onSave:i}){return n?s.jsx(MK,{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:Ne("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 MK({initialValue:e,onSave:t,onExit:n}){const r=m.useRef(e),[o,i]=m.useState(e),[a,l]=m.useState(!1),[d,f]=m.useState(!1),p=m.useRef(null),h=m.useRef(!1);m.useEffect(()=>{const w=p.current;w&&(w.focus(),w.select())},[]);const g=m.useCallback(()=>{var w;f(!0),window.setTimeout(()=>f(!1),260),(w=p.current)==null||w.focus()},[]),y=m.useCallback(async()=>{if(h.current)return;const w=o.trim();if(w.length===0){g();return}if(w===r.current){n();return}h.current=!0,l(!0);try{await t(w)}catch{}finally{l(!1),n()}},[o,n,t,g]);function S(w){w.key==="Enter"?(w.preventDefault(),y()):w.key==="Escape"&&(w.preventDefault(),h.current=!0,n())}return s.jsx("input",{ref:p,type:"text","data-no-drag":!0,disabled:a,value:o,onClick:w=>w.stopPropagation(),onChange:w=>i(w.target.value),onKeyDown:S,onBlur:()=>void y(),className:Ne("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",d&&"syntaur-input-shake",a&&"opacity-70")})}function LK(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function OK(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 LP({item:e,attachmentUrl:t,onAdd:n,onDelete:r}){const o=e.attachments??[],[i,a]=m.useState(!1),[l,d]=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){d(!0);try{await n(g),a(!1)}finally{d(!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(FK,{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(GE,{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=OK(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 FK({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:[LK(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(GE,{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(Nd,{className:"h-3 w-3"})})]})}function zK({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(ea,{delayDuration:120,children:s.jsxs(_r,{children:[s.jsx(Dr,{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(Nv,{className:"h-2.5 w-2.5"}),s.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),s.jsx(hr,{children:e.branch})]})}):null,e.planDir?s.jsx(ea,{delayDuration:120,children:s.jsxs(_r,{children:[s.jsx(Dr,{asChild:!0,children:s.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),Fd(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(qE,{className:"h-2.5 w-2.5"})})}),s.jsxs(hr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?s.jsx(ea,{delayDuration:120,children:s.jsxs(_r,{children:[s.jsx(Dr,{asChild:!0,children:s.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),s.jsx(hr,{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 OP="__one_off__";function Gw({open:e,selectedIds:t,scope:n,onOpenChange:r,onDone:o,defaultProject:i,defaultTitle:a,allowOneOff:l=!0}){const[d,f]=m.useState("new"),[p,h]=m.useState(!1),[g,y]=m.useState(null),[S,w]=m.useState(null),[b,j]=m.useState(null),[N,k]=m.useState(""),[C,I]=m.useState(""),[T,R]=m.useState(""),[D,$]=m.useState(""),[z,A]=m.useState(""),[F,W]=m.useState(""),[P,O]=m.useState(null),[B,H]=m.useState(!1),L=t.length>1;m.useEffect(()=>{if(!e){f("new"),y(null),k(""),I(""),R(""),$(""),A(""),W(""),O(null);return}k(i??""),I(a??"");let J=!1;return(async()=>{try{const ne=await fetch("/api/projects");if(!ne.ok)throw new Error(`HTTP ${ne.status}`);const Q=await ne.json();J||w(Q.filter(ce=>!ce.archived))}catch(ne){J||j(ne instanceof Error?ne.message:String(ne))}})(),()=>{J=!0}},[e,i,a]),m.useEffect(()=>{if(!z){O(null);return}let J=!1;return H(!0),(async()=>{try{const ne=await fetch(`/api/projects/${encodeURIComponent(z)}/assignments`);if(!ne.ok)throw new Error(`HTTP ${ne.status}`);const Q=await ne.json();J||O(Q)}catch{J||O([])}finally{J||H(!1)}})(),()=>{J=!0}},[z]);const U=m.useMemo(()=>S??[],[S]);async function M(J){if(J.preventDefault(),!N){y('Pick a target project (or "One-off").');return}if(L&&!C.trim()){y("Title is required when promoting multiple todos.");return}const ne=N===OP?{oneOff:!0}:{project:N};if(n.kind==="aggregate"){const ce={groups:n.groups,mode:"new-assignment",target:ne,title:C.trim()||void 0,type:T.trim()||void 0,priority:D||void 0};await q(ce);return}const Q={todoIds:t,mode:"new-assignment",target:ne,title:C.trim()||void 0,type:T.trim()||void 0,priority:D||void 0};await Y(Q)}async function V(J){if(J.preventDefault(),n.kind==="aggregate"){y("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!z||!F){y("Pick both project and assignment.");return}const ne={todoIds:t,mode:"to-assignment",target:{assignment:`${z}/${F}`}};await Y(ne)}async function Y(J){h(!0),y(null);try{let ne;if(n.kind==="workspace")ne=await kO(n.workspace,J);else if(n.kind==="project")ne=await $K(n.projectId,J);else throw new Error("Aggregate scope requires runBulkMutation.");o(ne),r(!1)}catch(ne){y(ne instanceof Error?ne.message:String(ne))}finally{h(!1)}}async function q(J){h(!0),y(null);try{const ne=await SO(J);o(ne),r(!1)}catch(ne){y(ne instanceof Error?ne.message:String(ne))}finally{h(!1)}}return s.jsx(Bn,{open:e,onOpenChange:J=>p?void 0:r(J),children:s.jsxs(_n,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsxs(Dn,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),s.jsxs(es,{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(YA,{value:d,onValueChange:J=>f(J),children:[s.jsxs(XA,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[s.jsx(Lb,{value:"new",className:Ne("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(Lb,{value:"existing",className:Ne("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(Ob,{value:"new",children:s.jsxs("form",{onSubmit:M,className:"space-y-4",children:[s.jsx(pl,{label:"Target project",children:s.jsx(fN,{value:N,onChange:k,projects:U,error:b,disabled:p,allowOneOff:l})}),s.jsx(pl,{label:L?"Title (required)":"Title (defaults to first todo)",children:s.jsx("input",{type:"text",value:C,onChange:J=>I(J.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(pl,{label:"Type",children:s.jsx("input",{type:"text",value:T,onChange:J=>R(J.target.value),placeholder:"feature",disabled:p,className:"editor-input bg-background/95 font-sans"})}),s.jsx(pl,{label:"Priority",children:s.jsxs("select",{value:D,onChange:J=>$(J.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(pN,{message:g}):null,s.jsx(hN,{onCancel:()=>r(!1),submitting:p,submitLabel:"Promote"})]})}),s.jsx(Ob,{value:"existing",children:s.jsxs("form",{onSubmit:V,className:"space-y-4",children:[s.jsx(pl,{label:"Project",children:s.jsx(fN,{value:z,onChange:J=>{A(J),W("")},projects:U,error:b,disabled:p})}),s.jsx(pl,{label:B?"Assignment (loading...)":"Assignment",children:s.jsxs("select",{value:F,onChange:J=>W(J.target.value),disabled:p||!z||B,className:"editor-input bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:z?"Select assignment...":"Pick a project first"}),(P??[]).map(J=>s.jsxs("option",{value:J.slug,children:[J.title," (",J.status,")"]},J.slug))]})}),g?s.jsx(pN,{message:g}):null,s.jsx(hN,{onCancel:()=>r(!1),submitting:p,submitLabel:"Promote"})]})})]})]})})}function pl({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 fN({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:OP,children:"One-off (no project)"}):null,n.map(a=>s.jsxs("option",{value:a.slug,children:[a.title," (",a.slug,")"]},a.slug))]})}function pN({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 hN({onCancel:e,submitting:t,submitLabel:n}){return s.jsxs(Fr,{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 FP({open:e,selectedIds:t,scope:n,onOpenChange:r,onDone:o}){const[i,a]=m.useState("project"),[l,d]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState(!1),[y,S]=m.useState(null),[w,b]=m.useState(null),[j,N]=m.useState(null);m.useEffect(()=>{if(!e){a("project"),d(""),p(""),S(null),b(null);return}let R=!1;return(async()=>{try{const D=await fetch("/api/projects");if(!D.ok)throw new Error(`HTTP ${D.status}`);const $=await D.json();R||N($.filter(z=>!z.archived))}catch(D){R||b(D instanceof Error?D.message:String(D))}})(),()=>{R=!0}},[e]);const k=m.useMemo(()=>j?n.kind==="project"?j.filter(R=>R.slug!==n.projectId):j:[],[j,n]);function C(){if(i==="global")return{global:!0};if(i==="workspace"){const R=l.trim();return R?{workspace:R}:"Workspace name is required."}return f?{project:f}:"Pick a target project."}async function I(R,D){try{return n.kind==="workspace"?await NO(n.workspace,R,D):await IK(n.projectId,R,D),{ok:!0}}catch($){return{ok:!1,error:$ instanceof Error?$.message:String($)}}}async function T(R){R.preventDefault(),b(null);const D=C();if(typeof D=="string"){b(D);return}g(!0),S(null);const $=[],z=[];for(const A of t){const F=await I(A,D);F.ok?$.push(A):z.push({id:A,error:F.error})}g(!1),o(),z.length===0?r(!1):S({succeeded:$,failed:z})}return s.jsx(Bn,{open:e,onOpenChange:R=>h?void 0:r(R),children:s.jsx(_n,{className:"max-w-xl",children:s.jsxs("form",{onSubmit:T,className:"space-y-4",children:[s.jsxs(sr,{children:[s.jsxs(Dn,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),s.jsxs(es,{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(Ny,{kind:"project",checked:i==="project",onChange:()=>a("project"),label:"Project"}),s.jsx(Ny,{kind:"workspace",checked:i==="workspace",onChange:()=>a("workspace"),label:"Workspace"}),s.jsx(Ny,{kind:"global",checked:i==="global",onChange:()=>a("global"),label:"Global"})]}),i==="project"?s.jsx(mN,{label:"Target project",children:s.jsxs("select",{value:f,onChange:R=>p(R.target.value),disabled:h,className:"editor-textarea w-full bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:"Select project..."}),k.map(R=>s.jsxs("option",{value:R.slug,children:[R.title," (",R.slug,")"]},R.slug))]})}):null,i==="workspace"?s.jsx(mN,{label:"Target workspace name",children:s.jsx("input",{type:"text",value:l,onChange:R=>d(R.target.value),disabled:h,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,w?s.jsx(BK,{message:w}):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(R=>s.jsxs("li",{children:["[t:",R.id,"] ",R.error]},R.id))})]}):null,s.jsxs(Fr,{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 mN({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 Ny({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 BK({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 Yw({label:e,count:t,expanded:n,onToggle:r,isDropTarget:o=!1,onDragOver:i,onDragLeave:a,onDrop:l,children:d}){return s.jsxs("div",{className:Ne("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(yr,{className:Ne("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:d})]})}const zP=[{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 Dm(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function Xw(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[Dm(n.status)].push(n);return zP.map(n=>({config:n,items:t[n.id]}))}const BP="syntaur.todos.sections.collapsed.v1",gN=Object.fromEntries(zP.map(e=>[e.id,e.defaultCollapsed]));function Cy(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(BP);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function UK(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(BP,JSON.stringify(e))}catch{}}function Qw(e){const[t,n]=m.useState(()=>Cy()[e]??{});m.useEffect(()=>{n(Cy()[e]??{})},[e]);const r=m.useCallback(i=>t[i]??gN[i],[t]),o=m.useCallback(i=>{const a=Cy(),l=a[e]??{},d=l[i]??gN[i],f={...l,[i]:!d};a[e]=f,UK(a),n(f)},[e]);return{isCollapsed:r,toggle:o}}function HK({projectId:e}){const{data:t,loading:n,error:r,refetch:o}=SK(e),[i,a]=m.useState(""),[l,d]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState(""),[y,S]=m.useState(null),[w,b]=m.useState(null),[j,N]=m.useState(new Set),[k,C]=m.useState(!1),[I,T]=m.useState(!1),[R,D]=m.useState(null),$=m.useRef(null);mi("list:todos");const z=Qw("project:"+e),[A,F]=m.useState(null),[W,P]=m.useState(null),O=m.useRef(null);async function B(ee,ye){ee.stopPropagation(),await Fd(ye)&&(S(ye),setTimeout(()=>S(ie=>ie===ye?null:ie),1500))}const H=m.useMemo(()=>{if(!(t!=null&&t.items))return[];const ee=new Set;for(const ye of t.items)for(const ie of ye.tags)ee.add(ie);return Array.from(ee).sort()},[t]),L=m.useMemo(()=>{if(!(t!=null&&t.items))return[];let ee=t.items;if(i.trim()){const ye=i.toLowerCase();ee=ee.filter(ie=>ie.description.toLowerCase().includes(ye)||ie.tags.some(we=>we.toLowerCase().includes(ye))||ie.id.includes(ye))}return l&&(ee=ee.filter(ye=>ye.status===l)),f&&(ee=ee.filter(ye=>ye.tags.includes(f))),ee},[t,i,l,f]);m.useEffect(()=>{N(new Set)},[i,l,f,e]);const U=m.useMemo(()=>L.filter(ee=>j.has(ee.id)).length,[L,j]),M=L.length>0&&U===L.length,V=U>0&&!M;function Y(ee){N(ye=>{const ie=new Set(ye);return ie.has(ee)?ie.delete(ee):ie.add(ee),ie})}function q(){N(ee=>{const ye=new Set(ee);if(M)for(const ie of L)ye.delete(ie.id);else for(const ie of L)ye.add(ie.id);return ye})}function J(){N(new Set)}const ne=R?[R]:Array.from(j);function Q(){N(new Set),D(null),o()}function ce(){N(new Set),o()}async function te(){h.trim()&&(await NK(e,h.trim()),g(""),o())}async function pe(ee,ye,ie){ee.stopPropagation(),window.confirm(`Delete "${ie}"? This can't be undone.`)&&(await AK(e,ye),o())}async function be(ee,ye){switch(ye){case"open":await RK(e,ee);break;case"in_progress":await TK(e,ee);break;case"completed":await CK(e,ee);break;case"blocked":await EK(e,ee);break}o()}async function Ee(ee,ye){await PK(e,ee,ye),o()}async function Te(ee,ye){await _K(e,ee,ye),o()}async function Se(ee,ye){await DK(e,ee,ye),o()}const Be=Xw(L),oe=Be.filter(ee=>!z.isCollapsed(ee.config.id)).flatMap(ee=>ee.items),{hotkeyRowProps:je}=Rd(oe,{scope:"list:todos",bindO:!1,onOpen:ee=>b(ee.id)});Jt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ee;return(ee=$.current)==null?void 0:ee.focus()}}),Jt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>o()});const[ke,_e]=js(),Ue=ke.get("focus");m.useEffect(()=>{if(!Ue||!(t!=null&&t.items))return;const ee=t.items.find(ie=>ie.id===Ue);if(!ee)return;const ye=Dm(ee.status);z.isCollapsed(ye)&&z.toggle(ye)},[Ue,t==null?void 0:t.items]),m.useEffect(()=>{if(!Ue)return;const ee=document.querySelector(`[data-todo-id="${window.CSS.escape(Ue)}"]`);if(!ee)return;ee.scrollIntoView({block:"nearest"}),ee.classList.add("ring-2","ring-primary/60");const ye=window.setTimeout(()=>{ee.classList.remove("ring-2","ring-primary/60"),_e(ie=>{const we=new URLSearchParams(ie);return we.delete("focus"),we},{replace:!0})},1500);return()=>window.clearTimeout(ye)},[Ue,oe.length,_e]);const et=A?(t==null?void 0:t.items.find(ee=>ee.id===A))??null:null;function Me(ee,ye){const ie=O.current;if(ie!=null&&ie.closest(Gl)){ee.preventDefault();return}ee.dataTransfer.effectAllowed="move",ee.dataTransfer.setData("text/plain",ye),F(ye)}function qe(){F(null),P(null)}function vt(ee,ye){!et||ye.statuses.includes(et.status)||(ee.preventDefault(),ee.dataTransfer.dropEffect="move",P(ye.id))}function ft(ee,ye){W===ye.id&&!ee.currentTarget.contains(ee.relatedTarget)&&P(null)}function st(ee,ye){ee.preventDefault();const ie=et;qe(),!(!ie||ye.statuses.includes(ie.status))&&be(ie.id,ye.dropStatus)}if(n)return s.jsx(bt,{label:"Loading todos..."});if(r)return s.jsx(Tt,{error:r});const le=(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.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(qn,{label:"Open",value:le.open,icon:Xr}),s.jsx(qn,{label:"In Progress",value:le.in_progress,icon:Xr,tone:"info"}),s.jsx(qn,{label:"Blocked",value:le.blocked,icon:Vh,tone:"warn"}),s.jsx(qn,{label:"Total",value:le.total,icon:Xr})]}),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:h,onChange:ee=>g(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&te(),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:te,disabled:!h.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(Pt,{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(pi,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:$,type:"text",placeholder:"Search...",value:i,onChange:ee=>a(ee.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:l,onChange:ee=>d(ee.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"})]}),H.length>0&&s.jsxs("select",{value:f,onChange:ee=>p(ee.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"}),H.map(ee=>s.jsxs("option",{value:ee,children:["#",ee]},ee))]})]}),j.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:[j.size," selected"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>C(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),s.jsx("button",{type:"button",onClick:()=>{D(null),T(!0)},className:"shell-action",children:"Move to…"}),s.jsx("button",{type:"button",onClick:J,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,L.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:M,ref:ee=>{ee&&(ee.indeterminate=V)},onChange:q,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",L.length,")"]})]}),s.jsx("div",{className:"space-y-3",children:(()=>{let ee=-1;return Be.map(({config:ye,items:ie})=>{const we=!z.isCollapsed(ye.id);return s.jsx(Yw,{label:ye.label,count:ie.length,expanded:we,onToggle:()=>z.toggle(ye.id),isDropTarget:W===ye.id,onDragOver:$e=>vt($e,ye),onDragLeave:$e=>ft($e,ye),onDrop:$e=>st($e,ye),children:we&&ie.map($e=>(ee+=1,s.jsx(IP,{item:$e,copiedId:y,selected:j.has($e.id),editing:w===$e.id,onBeginEdit:Ce=>b(Ce),onEndEdit:()=>b(null),onPatchDescription:Ee,onAddAttachments:Te,onDeleteAttachment:Se,attachmentUrl:(Ce,se)=>_P(e,Ce,se),onToggleSelected:Ce=>Y(Ce),onMoveOne:(Ce,se)=>{se.stopPropagation(),D(Ce),T(!0)},onStatusChange:be,onCopyId:B,onDelete:pe,hotkeyRowProps:je(ee),onDragOrigin:Ce=>{O.current=Ce.target},onDragStart:Me,onDragEnd:qe,isDragging:A===$e.id},$e.id)))},ye.id)})})()}),s.jsx(Gw,{open:k,selectedIds:Array.from(j),scope:{kind:"project",projectId:e},onOpenChange:C,onDone:ce}),s.jsx(FP,{open:I,selectedIds:ne,scope:{kind:"project",projectId:e},onOpenChange:ee=>{T(ee),ee||D(null)},onDone:Q})]})}const VK={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},xN=new Set(["title"]);function UP({visibility:e,onChange:t}){const[n,r]=m.useState(!1);function o(a){if(xN.has(a))return;const d=e.hidden.includes(a)?e.hidden.filter(f=>f!==a):[...e.hidden,a];t({hidden:d})}const i=e.hidden.length;return s.jsxs(Bn,{open:n,onOpenChange:r,children:[s.jsx(IF,{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(TL,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsxs("span",{children:["Columns",i>0?` (${sy.length-i}/${sy.length})`:""]})]})}),s.jsxs(_n,{className:"max-w-sm",children:[s.jsx(sr,{children:s.jsx(Dn,{children:"Columns"})}),s.jsx("div",{className:"space-y-2",children:sy.map(a=>{const l=e.hidden.includes(a),d=xN.has(a);return s.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${d?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[s.jsx("input",{type:"checkbox",checked:!l,onChange:()=>o(a),disabled:d,className:"h-4 w-4 rounded border-border accent-foreground"}),s.jsx("span",{children:VK[a]}),d?s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},a)})})]})]})}const Fl={...Gu,custom:!1},HP=`view-prefs.cache.v${Gu.version}`;let id=WK(),hl=null;const ad=new Set;let VP=0;function Jw(){return++VP}function Zw(e){return e===VP}function WK(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(HP);if(!e)return null;const t=JSON.parse(e);return t.version!==Gu.version?null:t}catch{return null}}function qK(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(HP,JSON.stringify(e))}catch{}}function e0(e){id=e,qK(e);for(const t of ad)t(e)}function t0(e){if(!e||typeof e!="object")return Fl;const t=e;return t.version!==Gu.version||!t.global||!t.projects?Fl:{version:Gu.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function n0(){if(hl)return hl;const e=Jw();return hl=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=t0(t);return Zw(e)&&e0(n),hl=null,id??n}).catch(()=>(hl=null,id??Fl)),hl}function WP(e){const[t,n]=m.useState(()=>id??Fl);return m.useEffect(()=>{let r=!1;return n0().then(o=>{r||n(o)}),ad.add(n),()=>{r=!0,ad.delete(n)}},[]),vT(t,e??null)}function KK(){const[e,t]=m.useState(()=>id??Fl);return m.useEffect(()=>{let n=!1;return n0().then(r=>{n||t(r)}),ad.add(t),()=>{n=!0,ad.delete(t)}},[]),e}async function qP(e){const t=Jw(),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=t0(await n.json());return Zw(t)&&e0(r),r}function KP(e){return qP({global:e})}function GP(e,t){return qP({projects:{[e]:t}})}async function GK(){const e=Jw(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=t0(await t.json());return Zw(e)&&e0(n),n}const yN=80;function YP({open:e,onOpenChange:t,initialName:n="",onSubmit:r,title:o="Save view"}){const[i,a]=m.useState(n),[l,d]=m.useState(!1),[f,p]=m.useState(null);m.useEffect(()=>{e&&(a(n),p(null),d(!1))},[e,n]);const h=i.trim(),g=h.length>0&&h.length<=yN;return s.jsx(Bn,{open:e,onOpenChange:t,children:s.jsx(_n,{className:"max-w-md",children:s.jsxs("form",{className:"space-y-4",onSubmit:async y=>{if(y.preventDefault(),!(!g||l)){d(!0),p(null);try{await r(h)}catch(S){p(S instanceof Error?S.message:String(S)),d(!1)}}},children:[s.jsx(sr,{children:s.jsx(Dn,{children:o})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{type:"text",value:i,autoFocus:!0,required:!0,maxLength:yN,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(Fr,{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 XP({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:r}){const{views:o,loading:i}=$d(),[a,l]=m.useState(!1),d=m.useRef(null);m.useEffect(()=>{if(!a)return;function g(S){d.current&&!d.current.contains(S.target)&&l(!1)}function y(S){S.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=>SR(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:d,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:"Saved views",children:[s.jsx("span",{className:"max-w-[160px] truncate",children:h}),s.jsx(yr,{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:Ne("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(Lr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),s.jsx("span",{className:"truncate",children:g.name})]},g.id)})})]})}const YK=new Set(["overview","assignments","todos","dependencies","knowledge"]),bN="__unknown_type__";function vN(){const{slug:e,workspace:t}=Bt(),n=mn(),r=zt();mi("project"),Jt({keys:"a",scope:"project",description:"Create assignment",handler:()=>r(`${n}/projects/${e}/create/assignment`)}),Jt({keys:"e",scope:"project",description:"Edit project",handler:()=>r(`${n}/projects/${e}/edit`)});const{data:o,loading:i,error:a,refetch:l}=w2(e),d=Ss(),f=Td(),{data:p}=fa(),[h,g]=js(),y=h.get("tab"),S=y&&YK.has(y)?y:"overview";function w(ue){g(We=>{const ot=new URLSearchParams(We);return ue==="overview"?ot.delete("tab"):ot.set("tab",ue),ot},{replace:!0})}const b=e?`p:${e}`:null,j=WP(b),[N,k]=m.useState(()=>Qx(j.defaultView)),[C,I]=m.useState(()=>Ve(j.filters.status)),[T,R]=m.useState(()=>Ve(j.filters.assignee)),[D,$]=m.useState(()=>Ve(j.filters.priority)),[z,A]=m.useState(()=>Ve(j.filters.type)),[F,W]=m.useState(()=>Ve(j.filters.tags)),[P,O]=m.useState(null),[B,H]=m.useState(()=>j.grouping),[L,U]=m.useState(()=>j.sortField),[M,V]=m.useState(()=>j.sortDirection),[Y,q]=m.useState(()=>({collapsed:[]})),[J,ne]=m.useState(()=>({hidden:[]})),[Q,ce]=m.useState(()=>({hidden:[]})),[te,pe]=m.useState(null),[be,Ee]=m.useState(!1),[Te,Se]=m.useState(!1),{toast:Be,showToast:oe,dismissToast:je}=gi(),ke={kind:"project",slug:e??"",workspace:t??null},_e=h.get("loadView"),{view:Ue,loading:et,error:Me}=ui(_e),{view:qe,loading:vt,error:ft}=ui(te),st=m.useRef(null);m.useEffect(()=>{te&&!vt&&!ft&&!qe&&pe(null)},[qe,ft,te,vt]),m.useEffect(()=>{pe(null),st.current=null,O(null)},[e,t]),m.useEffect(()=>{k(Qx(j.defaultView)),I(Ve(j.filters.status)),R(Ve(j.filters.assignee)),$(Ve(j.filters.priority)),A(Ve(j.filters.type)),W(Ve(j.filters.tags)),H(j.grouping),U(j.sortField),V(j.sortDirection)},[e,j.defaultView,j.filters.status,j.filters.assignee,j.filters.priority,j.filters.type,j.filters.tags,j.grouping,j.sortField,j.sortDirection]);const le=m.useCallback(ue=>{b&&GP(b,ue).catch(We=>{console.warn("Failed to persist project view prefs:",We)})},[b]),ee=m.useCallback(ue=>{k(ue),le({defaultView:ue})},[le]),ye=m.useCallback(ue=>{I(ue),le({filters:{status:ue}})},[le]),ie=m.useCallback(ue=>{R(ue),le({filters:{assignee:ue}})},[le]),we=m.useCallback(ue=>{$(ue),le({filters:{priority:ue}})},[le]),$e=m.useCallback(ue=>{A(ue),le({filters:{type:ue}})},[le]),Ce=m.useCallback(ue=>{W(ue),le({filters:{tags:ue}})},[le]),se=m.useCallback(ue=>{H(ue),le({grouping:ue})},[le]),me=m.useCallback(ue=>{U(ue),le({sortField:ue})},[le]),Pe=m.useCallback(ue=>{V(ue),le({sortDirection:ue})},[le]),Ke=m.useCallback(()=>({viewMode:N,filters:{status:C,priority:D,type:z,assignee:T,tags:F,project:"all",activity:"all",dateRange:ta(P)},sortField:L,sortDirection:M,listSectionVisibility:Y,kanbanColumnVisibility:J,tableColumnVisibility:Q}),[N,C,D,z,T,F,P,L,M,Y,J,Q]),de=m.useCallback(ue=>{SA(ue,{setViewMode:We=>k(Qx(We)),setStatusFilter:ye,setPriorityFilter:we,setTypeFilter:$e,setAssigneeFilter:ie,setTagsFilter:Ce,setDateRange:O,setSortField:me,setSortDirection:Pe,setListSectionVisibility:q,setKanbanColumnVisibility:ne,setTableColumnVisibility:ce}),pe(ue.id)},[ye,we,$e,ie,Ce,me,Pe]),pt=m.useCallback(ue=>{de(ue),st.current=ue.id,g(We=>{const ot=new URLSearchParams(We);return ot.set("loadView",ue.id),ot},{replace:!0})},[de,g]),xt=m.useCallback(async ue=>{try{const We=Yl({name:ue,context:{workspace:t??null,projectSlug:e??null},state:Ke()}),ot=await Wl(We),yt=ot.views[ot.views.length-1];pe((yt==null?void 0:yt.id)??null),yt&&(st.current=yt.id,g(Gn=>{const vr=new URLSearchParams(Gn);return vr.set("loadView",yt.id),vr},{replace:!0})),Ee(!1),Se(!1),oe(`Saved view "${ue}"`,"success")}catch(We){throw oe(We instanceof Error?We.message:"Failed to save view","error"),We}},[Ke,g,oe,e,t]),jt=m.useCallback(async()=>{if(!(!te||!qe))try{const ue=Ve(qe.config.filters.project)[0]??null,We=Yl({name:qe.name,context:{workspace:t??null,projectSlug:ue},state:Ke()}),ot=mh(qe.config,We.config,We.config);await uh(te,{config:ot}),oe("View updated","success")}catch(ue){oe(ue instanceof Error?ue.message:"Failed to update view","error")}},[Ke,qe,te,oe,t]);m.useEffect(()=>{if(!_e){st.current=null;return}if(st.current!==_e&&(te&&te!==_e&&pe(null),!et)){if(Me){oe("Couldn't load saved view — try again","error");return}if(Ue){if(st.current=_e,!SR(Ue,{kind:"project",slug:e??"",workspace:t??null})){r(CA(Ue),{replace:!0});return}de(Ue),g(ue=>{const We=new URLSearchParams(ue);return We.delete("loadView"),We},{replace:!0});return}st.current=_e,oe("Saved view no longer exists","error"),g(ue=>{const We=new URLSearchParams(ue);return We.delete("loadView"),We},{replace:!0})}},[_e,Ue,et,Me,te,de,g,oe,r,e,t]);function lt(ue){L===ue?Pe(M==="asc"?"desc":"asc"):(me(ue),Pe("asc"))}const ge=m.useMemo(()=>o?Object.fromEntries(o.assignments.flatMap(ue=>{const We=`${n}/projects/${o.slug}/assignments/${ue.slug}`;return[[ue.slug,We],[ue.title,We]]})):{},[o]);async function He(ue){await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:ue})}),l()}async function Je(ue){try{const We=await fetch(`/api/projects/${e}/${ue?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!We.ok){const ot=await We.json().catch(()=>null);oe((ot==null?void 0:ot.error)||`HTTP ${We.status}`,"error");return}l(),oe(ue?"Project archived":"Project restored","success")}catch(We){oe(We instanceof Error?We.message:"Failed to update archive state","error")}}async function It(ue){await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:ue})}),l()}if(i)return s.jsx(bt,{label:"Loading project workspace…"});if(a||!o)return s.jsx(Tt,{error:a||"Project not found."});const qt=(()=>{const ue=new Set;for(const ot of o.assignments)ot.assignee&&ue.add(ot.assignee);const We=[{value:"__unassigned__",label:"Unassigned"}];for(const ot of Array.from(ue).sort())We.push({value:ot,label:ot});return We})(),un=Array.from(new Set(o.assignments.flatMap(ue=>ue.tags??[]))).sort().map(ue=>({value:ue,label:ue})),Ut=o.assignments.filter(ue=>aU(ue,{status:C,priority:D,type:z,assignee:T,tags:F,dateRange:ta(P)})),Un=Ld(Ut,L,M),St=new Set(f.definitions.map(ue=>ue.id)),$n=B==="type"?[...f.definitions.map(ue=>({id:ue.id,title:Pl(f,ue.id),description:ue.description})),...Ut.some(ue=>!ue.type||!St.has(ue.type))?[{id:bN,title:"Other",description:"Assignments with no recognized type."}]:[]]:AA(d.order).map(ue=>({id:ue,title:li(d,ue),description:Od(ue)}));function Nt({field:ue,children:We}){const ot=L===ue;return s.jsx("th",{className:"pb-3 font-medium",children:s.jsxs("button",{type:"button",onClick:()=>lt(ue),className:"inline-flex items-center gap-1 hover:text-foreground",children:[We,ot?M==="asc"?s.jsx(VE,{className:"h-3 w-3"}):s.jsx(yr,{className:"h-3 w-3"}):null]})})}return s.jsxs("div",{className:"space-y-5","data-density":j.density,children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(kn,{status:o.status}),o.statusOverride&&s.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>He(null),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",value:"",onChange:ue=>{ue.target.value&&He(ue.target.value)},title:"Override project status",children:[s.jsx("option",{value:"",children:"Set Status…"}),d.statuses.map(ue=>s.jsx("option",{value:ue.id,children:ue.label},ue.id)),s.jsx("option",{value:"active",children:"Active"})]}),s.jsx("button",{type:"button",className:"shell-action",onClick:()=>Je(!o.archived),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",value:"",onChange:ue=>{ue.target.value==="_ungrouped"?It(null):ue.target.value&&It(ue.target.value)},title:"Move project to a different workspace",children:[s.jsx("option",{value:"",children:"Move to Workspace…"}),p.workspaces.filter(ue=>ue!==o.workspace).map(ue=>s.jsx("option",{value:ue,children:ue},ue)),o.workspace&&s.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),s.jsxs(Ie,{className:"shell-action",to:`${n}/projects/${o.slug}/edit`,children:[s.jsx(l1,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Project"})]}),s.jsxs(Ie,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:[s.jsx(Pt,{className:"h-4 w-4"}),s.jsx("span",{children:"New Assignment"})]}),s.jsx(_w,{externalIds:o.externalIds}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",Kn(o.created),". Last source update ",Jr(o.updated),"."]})]}),s.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[s.jsx(qn,{label:"Assignments",value:o.progress.total}),s.jsx(qn,{label:"In Progress",value:o.progress.in_progress??0,tone:"info"}),s.jsx(qn,{label:"Review",value:o.progress.review??0,tone:"info"}),s.jsx(qn,{label:"Blocked",value:o.progress.blocked??0,tone:"warn"}),s.jsx(qn,{label:"Completed",value:o.progress.completed??0,tone:"success"})]}),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(Rm,{value:S,onValueChange:w,items:[{value:"overview",label:"Overview",content:s.jsx("div",{className:"space-y-5",children:s.jsx(Ye,{title:"Project Overview",children:s.jsx(vn,{content:o.body,emptyState:"This project does not have overview content yet."})})})},{value:"assignments",label:"Assignments",count:o.assignments.filter(ue=>!ue.archived).length,content:s.jsx("div",{className:"space-y-5",children:s.jsx(Ye,{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(wn,{ariaLabel:"Status filter",className:"max-w-[170px]",allLabel:"All statuses",options:d.statuses.map(ue=>({value:ue.id,label:ue.label})),value:C,onChange:ye}),s.jsx(wn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:qt,value:T,onChange:ie}),s.jsx(wn,{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:D,onChange:we}),s.jsx(wn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:f.definitions.map(ue=>({value:ue.id,label:Pl(f,ue.id)})),value:z,onChange:$e}),s.jsx(wn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:un,value:F,onChange:Ce}),s.jsx(Sm,{className:"max-w-[190px]",value:P,onChange:O}),N==="kanban"&&s.jsxs("select",{value:B==="type"?"type":"status",onChange:ue=>se(ue.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(Em,{value:N,onChange:ue=>ee(ue),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),s.jsx(XP,{scope:ke,loadedViewId:te,onApply:pt,onOpenSaveDialog:()=>{Se(!1),Ee(!0)}}),s.jsx("button",{type:"button",onClick:()=>{qe?jt():(Se(!1),Ee(!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:qe?`Update ${qe.name}`:"Save current view",children:qe?`Update '${qe.name}'`:"Save view"}),qe?s.jsx("button",{type:"button",onClick:()=>{Se(!0),Ee(!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:Ut.length===0?s.jsx(Ct,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:s.jsx(Ie,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:"Create Assignment"})}):N==="kanban"?s.jsx(km,{columns:$n,items:Un,getItemId:ue=>ue.slug,getColumnId:ue=>B==="type"?ue.type&&St.has(ue.type)?ue.type:bN:ue.status,dragDisabled:!0,renderCard:ue=>s.jsx(XK,{projectSlug:o.slug,assignment:ue}),emptyMessage:ue=>`No ${ue.title.toLowerCase()} assignments.`,hiddenColumnIds:J.hidden,onHideColumn:ue=>ne(We=>({hidden:We.hidden.includes(ue)?We.hidden.filter(yt=>yt!==ue):[...We.hidden,ue]}))}):(()=>{const ue=new Set(Q.hidden),We=ot=>ot==="title"||!ue.has(ot);return s.jsxs("div",{className:"overflow-x-auto",children:[s.jsx("div",{className:"mb-3 flex items-center justify-end",children:s.jsx(UP,{visibility:Q,onChange:ce})}),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:[We("title")?s.jsx(Nt,{field:"title",children:"Assignment"}):null,We("status")?s.jsx(Nt,{field:"status",children:"Status"}):null,s.jsx("th",{className:"pb-3 font-medium",children:"Type"}),We("priority")?s.jsx(Nt,{field:"priority",children:"Priority"}):null,We("assignee")?s.jsx(Nt,{field:"assignee",children:"Assignee"}):null,We("dependencies")?s.jsx(Nt,{field:"dependencies",children:"Dependencies"}):null,We("created")?s.jsx(Nt,{field:"created",children:"Created"}):null,We("updated")?s.jsx(Nt,{field:"updated",children:"Updated"}):null]})}),s.jsx("tbody",{children:Un.map(ot=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[We("title")?s.jsx("td",{className:"py-4",children:s.jsx(Ie,{to:`${n}/projects/${o.slug}/assignments/${ot.slug}`,className:"font-semibold text-foreground hover:text-primary",children:ot.title})}):null,We("status")?s.jsx("td",{className:"py-4",children:s.jsx(kn,{status:ot.status,className:"max-w-[150px]"})}):null,s.jsx("td",{className:"py-4",children:s.jsx(ma,{type:ot.type,compact:!0})}),We("priority")?s.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:ot.priority}):null,We("assignee")?s.jsx("td",{className:"py-4 text-muted-foreground",children:ot.assignee??"—"}):null,We("dependencies")?s.jsx("td",{className:"py-4 text-muted-foreground",children:ot.dependsOn.length}):null,We("created")?s.jsx("td",{className:"py-4 text-muted-foreground",children:Kn(ot.created)}):null,We("updated")?s.jsx("td",{className:"py-4 text-muted-foreground",children:Kn(ot.updated)}):null]},ot.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:s.jsx(HK,{projectId:o.slug})},{value:"dependencies",label:"Dependencies",content:o.dependencyGraph?s.jsx(Ye,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:s.jsx(tH,{definition:o.dependencyGraph,nodeRoutes:ge})}):s.jsx(Ct,{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(Ye,{title:"Resources",description:"Shared project references.",actions:s.jsxs(Ie,{className:"shell-action",to:`/resources/new?project=${o.slug}`,children:[s.jsx(Pt,{className:"h-4 w-4"}),s.jsx("span",{children:"New Resource"})]}),children:o.resources.length===0?s.jsx(Ct,{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(ue=>s.jsxs(Ie,{to:`/projects/${o.slug}/resources/${ue.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:ue.name}),s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[ue.category," · ",ue.source]})]},ue.slug))})}),s.jsx(Ye,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:s.jsxs(Ie,{className:"shell-action",to:`/memories/new?project=${o.slug}`,children:[s.jsx(Pt,{className:"h-4 w-4"}),s.jsx("span",{children:"New Memory"})]}),children:o.memories.length===0?s.jsx(Ct,{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(ue=>s.jsxs(Ie,{to:`/projects/${o.slug}/memories/${ue.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:ue.name}),s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[ue.scope," · ",ue.source]})]},ue.slug))})})]})}]})}),s.jsxs("div",{className:"space-y-5",children:[s.jsx(Ye,{title:"Progress Summary",children:s.jsx(xh,{progress:o.progress,showLegend:!0})}),s.jsx(Ye,{title:"Attention",children:s.jsxs("dl",{className:"space-y-3 text-sm",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("dt",{className:"text-muted-foreground",children:"Blocked"}),s.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.blockedCount})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("dt",{className:"text-muted-foreground",children:"Failed"}),s.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.failedCount})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("dt",{className:"text-muted-foreground",children:"Unanswered questions"}),s.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.openQuestions})]})]})}),s.jsx(Ye,{title:"Quick Links",children:s.jsxs("div",{className:"space-y-2 text-sm",children:[s.jsxs(Ie,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/edit`,children:[s.jsx(l1,{className:"h-4 w-4"}),"Edit project source"]}),s.jsxs(Ie,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/create/assignment`,children:[s.jsx(Pt,{className:"h-4 w-4"}),"Create assignment"]}),s.jsxs(Ie,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[s.jsx(yL,{className:"h-4 w-4"}),"Review project rules"]}),s.jsxs("button",{type:"button",onClick:()=>w("dependencies"),className:"flex items-center gap-2 text-primary hover:underline",children:[s.jsx(Nv,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),o.archived?s.jsxs(Ye,{title:"Archive Metadata",children:[s.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["Archived ",o.archivedAt?Jr(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(ga,{toast:Be,onDismiss:je}),s.jsx(YP,{open:be,onOpenChange:ue=>{Ee(ue),ue||Se(!1)},initialName:Te&&qe?`${qe.name} (copy)`:"",title:Te?"Save as new view":"Save view",onSubmit:xt})]})}function XK({projectSlug:e,assignment:t}){const n=mn();return s.jsxs(Ie,{to:`${n}/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:r=>{r.preventDefault(),r.stopPropagation()},children:s.jsx(Qr,{value:t.id})})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Kn(t.updated)]})]}),s.jsx(kn,{status:t.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[s.jsx(ma,{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 QP({sessionId:e,disabled:t=!1,disabledReason:n,onError:r,onNotice:o}){const[i,a]=m.useState(!1),[l,d]=m.useState(!1);async function f(){var h;if(t||l)return;d(!0);const p=(async()=>{const g=await fetch(`/api/launch/command?session=${encodeURIComponent(e)}&mode=resume`);if(!g.ok){const S=await g.json().catch(()=>null);throw new Error((S==null?void 0:S.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(S=>new Blob([S.command],{type:"text/plain"}))})]),y=(await p).fallbackWarning;else{const S=await p;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(S.command),y=S.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(S){y=S instanceof Error?S:new Error(String(S))}r==null||r(y)}finally{d(!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(c1,{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(Lr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):s.jsx(c1,{className:"h-3 w-3","aria-hidden":"true"})})}function gu(e,t,n,r,o){let i=`syntaur://open?${e.kind}=${encodeURIComponent(e.id)}`;return e.kind==="session"&&t&&(i+=`&mode=${encodeURIComponent(t)}`),n&&(i+=`&terminal=${encodeURIComponent(n)}`),r&&e.kind==="assignment"&&(i+=`&agent=${encodeURIComponent(r)}`),o!==void 0&&e.kind==="assignment"&&(i+=`&prompt=${encodeURIComponent(o)}`),i}function QK(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 JK(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 JP(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 ZP(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 ZK(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 e_(e){return e.requiresReason||e.command==="block"}async function eG(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 tG(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 nG(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 rG(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 r0 extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function s0(e){const t=await e.json().catch(()=>null);return new r0((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function sG(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 oG(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 iG(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 s0(r);return(await r.json()).assignment}async function aG(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 s0(n);return(await n.json()).assignment}async function lG(e){const{url:t}=QK(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await s0(n);return await n.json()}async function $m(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 cG(e,t,n){const r=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return $m(r)}async function uG(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return $m(n)}async function dG(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await $m(n)).sourceAssignments}async function fG(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await $m(t)).sourceAssignments}function t_(){const[e,t]=m.useState(!1),[n,r]=m.useState(null),[o,i]=m.useState(null),[a,l]=m.useState(null),[d,f]=m.useState(null),[p,h]=m.useState(null),[g,y]=m.useState(!1),[S,w]=m.useState(null),[b,j]=m.useState(null);async function N(T,R,D,$){if(!e){t(!0);try{const z=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:T.kind,id:T.id}})});if(!z.ok){window.location.href=gu(T,R,void 0,D,$);return}const A=await z.json();if(A.ok){window.location.href=gu(T,R,void 0,D,$);return}if(A.reason==="workspace-path-invalid"){A.recreate?(f(A.recreate),h({target:T,mode:R,agentId:D,prompt:$})):l(A.message);return}r(A),i({target:T,mode:R,agentId:D,prompt:$})}catch(z){console.warn("preflight failed, firing without override:",z),window.location.href=gu(T,R,void 0,D,$)}finally{t(!1)}}}function k(){!n||!o||(window.location.href=gu(o.target,o.mode,n.suggestedFallback,o.agentId,o.prompt),r(null),i(null))}async function C(){if(!(!d||!p||g)){y(!0),w(null);try{const T=await lG({kind:d.kind,id:d.id,projectSlug:d.projectSlug,assignmentSlug:d.assignmentSlug}),{target:R,mode:D,agentId:$,prompt:z}=p;f(null),h(null),window.location.href=gu(R,D,void 0,$,z),!T.exact&&!T.alreadyExisted&&j(`Recreated from ${T.baseUsed} — the original branch couldn't be restored exactly, but the directory is back and your agent is opening.`)}catch(T){w(T instanceof r0&&T.stderr?`${T.message}
|
|
599
|
+
${T.stderr}`:T instanceof Error?T.message:String(T))}finally{y(!1)}}}const I=s.jsxs(s.Fragment,{children:[s.jsx(bl,{open:n!==null,onOpenChange:T=>!T&&(r(null),i(null)),children:s.jsxs(Ki,{children:[s.jsxs(vl,{children:[s.jsxs(Gi,{children:[n==null?void 0:n.terminal," is not installed"]}),s.jsxs(Yi,{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(Ie,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{r(null),i(null)},children:"Settings"}),"."]})]}),s.jsxs(wl,{children:[s.jsx(Xu,{className:"shell-action mt-0",children:"Cancel"}),s.jsxs(si,{className:"shell-action mt-0 shell-action--cta",onClick:T=>{T.preventDefault(),k()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),s.jsx(bl,{open:a!==null,onOpenChange:T=>!T&&l(null),children:s.jsxs(Ki,{children:[s.jsxs(vl,{children:[s.jsx(Gi,{children:"Can't open in agent"}),s.jsxs(Yi,{children:[a," Set a valid worktree or repository, then try again."]})]}),s.jsx(wl,{children:s.jsx(si,{className:"shell-action mt-0 shell-action--cta",onClick:()=>l(null),children:"OK"})})]})}),s.jsx(bl,{open:d!==null,onOpenChange:T=>{!T&&!g&&(f(null),h(null),w(null))},children:s.jsxs(Ki,{children:[s.jsxs(vl,{children:[s.jsx(Gi,{children:"Worktree was deleted"}),s.jsxs(Yi,{children:["The worktree at ",s.jsx("code",{children:d==null?void 0:d.deletedPath})," no longer exists. Recreate it",d!=null&&d.branch?s.jsxs(s.Fragment,{children:[" ","on branch ",s.jsx("code",{children:d.branch})]}):null," ","so this can open?"]})]}),S&&s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:S}),s.jsxs(wl,{children:[s.jsx(Xu,{className:"shell-action mt-0",disabled:g,children:"No"}),s.jsx(si,{className:"shell-action mt-0 shell-action--cta",disabled:g,onClick:T=>{T.preventDefault(),C()},children:g?"Recreating…":"Yes, recreate"})]})]})}),s.jsx(bl,{open:b!==null,onOpenChange:T=>!T&&j(null),children:s.jsxs(Ki,{children:[s.jsxs(vl,{children:[s.jsx(Gi,{children:"Worktree recreated"}),s.jsx(Yi,{children:b})]}),s.jsx(wl,{children:s.jsx(si,{className:"shell-action mt-0 shell-action--cta",onClick:()=>j(null),children:"OK"})})]})})]});return{open:N,pending:e,dialogs:I}}function n_({session:e,onMarkStopped:t}){const n=t_(),r={kind:"session",id:e.sessionId},o="size-3.5",i=Ne("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(ea,{delayDuration:200,children:s.jsxs("div",{className:"inline-flex items-center gap-1",children:[l&&s.jsxs(_r,{children:[s.jsx(Dr,{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(Cl,{className:o}),s.jsx("span",{children:"Reopen"})]})})}),s.jsx(hr,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?s.jsxs(_r,{children:[s.jsx(Dr,{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(Cl,{className:o}),s.jsx("span",{children:"Resume"})]})})}),s.jsx(hr,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):s.jsxs(_r,{children:[s.jsx(Dr,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(r,"resume"),children:[s.jsx(Cl,{className:o}),s.jsx("span",{children:"Resume"})]})}),s.jsx(hr,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&s.jsxs(_r,{children:[s.jsx(Dr,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(r,"fork"),children:[s.jsx(IL,{className:o}),s.jsx("span",{children:"Fork"})]})}),s.jsx(hr,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&s.jsxs(_r,{children:[s.jsx(Dr,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,onClick:()=>t(e.sessionId),children:[s.jsx(Rv,{className:o}),s.jsx("span",{children:"Mark stopped"})]})}),s.jsx(hr,{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 pG(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function r_({sessions:e,loading:t,error:n,onError:r,onNotice:o}){return t&&!e?null:n&&!e?s.jsx(Ye,{title:"Agent Sessions",children:s.jsx(Ct,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?s.jsx(Ye,{title:"Agent Sessions",children:s.jsx(Ct,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):s.jsx(Ye,{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(Fh,{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(Qr,{value:i.sessionId,onError:r}),s.jsx(QP,{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(kn,{status:i.status}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Jr(i.started)})]}),s.jsx(n_,{session:i,onMarkStopped:pG})]},i.sessionId))})})}const Ey="Cost / Usage";function s_({summary:e,error:t}){return t&&!e?s.jsx(Ye,{title:Ey,children:s.jsx(Ct,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?s.jsx(Ye,{title:Ey,children:s.jsx(Ct,{title:"No usage recorded yet",description:"Cost and token totals appear here once the usage collector records activity for this assignment."})}):s.jsx(Ye,{title:Ey,children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(wN,{label:"Total cost",value:Hl(e.totalCost)}),s.jsx(wN,{label:"Total tokens",value:Ul(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(Sd,{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:[Ul(n.totalTokens)," · ",Hl(n.totalCost)]})]},n.model))})]}):null,s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",F4(e.lastEventDay)]})]})}):null}function wN({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})]})}function o_({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 d=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(Bn,{open:e,onOpenChange:g=>r?void 0:i(g),children:s.jsx(_n,{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(Dn,{children:f}),s.jsx(es,{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:d}),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(Fr,{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 ya({open:e,title:t,description:n,confirmLabel:r,cancelLabel:o="Cancel",loading:i=!1,destructive:a=!1,onConfirm:l,onOpenChange:d}){return s.jsx(bl,{open:e,onOpenChange:f=>i?void 0:d(f),children:s.jsxs(Ki,{children:[s.jsxs(vl,{children:[s.jsx(Gi,{children:t}),s.jsx(Yi,{children:n})]}),s.jsxs(wl,{children:[s.jsx(Xu,{disabled:i,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:o}),s.jsx(si,{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 hG=/^[a-z0-9][a-z0-9_-]*$/,i_=["first","last","none"];class a_ extends Error{constructor(n,r){super(n);Rx(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=r}}const o0={agents:[],custom:!1};let jl=null,ml=null,wh=0;const Yb=new Set;function l_(e){jl=e;for(const t of Yb)t(e)}function mG(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"&&i_.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),n}function i0(e){if(!e||typeof e!="object")return o0;const t=e,n=Array.isArray(t.agents)?t.agents:[],r=[];for(const o of n){const i=mG(o);i&&r.push(i)}return{agents:r,custom:t.custom===!0}}function gG(){if(jl)return Promise.resolve(jl);if(ml)return ml;const e=++wh;return ml=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ml=null;const n=i0(t);return e!==wh?jl??n:(jl=n,n)}).catch(()=>(ml=null,o0)),ml}function c_(){const[e,t]=m.useState(()=>jl??o0);return m.useEffect(()=>{let n=!1;return gG().then(r=>{n||t(r)}),Yb.add(t),()=>{n=!0,Yb.delete(t)}},[]),e}async function u_(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new a_(n,t==null?void 0:t.fieldErrors)}async function xG(e){++wh;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await u_(t);const n=i0(await t.json());return l_(n),n}async function yG(){++wh;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await u_(e);const t=i0(await e.json());return l_(t),t}const jN=/[A-Za-z0-9_-]/,bG=/^[a-z0-9]+(-[a-z0-9]+)*$/,kN=/(^|\s)@([A-Za-z0-9_-]+)/g,Xb="assignment";function d_(e,t){const n=Math.max(0,Math.min(t,e.length));let r=n;for(;r>0&&jN.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&&jN.test(e[i]);)i++;return{start:o,end:i,partial:e.slice(o+1,n)}}function f_(e,t){const n=[Xb,...t.filter(a=>a!==Xb)],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 p_(e,t,n){const r=`@${n}`;return{text:e.slice(0,t.start)+r+e.slice(t.end),caret:t.start+r.length}}function h_(e,t){const n=t instanceof Set?t:new Set(t),r=[];kN.lastIndex=0;let o;for(;(o=kN.exec(e))!==null;){const i=o[2];i!==Xb&&(bG.test(i)?n.has(i)||r.push(`Playbook "${i}" is not installed — "@${i}" will be left as literal text.`):r.push(`"@${i}" is not a valid playbook token — it will be left as literal text.`))}return r}const SN=2e3;function vG({open:e,assignmentId:t,agentId:n,onConfirm:r,onOpenChange:o}){const[i,a]=m.useState(""),[l,d]=m.useState([]),[f,p]=m.useState(!1),[h,g]=m.useState(null),[y,S]=m.useState(0),[w,b]=m.useState(0),[j,N]=m.useState(!1),k=m.useRef(null);m.useEffect(()=>{if(!e)return;let P=!1;p(!0),g(null),N(!1);const O=new URLSearchParams({assignment:t});return n&&O.set("agent",n),fetch(`/api/launch/prompt?${O.toString()}`).then(async B=>{if(!B.ok){const H=await B.json().catch(()=>null);throw new Error((H==null?void 0:H.error)??`HTTP ${B.status}`)}return await B.json()}).then(B=>{P||(a(B.template??""),d(B.knownPlaybookSlugs??[]),S((B.template??"").length))}).catch(B=>{P||g(B instanceof Error?B.message:String(B))}).finally(()=>{P||p(!1)}),()=>{P=!0}},[e,t,n]);const C=d_(i,y),I=C?f_(C.partial,l):[],T=e&&!f&&!j&&I.length>0,R=h_(i,l),D=i.length>SN;function $(P){a(P.target.value),S(P.target.selectionStart??P.target.value.length),b(0),N(!1)}function z(P){S(P.currentTarget.selectionStart??i.length),b(0)}function A(P){if(!C||!P)return;const O=p_(i,C,P);a(O.text),S(O.caret),b(0),N(!0),requestAnimationFrame(()=>{const B=k.current;B&&(B.focus(),B.setSelectionRange(O.caret,O.caret))})}function F(P){T&&(P.key==="ArrowDown"?(P.preventDefault(),b(O=>Math.min(O+1,I.length-1))):P.key==="ArrowUp"?(P.preventDefault(),b(O=>Math.max(O-1,0))):(P.key==="Enter"||P.key==="Tab")&&(P.preventDefault(),A(I[w])))}function W(){D||f||(r(i),o(!1))}return s.jsx(Bn,{open:e,onOpenChange:o,children:s.jsxs(_n,{onEscapeKeyDown:P=>{T&&(P.preventDefault(),N(!0))},children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:"Edit launch prompt"}),s.jsxs(es,{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:k,value:i,disabled:f,rows:4,spellCheck:!1,placeholder:f?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:$,onKeyDown:F,onKeyUp:z,onClick:z,className:Ne("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",D&&"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:I.map((P,O)=>s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":O===w,onMouseDown:B=>{B.preventDefault(),A(P)},className:Ne("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",O===w&&"bg-accent"),children:[s.jsx("span",{className:"text-muted-foreground",children:"@"}),s.jsx("span",{className:"truncate",children:P})]})},P))})]}),R.length>0&&!h&&s.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:R.map(P=>s.jsx("li",{children:P},P))}),D&&s.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",SN," characters (",i.length,")."]}),s.jsxs(Fr,{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||D||h!==null,onClick:W,children:"Launch"})]})]})})}function m_({target:e,worktreePath:t=null,repository:n=null,size:r="default",title:o}){const i=e.kind==="assignment"&&!t&&!n,a=t_(),[l,d]=m.useState(null),p=c_().agents,[h,g]=m.useState(null);m.useEffect(()=>{p.length!==0&&g(R=>R&&p.some($=>$.id===R)?R:(p.find($=>$.default)??p[0]).id)},[p]);const y=e.kind==="assignment"&&p.length>1,S=p.find(R=>R.id===h)??null,w=m.useRef(null),[b,j]=m.useState(!1);m.useEffect(()=>{if(!b)return;function R($){w.current&&!w.current.contains($.target)&&j(!1)}function D($){$.key==="Escape"&&j(!1)}return document.addEventListener("mousedown",R),document.addEventListener("keydown",D),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",D)}},[b]);function N(R){var D,$;if(e.kind==="assignment"){const z=p.find(F=>F.id===R)??p.find(F=>F.default)??p[0];!!((D=z==null?void 0:z.launchPrompt)!=null&&D.trim())||!!(($=z==null?void 0:z.playbook)!=null&&$.trim())?a.open(e,void 0,R):d({agentId:R})}else a.open(e,void 0,R)}const k=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",I=Ne("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:I,"aria-disabled":!0,children:[s.jsx(Cl,{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:w,children:[s.jsxs("div",{className:"inline-flex items-stretch",children:[s.jsxs("button",{type:"button",onClick:()=>N(h??void 0),disabled:a.pending,title:(o??k)+(y&&S?` (${S.label})`:""),className:Ne(I,y&&"rounded-r-none"),children:[s.jsx(Cl,{className:"size-3.5"}),s.jsx("span",{children:T})]}),y&&s.jsx("button",{type:"button",onClick:()=>j(R=>!R),disabled:a.pending,"aria-haspopup":"menu","aria-expanded":b,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:Ne(I,"-ml-px rounded-l-none",r==="compact"?"px-1":"px-1.5"),children:s.jsx(yr,{className:Ne("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(R=>s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":R.id===h,onClick:()=>{g(R.id),j(!1),N(R.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(Lr,{className:Ne("size-3.5 shrink-0",R.id===h?"opacity-100":"opacity-0")}),s.jsx("span",{className:"truncate",children:R.label}),R.default&&s.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60",children:"default"})]},R.id))]})]}),a.dialogs,e.kind==="assignment"&&l&&s.jsx(vG,{open:!0,assignmentId:e.id,agentId:l.agentId,onConfirm:R=>{a.open(e,void 0,l.agentId,R)},onOpenChange:R=>{R||d(null)}})]})}const Ty="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 g_({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,d]=m.useState(!1),[f,p]=m.useState("new-branch"),[h,g]=m.useState(null),[y,S]=m.useState(null),[w,b]=m.useState(""),[j,N]=m.useState(!1),[k,C]=m.useState(""),[I,T]=m.useState([]),[R,D]=m.useState(!1),[$,z]=m.useState(null),[A,F]=m.useState(""),[W,P]=m.useState(null),[O,B]=m.useState(null),[H,L]=m.useState(""),[U,M]=m.useState(r),[V,Y]=m.useState(!1),[q,J]=m.useState(null);m.useEffect(()=>{if(!l)return;let oe=!1;return p("new-branch"),g(null),S(null),b(""),N(!1),C(""),T([]),D(!1),z(null),F(""),P(null),B(null),L(""),M(r),J(null),(a.kind==="project-nested"?sG(a.projectSlug):oG(a.assignmentId)).then(_e=>{if(!oe)if(g(_e),_e.length===0)N(!0);else{const Ue=_e.find(Me=>Me.source==="project"),et=_e.find(Me=>Me.source==="sibling");b((Ue==null?void 0:Ue.path)??(et==null?void 0:et.path)??_e[0].path)}}).catch(_e=>{oe||(S(_e.message),g([]),N(!0))}),(a.kind==="project-nested"?dG(a.projectSlug,a.assignmentSlug):fG(a.assignmentId)).then(_e=>{oe||P(_e)}).catch(_e=>{oe||(B(_e.message),P([]))}),()=>{oe=!0}},[l,r,o,e,t,n]);const ne=f==="branch-off"?(W??[]).find(oe=>oe.id===H)??null:null,Q=f==="branch-off"?(ne==null?void 0:ne.repository)??"":j?k.trim():w;m.useEffect(()=>{if(!l||f!=="new-branch")return;if(!Q){T([]),z(null),D(!1),F("");return}let oe=!1;return D(!0),z(null),F(""),(a.kind==="project-nested"?cG(a.projectSlug,a.assignmentSlug,Q):uG(a.assignmentId,Q)).then(ke=>{if(oe)return;T(ke.branches);const _e=(ke.defaultBranch&&ke.branches.includes(ke.defaultBranch)?ke.defaultBranch:ke.branches.includes(o)?o:ke.branches[0])??"";F(_e),D(!1)}).catch(ke=>{oe||(T([]),z(ke.message),D(!1))}),()=>{oe=!0}},[l,f,Q,o,e,t,n]);const ce=JK(U.trim()),te=m.useMemo(()=>!Q||!U.trim()?"":`${Q.replace(/\/+$/,"")}/.worktrees/${U.trim()}`,[Q,U]),pe=h!==null&&h.length===0,be=W!==null&&W.length===0,Ee=oe=>{oe!==f&&(p(oe),L(""),J(null),oe==="branch-off"&&(F(""),T([]),z(null),D(!1)))},Te=oe=>{L(oe);const je=(W??[]).find(ke=>ke.id===oe);F((je==null?void 0:je.branch)??"")},Se=V||ce!==null||!Q||!A.trim()||(f==="new-branch"?h===null||R:W===null||!H),Be=async()=>{Y(!0),J(null);try{const oe={repository:Q,branch:U.trim(),parentBranch:A.trim()};a.kind==="project-nested"?await iG(a.projectSlug,a.assignmentSlug,oe):await aG(a.assignmentId,oe),d(!1),i()}catch(oe){oe instanceof r0?J({message:oe.message,stderr:oe.stderr}):oe instanceof Error?J({message:oe.message}):J({message:String(oe)})}finally{Y(!1)}};return s.jsxs(Bn,{open:l,onOpenChange:oe=>V?void 0:d(oe),children:[s.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>d(!0),children:[s.jsx($L,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{children:"Create worktree"})]}),s.jsxs(_n,{children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:"Create worktree"}),s.jsxs(es,{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:V,onClick:()=>Ee("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:V,onClick:()=>Ee("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:[pe?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:Ty,value:w,onChange:oe=>b(oe.target.value),disabled:V||h===null||j,children:(h??[]).map(oe=>s.jsxs("option",{value:oe.path,children:[oe.path,oe.source==="project"?" (project)":oe.sourceAssignmentSlug?` (sibling — ${oe.sourceAssignmentSlug})`:" (sibling)"]},`${oe.source}:${oe.path}`))}),pe?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:V,onClick:()=>N(oe=>!oe),children:j?"Use a listed repository":"Enter a custom repository path (advanced)"}),j?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:k,onChange:oe=>C(oe.target.value),disabled:V}):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:Ty,value:A,onChange:oe=>F(oe.target.value),disabled:V||R||I.length===0,children:R?s.jsx("option",{value:"",children:"Loading branches…"}):I.length===0?s.jsx("option",{value:"",children:$?"Could not load branches":Q?"No branches found":"— pick a repository —"}):I.map(oe=>s.jsx("option",{value:oe,children:oe},oe))}),$?s.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",$]}):null]})]}):s.jsxs(s.Fragment,{children:[O?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: ",O]}):null,be?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:Ty,value:H,onChange:oe=>Te(oe.target.value),disabled:V||W===null,children:[s.jsx("option",{value:"",children:"— select an assignment —"}),(W??[]).map(oe=>s.jsxs("option",{value:oe.id,children:[oe.title," (",oe.branch,")"]},oe.id))]})]}),ne?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:ne.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:ne.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:U,onChange:oe=>M(oe.target.value),disabled:V}),ce?s.jsx("span",{className:"text-[11px] text-error-foreground",children:ce}):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 —"})})]}),q?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:q.message}),q.stderr?s.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:q.stderr}):null]}):null]}),s.jsxs(Fr,{children:[s.jsx(LF,{disabled:V,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",disabled:Se,onClick:()=>void Be(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:V?"Working…":"Create worktree"})]})]})]})}function wG(e){const t=e.split(`
|
|
600
|
+
`),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(`
|
|
601
|
+
`).replace(/\n{3,}/g,`
|
|
602
|
+
|
|
603
|
+
`).trim();return{acceptanceCriteria:o,summaryBody:i}}function jG(e){const t=e.split(`
|
|
604
|
+
`),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(`
|
|
605
|
+
`).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
|
|
606
|
+
|
|
607
|
+
`).trim(),i=[...t.slice(0,n),...t.slice(r)].join(`
|
|
608
|
+
`).replace(/\n{3,}/g,`
|
|
609
|
+
|
|
610
|
+
`).trim();return{hasSection:!0,todosMarkdown:o,remaining:i}}function kG({projectSlug:e,dependencies:t,blockedReason:n}){const[r,o]=m.useState(!1);if(t.length===0)return null;const i=t.filter(l=>l.status!=="completed"&&l.status!=="review"),a=i.length===0;return a&&!r?s.jsxs("button",{type:"button",onClick:()=>o(!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(kv,{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(yr,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):s.jsxs("div",{className:"space-y-3",children:[i.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(Qp,{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:[i.length," ",i.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(Ye,{title:"Dependencies",description:`${t.length-i.length} of ${t.length} resolved`,actions:a?s.jsx("button",{type:"button",onClick:()=>o(!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(l=>s.jsxs(Ie,{to:`/projects/${e}/assignments/${l.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(kn,{status:l.status}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:l.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:l.slug})]}),l.assignee&&s.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:l.assignee}),s.jsx(Xp,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},l.slug))})})]})}function SG({links:e}){const t=mn();if(e.length===0)return null;const n=e.filter(o=>!o.isReverse),r=e.filter(o=>o.isReverse);return s.jsx(Ye,{title:"Linked Assignments",description:`${e.length} ${e.length===1?"link":"links"}`,children:s.jsxs("div",{className:"divide-y divide-border/40",children:[n.map(o=>s.jsxs(Ie,{to:`${t}/projects/${o.projectSlug}/assignments/${o.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(zE,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx(kn,{status:o.status}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:o.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.slug})]}),s.jsx(Xp,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${o.slug}`)),r.map(o=>s.jsxs(Ie,{to:`${t}/projects/${o.projectSlug}/assignments/${o.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(Yp,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx(kn,{status:o.status}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:o.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.slug})]}),s.jsx(Xp,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${o.slug}`))]})})}function NG(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 CG(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function x_({projectSlug:e,assignmentSlug:t,entries:n}){const[r,o]=m.useState(n);m.useEffect(()=>{o(n)},[n]);const i=m.useMemo(()=>NG(r),[r]),[a,l]=m.useState(""),[d,f]=m.useState("note"),[p,h]=m.useState(!1),[g,y]=m.useState(null);async function S(b){var k;if(b.preventDefault(),!a.trim())return;h(!0),y(null);const j=`tmp-${Date.now()}`,N={id:j,timestamp:new Date().toISOString(),author:"human",type:d,body:a,resolved:d==="question"?!1:void 0};o(C=>[...C,N]);try{const C=await fetch(CG(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:a,type:d})});if(!C.ok){const R=await C.text();throw new Error(R||`HTTP ${C.status}`)}const I=await C.json().catch(()=>null),T=(k=I==null?void 0:I.comment)==null?void 0:k.id;o(R=>R.map(D=>D.id===j?{...D,id:T??D.id}:D)),l(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(C){y(C instanceof Error?C.message:String(C)),o(I=>I.filter(T=>T.id!==j))}finally{h(!1)}}async function w(b,j){o(N=>N.map(k=>k.id===b?{...k,resolved:j}:k));try{const N=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(b)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(b)}/resolved`,k=await fetch(N,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:j})});if(!k.ok)throw new Error(`HTTP ${k.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(N){y(N instanceof Error?N.message:String(N)),o(k=>k.map(C=>C.id===b?{...C,resolved:!j}:C))}}return s.jsx(Ye,{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(y_,{node:b,onToggleResolved:w,depth:0},b.entry.id)),s.jsxs("form",{onSubmit:S,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:d,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 y_({node:e,depth:t,onToggleResolved:n}){const{entry:r,replies:o}=e,i=r.type==="question";return s.jsxs("div",{className:Ne("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:Ne("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:Ne("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(kv,{className:"h-3 w-3"}):s.jsx(kL,{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(YL,{className:"h-3 w-3"}),r.replyTo]}):null]}),s.jsx(vn,{content:r.body}),o.length>0?s.jsx("div",{className:"space-y-2",children:o.map(a=>s.jsx(y_,{node:a,depth:t+1,onToggleResolved:n},a.entry.id))}):null]})}const EG=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function NN(){var Ce,se,me,Pe,Ke,de,pt,xt,jt,lt;const{slug:e,aslug:t}=Bt(),n=zt(),r=mn(),[o,i]=js(),[a,l]=m.useState(null),{toast:d,showToast:f,dismissToast:p}=gi(),[h,g]=m.useState(null),[y,S]=m.useState(null),[w,b]=m.useState(null),[j,N]=m.useState(null),[k,C]=m.useState(!1),[I,T]=m.useState(!1),[R,D]=m.useState(0),$=o.get("tab")??"summary",z=Ss(),{data:A,loading:F,error:W,refetch:P}=rO(e,t),{data:O}=w2(e),{data:B}=Dv(),{data:H,loading:L,error:U}=oO(e,t),{data:M,loading:V,error:Y}=aO(e,t),q=m.useMemo(()=>{if(!A||!O)return[];const ge=new Map(O.assignments.map(He=>[He.slug,He]));return A.dependsOn.map(He=>{const Je=ge.get(He);return{slug:He,title:(Je==null?void 0:Je.title)??He,status:(Je==null?void 0:Je.status)??"pending",priority:(Je==null?void 0:Je.priority)??"medium",assignee:(Je==null?void 0:Je.assignee)??null}})},[A,O]),J=q.filter(ge=>ge.status!=="completed"&&ge.status!=="review");mi("assignment");const ne=m.useMemo(()=>((O==null?void 0:O.assignments)??[]).map(ge=>ge.slug),[O]),Q=t?ne.indexOf(t):-1,ce=Q>0?ne[Q-1]:null,te=Q>=0&&Q<ne.length-1?ne[Q+1]:null,pe=`${r}/projects/${e}/assignments/${t}`;Jt({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${pe}/edit`)}),Jt({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${pe}/plan/edit`)}),Jt({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${pe}/handoff/edit`)}),Jt({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${pe}/decision-record/edit`)}),Jt({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${pe}/scratchpad/edit`)}),Jt({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!ce,handler:()=>ce&&n(`${r}/projects/${e}/assignments/${ce}`)}),Jt({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!te,handler:()=>te&&n(`${r}/projects/${e}/assignments/${te}`)});const be=m.useMemo(()=>A?wG(A.body):{acceptanceCriteria:[],summaryBody:""},[A]),Ee=m.useMemo(()=>jG(be.summaryBody),[be.summaryBody]),Te=be.acceptanceCriteria,Se=Te.filter(ge=>ge.checked).length,Be=Te.length>0&&Se===Te.length,oe=m.useRef(Be),je=m.useRef(!1);if(m.useEffect(()=>{if(A){if(!je.current){oe.current=Be,je.current=!0;return}Be&&!oe.current&&D(ge=>ge+1),oe.current=Be}},[Be,A]),F)return s.jsx(bt,{label:"Loading assignment workspace…"});if(W||!A||!e||!t)return s.jsx(Tt,{error:W||"Assignment not found."});const ke=e,_e=t,Ue=Te.length>0?{checked:Se,total:Te.length}:void 0,et=A.availableTransitions??[],Me=et.filter(ge=>!ge.disabled&&ge.targetStatus!==A.status),qe=EG.map(ge=>Me.find(He=>He.command===ge)).find(Boolean)??Me[0]??null,vt=[];if(B!=null&&B.sessions)for(const ge of B.sessions)for(const He of ge.windows)for(const Je of He.panes)((Ce=Je.assignment)==null?void 0:Ce.project)===e&&((se=Je.assignment)==null?void 0:se.slug)===t&&vt.push({sessionName:ge.name,command:Je.command,urls:Je.urls});async function ft(ge){l(null);try{await ZP(ke,_e,ge),P()}catch(He){l(He.message)}}async function st(ge){l(null);try{const He=await fetch(`/api/projects/${ke}/assignments/${_e}/${ge?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!He.ok){const Je=await He.json().catch(()=>null);throw new Error((Je==null?void 0:Je.error)||`HTTP ${He.status}`)}P(),f(ge?"Assignment archived":"Assignment restored","success")}catch(He){l(He.message)}}async function le(){T(!0);try{await ZK(ke,_e),n(`${r}/projects/${ke}`)}catch(ge){l(ge.message),T(!1),C(!1)}}async function ee(ge,He){l(null),g(ge.command);try{return await JP(ke,_e,ge,He),P(),!0}catch(Je){return l(Je.message),!1}finally{g(null)}}function ye(ge){if(e_(ge)){S(ge);return}ee(ge)}async function ie(ge,He){b(null),N(ge);try{const Je=await fetch(`/api/projects/${ke}/assignments/${_e}/acceptance-criteria/${ge}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:He})}),It=await Je.json();if(!Je.ok)throw new Error(It.error||`HTTP ${Je.status}`);P()}catch(Je){b(Je.message)}finally{N(null)}}const we=[...Me.filter(ge=>ge!==qe).map(ge=>({key:`transition-${ge.command}`,label:ge.label,onSelect:()=>ye(ge),disabled:h===ge.command})),...et.filter(ge=>ge.disabled||ge.targetStatus===A.status).map(ge=>({key:`transition-${ge.command}`,label:ge.label,disabled:!0,disabledReason:ge.targetStatus===A.status?`Already ${A.status.replace(/_/g," ")}`:ge.disabledReason??ge.warning??ge.description})),...z.statuses.map(ge=>({key:`override-${ge.id}`,label:`Override → ${ge.label}`,onSelect:()=>ft(ge.id),disabled:ge.id===A.status,disabledReason:ge.id===A.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:_L,href:`${r}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:QL,href:`${r}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:Ox,href:`${r}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:Xp,href:`${r}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:ML,href:`${r}/projects/${e}/assignments/${t}/decision-record/edit`},{key:A.archived?"unarchive":"archive",label:A.archived?"Restore assignment":"Archive assignment",icon:A.archived?Gp:zh,onSelect:()=>st(!A.archived)},{key:"delete",label:"Delete assignment",icon:jn,destructive:!0,onSelect:()=>C(!0)}],$e=(qe==null?void 0:qe.command)==="review";return s.jsxs("div",{className:"space-y-5",children:[s.jsx(ga,{toast:d,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 flex-wrap items-center gap-3",children:[s.jsx(kn,{status:A.status,progress:Ue}),A.phase&&A.phase!==A.status&&s.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",title:"Phase dimension — how far along the work is, independent of blockage",children:["phase: ",A.phase]}),A.disposition&&A.disposition!=="active"&&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:A.disposition}),s.jsx(ma,{type:A.type}),s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:A.title}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",o2(A.updated)]}),J.length>0&&s.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",J.length," unmet dep",J.length===1?"":"s"]}),s.jsx(_w,{externalIds:A.externalIds}),s.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[s.jsx(m_,{target:{kind:"assignment",id:A.id},worktreePath:((me=A.workspace)==null?void 0:me.worktreePath)??null,repository:((Pe=A.workspace)==null?void 0:Pe.repository)??null}),!((Ke=A.workspace)!=null&&Ke.worktreePath)&&e&&t&&s.jsx(g_,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>P()}),qe&&s.jsx("button",{type:"button",title:qe.warning||qe.description,disabled:h===qe.command,onClick:()=>ye(qe),className:Ne("shell-action disabled:cursor-not-allowed disabled:opacity-50",qe.warning&&"border-warning-foreground/40",$e&&R>0&&"send-to-review-glow"),children:s.jsx("span",{children:h===qe.command?"Working…":qe.label})},$e?`review-${R}`:qe.command),s.jsx(Nw,{items:we,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,A.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:"})," ",A.blockedReason]}):null,A.override&&A.derived&&A.derived.derivedStatus!==A.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 ",A.status]})," by ",A.override.source,A.override.reason?s.jsxs(s.Fragment,{children:[" — “",A.override.reason,"”"]}):null," · ","would otherwise be ",s.jsx("strong",{children:A.derived.derivedStatus})]}):null,(de=A.derived)!=null&&de.nextAction?s.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Next:"})," ",A.derived.nextAction]}):null]}),A.derived&&(Object.keys(A.derived.customFacts??{}).length>0||(A.derived.attestations??[]).length>0)?s.jsx(Ye,{title:"Facts",description:"Custom asserted facts and review attestations, materialized server-side.",children:s.jsxs("div",{className:"space-y-3",children:[Object.keys(A.derived.customFacts??{}).length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries(A.derived.customFacts??{}).map(([ge,He])=>s.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",children:[ge,": ",s.jsx("span",{className:"font-medium text-foreground",children:String(He)})]},ge))}),(A.derived.attestations??[]).map(ge=>s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-[11px] font-medium text-foreground",children:ge.fact}),s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",ge.binds,")"]}),ge.records.length===0?s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"— no attestations yet"}):ge.records.map(He=>s.jsxs("span",{title:`${He.verdict}${He.note?` — ${He.note}`:""}${He.stale?" (stale — revision moved)":""} · ${He.at}`,className:Ne("rounded-full border px-2 py-0.5 text-[11px]",He.stale?"border-border/40 text-muted-foreground line-through":He.verdict==="approved"?"border-success-foreground/40 text-success-foreground":"border-warning-foreground/40 text-warning-foreground"),children:[He.actor,": ",He.verdict==="approved"?"approved":"changes",He.stale?" (stale)":""]},He.actor))]},ge.fact))]})}):null,q.length>0&&s.jsx(kG,{projectSlug:e,dependencies:q,blockedReason:A.blockedReason}),A.enrichedLinks&&A.enrichedLinks.length>0&&s.jsx(SG,{links:A.enrichedLinks}),A.referencedBy&&A.referencedBy.length>0&&s.jsx(Ye,{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:A.referencedBy.map(ge=>{const He=ge.sourceProjectSlug===null?`/assignments/${ge.sourceId}`:`${r}/projects/${ge.sourceProjectSlug}/assignments/${ge.sourceSlug}`;return s.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Ie,{to:He,className:"text-foreground hover:text-primary",children:ge.sourceTitle}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",ge.mentions," mention",ge.mentions===1?"":"s",")"]}),ge.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]},ge.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(Rm,{value:$,onValueChange:ge=>i({tab:ge}),items:[{value:"summary",label:"Summary",content:s.jsxs("div",{className:"space-y-5",children:[be.acceptanceCriteria.length>0?s.jsx(Ye,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:s.jsxs("div",{className:"space-y-3",children:[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,be.acceptanceCriteria.map((ge,He)=>{const Je=j!==null;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:ge.checked,disabled:Je,onChange:It=>ie(He,It.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":ge.checked,children:ge.text})]},`${He}-${ge.text}`)})]})}):null,Ee.hasSection?s.jsx(Ye,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:s.jsx(vn,{content:Ee.todosMarkdown,emptyState:"No todos yet."})}):null,s.jsx(Ye,{title:"Assignment Summary",children:s.jsx(vn,{content:Ee.remaining,emptyState:be.acceptanceCriteria.length>0||Ee.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:A.plan?1:0,content:A.plan?s.jsx("div",{className:"space-y-5",children:s.jsxs(Ye,{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(Ie,{className:"shell-action",to:`${r}/projects/${e}/assignments/${t}/plan/edit`,children:[s.jsx(Ox,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Plan"})]}),children:[s.jsx("div",{className:"mb-4",children:s.jsx(kn,{status:A.plan.status})}),s.jsx(vn,{content:A.plan.body,emptyState:"No plan content yet."})]})}):s.jsx(Ct,{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:A.scratchpad?1:0,content:A.scratchpad?s.jsx(Ye,{title:"Scratchpad",actions:s.jsxs(Ie,{className:"shell-action",to:`${r}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[s.jsx(Ox,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Scratchpad"})]}),children:s.jsx(vn,{content:A.scratchpad.body,emptyState:"Scratchpad is empty."})}):s.jsx(Ct,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((pt=A.handoff)==null?void 0:pt.handoffCount)??0,content:s.jsx("div",{className:"space-y-5",children:A.handoff?s.jsx(Ye,{children:s.jsx(vn,{content:A.handoff.body,emptyState:"No handoff history yet."})}):s.jsx(Ct,{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:((xt=A.progress)==null?void 0:xt.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:A.progress&&A.progress.entries.length>0?s.jsx(Ye,{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:A.progress.entries.map((ge,He)=>s.jsxs("li",{className:"border-l-2 border-border pl-3",children:[s.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:ge.timestamp}),s.jsx(vn,{content:ge.body})]},`${ge.timestamp}-${He}`))})}):s.jsx(Ct,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((jt=A.comments)==null?void 0:jt.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:A.comments&&A.comments.entries.length>0?s.jsx(x_,{projectSlug:e,assignmentSlug:t,entries:A.comments.entries}):s.jsx(Ct,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((lt=A.decisionRecord)==null?void 0:lt.decisionCount)??0,content:s.jsx("div",{className:"space-y-5",children:A.decisionRecord?s.jsx(Ye,{children:s.jsx(vn,{content:A.decisionRecord.body,emptyState:"No decision history yet."})}):s.jsx(Ct,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),s.jsxs("div",{className:"min-w-0 space-y-5",children:[s.jsx(Ye,{title:"Details",children:s.jsxs("dl",{className:"space-y-3 text-sm",children:[s.jsx(Xo,{label:"ID",value:A.id,copyable:!0}),s.jsx(Xo,{label:"Priority",value:A.priority}),A.assignee&&s.jsx(Xo,{label:"Assignee",value:A.assignee}),s.jsx(Xo,{label:"Updated",value:`${s2(A.updated)} · Created ${r2(A.created)}`}),A.workspace.repository&&s.jsx(Xo,{label:"Repository",value:A.workspace.repository,copyable:!0}),A.workspace.worktreePath&&s.jsx(Xo,{label:"Worktree",value:A.workspace.worktreePath,copyable:!0}),A.workspace.branch&&s.jsx(Xo,{label:"Branch",value:A.workspace.branch,copyable:!0}),A.workspace.parentBranch&&s.jsx(Xo,{label:"Parent branch",value:A.workspace.parentBranch,copyable:!0}),A.externalIds.map((ge,He)=>s.jsx(TG,{entry:ge},`${ge.system}:${ge.id}:${He}`))]})}),vt.length>0&&s.jsx(Ye,{title:"Servers",children:s.jsx("div",{className:"space-y-2",children:vt.map((ge,He)=>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:ge.command,children:ge.command}),s.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:ge.sessionName,children:ge.sessionName}),ge.urls.map(Je=>s.jsxs("a",{href:Je,target:"_blank",rel:"noopener noreferrer",title:Je,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:Je.replace("http://localhost:",":")}),s.jsx(ac,{className:"h-2.5 w-2.5 shrink-0"})]},Je))]},He))})}),s.jsx(r_,{sessions:H==null?void 0:H.sessions,loading:L,error:U,onError:ge=>f(ge.message,"error"),onNotice:ge=>f(ge,"success")}),s.jsx(s_,{summary:M==null?void 0:M.summary,loading:V,error:Y})]})]}),s.jsx(o_,{open:y!==null,action:y,assignmentTitle:A.title,loading:h===(y==null?void 0:y.command),onOpenChange:ge=>{ge||S(null)},onConfirm:async ge=>{if(!y)return;await ee(y,ge)&&S(null)}}),s.jsx(ya,{open:k,title:"Delete assignment?",description:`This will permanently delete "${A.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:I,onOpenChange:ge=>{ge||C(!1)},onConfirm:le})]})}function Xo({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(Qr,{value:t})]})]})}function TG({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(ac,{className:"h-2.5 w-2.5 shrink-0"})]}):s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function RG(){var T,R,D,$,z,A,F,W;const{id:e}=Bt(),[t,n]=js(),r=t.get("tab")??"summary",{data:o,loading:i,error:a,refetch:l}=sO(e),{data:d,loading:f,error:p}=iO(e),{data:h,loading:g,error:y}=lO(o==null?void 0:o.slug),[S,w]=m.useState(!1),[b,j]=m.useState(null),{toast:N,showToast:k,dismissToast:C}=gi();async function I(P){if(e){j(null);try{const O=await fetch(`/api/assignments/${e}/${P?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!O.ok){const B=await O.json().catch(()=>null);throw new Error((B==null?void 0:B.error)||`HTTP ${O.status}`)}l(),k(P?"Assignment archived":"Assignment restored","success")}catch(O){j(O instanceof Error?O.message:"Archive failed")}}}return i?s.jsx(bt,{}):a?s.jsx(Tt,{error:a}):o?s.jsxs("div",{className:"space-y-6",children:[s.jsx(ga,{toast:N,onDismiss:C}),s.jsxs("header",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(kn,{status:o.status}),s.jsx(ma,{type:o.type}),s.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:o.id}),s.jsx(_w,{externalIds:o.externalIds}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx(m_,{target:{kind:"assignment",id:o.id},worktreePath:((T=o.workspace)==null?void 0:T.worktreePath)??null,repository:((R=o.workspace)==null?void 0:R.repository)??null,size:"compact"}),!((D=o.workspace)!=null&&D.worktreePath)&&s.jsx(g_,{assignmentId:o.id,defaultBranch:`syntaur/${o.slug}`,onCreated:()=>l()}),s.jsxs("button",{type:"button",onClick:()=>w(!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(Bh,{className:"h-3 w-3"}),"Move to workspace…"]}),s.jsx(Ie,{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:()=>I(!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(Gp,{className:"h-3 w-3"}):s.jsx(zh,{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,b?s.jsx("p",{className:"text-sm text-status-failed-foreground",children:b}):null]}),o.referencedBy&&o.referencedBy.length>0?s.jsx(Ye,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:s.jsx("ul",{className:"space-y-2",children:o.referencedBy.map(P=>s.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Ie,{to:P.sourceProjectSlug===null?`/assignments/${P.sourceId}`:`/projects/${P.sourceProjectSlug}/assignments/${P.sourceSlug}`,className:"text-foreground hover:text-primary",children:P.sourceTitle}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",P.mentions," mention",P.mentions===1?"":"s",")"]})]},P.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(Rm,{value:r,onValueChange:P=>n({tab:P}),items:[{value:"summary",label:"Summary",content:s.jsx("div",{className:"space-y-5",children:s.jsx(Ye,{title:"Assignment",children:s.jsx(vn,{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(Ye,{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((P,O)=>s.jsxs("li",{className:"border-l-2 border-border pl-3",children:[s.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:P.timestamp}),s.jsx(vn,{content:P.body})]},`${P.timestamp}-${O}`))})}):s.jsx(Ct,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((z=o.comments)==null?void 0:z.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:s.jsx(x_,{projectSlug:null,assignmentSlug:o.id,entries:((A=o.comments)==null?void 0:A.entries)??[]})})},{value:"plan",label:"Plan",content:s.jsx("div",{className:"space-y-5",children:o.plan?s.jsxs(Ye,{children:[s.jsx(vn,{content:o.plan.body,emptyState:"Plan file exists but is empty."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(Ie,{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(Ct,{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(Ye,{children:[s.jsx(vn,{content:o.scratchpad.body,emptyState:"Scratchpad is empty."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(Ie,{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(Ct,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((F=o.handoff)==null?void 0:F.handoffCount)??0,content:s.jsx("div",{className:"space-y-5",children:o.handoff?s.jsxs(Ye,{children:[s.jsx(vn,{content:o.handoff.body,emptyState:"No handoff history yet."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(Ie,{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(Ct,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((W=o.decisionRecord)==null?void 0:W.decisionCount)??0,content:s.jsx("div",{className:"space-y-5",children:o.decisionRecord?s.jsxs(Ye,{children:[s.jsx(vn,{content:o.decisionRecord.body,emptyState:"No decision history yet."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(Ie,{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(Ct,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]})}),s.jsxs("div",{className:"min-w-0 space-y-5",children:[s.jsx(Ye,{title:"Details",children:s.jsxs("dl",{className:"space-y-3 text-sm",children:[s.jsx(Qo,{label:"ID",value:o.id,copyable:!0}),s.jsx(Qo,{label:"Priority",value:o.priority}),o.assignee&&s.jsx(Qo,{label:"Assignee",value:o.assignee}),s.jsx(Qo,{label:"Updated",value:`${s2(o.updated)} · Created ${r2(o.created)}`}),o.workspace.repository&&s.jsx(Qo,{label:"Repository",value:o.workspace.repository,copyable:!0}),o.workspace.worktreePath&&s.jsx(Qo,{label:"Worktree",value:o.workspace.worktreePath,copyable:!0}),o.workspace.branch&&s.jsx(Qo,{label:"Branch",value:o.workspace.branch,copyable:!0}),o.workspace.parentBranch&&s.jsx(Qo,{label:"Parent branch",value:o.workspace.parentBranch,copyable:!0}),o.externalIds.map((P,O)=>s.jsx(AG,{entry:P},`${P.system}:${P.id}:${O}`))]})}),s.jsx(r_,{sessions:d==null?void 0:d.sessions,loading:f,error:p,onError:P=>k(P.message,"error"),onNotice:P=>k(P,"success")}),s.jsx(s_,{summary:h==null?void 0:h.summary,loading:g,error:y})]})]}),s.jsx(Pw,{open:S,onOpenChange:w,currentWorkspace:o.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async P=>{const O=await fetch(`/api/assignments/${encodeURIComponent(o.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:P})});if(!O.ok){const B=await O.json().catch(()=>({}));throw new Error(B.error||"Failed to move assignment")}l()}})]}):s.jsx(Tt,{error:"Assignment not found"})}function Qo({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(Qr,{value:t})]})]})}function AG({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(ac,{className:"h-2.5 w-2.5 shrink-0"})]}):s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function PG({currentStatus:e,availableTransitions:t,onSelect:n,overrideTargets:r,onOverride:o,disabled:i=!1,className:a}){const[l,d]=m.useState(!1),[f,p]=m.useState(null),[h,g]=m.useState(0),y=m.useRef(null),S=m.useRef(null),w=m.useId(),b=Ss(),j=sd(b.statuses,e),N=_b(e),k=r??[],C=t.length+k.length,I=m.useCallback(A=>{d(!1),A&&requestAnimationFrame(()=>{var F;(F=y.current)==null||F.focus()})},[]),T=m.useCallback(()=>{var F;const A=(F=y.current)==null?void 0:F.getBoundingClientRect();A&&p({top:A.top,left:A.left,width:A.width,bottom:A.bottom})},[]);m.useLayoutEffect(()=>{l&&T()},[l,T]),m.useEffect(()=>{if(!l)return;const A=()=>T();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[l,T]),m.useEffect(()=>{if(!l)return;const A=F=>{var P,O;const W=F.target;W&&((P=S.current)!=null&&P.contains(W)||(O=y.current)!=null&&O.contains(W)||I(!1))};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[l,I]),m.useEffect(()=>{l&&g(0)},[l,C]);function R(A){return!A.disabled&&A.id!==e}function D(A){if(A<t.length){const W=t[A];W&&(n(W),I(!0));return}const F=k[A-t.length];F&&R(F)&&(o==null||o(F.id),I(!0))}function $(A){(A.key==="Enter"||A.key===" "||A.key==="ArrowDown")&&(A.preventDefault(),d(!0))}function z(A){if(C===0){A.key==="Escape"&&(A.preventDefault(),I(!0));return}A.key==="ArrowDown"?(A.preventDefault(),g(F=>(F+1)%C)):A.key==="ArrowUp"?(A.preventDefault(),g(F=>(F-1+C)%C)):A.key==="Home"?(A.preventDefault(),g(0)):A.key==="End"?(A.preventDefault(),g(C-1)):A.key==="Enter"?(A.preventDefault(),D(h)):A.key==="Escape"&&(A.preventDefault(),I(!0))}return s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:y,type:"button","data-no-drag":!0,disabled:i,"aria-haspopup":"menu","aria-expanded":l,"aria-controls":l?w:void 0,onClick:()=>{i||d(A=>!A)},onKeyDown:$,title:`Status: ${j.label}. Click to change.`,style:j.style,className:Ne(vA,j.className,a,"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",i&&"cursor-not-allowed opacity-60"),children:[s.jsx(N,{className:"h-3.5 w-3.5 shrink-0"}),s.jsx("span",{className:"min-w-0 truncate",children:j.label})]}),l&&f&&typeof document<"u"?mo.createPortal(s.jsx("div",{ref:S,id:w,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:z,style:{position:"fixed",top:f.bottom+6,left:f.left,minWidth:Math.max(f.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:C===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((A,F)=>{const W=_b(A.targetStatus),P=F===h;return s.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>g(F),onClick:()=>D(F),title:A.warning||A.description,className:Ne("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",P?"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(W,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate",children:A.label})]}),s.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:li(b,A.targetStatus)})]}),A.warning?s.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:A.warning}):null]},`${A.command}:${A.targetStatus}`)}),k.length>0&&t.length>0?s.jsx("div",{className:"my-1 border-t border-border/60",role:"separator"}):null,k.map((A,F)=>{const W=t.length+F,P=W===h,O=!R(A),B=sd(b.statuses,A.id);return s.jsx("button",{type:"button",role:"menuitem","data-no-drag":!0,disabled:O,onMouseEnter:()=>g(W),onClick:()=>D(W),title:O?A.disabledReason??(A.id===e?"Already in this status":void 0):`Set status to ${A.label}`,className:Ne("flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left text-sm transition",O?"cursor-not-allowed text-muted-foreground/60":P?"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:Ne("h-2.5 w-2.5 flex-shrink-0 rounded-full border border-border/40",B.style?void 0:B.className),style:B.style?{backgroundColor:B.style.color}:void 0}),s.jsxs("span",{className:"truncate",children:["Override → ",A.label]})]})},`override-${A.id}`)})]})}),document.body):null]})}function b_({title:e,detailHref:t,onSave:n,disabled:r=!1}){const[o,i]=m.useState(!1);return o?s.jsx(_G,{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:Ne("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(Ie,{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(ac,{className:"h-3.5 w-3.5"})})]})}function _G({initialTitle:e,disabled:t,onSave:n,onExit:r}){const o=m.useRef(e),[i,a]=m.useState(e),[l,d]=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()},[]),S=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,d(!0);try{await n(b)}catch{}finally{d(!1),r()}},[i,r,n,y]);function w(b){b.key==="Enter"?(b.preventDefault(),S()):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:w,onBlur:()=>void S(),className:Ne("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 v_(e){const t=zt(),n=m.useRef(null),r=m.useRef(!1),o=m.useCallback(()=>{const a=n.current,l=!!(a!=null&&a.querySelector('[aria-expanded="true"]')),d=!!document.querySelector('[role="menu"]'),f=document.activeElement,p=!!(f&&(a!=null&&a.contains(f))&&(f.tagName==="INPUT"||f.tagName==="TEXTAREA"));r.current=l||d||p},[]),i=m.useCallback(a=>{if(r.current)return;const l=a.target;!l||l.closest(Gl)||t(e)},[t,e]);return{containerRef:n,onMouseDown:o,onClick:i}}const CN=/[A-Za-z0-9_-]/;function EN(e,t){const n=Math.max(0,Math.min(t,e.length)),r=DG(e,n);if(r)return r;let o=n;for(;o>0&&CN.test(e[o-1]);)o--;let i=n;for(;i<e.length&&CN.test(e[i]);)i++;const a=e.slice(o,n),l=e.slice(0,o),d=l.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(d)return{kind:"value",field:d[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 DG(e,t){let n=-1;for(let d=t-1;d>=0;d--)if(e[d]==='"'&&(d===0||e[d-1]!=="\\")){n=d;break}if(n<0)return null;for(let d=n+1;d<t;d++)if(e[d]==='"'&&e[d-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 $G(e,t){const n=fA(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 IG(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 MG(e,t,n){let r;return t.kind==="field"?r=`${n}:`:r=ew(n),{text:e.slice(0,t.tokenStart)+r+e.slice(t.tokenEnd),caret:t.tokenStart+r.length}}const LG=180;function OG(e,t){const[n,r]=m.useState(e);return m.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),n}function FG({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 d=m.useRef(null),f=m.useRef(null),p=OG(e,LG),[h,g]=m.useState([]),[y,S]=m.useState([]),[w,b]=m.useState("field"),[j,N]=m.useState(-1),[k,C]=m.useState(!1),I=m.useRef(e.length);m.useEffect(()=>{if(p.trim()===""){g([]),n==null||n(null);return}const P=Vl(p,r);P.errors.length>0?(g(P.errors),n==null||n(null)):(g([]),n==null||n(P.query))},[p,r,n]);const T=m.useCallback((P,O)=>{const B=EN(P,O);if(!B){S([]),C(!1);return}if(B.kind==="field"){const H=$G(B.partial,o);S(H),b("field"),C(H.length>0)}else{const H=IG(B.field,B.partial,i,r);S(H),b("value"),C(H.length>0)}N(-1)},[o,i,r]),R=m.useCallback(P=>{const O=P.target.value,B=P.target.selectionStart??O.length;I.current=B,t(O),T(O,B)},[t,T]),D=m.useCallback(P=>{const O=d.current,B=(O==null?void 0:O.selectionStart)??I.current,H=EN(e,B);if(!H)return;const{text:L,caret:U}=MG(e,H,P);t(L),C(!1),S([]),requestAnimationFrame(()=>{d.current&&(d.current.focus(),d.current.setSelectionRange(U,U),I.current=U)})},[e,t]),$=m.useCallback(P=>{if(!(!k||y.length===0))switch(P.key){case"ArrowDown":P.preventDefault(),N(O=>Math.min(O+1,y.length-1));break;case"ArrowUp":P.preventDefault(),N(O=>Math.max(O-1,-1));break;case"Enter":case"Tab":j>=0&&(P.preventDefault(),D(y[j]));break;case"Escape":C(!1),S([]);break}},[k,y,j,D]),z=m.useRef(null),A=m.useCallback(()=>{z.current=setTimeout(()=>C(!1),120)},[]);m.useEffect(()=>()=>{z.current!==null&&clearTimeout(z.current)},[]);const F=m.useCallback(()=>{var O;const P=((O=d.current)==null?void 0:O.selectionStart)??e.length;T(e,P)},[e,T]);m.useEffect(()=>{var P,O;k&&((O=(P=f.current)==null?void 0:P.querySelector('[aria-selected="true"]'))==null||O.scrollIntoView({block:"nearest"}))},[j,k]);const W=h.length>0&&p.trim()!=="";return s.jsxs("div",{className:`relative flex flex-col gap-1 ${l??""}`,children:[s.jsx("input",{ref:d,type:"text",value:e,onChange:R,onKeyDown:$,onBlur:A,onFocus:F,placeholder:a,"aria-label":"AQL query input","aria-expanded":k,"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",W?"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(" ")}),k&&y.length>0&&s.jsx("ul",{ref:f,role:"listbox","aria-label":w==="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((P,O)=>s.jsx("li",{role:"option","aria-selected":O===j,onMouseDown:B=>{B.preventDefault(),D(P)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",O===j?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:P},P))}),W&&s.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:h.map((P,O)=>s.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",P.pos,": ",P.message]},O))})]})}const TN=Zv;function up(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function zG(e,t){return e.toString()===t.toString()}function RN(){const{workspace:e}=Bt(),t=mn(),n=zt(),r=m.useRef(null);mi("list:assignments");const{data:o,loading:i,error:a,refetch:l}=qh(),d=Ss(),f=Td(),[p,h]=js(),g=e?`w:${e}`:null,y=WP(g),S=m.useRef(void 0),w=m.useMemo(()=>AA(d.order),[d]),b=m.useMemo(()=>{const G={};for(const Z of w)G[Z]=li(d,Z);return G},[w,d]),j=m.useMemo(()=>w.map(G=>({id:G,title:b[G]??G,description:Od(G)})),[w,b]),N=m.useMemo(()=>f.definitions.map(G=>({id:G.id,title:Pl(f,G.id),description:G.description})),[f]),k="__unknown_type__",C=m.useMemo(()=>new Set(["all",...w]),[w]),I=p.get("view"),T=p.get("status"),R=p.get("stale"),D=I&&TN.includes(I)?I:"kanban";function $(G){if(!G)return[];const Z=[];for(const ve of G.split(",")){const ze=ve.trim();!ze||ze==="all"||!C.has(ze)||Z.includes(ze)||Z.push(ze)}return Z}const z=m.useCallback(G=>{h(Z=>{const ve=new URLSearchParams(Z);return G==="kanban"?ve.delete("view"):ve.set("view",G),ve})},[h]),[A,F]=m.useState(""),[W,P]=m.useState(()=>$(T)),[O,B]=m.useState(()=>Ve(y.filters.priority)),[H,L]=m.useState(()=>Ve(y.filters.type)),[U,M]=m.useState(()=>Ve(y.filters.assignee)),[V,Y]=m.useState(()=>Ve(y.filters.project)),[q,J]=m.useState(()=>Ve(y.filters.tags)),[ne,Q]=m.useState(null),[ce,te]=m.useState(()=>up(R)),[pe,be]=m.useState(()=>Pu({status:$(T),priority:Ve(y.filters.priority),type:Ve(y.filters.type),assignee:Ve(y.filters.assignee),project:Ve(y.filters.project),tags:Ve(y.filters.tags),activity:up(R)})),[Ee,Te]=m.useState(()=>y.sortField),[Se,Be]=m.useState(()=>y.sortDirection),[oe,je]=m.useState(()=>({hidden:[]})),[ke,_e]=m.useState(()=>({hidden:[]})),[Ue,et]=m.useState(()=>y.grouping),Me=Ue==="type"?"type":"status",[qe,vt]=m.useState(()=>new Set),[ft,st]=m.useState([]),{toast:le,showToast:ee,dismissToast:ye}=gi(),[ie,we]=m.useState(null),[$e,Ce]=m.useState(null),[se,me]=m.useState(null),[Pe,Ke]=m.useState(null),[de,pt]=m.useState(null),[xt,jt]=m.useState(null),[lt,ge]=m.useState(null),[He,Je]=m.useState(null),[It,qt]=m.useState(null),[un,Ut]=m.useState(!1),[Un,St]=m.useState(!1),$n=e?{kind:"workspace",workspace:e}:{kind:"global"},Nt=p.get("loadView"),{view:ue,loading:We,error:ot}=ui(Nt),{view:yt,loading:Gn,error:vr}=ui(It),rs=m.useRef(null);m.useEffect(()=>{st((o==null?void 0:o.assignments)??[])},[o]),m.useEffect(()=>{It&&!Gn&&!vr&&!yt&&qt(null)},[yt,vr,It,Gn]),m.useEffect(()=>{qt(null),rs.current=null,Q(null),F("")},[e]);const va=m.useRef({status:T,stale:R});m.useEffect(()=>{const G=$(T),Z=up(R);ZF(G,W)||P(G),Z!==ce&&te(Z);const ve=va.current,ze=ve.status!==T||ve.stale!==R;va.current={status:T,stale:R},ze&&en({status:G,activity:Z})},[ce,R,W,T]),m.useEffect(()=>{S.current===g&&h(G=>{const Z=new URLSearchParams(G);return W.length===0?Z.delete("status"):Z.set("status",W.join(",")),ce==="all"?Z.delete("stale"):ce==="stale"?Z.set("stale","1"):Z.set("stale","0"),zG(G,Z)?G:Z})},[ce,g,h,W]),m.useEffect(()=>{B(Ve(y.filters.priority)),L(Ve(y.filters.type)),M(Ve(y.filters.assignee)),Y(Ve(y.filters.project)),J(Ve(y.filters.tags)),Te(y.sortField),Be(y.sortDirection),et(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(S.current===g)return;let G=!1;return n0().then(Z=>{if(G||S.current===g)return;const ve=vT(Z,g),ze=ve.defaultView,dt=Ve(ve.filters.status),_t=ve.filters.activity??"all",Rt=new URLSearchParams(window.location.search);let Mn=!1;const gn=new URLSearchParams(Rt);Rt.get("view")===null&&ze!=="kanban"&&TN.includes(ze)&&(gn.set("view",ze),Mn=!0),Rt.get("status")===null&&dt.length>0&&(gn.set("status",dt.join(",")),P(dt),Mn=!0),Rt.get("stale")===null&&_t!=="all"&&(gn.set("stale",_t==="stale"?"1":"0"),te(_t),Mn=!0),Mn&&h(gn,{replace:!0});const dn=$(gn.get("status")),jr=gn.get("stale")===null?_t:up(gn.get("stale"));be(Pu({status:dn,priority:Ve(ve.filters.priority),type:Ve(ve.filters.type),assignee:Ve(ve.filters.assignee),project:Ve(ve.filters.project),tags:Ve(ve.filters.tags),activity:jr==="fresh"||jr==="stale"?jr:"all"})),queueMicrotask(()=>{S.current=g})}),()=>{G=!0}},[g]);const ht=m.useCallback(G=>{(g===null?KP(G):GP(g,G)).catch(ve=>{console.warn("Failed to persist view prefs:",ve)})},[g]),yi=m.useCallback(G=>{z(G),ht({defaultView:G})},[z,ht]),Co=m.useRef(null);Co.current={status:W,priority:O,type:H,assignee:U,project:V,tags:q,activity:ce,dateRange:ne,search:A};const wa=m.useCallback((G={})=>{const Z=Co.current;return{status:Z.status,priority:Z.priority,type:Z.type,assignee:Z.assignee,project:Z.project,tags:Z.tags,activity:Z.activity,dateRange:ta(Z.dateRange),search:Z.search,...G}},[]),en=m.useCallback((G={})=>{be(Pu(wa(G)))},[wa]),ja=m.useCallback(G=>{P(G),ht({filters:{status:G}}),en({status:G})},[ht,en]),ka=m.useCallback(G=>{B(G),ht({filters:{priority:G}}),en({priority:G})},[ht,en]),Sa=m.useCallback(G=>{L(G),ht({filters:{type:G}}),en({type:G})},[ht,en]),Ec=m.useCallback(G=>{M(G),ht({filters:{assignee:G}}),en({assignee:G})},[ht,en]),Na=m.useCallback(G=>{Y(G),ht({filters:{project:G}}),en({project:G})},[ht,en]),Kt=m.useCallback(G=>{J(G),ht({filters:{tags:G}}),en({tags:G})},[ht,en]),Tc=m.useCallback(G=>{te(G),ht({filters:{activity:G}}),en({activity:G})},[ht,en]),bi=m.useCallback(G=>{F(G),en({search:G})},[en]),Ca=m.useCallback(G=>{Q(G),en({dateRange:ta(G)})},[en]),Es=m.useCallback(G=>{Te(G),ht({sortField:G})},[ht]),Eo=m.useCallback(G=>{Be(G),ht({sortDirection:G})},[ht]),Ea=m.useCallback(G=>{et(G),ht({grouping:G})},[ht]),To=m.useCallback(G=>{be(G);const Z=_u(G);Z&&(P(Ve(Z.status)),B(Ve(Z.priority)),L(Ve(Z.type)),M(Ve(Z.assignee)),Y(Ve(Z.project)),J(Ve(Z.tags)),F(Z.search??""),te(Z.activity&&Z.activity!=="all"?Z.activity:"all"),Q(Nm(Z.dateRange)))},[]),tn=m.useMemo(()=>_u(pe)!==null,[pe]),Ro=m.useCallback(()=>{const Z=_u(pe)!==null?{status:W,priority:O,type:H,assignee:U,project:V,tags:q,activity:ce,dateRange:ta(ne),search:A}:{};return{viewMode:D,filters:{...Z,query:pe},sortField:Ee,sortDirection:Se,listSectionVisibility:{collapsed:[...qe]},kanbanColumnVisibility:oe,tableColumnVisibility:ke}},[D,pe,W,O,H,U,V,q,ce,ne,A,Ee,Se,qe,oe,ke]),In=m.useCallback(G=>{SA(G,{setViewMode:z,setQuery:be,setStatusFilter:Z=>{P(Z),ht({filters:{status:Z}})},setPriorityFilter:Z=>{B(Z),ht({filters:{priority:Z}})},setTypeFilter:Z=>{L(Z),ht({filters:{type:Z}})},setAssigneeFilter:Z=>{M(Z),ht({filters:{assignee:Z}})},setProjectFilter:Z=>{Y(Z),ht({filters:{project:Z}})},setTagsFilter:Z=>{J(Z),ht({filters:{tags:Z}})},setActivityFilter:Z=>{te(Z),ht({filters:{activity:Z}})},setDateRange:Q,setSearch:F,setSortField:Es,setSortDirection:Eo,setListSectionVisibility:Z=>vt(new Set(Z.collapsed)),setKanbanColumnVisibility:je,setTableColumnVisibility:_e}),qt(G.id)},[z,ht,Es,Eo]),Rc=m.useCallback(G=>{In(G),rs.current=G.id,h(Z=>{const ve=new URLSearchParams(Z);return ve.set("loadView",G.id),ve},{replace:!0})},[In,h]),Ac=m.useCallback(async G=>{try{const Z=Yl({name:G,context:{workspace:e??null,projectSlug:null},state:Ro()}),ve=await Wl(Z),ze=ve.views[ve.views.length-1];qt((ze==null?void 0:ze.id)??null),ze&&(rs.current=ze.id,h(dt=>{const _t=new URLSearchParams(dt);return _t.set("loadView",ze.id),_t},{replace:!0})),Ut(!1),St(!1),ee(`Saved view "${G}"`,"success")}catch(Z){throw ee(Z instanceof Error?Z.message:"Failed to save view","error"),Z}},[Ro,h,ee,e]),Pc=m.useCallback(async()=>{if(!(!It||!yt))try{const G=Yl({name:yt.name,context:{workspace:e??null,projectSlug:null},state:Ro()}),Z=mh(yt.config,G.config,G.config);await uh(It,{config:Z}),ee("View updated","success")}catch(G){ee(G instanceof Error?G.message:"Failed to update view","error")}},[Ro,yt,It,ee,e]);m.useEffect(()=>{if(!Nt){rs.current=null;return}if(rs.current!==Nt&&(It&&It!==Nt&&qt(null),!We)){if(ot){ee("Couldn't load saved view — try again","error");return}if(ue){rs.current=Nt,In(ue),h(G=>{const Z=new URLSearchParams(G);return Z.delete("loadView"),Z},{replace:!0});return}rs.current=Nt,ee("Saved view no longer exists","error"),h(G=>{const Z=new URLSearchParams(G);return Z.delete("loadView"),Z},{replace:!0})}},[Nt,ue,We,ot,It,In,h,ee]);const Hn=m.useMemo(()=>ft.filter(G=>e?e==="_ungrouped"?G.projectWorkspace===null:G.projectWorkspace===e:!0),[ft,e]),Ao=m.useMemo(()=>Array.from(new Set(Hn.map(G=>G.status))).sort(),[Hn]),Ts=m.useMemo(()=>Array.from(new Set(Hn.map(G=>G.priority))).sort(),[Hn]),zr=m.useMemo(()=>Array.from(new Set(Hn.map(G=>G.assignee??"__unassigned__"))).sort(),[Hn]),Ta=m.useMemo(()=>Array.from(new Map(Hn.filter(G=>G.projectSlug!==null).map(G=>[G.projectSlug,G.projectTitle]))).sort(([,G],[,Z])=>G.localeCompare(Z)),[Hn]),vi=m.useMemo(()=>Array.from(new Set(Hn.flatMap(G=>G.tags??[]))).sort(),[Hn]),Zs=m.useMemo(()=>dA(d.factDeclarations),[d.factDeclarations]),wi=m.useMemo(()=>pe.trim()===""?null:Vl(pe,Zs).query,[pe,Zs]),Ot=m.useMemo(()=>cA(ft,wi,{workspace:e}),[ft,wi,e]),wr=m.useMemo(()=>Ld(Ot,Ee,Se),[Ot,Ee,Se]),ji=m.useMemo(()=>{if(Ue==="none")return[{id:"__all__",label:"All assignments",items:Ot}];if(Ue==="type"){const G=f.definitions.map(ze=>({id:ze.id,label:Pl(f,ze.id),items:Ot.filter(dt=>dt.type===ze.id)})),Z=new Set(f.definitions.map(ze=>ze.id)),ve=Ot.filter(ze=>!ze.type||!Z.has(ze.type));return ve.length>0&&G.push({id:k,label:"Other",items:ve}),G}if(Ue==="priority")return["critical","high","medium","low"].map(Z=>({id:Z,label:Z.charAt(0).toUpperCase()+Z.slice(1),items:Ot.filter(ve=>ve.priority===Z)}));if(Ue==="assignee")return Array.from(new Set(Ot.map(Z=>Z.assignee??"__unassigned__"))).sort().map(Z=>({id:Z,label:Z==="__unassigned__"?"Unassigned":Z,items:Ot.filter(ve=>(ve.assignee??"__unassigned__")===Z)}));if(Ue==="project"){const G=new Map;for(const Z of Ot){const ve=Z.projectSlug??"__standalone__",ze=Z.projectTitle??"Standalone";G.has(ve)||G.set(ve,ze)}return Array.from(G.entries()).sort(([,Z],[,ve])=>Z.localeCompare(ve)).map(([Z,ve])=>({id:Z,label:ve,items:Ot.filter(ze=>(ze.projectSlug??"__standalone__")===Z)}))}return w.map(G=>({id:G,label:b[G]??G,items:Ot.filter(Z=>Z.status===G)}))},[Ue,Ot,f,w,b]),Po=m.useMemo(()=>{const G=new Set(f.definitions.map(ve=>ve.id));return Ot.some(ve=>!ve.type||!G.has(ve.type))?[...N,{id:k,title:"Other",description:"Assignments with no recognized type."}]:N},[N,f,Ot]),{visibleItems:Mt,visibleIndexByKey:_c}=m.useMemo(()=>{let G;if(D==="table")G=wr;else if(D==="kanban"){const ve=new Set(f.definitions.map(ze=>ze.id));Me==="type"?G=[...f.definitions.flatMap(ze=>Ot.filter(dt=>dt.type===ze.id)),...Ot.filter(ze=>!ze.type||!ve.has(ze.type))]:G=w.flatMap(ze=>Ot.filter(dt=>dt.status===ze))}else G=ji.flatMap(ve=>ve.items);const Z=new Map;return G.forEach((ve,ze)=>Z.set(yn(ve),ze)),{visibleItems:G,visibleIndexByKey:Z}},[D,wr,ji,Me,f,Ot,w]),{hotkeyRowProps:Ra}=Rd(Mt,{scope:"list:assignments",onOpen:G=>{if(G.projectSlug===null){n(`/assignments/${G.id}`);return}const Z=G.projectWorkspace?`/w/${G.projectWorkspace}`:t;n(`${Z}/projects/${G.projectSlug}/assignments/${G.slug}`)}});if(Jt({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var G;return(G=r.current)==null?void 0:G.focus()}}),Jt({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>l()}),i)return s.jsx(bt,{label:"Loading assignments board…"});if(a||!o)return s.jsx(Tt,{error:a||"Assignments board is unavailable."});async function Aa({item:G,toColumnId:Z,action:ve,reason:ze}){if(!ve){const _t=d.statuses.find(Rt=>Rt.id===Z);if(Pb(_t??{id:Z}))return ee(`Reach “${li(d,Z)}” through its complete/fail transition.`,"error"),!1}we(yn(G));const dt=ft;st(_t=>_t.map(Rt=>yn(Rt)===yn(G)?{...Rt,status:Z,blockedReason:Z==="blocked"?ze??Rt.blockedReason:null}:Rt));try{const _t=G.projectSlug===null?ve?await eG(G.id,ve,ze):await tG(G.id,Z):ve?await JP(G.projectSlug,G.slug,ve,ze):await ZP(G.projectSlug,G.slug,Z);return st(Rt=>Rt.map(Mn=>yn(Mn)===yn(G)?{...Mn,status:_t.status,blockedReason:_t.blockedReason,availableTransitions:_t.availableTransitions,updated:_t.updated}:Mn)),l(),!0}catch(_t){return st(dt),ee(_t.message,"error"),!1}finally{we(null)}}async function eo({item:G,toColumnId:Z,action:ve}){if(G.status===Z)return;const ze=ve??xu(G,Z);if(ze!=null&&ze.disabled){ee(ze.disabledReason||`Cannot move this assignment to ${Z}.`,"error");return}if(ze&&e_(ze)){Ke({item:G,toColumnId:Z,action:ze});return}await Aa({item:G,toColumnId:Z,action:ze})}function Dc(G){return yA(d).map(Z=>Z.id===G.status?{id:Z.id,label:Z.label,disabled:!0,disabledReason:"Already in this status"}:Z.terminal&&!G.availableTransitions.find(ze=>ze.targetStatus===Z.id&&!ze.disabled)?{id:Z.id,label:Z.label,disabled:!0,disabledReason:`Reach ${Z.label} via its transition when available`}:{id:Z.id,label:Z.label})}function $c(G,Z){eo({item:G,toColumnId:Z})}async function ki(G,Z){if(Z===G.title)return;const ve=yn(G),ze=ft;st(dt=>dt.map(_t=>yn(_t)===ve?{..._t,title:Z}:_t)),we(ve);try{const dt=G.projectSlug===null?await rG({id:G.id,title:Z}):await nG({projectSlug:G.projectSlug,assignmentSlug:G.slug,title:Z});st(_t=>_t.map(Rt=>yn(Rt)===ve?{...Rt,title:dt.title,updated:dt.updated}:Rt)),l()}catch(dt){throw st(ze),ee(dt.message,"error"),dt}finally{we(null)}}function Pa(G){vt(Z=>{const ve=new Set(Z);return ve.has(G)?ve.delete(G):ve.add(G),ve})}function Rs(G){Ee===G?Eo(Se==="asc"?"desc":"asc"):(Es(G),Eo("asc"))}const pn=$e?ft.find(G=>yn(G)===$e)??null:null;function As(G,Z){G.dataTransfer.effectAllowed="move",G.dataTransfer.setData("text/plain",Z),Ce(Z)}function to(){Ce(null),me(null)}function Si(G,Z){if(!pn)return;const ve=xu(pn,Z);pn.status===Z||ve!=null&&ve.disabled||(G.preventDefault(),G.dataTransfer.dropEffect="move",me(Z))}function Ps(G,Z){se===Z&&!G.currentTarget.contains(G.relatedTarget)&&me(null)}function ng(G,Z){if(G.preventDefault(),!pn||pn.status===Z){to();return}to(),eo({item:pn,toColumnId:Z})}function _s({field:G,children:Z}){const ve=Ee===G;return s.jsx("th",{className:"pb-3 font-medium",children:s.jsxs("button",{type:"button",onClick:()=>Rs(G),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Z,ve?Se==="asc"?s.jsx(VE,{className:"h-3 w-3"}):s.jsx(yr,{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(Ie,{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(Pt,{className:"h-4 w-4"}),"New Assignment"]})}),s.jsxs(Rw,{children:[s.jsx(FG,{className:"w-full md:min-w-[320px] md:flex-1",value:pe,onChange:To,registry:Zs,declarations:d.factDeclarations,valueSources:{statuses:d.order,priorities:Ts,types:f.definitions.map(G=>G.id),assignees:zr.filter(G=>G!=="__unassigned__"),projects:Ta.map(([G])=>G),tags:vi}}),tn?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(Cm,{ref:r,value:A,onChange:tn?bi:()=>{},placeholder:"Search assignments or projects"}),s.jsx(wn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!tn,options:Ao.map(G=>({value:G,label:b[G]??G})),value:W,onChange:ja}),s.jsx(wn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!tn,options:Ts.map(G=>({value:G,label:G[0].toUpperCase()+G.slice(1)})),value:O,onChange:ka}),s.jsx(wn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!tn,options:f.definitions.map(G=>({value:G.id,label:Pl(f,G.id)})),value:H,onChange:Sa}),s.jsx(wn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!tn,options:[{value:"__unassigned__",label:"Unassigned"},...zr.filter(G=>G!=="__unassigned__").map(G=>({value:G,label:G}))],value:U,onChange:Ec}),s.jsx(wn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!tn,options:[{value:"__standalone__",label:"Standalone"},...Ta.map(([G,Z])=>({value:G,label:Z}))],value:V,onChange:Na}),s.jsx(wn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!tn,options:vi.map(G=>({value:G,label:G})),value:q,onChange:Kt}),s.jsx(Sm,{className:"max-w-[200px]",value:ne,onChange:tn?Ca:()=>{}}),s.jsxs("select",{value:ce,disabled:!tn,onChange:G=>Tc(G.target.value),className:"editor-input max-w-[180px]",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:D==="kanban"?Me:Ue,onChange:G=>Ea(G.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:QF.map(G=>{const Z=D==="kanban"&&G!=="status"&&G!=="type",ve=G==="none"?"No grouping":`Group: ${G.charAt(0).toUpperCase()+G.slice(1)}`;return s.jsx("option",{value:G,disabled:Z,children:Z?`${ve} (list only)`:ve},G)})}),s.jsx(Em,{value:D,onChange:G=>yi(G),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),D==="table"?s.jsx(UP,{visibility:ke,onChange:_e}):null,s.jsx(XP,{scope:$n,loadedViewId:It,onApply:Rc,onOpenSaveDialog:()=>{St(!1),Ut(!0)}}),s.jsx("button",{type:"button",onClick:()=>{yt?Pc():(St(!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:yt?`Update ${yt.name}`:"Save current view",children:yt?`Update '${yt.name}'`:"Save view"}),yt?s.jsx("button",{type:"button",onClick:()=>{St(!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(Ct,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:s.jsxs(Ie,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[s.jsx(Sv,{className:"h-4 w-4"}),s.jsx("span",{children:"Browse Projects"})]})}):Ot.length===0?s.jsx(Ct,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):D==="table"?(()=>{const G=new Set(ke.hidden),Z=ve=>ve==="title"||!G.has(ve);return s.jsx(Ye,{title:`${wr.length} assignment${wr.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:[Z("title")?s.jsx(_s,{field:"title",children:"Assignment"}):null,Z("status")?s.jsx(_s,{field:"status",children:"Status"}):null,s.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),Z("priority")?s.jsx(_s,{field:"priority",children:"Priority"}):null,Z("assignee")?s.jsx(_s,{field:"assignee",children:"Assignee"}):null,Z("dependencies")?s.jsx(_s,{field:"dependencies",children:"Dependencies"}):null,Z("created")?s.jsx(_s,{field:"created",children:"Created"}):null,Z("updated")?s.jsx(_s,{field:"updated",children:"Updated"}):null]})}),s.jsx("tbody",{children:wr.map((ve,ze)=>s.jsxs(UG,{detailHref:rd(ve),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...Ra(ze),children:[Z("title")?s.jsxs("td",{className:"py-4 pr-4",children:[s.jsx(b_,{title:ve.title,detailHref:rd(ve),onSave:dt=>ki(ve,dt),disabled:ie===yn(ve)}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:ve.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:ve.id,children:[ve.id.slice(0,8),s.jsx(Qr,{value:ve.id})]})]}):null,Z("status")?s.jsx("td",{className:"py-4 pr-4",children:s.jsx("select",{value:ve.status,disabled:ie===yn(ve),onChange:dt=>eo({item:ve,toColumnId:dt.target.value}),className:Ne("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")]`,sd(d.statuses,ve.status).className,ie===yn(ve)&&"animate-pulse opacity-60"),style:sd(d.statuses,ve.status).style,children:w.map(dt=>{const _t=ve.status===dt,Rt=_t?void 0:xu(ve,dt),Mn=d.statuses.find(_a=>_a.id===dt),gn=!_t&&Pb(Mn??{id:dt})&&!Rt,dn=((Rt==null?void 0:Rt.disabled)??!1)||gn,jr=gn?`Reach ${b[dt]??dt} via its transition when available`:(Rt==null?void 0:Rt.disabledReason)??void 0;return s.jsx("option",{value:dt,disabled:dn,title:dn?jr:void 0,children:b[dt]},dt)})})}):null,s.jsx("td",{className:"py-4 pr-4",children:s.jsx(ma,{type:ve.type,compact:!0})}),Z("priority")?s.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:ve.priority}):null,Z("assignee")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:ve.assignee??"Unassigned"}):null,Z("dependencies")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:ve.dependsOn.length}):null,Z("created")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Kn(ve.created)}):null,Z("updated")?s.jsx("td",{className:"py-4 text-muted-foreground",children:Kn(ve.updated)}):null]},yn(ve)))})]})})})})():D==="list"?s.jsx("div",{className:"space-y-3",children:ji.map(({id:G,label:Z,items:ve})=>{var gn;if(ve.length===0&&!(pn&&Ue==="status"))return null;const ze=!qe.has(G),dt=Ue==="status",_t=dt&&pn?pn.status!==G&&!((gn=xu(pn,G))!=null&&gn.disabled):!1,Rt=dt&&pn?pn.status!==G&&!_t:!1,Mn=dt&&se===G;return s.jsxs("div",{className:Ne("rounded-lg border border-border/60 bg-card/90 transition",Mn&&_t&&"ring-2 ring-ring/30",Rt&&"border-dashed opacity-65"),onDragOver:dt?dn=>Si(dn,G):void 0,onDragLeave:dt?dn=>Ps(dn,G):void 0,onDrop:dt?dn=>ng(dn,G):void 0,children:[s.jsxs("button",{type:"button",onClick:()=>Pa(G),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[s.jsx(yr,{className:`h-4 w-4 text-muted-foreground transition-transform ${ze?"":"-rotate-90"}`}),s.jsx("span",{className:"font-semibold text-foreground",children:Z}),s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:ve.length})]}),ze&&ve.length>0&&s.jsx("div",{className:"space-y-3 px-4 pb-4",children:ve.map(dn=>{const jr=yn(dn),_a=$e===jr,Da=_c.get(jr)??-1,no=dt;return s.jsx("div",{draggable:no,onDragStart:no?Br=>As(Br,jr):void 0,onDragEnd:no?to:void 0,...Da>=0?Ra(Da):{},className:Ne("transition",no&&"cursor-grab active:cursor-grabbing",_a&&"scale-[0.98] opacity-50"),children:s.jsx(AN,{assignment:dn,dragging:_a,transitioning:ie===jr,onPillSelect:Br=>void eo({item:dn,toColumnId:Br.targetStatus,action:Br}),overrideTargets:Dc(dn),onOverride:Br=>$c(dn,Br),onRenameTitle:Br=>ki(dn,Br)})},jr)})})]},G)})}):s.jsx(km,{columns:Me==="type"?Po:j,items:Ot,getItemId:yn,getColumnId:G=>Me==="type"?G.type&&f.definitions.some(Z=>Z.id===G.type)?G.type:k:G.status,canDrop:({item:G,fromColumnId:Z,toColumnId:ve})=>{if(Z===ve)return{allowed:!0};const ze=xu(G,ve);return ze!=null&&ze.disabled?{allowed:!1,reason:ze.disabledReason||ze.description}:{allowed:!0,reason:ze?ze.warning||ze.description:`Move to ${ve} (direct status change).`}},onMove:Me==="type"?void 0:({item:G,toColumnId:Z})=>eo({item:G,toColumnId:Z}),dragDisabled:Me==="type",getExternalDragData:G=>G.projectSlug===null?{type:"standalone-assignment",id:G.id}:{type:"project-assignment",id:G.id},onCardContextMenu:(G,Z)=>{Z.preventDefault(),pt({item:G,anchor:{x:Z.clientX,y:Z.clientY}})},emptyMessage:G=>`No ${G.title.toLowerCase()} assignments.`,hiddenColumnIds:oe.hidden,onHideColumn:G=>je(Z=>({hidden:Z.hidden.includes(G)?Z.hidden.filter(ze=>ze!==G):[...Z.hidden,G]})),renderCard:(G,{dragging:Z})=>{const ve=_c.get(yn(G))??-1;return s.jsx("div",{...ve>=0?Ra(ve):{},children:s.jsx(AN,{assignment:G,dragging:Z,transitioning:ie===yn(G),onPillSelect:ze=>void eo({item:G,toColumnId:ze.targetStatus,action:ze}),overrideTargets:Dc(G),onOverride:ze=>$c(G,ze),onRenameTitle:ze=>ki(G,ze)})})}}),s.jsx(ga,{toast:le,onDismiss:ye}),s.jsx(YP,{open:un,onOpenChange:G=>{Ut(G),G||St(!1)},initialName:Un&&yt?`${yt.name} (copy)`:"",title:Un?"Save as new view":"Save view",onSubmit:Ac}),s.jsx(o_,{open:Pe!==null,action:(Pe==null?void 0:Pe.action)??null,assignmentTitle:(Pe==null?void 0:Pe.item.title)??"Assignment",loading:ie===(Pe?yn(Pe.item):null),onOpenChange:G=>{G||Ke(null)},onConfirm:async G=>{if(!Pe)return;const Z=Pe;await Aa({item:Z.item,toColumnId:Z.toColumnId,action:Z.action,reason:G})&&Ke(null)}}),s.jsx(PA,{anchor:(de==null?void 0:de.anchor)??null,items:de?BG(de.item,{onEdit:()=>{const G=de.item,Z=G.projectSlug===null?`/assignments/${G.id}`:`${G.projectWorkspace?`/w/${G.projectWorkspace}`:t}/projects/${G.projectSlug}/assignments/${G.slug}`;n(Z)},onDelete:()=>jt(de.item),onMove:()=>Je(de.item)}):[],onClose:()=>pt(null)}),s.jsx(ya,{open:xt!==null,title:"Delete assignment?",description:xt?`"${xt.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:lt!==null,onOpenChange:G=>{!G&<===null&&jt(null)},onConfirm:async()=>{if(!xt||xt.projectSlug===null){jt(null);return}const G=yn(xt);ge(G);try{const Z=await fetch(`/api/projects/${encodeURIComponent(xt.projectSlug)}/assignments/${encodeURIComponent(xt.slug)}`,{method:"DELETE"});if(!Z.ok){const ve=await Z.json().catch(()=>({}));throw new Error(ve.error||"Failed to delete assignment")}jt(null),l()}catch(Z){alert(Z instanceof Error?Z.message:"Failed to delete assignment")}finally{ge(null)}}}),s.jsx(Pw,{open:He!==null,onOpenChange:G=>{G||Je(null)},currentWorkspace:(He==null?void 0:He.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async G=>{if(!He)return;const Z=await fetch(`/api/assignments/${encodeURIComponent(He.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:G})});if(!Z.ok){const ve=await Z.json().catch(()=>({}));throw new Error(ve.error||"Failed to move assignment")}l()}})]})}function BG(e,t){const n=[{key:"edit",label:"Edit",icon:cc,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:jn,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:Bh,onSelect:t.onMove}),n}function UG({detailHref:e,children:t,className:n,...r}){const o=v_(e);return s.jsx("tr",{...r,ref:o.containerRef,className:n,onMouseDown:o.onMouseDown,onClick:o.onClick,children:t})}function AN({assignment:e,dragging:t,transitioning:n,onPillSelect:r,overrideTargets:o,onOverride:i,onRenameTitle:a}){var p;const l=rd(e),d=!!(r&&a),f=v_(l);return s.jsxs("div",{ref:d?f.containerRef:void 0,className:Ne("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",d&&"cursor-pointer"),onMouseDown:d?f.onMouseDown:void 0,onClick:d?f.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:[d?s.jsx(b_,{title:e.title,detailHref:l,onSave:a,disabled:n}):s.jsx(Ie,{to:l,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:[(p=e.id)==null?void 0:p.slice(0,8),e.id&&s.jsx(Qr,{value:e.id})]})]}),d?s.jsx(PG,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:r,overrideTargets:o,onOverride:i,disabled:n,className:"max-w-[150px]"}):s.jsx(kn,{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(ma,{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"}),s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.dependsOn.length," dependencies"]})]}),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:Kn(e.updated)})]})]})}function xu(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function yn(e){return e.id||e.slug||"unknown"}function ns(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(`
|
|
611
|
+
`),i=[],a=new Map;let l=null,d=[];const f=()=>{l&&(i.push(l),a.set(l,d))};for(const p of o){const h=p.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(h&&!p.startsWith(" ")){f(),l=h[1],d=[p];continue}l&&d.push(p)}return f(),{order:i,blocks:a,body:r}}function jc(e){return`---
|
|
612
|
+
${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
|
|
613
|
+
`)}
|
|
614
|
+
---
|
|
615
|
+
|
|
616
|
+
${e.body.replace(/^\n+/,"")}`}function An(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"?"":o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'")?o.slice(1,-1):o}function HG(e,t){return An(e,t)==="true"}function Bu(e,t){const n=e.blocks.get(t);return n!=null&&n.length?n[0].trim().endsWith("[]")?[]:n.slice(1).map(r=>r.trim()).filter(r=>r.startsWith("- ")).map(r=>r.slice(2).trim()):[]}function VG(e){return typeof e=="boolean"?e?"true":"false":e===null||e===""?"null":/^\d{4}-\d{2}-\d{2}T/.test(e)?`"${e}"`:/[:#{}[\],&*?|>!%@`]/.test(e)||/^\s|\s$/.test(e)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e}function Pn(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${VG(n)}`])}function Uu(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=>` - ${r}`)])}function Hu(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Im(e){const t=ns(e);return{title:An(t,"title"),slug:An(t,"slug"),workspace:An(t,"workspace"),archived:HG(t,"archived"),archivedAt:An(t,"archivedAt"),archivedReason:An(t,"archivedReason"),tags:Bu(t,"tags").join(", "),body:t.body}}function WG(e,t){const n=ns(e),r={...Im(e),...t};return Pn(n,"title",r.title),Pn(n,"slug",r.slug),Pn(n,"workspace",r.workspace||null),Pn(n,"archived",r.archived),Pn(n,"archivedAt",r.archivedAt||null),Pn(n,"archivedReason",r.archivedReason||null),Uu(n,"tags",Hu(r.tags)),n.body=r.body,jc(n)}function Mm(e){const t=ns(e);return{title:An(t,"title"),slug:An(t,"slug"),status:An(t,"status"),priority:An(t,"priority")||"medium",assignee:An(t,"assignee"),dependsOn:Bu(t,"dependsOn").join(", "),links:Bu(t,"links").join(", "),blockedReason:An(t,"blockedReason"),tags:Bu(t,"tags").join(", "),body:t.body}}function qG(e,t){const n=ns(e),r={...Mm(e),...t};return Pn(n,"title",r.title),Pn(n,"slug",r.slug),Pn(n,"status",r.status),Pn(n,"priority",r.priority),Pn(n,"assignee",r.assignee||null),Uu(n,"dependsOn",Hu(r.dependsOn)),Uu(n,"links",Hu(r.links)),Pn(n,"blockedReason",r.blockedReason||null),Uu(n,"tags",Hu(r.tags)),n.body=r.body,jc(n)}function Lm(e){const t=ns(e);return{assignment:An(t,"assignment"),status:An(t,"status"),body:t.body}}function KG(e,t){const n=ns(e),r={...Lm(e),...t};return Pn(n,"assignment",r.assignment),Pn(n,"status",r.status),n.body=r.body,jc(n)}function Om(e){const t=ns(e);return{assignment:An(t,"assignment"),body:t.body}}function GG(e,t){const n=ns(e),r={...Om(e),...t};return Pn(n,"assignment",r.assignment),n.body=r.body,jc(n)}function Fm(e){const t=ns(e);return{name:An(t,"name"),slug:An(t,"slug"),description:An(t,"description"),whenToUse:An(t,"when_to_use"),tags:Bu(t,"tags").join(", "),body:t.body}}function YG(e,t){const n=ns(e),r={...Fm(e),...t};return Pn(n,"name",r.name),Pn(n,"slug",r.slug),Pn(n,"description",r.description||null),Pn(n,"when_to_use",r.whenToUse||null),Uu(n,"tags",Hu(r.tags)),n.body=r.body,jc(n)}function a0(e){return{body:ns(e).body}}function w_(e){return a0(e)}function j_(e,t){const n=ns(e);return t.body!==void 0&&(n.body=t.body),jc(n)}function XG(e,t){return j_(e,t)}function Qt(e,t,n){switch(e){case"project":return WG(t,n);case"assignment":return qG(t,n);case"plan":return KG(t,n);case"scratchpad":return GG(t,n);case"playbook":return YG(t,n);case"memory":return j_(t,n);case"resource":return XG(t,n);default:return t}}function kc({initialContent:e,documentType:t,mode:n="edit",onSave:r,saving:o,error:i,title:a,description:l,onCancel:d,helpTitle:f,helpBody:p,allowSlugEdit:h=!1}){const[g,y]=m.useState(e),[S,w]=m.useState(!1),[b,j]=m.useState("edit");m.useEffect(()=>{y(e)},[e]);const N=eY(t,g),k=g!==e,C=ZG(t,g),I=k?"Unsaved changes":n==="create"?"Draft":"Saved",T=t!=="memory"&&t!=="resource";return 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:I})]}),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:d,className:"shell-action",children:[s.jsx(Yp,{className:"h-4 w-4"}),s.jsx("span",{children:"Back"})]}),T?s.jsxs("button",{type:"button",onClick:()=>w(R=>!R),className:"shell-action",children:[s.jsx(PL,{className:"h-4 w-4"}),s.jsx("span",{children:S?"Structured":"Raw Markdown"})]}):null,s.jsxs("button",{type:"button",onClick:()=>r(g),disabled:o||N.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(Hh,{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,N.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:N.map(R=>s.jsx("li",{children:R},R))})}):null]}),s.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[s.jsx("button",{type:"button",onClick:()=>j("edit"),className:`shell-action ${b==="edit"?"shell-action--cta":""}`,children:"Edit"}),s.jsxs("button",{type:"button",onClick:()=>j("preview"),className:`shell-action ${b==="preview"?"shell-action--cta":""}`,children:[s.jsx(a1,{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:S?s.jsx("textarea",{value:g,onChange:R=>y(R.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(QG,{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(a1,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),s.jsx(vn,{content:C,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function QG({documentType:e,content:t,onChange:n,allowSlugEdit:r}){const o=Ss();if(e==="project"){const a=Im(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(yu,{children:[s.jsx(Ft,{label:"Project title",children:s.jsx("input",{value:a.title,onChange:l=>{const d=l.target.value,f={title:d};r&&(a.slug===Tr(a.title)||!a.slug.trim())&&(f.slug=Tr(d)),n(Qt(e,t,f))},className:"editor-input"})}),s.jsx(Ft,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:a.slug,disabled:!r,onChange:l=>n(Qt(e,t,{slug:Tr(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(Ft,{label:"Tags",children:s.jsx("input",{value:a.tags,onChange:l=>n(Qt(e,t,{tags:l.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),s.jsx(JG,{value:a.workspace,onChange:l=>n(Qt(e,t,{workspace:l}))})]}),s.jsx(Ft,{label:"Project body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Qt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const a=Mm(t),l=yA(o),d=!l.some(f=>f.id===a.status);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(yu,{children:[s.jsx(Ft,{label:"Assignment title",children:s.jsx("input",{value:a.title,onChange:f=>{const p=f.target.value,h={title:p};r&&(a.slug===Tr(a.title)||!a.slug.trim())&&(h.slug=Tr(p)),n(Qt(e,t,h))},className:"editor-input"})}),s.jsx(Ft,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:a.slug,disabled:!r,onChange:f=>n(Qt(e,t,{slug:Tr(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(Ft,{label:"Status",children:s.jsxs("select",{value:a.status,onChange:f=>n(Qt(e,t,{status:f.target.value})),className:"editor-input",children:[d?s.jsx("option",{value:a.status,children:li(o,a.status)}):null,l.map(f=>s.jsx("option",{value:f.id,children:f.label},f.id))]})}),s.jsx(Ft,{label:"Priority",children:s.jsxs("select",{value:a.priority,onChange:f=>n(Qt(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(Ft,{label:"Assignee",children:s.jsx("input",{value:a.assignee,onChange:f=>n(Qt(e,t,{assignee:f.target.value})),placeholder:"Agent name",className:"editor-input"})}),s.jsx(Ft,{label:"Depends on",className:"md:col-span-2",children:s.jsx("input",{value:a.dependsOn,onChange:f=>n(Qt(e,t,{dependsOn:f.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),s.jsx(Ft,{label:"Links",className:"md:col-span-2",children:s.jsx("input",{value:a.links,onChange:f=>n(Qt(e,t,{links:f.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),s.jsx(Ft,{label:"Blocked reason",className:"md:col-span-2",children:s.jsx("input",{value:a.blockedReason,onChange:f=>n(Qt(e,t,{blockedReason:f.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),s.jsx(Ft,{label:"Tags",className:"md:col-span-2",children:s.jsx("input",{value:a.tags,onChange:f=>n(Qt(e,t,{tags:f.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),s.jsx(Ft,{label:"Assignment body",children:s.jsx("textarea",{value:a.body,onChange:f=>n(Qt(e,t,{body:f.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const a=Lm(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(yu,{children:[s.jsx(Ft,{label:"Assignment",children:s.jsx("input",{value:a.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),s.jsx(Ft,{label:"Plan status",children:s.jsxs("select",{value:a.status,onChange:l=>n(Qt(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(Ft,{label:"Plan body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Qt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const a=Om(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsx(yu,{children:s.jsx(Ft,{label:"Assignment",children:s.jsx("input",{value:a.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),s.jsx(Ft,{label:"Scratchpad body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Qt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const a=e==="memory"?a0(t):w_(t),l=e==="memory"?"Memory body":"Resource body";return s.jsxs("div",{className:"space-y-3",children:[s.jsx(Ft,{label:l,children:s.jsx("textarea",{value:a.body,onChange:d=>n(Qt(e,t,{body:d.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=Fm(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(yu,{children:[s.jsx(Ft,{label:"Playbook name",children:s.jsx("input",{value:i.name,onChange:a=>{const l=a.target.value,d={name:l};r&&(i.slug===Tr(i.name)||!i.slug.trim())&&(d.slug=Tr(l)),n(Qt(e,t,d))},className:"editor-input"})}),s.jsx(Ft,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:i.slug,disabled:!r,onChange:a=>n(Qt(e,t,{slug:Tr(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(Ft,{label:"Description",className:"md:col-span-2",children:s.jsx("input",{value:i.description,onChange:a=>n(Qt(e,t,{description:a.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),s.jsx(Ft,{label:"Tags",className:"md:col-span-2",children:s.jsx("input",{value:i.tags,onChange:a=>n(Qt(e,t,{tags:a.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),s.jsx(Ft,{label:"When to use",className:"md:col-span-2",children:s.jsx("input",{value:i.whenToUse,onChange:a=>n(Qt(e,t,{whenToUse:a.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),s.jsx(Ft,{label:"Playbook rules",children:s.jsx("textarea",{value:i.body,onChange:a=>n(Qt(e,t,{body:a.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function yu({children:e}){return s.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function Ft({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 JG({value:e,onChange:t}){const{data:n}=fa(),r=(n==null?void 0:n.workspaces)??[];return s.jsx(Ft,{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 ZG(e,t){switch(e){case"project":return Im(t).body;case"assignment":return Mm(t).body;case"plan":return Lm(t).body;case"scratchpad":return Om(t).body;case"playbook":return Fm(t).body;case"memory":return a0(t).body;case"resource":return w_(t).body}}function eY(e,t){switch(e){case"project":{const n=Im(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!Tp(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"assignment":{const n=Mm(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!Tp(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"plan":return Lm(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return Om(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=Fm(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!Tp(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"memory":case"resource":return[]}}function PN(){const e=zt(),{workspace:t}=Bt(),n=mn(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,d]=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
|
|
617
|
+
workspace: ${t}`)),o(y),a(!1)}).catch(g=>{p(g.message),a(!1)})},[t]);async function h(g){d(!0),p(null);try{const y=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),S=await y.json();if(!y.ok){p(S.error||`HTTP ${y.status}`),d(!1);return}e(`${n}/projects/${S.slug}`)}catch(y){p(y.message),d(!1);return}d(!1)}return i?s.jsx(bt,{label:"Loading project template…"}):f&&!r?s.jsx(Tt,{error:f}):s.jsx(kc,{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 _N(){const{slug:e}=Bt(),t=mn(),n=zt(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,d]=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}d(!0),p(null);try{const y=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),S=await y.json();if(!y.ok){p(S.error||`HTTP ${y.status}`),d(!1);return}n(`${t}/projects/${e}/assignments/${S.slug}`)}catch(y){p(y.message),d(!1);return}d(!1)}return i?s.jsx(bt,{label:"Loading assignment template…"}):f&&!r?s.jsx(Tt,{error:f}):s.jsx(kc,{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 DN(){const{workspace:e}=Bt(),t=mn(),n=zt(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,d]=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;d(!0),p(null);try{const S=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),w=await S.json();if(!S.ok){p(w.error||`HTTP ${S.status}`),d(!1);return}const b=(y=w==null?void 0:w.assignment)==null?void 0:y.id;if(!b){p("Server did not return the new assignment id."),d(!1);return}n(`/assignments/${b}`)}catch(S){p(S.message),d(!1);return}d(!1)}return i?s.jsx(bt,{label:"Loading assignment template…"}):f&&!r?s.jsx(Tt,{error:f}):s.jsx(kc,{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 Sc({loadUrl:e,saveUrl:t,redirectTo:n,title:r,description:o,documentType:i,helpTitle:a,helpBody:l}){const d=zt(),{data:f,loading:p,error:h}=j2(e),[g,y]=m.useState(!1),[S,w]=m.useState(null);async function b(j){y(!0),w(null);try{const N=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await N.json();if(!N.ok){w(k.error||`HTTP ${N.status}`),y(!1);return}d(n)}catch(N){w(N.message),y(!1);return}y(!1)}return p?s.jsx(bt,{label:`Loading ${r.toLowerCase()}…`}):h||!f?s.jsx(Tt,{error:h||`${r} is unavailable.`}):s.jsx(kc,{initialContent:f.content,documentType:i,onSave:b,saving:g,error:S,title:r,description:o,onCancel:()=>d(n),helpTitle:a,helpBody:l})}function $N(){const{slug:e}=Bt(),t=mn(),n=e??"";return s.jsx(Sc,{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 Ry(){const{slug:e,aslug:t,id:n}=Bt(),r=mn(),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(Sc,{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 Ay(){const{slug:e,aslug:t,id:n}=Bt(),r=mn(),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(Sc,{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 Py(){const{slug:e,aslug:t,id:n}=Bt(),r=mn(),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(Sc,{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 k_({loadUrl:e,saveUrl:t,redirectTo:n,title:r,description:o,helpTitle:i,helpBody:a}){const l=zt(),{data:d,loading:f,error:p}=j2(e),[h,g]=m.useState(""),[y,S]=m.useState(""),[w,b]=m.useState(!1),[j,N]=m.useState(null);async function k(){b(!0),N(null);try{const C=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:h,body:y})}),I=await C.json();if(!C.ok){N(I.error||`HTTP ${C.status}`),b(!1);return}l(n)}catch(C){N(C.message),b(!1);return}b(!1)}return f?s.jsx(bt,{label:`Loading ${r.toLowerCase()}…`}):p||!d?s.jsx(Tt,{error:p||`${r} is unavailable.`}):s.jsxs("div",{className:"space-y-4",children:[s.jsx(Ye,{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=>S(C.target.value),className:"editor-textarea",spellCheck:!1})]}),j?s.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:j}):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:k,disabled:w||!y.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:w?"Appending…":"Append Entry"})]})]})}),s.jsx(Ye,{title:"Current Document",children:s.jsx(vn,{content:d.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function _y(){const{slug:e,aslug:t,id:n}=Bt(),r=mn(),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(k_,{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 Dy(){const{slug:e,aslug:t,id:n}=Bt(),r=mn(),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(k_,{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 IN(){const{workspace:e}=Bt(),{data:t}=Xs(),{data:n,loading:r,error:o,refetch:i}=Dv(),[a,l]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState(!1),g=rr();m.useEffect(()=>{const N=g.hash.match(/^#server-(.+)/);if(!N)return;const k=decodeURIComponent(N[1]),C=document.querySelector(`[data-server-name="${window.CSS.escape(k)}"]`);if(!C)return;C.scrollIntoView({block:"nearest"}),C.classList.add("ring-2","ring-primary/60");const I=window.setTimeout(()=>C.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(I)},[g.hash,n]);const y=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const N=new Set(t.filter(k=>e==="_ungrouped"?k.workspace===null:k.workspace===e).map(k=>k.slug));return n.sessions.filter(k=>k.windows.some(C=>C.panes.some(I=>I.assignment&&I.assignment.project!==null&&N.has(I.assignment.project))))})();async function S(N){if(N.preventDefault(),!!d.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim()})}),f(""),l(!1),i()}catch{}}async function w(){h(!0);try{await fetch("/api/servers/refresh",{method:"POST"}),i()}finally{h(!1)}}async function b(N){await fetch(`/api/servers/${encodeURIComponent(N)}`,{method:"DELETE"}),i()}async function j(N){await fetch(`/api/servers/${encodeURIComponent(N)}/refresh`,{method:"POST"}),i()}return r?s.jsx(bt,{label:"Loading servers…"}):o?s.jsx(Tt,{error:o}):n?n.tmuxAvailable?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a?s.jsxs("form",{onSubmit:S,className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:d,onChange:N=>f(N.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:()=>l(!1),children:"Cancel"})]}):s.jsxs("button",{className:"shell-action",onClick:()=>l(!0),children:[s.jsx(Pt,{className:"h-3.5 w-3.5"}),"Track Session"]}),s.jsxs("button",{className:"shell-action",onClick:w,disabled:p,children:[s.jsx(YE,{className:`h-3.5 w-3.5 ${p?"animate-spin":""}`}),"Refresh All"]})]}),y.length===0?s.jsx(Ct,{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:y.map(N=>s.jsx(tY,{session:N,onRefresh:()=>j(N.name),onRemove:()=>b(N.name),onRefetch:i},N.name))})]}):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(Cl,{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 tY({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(Tv,{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: ",new Date(e.lastRefreshed).toLocaleString()]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{className:"shell-action",onClick:t,title:"Refresh",children:s.jsx(YE,{className:"h-3.5 w-3.5"})}),s.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:s.jsx(jn,{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(nY,{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(JL,{className:"h-4 w-4"}),s.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function nY({pane:e,sessionName:t,windowIndex:n,onRefetch:r}){const o=mn(),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(Qr,{value:e.cwd})]}),e.branch&&s.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Nv,{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(ac,{className:"h-2.5 w-2.5"})]},a))}),s.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?s.jsxs(Ie,{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(BL,{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 S_(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 rY(e,t){const n=Date.parse(e),r=Math.floor((n-t)/1e3);return Number.isNaN(r)?"–":r<=0?"expired":S_(r)}function sY(e){switch(e){case"idle":return"bg-green-500/15 text-green-400 border-green-500/30";case"leased":return"bg-amber-500/15 text-amber-400 border-amber-500/30";case"retired":return"bg-zinc-500/15 text-zinc-400 border-zinc-500/30"}}function oY(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function MN(){const{data:e,loading:t,error:n,refetch:r}=k2(),[o,i]=m.useState(()=>Date.now()),[a,l]=m.useState(null),[d,f]=m.useState(!1);if(m.useEffect(()=>{const h=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(h)},[]),t)return s.jsx(bt,{label:"Loading inventories…"});if(n)return s.jsx(Tt,{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(Ct,{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 p(){if(a){f(!0);try{const h=await fetch(`/api/leases/${encodeURIComponent(a.slug)}/force-release/${encodeURIComponent(a.lease.lease_id)}`,{method:"POST"});if(!h.ok){const g=await h.json().catch(()=>null);throw new Error((g==null?void 0:g.error)??`HTTP ${h.status}`)}r(),l(null)}catch(h){window.alert(h instanceof Error?`Force release failed: ${h.message}`:"Force release failed")}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(h=>s.jsx(iY,{detail:h,now:o,onForceRelease:g=>l({slug:h.inventory.slug,lease:g})},h.inventory.slug))}),s.jsx(ya,{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:d,onConfirm:p,onOpenChange:h=>{h||l(null)}})]})}function iY({detail:e,now:t,onForceRelease:n}){const{inventory:r,members:o,active_leases:i}=e,a=o.filter(d=>d.status==="idle").length,l=o.filter(d=>d.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(Uh,{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=",S_(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(d=>s.jsx(aY,{member:d},d.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(d=>s.jsx(lY,{lease:d,now:t,onForceRelease:()=>n(d)},d.lease_id))})]})]})}function aY({member:e}){const t=oY(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 ${sY(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 lY({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(NL,{className:"h-3 w-3"}),rY(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(t4,{className:"h-3 w-3"}),"Force release"]})]})]})}function cY(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 uY(){const e=await fetch("/api/schedules");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).schedules}async function dY(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 fY(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 pY(){const[e,t]=m.useState(null),[n,r]=m.useState(!0),[o,i]=m.useState(null),a=m.useCallback(async()=>{try{t(await uY()),i(null)}catch(l){i(l instanceof Error?l.message:"Failed to fetch schedules")}finally{r(!1)}},[]);return m.useEffect(()=>{a()},[a]),dc(l=>{l.type==="schedules-updated"&&a()}),{data:e,loading:n,error:o,refetch:a}}const hY=[{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 mY({open:e,onOpenChange:t,onCreated:n}){const[r,o]=m.useState(""),[i,a]=m.useState("claude"),[l,d]=m.useState("cron"),[f,p]=m.useState(!0),[h,g]=m.useState(""),[y,S]=m.useState(""),[w,b]=m.useState("0 3 * * *"),[j,N]=m.useState(""),[k,C]=m.useState(""),[I,T]=m.useState("5"),[R,D]=m.useState("claude"),[$,z]=m.useState(""),[A,F]=m.useState("rolling-5h"),[W,P]=m.useState("ready_to_implement"),[O,B]=m.useState(""),[H,L]=m.useState(!1),[U,M]=m.useState(null);if(!e)return null;function V(){switch(l){case"cron":return{kind:l,expr:w,...j?{tz:j}:{}};case"at":return{kind:l,at:k};case"in":return{kind:l,durationMs:Math.round(Number(I)*36e5),anchorIso:new Date().toISOString()};case"after-reset":return{kind:l,provider:R,anchor:{windowStartIso:$||new Date().toISOString(),windowKind:A}};case"when-status":return{kind:l,status:W,...O?{assignmentId:O}:{}};case"when-plan-lands":return{kind:l,...O?{assignmentId:O}:{}}}}async function Y(){L(!0),M(null);try{const ne={assignmentId:r.trim(),agentId:i.trim(),trigger:V(),unattended:f,terminalPreference:h.trim()||null,promptTemplate:y.trim()||null};if(!ne.assignmentId)throw new Error("Assignment id is required");await dY(ne),n(),t(!1)}catch(ne){M(ne instanceof Error?ne.message:"Create failed")}finally{L(!1)}}const q="w-full rounded border bg-background px-2 py-1 text-sm",J="block text-xs font-medium text-muted-foreground";return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"max-h-[90vh] w-full max-w-lg overflow-y-auto rounded-lg border bg-card p-5",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"New schedule"}),s.jsx("button",{type:"button",onClick:()=>t(!1),className:"text-muted-foreground hover:text-foreground",children:s.jsx(Nd,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Assignment id / slug"}),s.jsx("input",{className:q,value:r,onChange:ne=>o(ne.target.value),placeholder:"scheduled-agents"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Agent"}),s.jsx("input",{className:q,value:i,onChange:ne=>a(ne.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Terminal (optional)"}),s.jsx("input",{className:q,value:h,onChange:ne=>g(ne.target.value),placeholder:"default"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Trigger"}),s.jsx("select",{className:q,value:l,onChange:ne=>d(ne.target.value),children:hY.map(ne=>s.jsx("option",{value:ne.value,children:ne.label},ne.value))})]}),l==="cron"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Cron expr"}),s.jsx("input",{className:q,value:w,onChange:ne=>b(ne.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Timezone (optional)"}),s.jsx("input",{className:q,value:j,onChange:ne=>N(ne.target.value),placeholder:"local"})]})]}),l==="at"&&s.jsxs("div",{children:[s.jsx("label",{className:J,children:"ISO timestamp"}),s.jsx("input",{className:q,value:k,onChange:ne=>C(ne.target.value),placeholder:"2026-06-16T03:00:00Z"})]}),l==="in"&&s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Delay (hours)"}),s.jsx("input",{className:q,type:"number",value:I,onChange:ne=>T(ne.target.value)})]}),l==="after-reset"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Provider"}),s.jsxs("select",{className:q,value:R,onChange:ne=>D(ne.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:J,children:"Window kind"}),s.jsxs("select",{className:q,value:A,onChange:ne=>F(ne.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:J,children:"Window start (optional ISO)"}),s.jsx("input",{className:q,value:$,onChange:ne=>z(ne.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:J,children:"Status"}),s.jsx("input",{className:q,value:W,onChange:ne=>P(ne.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Watch assignment (optional)"}),s.jsx("input",{className:q,value:O,onChange:ne=>B(ne.target.value),placeholder:"this assignment"})]})]}),l==="when-plan-lands"&&s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Watch assignment (optional)"}),s.jsx("input",{className:q,value:O,onChange:ne=>B(ne.target.value),placeholder:"this assignment"})]}),s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Prompt template (optional)"}),s.jsx("input",{className:q,value:y,onChange:ne=>S(ne.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:ne=>p(ne.target.checked)}),"Unattended (hard limits + kill switch apply)"]}),U&&s.jsx("p",{className:"text-sm text-destructive",children:U})]}),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:H,className:"rounded bg-primary px-3 py-1 text-sm text-primary-foreground disabled:opacity-50",children:H?"Creating…":"Create"})]})]})})}const gY=new Set(["completed","failed","launch_failed","cancelled","killed"]);function xY(e){return e==="running"?"bg-green-500/15 text-green-400 border-green-500/30":e==="eligible"?"bg-blue-500/15 text-blue-400 border-blue-500/30":e==="held"?"bg-amber-500/15 text-amber-400 border-amber-500/30":e==="launch_failed"||e==="failed"||e==="killed"?"bg-red-500/15 text-red-400 border-red-500/30":"bg-zinc-500/15 text-zinc-400 border-zinc-500/30"}function yY(){const{data:e,loading:t,error:n,refetch:r}=pY(),[o,i]=m.useState(!1);if(t)return s.jsx(bt,{label:"Loading schedules…"});if(n)return s.jsx(Tt,{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 a(l){try{await fY(l.id),r()}catch(d){window.alert(d instanceof Error?`Cancel failed: ${d.message}`:"Cancel failed")}}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:"flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-sm text-primary-foreground",children:[s.jsx(Pt,{className:"h-4 w-4"}),"New schedule"]})]}),!e||e.length===0?s.jsx(Ct,{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(l=>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(UE,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"font-mono text-sm",children:l.assignmentId}),s.jsx("span",{className:`rounded border px-1.5 py-0.5 text-xs ${xY(l.attempt.state)}`,children:l.attempt.state}),!l.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:[cY(l.trigger)," · agent ",s.jsx("code",{className:"font-mono",children:l.agentId}),l.attempt.lastError&&s.jsxs("span",{className:"text-destructive",children:[" · ",l.attempt.lastError]})]})]}),!gY.has(l.attempt.state)&&s.jsxs("button",{type:"button",onClick:()=>a(l),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(xL,{className:"h-3 w-3"}),"Cancel"]})]},l.id))}),s.jsx(mY,{open:o,onOpenChange:i,onCreated:r})]})}const bY={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"},Jo="bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm";function LN(){const[e,t]=js(),n=Z4(e),r=n.window??"30d",o=e.get("groupBy")==="assignment"?"assignment":"project",{data:i}=Xs(),{data:a}=fa(),{data:l}=S2(),[d,f]=m.useState(null),[p,h]=m.useState(!0),[g,y]=m.useState(null);m.useEffect(()=>{if(!e.get("window")){const b=ub({window:"30d",...n});o==="assignment"&&b.set("groupBy","assignment"),t(b,{replace:!0})}},[]);const S=b2({window:r,...n}).toString();m.useEffect(()=>{const b=new AbortController;h(!0),y(null);const j=S?`/api/usage?${S}&groupBy=${o}`:`/api/usage?groupBy=${o}`;return fetch(j,{signal:b.signal}).then(async N=>{if(!N.ok){const k=await N.json().catch(()=>({}));throw new Error(k.error??`HTTP ${N.status}`)}return N.json()}).then(N=>{f(N),h(!1)}).catch(N=>{N instanceof Error&&N.name==="AbortError"||(y(N instanceof Error?N.message:String(N)),h(!1))}),()=>b.abort()},[S,o]);function w(b,j=o){const N=ub(b);j==="assignment"&&N.set("groupBy","assignment"),t(N)}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(Sd,{className:"w-6 h-6 text-amber-400"}),s.jsx("h1",{className:"text-2xl font-semibold",children:"Token usage"})]}),s.jsxs("div",{className:"flex flex-wrap gap-4 items-end mb-6 p-4 rounded-lg bg-zinc-900/50 border border-zinc-800",children:[s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Window"}),s.jsx("select",{value:r,onChange:b=>w({...n,window:b.target.value}),className:Jo,children:Wh.map(b=>s.jsx("option",{value:b,children:bY[b]},b))})]}),r==="custom"?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Since"}),s.jsx("input",{type:"date",value:n.since??"",onChange:b=>w({...n,window:"custom",since:b.target.value||void 0}),className:Jo})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Until"}),s.jsx("input",{type:"date",value:n.until??"",onChange:b=>w({...n,window:"custom",until:b.target.value||void 0}),className:Jo})]})]}):null,s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Workspace"}),s.jsxs("select",{value:n.workspace??"",onChange:b=>w({...n,workspace:b.target.value||void 0,project:void 0}),className:Jo,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(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Project"}),s.jsxs("select",{value:n.project??"",onChange:b=>w({...n,project:b.target.value||void 0,workspace:void 0}),className:Jo,children:[s.jsx("option",{value:"",children:"All"}),(i??[]).map(b=>s.jsx("option",{value:b.slug,children:b.slug},b.slug))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Model"}),s.jsxs("select",{value:n.model??"",onChange:b=>w({...n,model:b.target.value||void 0}),className:Jo,children:[s.jsx("option",{value:"",children:"All"}),((l==null?void 0:l.models)??[]).map(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Tool"}),s.jsxs("select",{value:n.tool??"",onChange:b=>w({...n,tool:b.target.value||void 0}),className:Jo,children:[s.jsx("option",{value:"",children:"All"}),((l==null?void 0:l.tools)??[]).map(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Group by"}),s.jsxs("select",{value:o,onChange:b=>w(n,b.target.value),className:Jo,children:[s.jsx("option",{value:"project",children:"Project"}),s.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),p&&s.jsx("p",{className:"text-zinc-400",children:"Loading…"}),g&&s.jsxs("p",{className:"text-red-400",children:["Error: ",g]}),d&&!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"}),d.summary.length===0?s.jsxs("p",{className:"text-zinc-500 text-sm",children:["No usage data for these filters. Run"," ",s.jsx("code",{className:"bg-zinc-800 px-1 py-0.5 rounded text-amber-300",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):s.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[s.jsx("thead",{className:"bg-zinc-900 text-zinc-400",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:d.summary.map((b,j)=>s.jsxs("tr",{className:"border-t border-zinc-800",children:[s.jsx("td",{className:"px-3 py-2",children:b.projectSlug||"(unattributed)"}),o==="assignment"&&s.jsx("td",{className:"px-3 py-2",children:b.assignmentSlug||"(unattributed)"}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ul(b.totalTokens)}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Hl(b.totalCost)}),s.jsx("td",{className:"px-3 py-2 text-zinc-400",children:b.lastEventDay})]},j))})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-lg font-medium mb-2",children:"Daily breakdown"}),d.daily.length===0?s.jsx("p",{className:"text-zinc-500 text-sm",children:"No daily rows."}):s.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[s.jsx("thead",{className:"bg-zinc-900 text-zinc-400",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:d.daily.map((b,j)=>s.jsxs("tr",{className:"border-t border-zinc-800",children:[s.jsx("td",{className:"px-3 py-2 tabular-nums",children:b.day}),s.jsx("td",{className:"px-3 py-2 text-zinc-400",children:b.tool}),s.jsx("td",{className:"px-3 py-2 text-zinc-400",children:b.model}),s.jsx("td",{className:"px-3 py-2",children:b.project_slug||"–"}),s.jsx("td",{className:"px-3 py-2",children:b.assignment_slug||"–"}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ul(b.total_tokens)}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Hl(b.total_cost)})]},j))})]})]})]})]})}function ON(){const{workspace:e}=Bt(),{data:t}=Xs(),{data:n,loading:r,error:o}=Kh(),[i,a]=m.useState(""),[l,d]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState("started_desc"),[y,S]=m.useState(0),[w,b]=m.useState(new Set),[j,N]=m.useState(!1),[k,C]=m.useState(null),[I,T]=m.useState(null),R=(n==null?void 0:n.sessions.some(P=>P.status==="active"))??!1;m.useEffect(()=>{if(!R)return;const P=window.setInterval(()=>S(O=>O+1),3e4);return()=>window.clearInterval(P)},[R]),m.useEffect(()=>{b(P=>{if(P.size===0)return P;const O=new Set((n==null?void 0:n.sessions.map(H=>H.sessionId))??[]),B=new Set([...P].filter(H=>O.has(H)));return B.size===P.size?P:B})},[n]);const D=m.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const P=i.trim().toLowerCase();return[...n.sessions.filter(B=>{var U;if(e&&t){const M=((U=t.find(V=>V.slug===B.projectSlug))==null?void 0:U.workspace)??null;if(e==="_ungrouped"){if(M!==null)return!1}else if(M!==e)return!1}const H=wY(B.started);return l&&(!H||H<l)||f&&(!H||H>f)?!1:P?[B.projectSlug??"",B.assignmentSlug??"",B.agent,B.sessionId,B.path,B.description??"",B.transcriptPath??""].join(" ").toLowerCase().includes(P):!0})].sort((B,H)=>jY(B,H,h))},[n,i,h,l,f,y,e,t]);function $(P){b(O=>{const B=new Set(O);return B.has(P)?B.delete(P):B.add(P),B})}function z(){w.size===D.length&&D.length>0?b(new Set):b(new Set(D.map(P=>P.sessionId)))}async function A(P){C(null),N(!0);try{const O=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:P})}),B=await O.json().catch(()=>null);if(!O.ok)throw new Error((B==null?void 0:B.error)||`HTTP ${O.status}`);b(H=>new Set([...H].filter(L=>!P.includes(L)))),T(null)}catch(O){C(O.message)}finally{N(!1)}}async function F(P){try{const O=await fetch(`/api/agent-sessions/${encodeURIComponent(P)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!O.ok){const B=await O.json().catch(()=>null);C((B==null?void 0:B.error)||`Failed to mark session stopped: HTTP ${O.status}`)}}catch(O){C(O.message)}}if(r)return s.jsx(bt,{label:"Loading agent sessions..."});if(o)return s.jsx(Tt,{error:o});if(!n)return null;const W=n.sessions.length>0;return s.jsxs(s.Fragment,{children:[s.jsxs(Rw,{children:[s.jsx(Cm,{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:P=>d(P.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=>p(P.target.value),className:"editor-input min-w-[150px]"})]}),s.jsxs("select",{value:h,onChange:P=>g(P.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"})]})]}),k?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:k}):null,w.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:[w.size," session",w.size!==1?"s":""," selected"]}),s.jsxs("button",{className:"shell-action text-destructive",onClick:()=>T({sessionIds:[...w],title:`Delete ${w.size} selected session${w.size===1?"":"s"}?`,description:"This removes the selected agent session records from the dashboard. This cannot be undone.",confirmLabel:w.size===1?"Delete Session":"Delete Sessions"}),disabled:j,children:[s.jsx(jn,{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"})]}),W?D.length===0?s.jsx(Ct,{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-[1280px] table-fixed text-sm",children:[s.jsxs("colgroup",{children:[s.jsx("col",{style:{width:"32px"}}),s.jsx("col",{style:{width:"140px"}}),s.jsx("col",{style:{width:"160px"}}),s.jsx("col",{style:{width:"200px"}}),s.jsx("col",{style:{width:"110px"}}),s.jsx("col",{style:{width:"130px"}}),s.jsx("col",{style:{width:"140px"}}),s.jsx("col",{style:{width:"200px"}}),s.jsx("col",{style:{width:"200px"}}),s.jsx("col",{style:{width:"40px"}})]}),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:"pb-2 pr-3",children:s.jsx("button",{onClick:z,className:"text-muted-foreground hover:text-foreground",children:w.size===D.length&&D.length>0?s.jsx(Xr,{className:"h-4 w-4"}):s.jsx(Rv,{className:"h-4 w-4"})})}),s.jsx("th",{className:"pb-2 pr-3",children:"Project"}),s.jsx("th",{className:"pb-2 pr-3",children:"Assignment"}),s.jsx("th",{className:"pb-2 pr-3",children:"Description"}),s.jsx("th",{className:"pb-2 pr-3",children:"Agent"}),s.jsx("th",{className:"pb-2 pr-3",children:"Session ID"}),s.jsx("th",{className:"pb-2 pr-3",children:"Started"}),s.jsx("th",{className:"pb-2 pr-3",children:"Path"}),s.jsx("th",{className:"pb-2 pr-3",children:"Transcript"}),s.jsx("th",{className:"pb-2"})]})}),s.jsx("tbody",{children:D.map(P=>s.jsx(vY,{session:P,selected:w.has(P.sessionId),onToggle:()=>$(P.sessionId),onDelete:()=>T({sessionIds:[P.sessionId],title:`Delete session ${P.sessionId.slice(0,8)}...?`,description:`Remove this ${P.agent} session record${P.assignmentSlug?` for ${P.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:F,onCopyError:C},P.sessionId))})]})}):s.jsx(Ct,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),s.jsx(ya,{open:I!==null,title:(I==null?void 0:I.title)??"Delete session?",description:(I==null?void 0:I.description)??"",confirmLabel:(I==null?void 0:I.confirmLabel)??"Delete",destructive:!0,loading:j,onOpenChange:P=>{P||T(null)},onConfirm:async()=>{I&&await A(I.sessionIds)}})]})}function vY({session:e,selected:t,onToggle:n,onDelete:r,onMarkStopped:o,onCopyError:i}){const a=mn(),l=e.sessionId.length>12?e.sessionId.slice(0,8)+"...":e.sessionId,d=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(Xr,{className:"h-4 w-4"}):s.jsx(Rv,{className:"h-4 w-4"})})}),s.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?s.jsx(Ie,{to:`${a}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:Tn(e.projectSlug),children:Tn(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(Ie,{to:`${a}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:Tn(e.assignmentSlug),children:Tn(e.assignmentSlug)}):e.assignmentSlug?s.jsx(Ie,{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(Fh,{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:"py-2 pr-3",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(Qr,{value:e.sessionId}),s.jsx(QP,{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:Jr(e.started)})}),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("span",{className:"block min-w-0 truncate text-xs text-muted-foreground",title:e.path,children:d}),e.path&&s.jsx(Qr,{value:e.path})]})}),s.jsx("td",{className:"py-2 pr-3",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(Qr,{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(n_,{session:e,onMarkStopped:o}),s.jsx("button",{onClick:r,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:s.jsx(jn,{className:"h-3.5 w-3.5"})})]})})]})}function wY(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 dp(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 jY(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 dp(e)-dp(t);case"duration_desc":return dp(t)-dp(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 kY(){const{data:e,loading:t,error:n,refetch:r}=$v(),[o,i]=m.useState(""),[a,l]=m.useState(null),[d,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 w=o.toLowerCase();return e.playbooks.filter(b=>b.name.toLowerCase().includes(w)||b.description.toLowerCase().includes(w)||b.slug.toLowerCase().includes(w)||b.tags.some(j=>j.toLowerCase().includes(w)))},[e,o]);async function y(w,b,j){if(w.preventDefault(),w.stopPropagation(),!a){l(b);try{const N=j?"disable":"enable",k=await fetch(`/api/playbooks/${encodeURIComponent(b)}/${N}`,{method:"POST"});if(!k.ok){const C=await k.json().catch(()=>({}));throw new Error(C.error||`Failed to ${N} playbook`)}r()}catch(N){console.error(N),alert(N instanceof Error?N.message:"Failed to update playbook")}finally{l(null)}}}async function S(){if(d){h(d.slug);try{const w=await fetch(`/api/playbooks/${encodeURIComponent(d.slug)}`,{method:"DELETE"});if(!w.ok){const b=await w.json().catch(()=>({}));throw new Error(b.error||"Failed to delete playbook")}f(null),r()}catch(w){console.error(w),alert(w instanceof Error?w.message:"Failed to delete playbook")}finally{h(null)}}}return t?s.jsx(bt,{label:"Loading playbooks..."}):n?s.jsx(Tt,{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(pi,{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:w=>i(w.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(Ie,{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(Pt,{className:"h-4 w-4"}),"Create Playbook"]})]}),s.jsxs(Ie,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[s.jsx(qE,{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(Ct,{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(Ie,{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(Pt,{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(w=>{const b=a===w.slug,j=[{key:"delete",label:"Delete",icon:jn,destructive:!0,onSelect:()=>f({slug:w.slug,name:w.name})}];return s.jsxs("div",{className:`surface-panel relative flex flex-col gap-2 p-4 transition hover:border-foreground/20 ${w.enabled?"":"opacity-75"}`,children:[s.jsx("div",{className:"absolute right-3 top-3 z-10",children:s.jsx(Nw,{items:j})}),s.jsxs(Ie,{to:`/playbooks/${w.slug}`,className:"group flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(BE,{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:w.name}),w.description?s.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground line-clamp-2",children:w.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:[w.tags.slice(0,3).map(N=>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(XE,{className:"h-2.5 w-2.5"}),N]},N)),w.tags.length>3?s.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["+",w.tags.length-3]}):null]})})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":w.enabled,"aria-label":w.enabled?"Disable playbook":"Enable playbook",onClick:N=>y(N,w.slug,w.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 ${w.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 ${w.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]},w.slug)})}),s.jsx(ya,{open:d!==null,title:"Delete playbook?",description:d?`"${d.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:S,onOpenChange:w=>{w||f(null)}})]})}function SY(){const{slug:e}=Bt(),t=zt(),{data:n,loading:r,error:o,refetch:i}=uO(e),[a,l]=m.useState(!1),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(!1),[S,w]=m.useState(""),[b,j]=m.useState(!1),[N,k]=m.useState(null),C=e==="manifest";m.useEffect(()=>{g&&(w(e??""),k(null))},[g,e]);const I=Tr(S),T=I.length>0&&Tp(I)&&I!=="manifest",R=I!==e;async function D(){if(!(!e||!T||!R)){j(!0),k(null);try{const A=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:I})});if(!A.ok){const F=await A.json().catch(()=>({}));throw new Error(F.error||"Failed to rename playbook")}y(!1),t(`/playbooks/${I}`)}catch(A){k(A instanceof Error?A.message:"Failed to rename playbook")}finally{j(!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 A=n.enabled?"disable":"enable",F=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${A}`,{method:"POST"});if(!F.ok){const W=await F.json().catch(()=>({}));throw new Error(W.error||`Failed to ${A} playbook`)}i()}catch(A){console.error(A),alert(A instanceof Error?A.message:"Failed to update playbook")}finally{h(!1)}}}return r?s.jsx(bt,{label:"Loading playbook..."}):o?s.jsx(Tt,{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 ",Jr(n.created)]}),s.jsxs("span",{children:["Updated ",Jr(n.updated)]})]}),n.tags.length>0?s.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map(A=>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(XE,{className:"h-3 w-3"}),A]},A))}):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(Ie,{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(cc,{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(r4,{className:"h-3 w-3"}),"Rename"]}),a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:$,disabled:d,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:d?"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(jn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(vn,{content:n.body})}),s.jsx(Bn,{open:g,onOpenChange:A=>b?void 0:y(A),children:s.jsxs(_n,{children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:"Rename playbook"}),s.jsx(es,{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:S,onChange:A=>w(A.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"}),S&&I!==S?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:I||"—"})]}):null,S&&!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]}),N?s.jsx("p",{className:"text-sm text-destructive",role:"alert",children:N}):null,s.jsxs(Fr,{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:D,disabled:b||!T||!R,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:b?"Renaming…":"Rename"})]})]})})]}):null}function NY(){const e=zt(),[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(!1),[l,d]=m.useState(null);m.useEffect(()=>{fetch("/api/playbooks/template/new").then(p=>p.json()).then(p=>{n(p.content),o(!1)}).catch(p=>{d(p.message),o(!1)})},[]);async function f(p){a(!0),d(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){d(g.error||`HTTP ${h.status}`),a(!1);return}e(`/playbooks/${g.slug}`)}catch(h){d(h.message),a(!1);return}a(!1)}return r?s.jsx(bt,{label:"Loading playbook template..."}):l&&!t?s.jsx(Tt,{error:l}):s.jsx(kc,{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 CY(){const{slug:e}=Bt(),t=zt(),[n,r]=m.useState(null),[o,i]=m.useState(!0),[a,l]=m.useState(!1),[d,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..."}):d&&!n?s.jsx(Tt,{error:d}):s.jsx(kc,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:p,saving:a,error:d,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function EY(){const{data:e,loading:t,error:n}=dO(),[r,o]=m.useState(""),[i,a]=m.useState("all"),[l,d]=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]),S=m.useMemo(()=>Array.from(new Set(h.map(b=>b.source).filter(Boolean))).sort(),[h]),w=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 j=r.toLowerCase();if(!b.name.toLowerCase().includes(j)&&!b.slug.toLowerCase().includes(j)&&!b.projectTitle.toLowerCase().includes(j))return!1}return!0}),[h,r,i,l,f]);return t?s.jsx(bt,{label:"Loading memories…"}):n?s.jsx(Tt,{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(pi,{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=>d(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"}),S.map(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs(Ie,{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(Pt,{className:"h-4 w-4"}),"New Memory"]})]}),w.length===0?s.jsx(Ct,{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(Ie,{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(Pt,{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:w.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(Ie,{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(Ie,{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:Kn(b.updated)})]},`${b.projectSlug}/${b.slug}`))})]})})]})}function TY(){const{slug:e,itemSlug:t}=Bt(),n=zt(),{data:r,loading:o,error:i}=fO(e,t),[a,l]=m.useState(!1),[d,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(Tt,{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(Ie,{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 ",Jr(r.created)]}),s.jsxs("span",{children:["Updated ",Jr(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(Ie,{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(cc,{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:d,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:d?"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(jn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(vn,{content:r.body})})]}):null}function RY(){const e=zt(),[t]=js(),n=t.get("project"),{data:r,loading:o,error:i}=Xs(),[a,l]=m.useState(n??""),[d,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(!1),[S,w]=m.useState(null);m.useEffect(()=>{!a&&r&&r.length>0&&l(n??r[0].slug)},[r,n,a]);async function b(j){if(j.preventDefault(),!(!a||!d.trim())){y(!0),w(null);try{const N=await fetch(`/api/projects/${a}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),body:p||void 0})}),k=await N.json();if(!N.ok){w(k.error||`HTTP ${N.status}`),y(!1);return}e(`/projects/${k.projectSlug}/memories/${k.slug}`)}catch(N){w(N.message),y(!1)}}}return o?s.jsx(bt,{label:"Loading projects…"}):i?s.jsx(Tt,{error:i}):!r||r.length===0?s.jsx(Tt,{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:j=>l(j.target.value),className:"editor-input",required:!0,children:r.map(j=>s.jsx("option",{value:j.slug,children:j.title},j.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:d,onChange:j=>f(j.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:j=>h(j.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"})]}),S?s.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:S}):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"submit",disabled:g||!d.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 AY(){const{slug:e,itemSlug:t}=Bt();return s.jsx(Sc,{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 PY(){const{data:e,loading:t,error:n}=pO(),[r,o]=m.useState(""),[i,a]=m.useState("all"),[l,d]=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]),S=m.useMemo(()=>Array.from(new Set(h.map(b=>b.source).filter(Boolean))).sort(),[h]),w=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 j=r.toLowerCase();if(!b.name.toLowerCase().includes(j)&&!b.slug.toLowerCase().includes(j)&&!b.projectTitle.toLowerCase().includes(j))return!1}return!0}),[h,r,i,l,f]);return t?s.jsx(bt,{label:"Loading resources…"}):n?s.jsx(Tt,{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(pi,{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=>d(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"}),S.map(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs(Ie,{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(Pt,{className:"h-4 w-4"}),"New Resource"]})]}),w.length===0?s.jsx(Ct,{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(Ie,{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(Pt,{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:w.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(Ie,{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(Ie,{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:Kn(b.updated)})]},`${b.projectSlug}/${b.slug}`))})]})})]})}function _Y(){const{slug:e,itemSlug:t}=Bt(),n=zt(),{data:r,loading:o,error:i}=hO(e,t),[a,l]=m.useState(!1),[d,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(Tt,{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(Ie,{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 ",Jr(r.created)]}),s.jsxs("span",{children:["Updated ",Jr(r.updated)]})]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs(Ie,{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(cc,{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:d,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:d?"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(jn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(vn,{content:r.body})})]}):null}function DY(){const e=zt(),[t]=js(),n=t.get("project"),{data:r,loading:o,error:i}=Xs(),[a,l]=m.useState(n??""),[d,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(!1),[S,w]=m.useState(null);m.useEffect(()=>{!a&&r&&r.length>0&&l(n??r[0].slug)},[r,n,a]);async function b(j){if(j.preventDefault(),!(!a||!d.trim())){y(!0),w(null);try{const N=await fetch(`/api/projects/${a}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),body:p||void 0})}),k=await N.json();if(!N.ok){w(k.error||`HTTP ${N.status}`),y(!1);return}e(`/projects/${k.projectSlug}/resources/${k.slug}`)}catch(N){w(N.message),y(!1)}}}return o?s.jsx(bt,{label:"Loading projects…"}):i?s.jsx(Tt,{error:i}):!r||r.length===0?s.jsx(Tt,{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:j=>l(j.target.value),className:"editor-input",required:!0,children:r.map(j=>s.jsx("option",{value:j.slug,children:j.title},j.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:d,onChange:j=>f(j.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:j=>h(j.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"})]}),S?s.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:S}):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"submit",disabled:g||!d.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 $Y(){const{slug:e,itemSlug:t}=Bt();return s.jsx(Sc,{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 Qb=["projects","playbooks","todos","servers","config"];function IY(e){const t=new Set;for(const n of e.split(",").map(r=>r.trim()))Qb.includes(n)&&t.add(n);return t}function FN(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function MY(){const[e,t]=m.useState(!0),[n,r]=m.useState(null),[o,i]=m.useState(""),[a,l]=m.useState(new Set(Qb)),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(null),[S,w]=m.useState(null),b=m.useCallback(async()=>{try{const T=await fetch("/api/backup");if(!T.ok)throw new Error(`HTTP ${T.status}`);const R=await T.json();r(R),i(R.repo??""),l(IY(R.categories)),f(!1)}catch(T){w({type:"error",message:`Failed to load backup config: ${T instanceof Error?T.message:String(T)}`})}finally{t(!1)}},[]);m.useEffect(()=>{b()},[b]);function j(T){l(R=>{const D=new Set(R);return D.has(T)?D.delete(T):D.add(T),D}),f(!0)}async function N(){h(!0),w(null);try{const T=Array.from(a),R=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:o.trim()||null,categories:T})}),D=await R.json();if(!R.ok)throw new Error(D.error||`HTTP ${R.status}`);r(D),f(!1),w({type:"success",message:"Backup configuration saved."})}catch(T){w({type:"error",message:`Save failed: ${T instanceof Error?T.message:String(T)}`})}finally{h(!1)}}async function k(){y("push"),w(null);try{const T=await fetch("/api/backup/push",{method:"POST"}),R=await T.json();if(!T.ok||R.success===!1)throw new Error(R.error||R.message||`HTTP ${T.status}`);w({type:"success",message:R.message||"Backup complete."}),await b()}catch(T){w({type:"error",message:`Backup failed: ${T instanceof Error?T.message:String(T)}`})}finally{y(null)}}async function C(){if(window.confirm("Restore will overwrite local files for the selected categories with the contents of the GitHub repo. This cannot be undone. Continue?")){y("pull"),w(null);try{const R=await fetch("/api/backup/pull",{method:"POST"}),D=await R.json();if(!R.ok||D.success===!1)throw new Error(D.error||D.message||`HTTP ${R.status}`);w({type:"success",message:D.message||"Restore complete."}),await b()}catch(R){w({type:"error",message:`Restore failed: ${R instanceof Error?R.message:String(R)}`})}finally{y(null)}}}if(e)return s.jsx(Ye,{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 I=!!o.trim()&&a.size>0&&!g&&!d;return s.jsx(Ye,{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:[S&&s.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${S.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:S.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:T=>{i(T.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:Qb.map(T=>{const R=a.has(T);return s.jsxs("button",{type:"button",onClick:()=>j(T),className:`shell-action text-xs ${R?"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 ${R?"bg-primary":"bg-muted-foreground/40"}`}),T]},T)})})]}),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: "}),FN((n==null?void 0:n.lastBackup)??null)]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),FN((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:N,disabled:p||!d,children:[s.jsx(Hh,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Config"]}),s.jsxs("button",{className:"shell-action",onClick:k,disabled:!I,title:I?"Back up now":d?"Save config first":"Set repo and pick categories",children:[s.jsx(s4,{className:"h-3.5 w-3.5"}),g==="push"?"Backing up...":"Back Up Now"]}),s.jsxs("button",{className:"shell-action",onClick:C,disabled:!I,title:I?"Restore from backup":d?"Save config first":"Set repo and pick categories",children:[s.jsx(RL,{className:"h-3.5 w-3.5"}),g==="pull"?"Restoring...":"Restore"]}),d&&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(CL,{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."]})]})]})})}function LY(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:r,bindAction:o,unbindAction:i}=hi(),[a,l]=m.useState(null),[d,f]=m.useState(null),[p,h]=m.useState(!1),g=Object.values(t).some(k=>typeof k=="string"&&k.length>0);function y(k,C){f({type:k,message:C}),setTimeout(()=>f(null),2500)}function S(k){l({kind:k,combo:null,conflict:null,saving:!1,error:null})}function w(k){if(!a||k.key==="Escape")return;if(k.key==="Enter"&&a.combo){k.preventDefault(),b();return}if(k.key==="Enter")return;k.preventDefault(),k.stopPropagation();const C=N2(k.nativeEvent);if(!C)return;const I=r(C,a.kind);l({...a,combo:C,conflict:I,error:null})}async function b(){var k;if(a!=null&&a.combo){if((k=a.conflict)!=null&&k.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 ${du[a.kind]}`)}catch(C){l({...a,saving:!1,error:C instanceof Error?C.message:"Failed to save"})}}}async function j(k){try{await i(k),y("success",`Cleared ${du[k]} binding`)}catch(C){y("error",C instanceof Error?C.message:"Failed to clear binding")}}async function N(){if(!p){h(!0);try{await F6(),y("success","All hotkey bindings cleared")}catch(k){y("error",k instanceof Error?k.message:"Failed to reset bindings")}finally{h(!1)}}}return s.jsxs(Ye,{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 N(),disabled:p,children:[s.jsx(Gs,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[d?s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${d.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:d.message}):null,s.jsx("ul",{className:"space-y-2",children:Gh.map(k=>{var D,$;const C=n.find(z=>z.bindableKind===k),I=e[k],T=typeof t[k]=="string"&&!!t[k],R=(a==null?void 0:a.kind)===k;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(ib,{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)??du[k]}),C!=null&&C.subtitle?s.jsx("div",{className:"text-xs text-muted-foreground",children:C.subtitle}):null]}),I?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:Ws(I)}),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:()=>S(k),children:I?"Rebind":"Bind"}),T?s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void j(k),"aria-label":`Restore default ${du[k]} binding`,children:[s.jsx(Nd,{className:"h-3 w-3"}),"Restore default"]}):null]}),R?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:w,onBlur:()=>{(a==null?void 0:a.kind)===k&&!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:Ws(a.combo)}),(D=a.conflict)!=null&&D.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 "',du[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]},k)})})]})}const OY={kanban:"Kanban",list:"List",table:"Table"},FY={comfortable:"Comfortable",compact:"Compact"},zY={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},BY={asc:"Ascending",desc:"Descending"};function UY(){const e=KK(),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 KP({[f]:p}),a("success","Saved")}catch(h){a("error",h instanceof Error?h.message:"Failed to save")}finally{r(!1)}}}async function d(){if(e.custom){r(!0);try{await GK(),a("success","Reset to defaults")}catch(f){a("error",f instanceof Error?f.message:"Failed to reset")}finally{r(!1)}}}return s.jsxs(Ye,{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:d,disabled:n,children:[s.jsx(Gs,{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:Zv.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:OY[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:XF.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:FY[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:bT.map(f=>s.jsx("option",{value:f,children:zY[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:YF.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:BY[f]},f))})]})]})]})}function HY({value:e,onChange:t,knownSlugs:n,rows:r=2,placeholder:o,className:i,wrapperClassName:a,singleLine:l,"aria-label":d}){const[f,p]=m.useState(0),[h,g]=m.useState(0),[y,S]=m.useState(!1),w=m.useRef(null),b=d_(e,f),j=b?f_(b.partial,n):[],N=!y&&j.length>0,k=Math.min(h,Math.max(0,j.length-1)),C=$=>l?$.replace(/[\r\n]+/g," "):$;function I($){t(C($.target.value)),p($.target.selectionStart??$.target.value.length),g(0),S(!1)}function T($){p($.currentTarget.selectionStart??e.length)}function R($){if(!b||!$)return;const z=p_(e,b,$);t(C(z.text)),p(z.caret),g(0),S(!0),requestAnimationFrame(()=>{const A=w.current;A&&(A.focus(),A.setSelectionRange(z.caret,z.caret))})}function D($){N&&($.key==="ArrowDown"?($.preventDefault(),g(z=>Math.min(z+1,j.length-1))):$.key==="ArrowUp"?($.preventDefault(),g(z=>Math.max(z-1,0))):$.key==="Enter"||$.key==="Tab"?($.preventDefault(),R(j[k])):$.key==="Escape"&&($.preventDefault(),S(!0)))}return s.jsxs("div",{className:Ne("relative",a),children:[s.jsx("textarea",{ref:w,value:e,rows:r,placeholder:o,"aria-label":d,onChange:I,onKeyDown:D,onKeyUp:T,onClick:T,className:i}),N&&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:j.map(($,z)=>s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":z===k,onMouseDown:A=>{A.preventDefault(),R($)},className:Ne("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===k&&"bg-accent"),children:[s.jsx("span",{className:"text-muted-foreground",children:"@"}),s.jsx("span",{className:"truncate",children:$})]})},$))})]})}const VY={first:"first",last:"last",none:"none"};function N_(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function bu(e){return e.map(t=>({rowKey:N_(),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??"",fieldErrors:{}}))}function WY(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),n})}function qY(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 KY(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 GY(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function YY(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)return!1}return!0}function XY({row:e,index:t,canRemove:n,playbooks:r,onPatch:o,onSetDefault:i,onRemove:a}){const{attributes:l,listeners:d,setNodeRef:f,setActivatorNodeRef:p,transform:h,transition:g,isDragging:y}=pm({id:e.rowKey}),S={transform:gs.Transform.toString(h),transition:g,zIndex:y?50:void 0,position:y?"relative":void 0};function w(C){const I={label:C};if(e.autoSlugFromLabel){const T=Tr(C);T&&hG.test(T)?I.id=T:I.id=`agent-${t+1}`}o(I)}function b(C){o({id:C,autoSlugFromLabel:!1})}const j=C=>e.fieldErrors[C]?"border-error-foreground/60":"",N=m.useMemo(()=>r.map(C=>C.slug),[r]),k=m.useMemo(()=>h_(e.launchPrompt,N),[e.launchPrompt,N]);return s.jsxs("div",{ref:f,style:S,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,...d,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(lc,{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"]}),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:C=>b(C.target.value),className:`editor-input w-32 font-mono text-xs ${j("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(jn,{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:C=>w(C.target.value),className:`editor-input mt-0.5 w-full ${j("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:C=>o({command:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${j("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:C=>o({argsText:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${j("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:C=>o({promptArgPosition:C.target.value}),className:`editor-input mt-0.5 w-full ${j("promptArgPosition")}`,children:i_.map(C=>s.jsx("option",{value:C,children:VY[C]},C))}),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:C=>o({model:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${j("model")}`}),e.fieldErrors.model&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.model})]}),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(HY,{value:e.launchPrompt,onChange:C=>o({launchPrompt:C}),knownSlugs:N,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] ${j("launchPrompt")}`,"aria-label":"Launch prompt"}),e.fieldErrors.launchPrompt&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.launchPrompt}),k.length>0&&!e.fieldErrors.launchPrompt&&s.jsx("ul",{className:"mt-0.5 space-y-0.5 text-[11px] text-error-foreground",children:k.map(C=>s.jsx("li",{children:C},C))})]}),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:C=>o({resolveFromShellAliases:C.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 QY(){const e=c_(),t=$v(),n=m.useMemo(()=>{var D;return(((D=t.data)==null?void 0:D.playbooks)??[]).filter($=>$.enabled).map($=>({slug:$.slug,name:$.name}))},[t.data]),[r,o]=m.useState(()=>bu(e.agents)),[i,a]=m.useState(()=>bu(e.agents)),[l,d]=m.useState(!1),[f,p]=m.useState(null),[h,g]=m.useState(null);m.useEffect(()=>{const D=bu(e.agents);o(D),a(D),p(null)},[e.agents]);const y=m.useMemo(()=>!YY(r,i),[r,i]),S=im(ci(gc,{activationConstraint:{distance:8}}),ci(mc));function w(D,$){g({type:D,message:$}),setTimeout(()=>g(null),2500)}function b(D,$){o(z=>z.map(A=>A.rowKey===D?{...A,...$,fieldErrors:JY(A.fieldErrors,$)}:A))}function j(D){o($=>$.map(z=>({...z,default:z.rowKey===D})))}function N(){o(D=>{const $=new Set(D.map(O=>O.id)),z="new-agent";let A=z,F=1;for(;$.has(A);)F+=1,A=`${z}-${F}`;const W=F===1?"New Agent":`New Agent ${F}`,P={rowKey:N_(),id:A,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:W,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...D,P]})}function k(D){o($=>$.filter(z=>z.rowKey!==D))}async function C(){d(!0),p(null);try{const D=qY(r),$=WY(D),z=await xG($),A=bu(z.agents);o(A),a(A),w("success","Agents saved")}catch(D){if(D instanceof a_)p(D.message),o($=>KY(GY($),D.fieldErrors)),w("error",D.message);else{const $=D instanceof Error?D.message:"Failed to save";p($),w("error",$)}}finally{d(!1)}}function I(){o(i),p(null)}async function T(){if(e.custom&&window.confirm("Reset agents to built-in defaults? Any custom agents will be deleted from your config.")){d(!0),p(null);try{const D=await yG(),$=bu(D.agents);o($),a($),w("success","Reset to defaults")}catch(D){const $=D instanceof Error?D.message:"Failed to reset";p($),w("error",$)}finally{d(!1)}}}function R(D){const{active:$,over:z}=D;!z||$.id===z.id||o(A=>{const F=A.findIndex(P=>P.rowKey===$.id),W=A.findIndex(P=>P.rowKey===z.id);return F===-1||W===-1?A:xc(A,F,W)})}return s.jsxs(Ye,{title:"Agents",description:"Configure which agents the dashboard and 'Open in agent' actions can launch. The default agent is used when no other one is specified.",actions:e.custom?s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:T,disabled:l,children:[s.jsx(Gs,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[!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(Cv,{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"}),"."]})]}),h&&s.jsx("div",{className:`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}),f&&(!h||h.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(dm,{sensors:S,collisionDetection:am,onDragEnd:R,children:s.jsx(fm,{items:r.map(D=>D.rowKey),strategy:fw,children:s.jsx("div",{className:"space-y-2",children:r.map((D,$)=>s.jsx(XY,{row:D,index:$,canRemove:r.length>1,playbooks:n,onPatch:z=>b(D.rowKey,z),onSetDefault:()=>j(D.rowKey),onRemove:()=>k(D.rowKey)},D.rowKey))})})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:N,disabled:l,className:"shell-action text-xs",children:[s.jsx(Pt,{className:"h-3 w-3"}),"Add agent"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:I,disabled:!y||l,className:"shell-action text-xs",children:"Discard"}),s.jsxs("button",{type:"button",onClick:C,disabled:!y||l,className:"shell-action text-xs",children:[s.jsx(Hh,{className:"h-3 w-3"}),"Save"]})]})]})]})}function JY(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 C_=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],jh={terminal:"terminal-app",custom:!1};let kl=null,gl=null,kh=0;const Jb=new Set;function E_(e){kl=e;for(const t of Jb)t(e)}function l0(e){if(!e||typeof e!="object")return jh;const t=e;return{terminal:typeof t.terminal=="string"&&C_.includes(t.terminal)?t.terminal:jh.terminal,custom:t.custom===!0}}function ZY(){if(kl)return Promise.resolve(kl);if(gl)return gl;const e=++kh;return gl=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{gl=null;const n=l0(t);return e!==kh?kl??n:(kl=n,n)}).catch(()=>(gl=null,jh)),gl}function eX(){const[e,t]=m.useState(()=>kl??jh);return m.useEffect(()=>{let n=!1;return ZY().then(r=>{n||t(r)}),Jb.add(t),()=>{n=!0,Jb.delete(t)}},[]),e}async function tX(e){++kh;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=l0(await t.json());return E_(n),n}async function nX(){++kh;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=l0(await e.json());return E_(t),t}const fp={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function rX(){const{terminal:e,custom:t}=eX(),[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 tX(f),a({type:"success",message:`Terminal set to ${fp[f]}.`})}catch(p){a({type:"error",message:p instanceof Error?p.message:"Save failed."})}finally{r(!1)}}}async function d(){r(!0);try{const f=await nX();a({type:"success",message:`Reset to OS default (${fp[f.terminal]}).`})}catch(f){a({type:"error",message:f instanceof Error?f.message:"Reset failed."})}finally{r(!1)}}return s.jsxs(Ye,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${fp[e]}) when unset.`,actions:t?s.jsxs("button",{className:"shell-action text-xs",onClick:d,disabled:n,type:"button",children:[s.jsx(Gs,{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:C_.map(f=>s.jsx("option",{value:f,children:fp[f]},f))})]})]})}const zN={all:"Everything",assignment:"Assignments",project:"Projects",todo:"Todos",server:"Servers",playbook:"Playbooks"},sX=["all",...Yh];function $y(e){return Object.entries(e).map(([t,n])=>({prefix:t,kind:n}))}function oX(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=TO(n);return o.ok||t.push(...o.errors),{map:n,errors:t}}function iX(){const{search:e,custom:t}=Bv(),[n,r]=m.useState(e.defaultScope),[o,i]=m.useState(e.externalIds),[a,l]=m.useState(()=>$y(e.aliases)),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(null),S=JSON.stringify(e);m.useEffect(()=>{d||(r(e.defaultScope),i(e.externalIds),l($y(e.aliases)))},[S]);const{map:w,errors:b}=oX(a);function j($){y($),setTimeout(()=>y(null),2500)}function N(){l($=>[...$,{prefix:"",kind:"assignment"}]),f(!0)}function k($){l(z=>z.filter((A,F)=>F!==$)),f(!0)}function C($,z){l(A=>A.map((F,W)=>W===$?{...F,...z}:F)),f(!0)}function I($){r($.defaultScope),i($.externalIds),l($y($.aliases)),f(!1)}async function T(){if(!(b.length>0)){h(!0);try{const $=await PO({defaultScope:n,aliases:w,externalIds:o});I($.search),j({type:"success",message:"Search settings saved."})}catch($){j({type:"error",message:$ instanceof Error?$.message:"Save failed."})}finally{h(!1)}}}async function R(){h(!0);try{const $=await _O();I($.search),j({type:"success",message:"Reset to defaults."})}catch($){j({type:"error",message:$ instanceof Error?$.message:"Reset failed."})}finally{h(!1)}}const D=d&&b.length===0&&!p;return s.jsxs(Ye,{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:R,disabled:p,type:"button",children:[s.jsx(Gs,{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:sX.map($=>s.jsx("option",{value:$,children:zN[$]},$))}),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:A=>C(z,{prefix:A.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:A=>C(z,{kind:A.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:Yh.map(A=>s.jsx("option",{value:A,children:zN[A]},A))}),s.jsx("button",{type:"button",onClick:()=>k(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(Nd,{className:"h-3.5 w-3.5"})})]},z))}),s.jsxs("button",{type:"button",onClick:N,disabled:p,className:"mt-2 inline-flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-60",children:[s.jsx(Pt,{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."]})]})]}),d&&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:!D,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 vu(e){return e===nh?"Ungrouped":e}function aX(){const{data:e,loading:t,error:n,refetch:r}=fa(),{hidden:o,custom:i,loading:a,error:l,reload:d}=RT(),[f,p]=m.useState(!1),[h,g]=m.useState(null);function y(j){g(j),setTimeout(()=>g(null),2500)}const S=e?[...e.workspaces,...e.hasUngrouped?[nh]:[]]:[];async function w(j,N){const k=N?o.filter(C=>C!==j):[...o,j];p(!0);try{await Y6(k),y({type:"success",message:N?`Showing "${vu(j)}" in the left nav.`:`Hiding "${vu(j)}" 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 X6(),y({type:"success",message:"All workspaces shown in the left nav."})}catch(j){y({type:"error",message:j instanceof Error?j.message:"Reset failed."})}finally{p(!1)}}return s.jsxs(Ye,{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(Gs,{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&&d()},children:[s.jsx(Gs,{className:"h-3 w-3"}),"Retry"]})]}):S.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:S.map(j=>{const N=!q6(j,o);return s.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[s.jsxs("span",{className:"truncate text-sm",title:vu(j),children:[vu(j),j===nh&&s.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":N,"aria-label":`Show "${vu(j)}" in the left nav`,onClick:()=>w(j,!N),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 ${N?"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 ${N?"translate-x-4":"translate-x-0"}`})})]},j)})})]})}function lX(){const{preset:e,setPreset:t,resetPreset:n}=_v(),[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 d(){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(Ye,{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:d,disabled:r,children:[s.jsx(Gs,{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:c2.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(Lr,{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(LY,{}),s.jsx(rX,{}),s.jsx(iX,{}),s.jsx(aX,{}),s.jsx(QY,{}),s.jsx(UY,{}),s.jsx(MY,{})]})}function cX({open:e,affected:t,remaining:n,ruleReferences:r,headlineReferences:o,onResolve:i,onCancel:a}){var I,T;const[l,d]=m.useState(n.length>0?"remap":"delete"),[f,p]=m.useState(((I=n[0])==null?void 0:I.id)??""),[h,g]=m.useState(((T=n[0])==null?void 0:T.id)??""),[y,S]=m.useState(!1),w=t.count>0;m.useEffect(()=>{var R,D;e&&(d(n.length>0?"remap":"delete"),p(((R=n[0])==null?void 0:R.id)??""),g(((D=n[0])==null?void 0:D.id)??""),S(!1))},[e,n]);const b=!o||h!==""&&h!==t.id,j=l==="remap"&&n.length>0&&f!==""&&f!==t.id||l==="delete"&&(!w||y)&&b;function N(){j&&(l==="remap"?i({id:t.id,mode:"remap",target:f},f):i({id:t.id,mode:"delete"},o?h:""))}const k=t.assignments.slice(0,10),C=t.count-k.length;return s.jsx(Bn,{open:e,onOpenChange:R=>R?void 0:a(),children:s.jsxs(_n,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsxs(Dn,{children:['Delete status "',t.label,'"',w?` — ${t.count} assignment${t.count===1?"":"s"} reference it`:""]}),s.jsx(es,{children:w?"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."})]}),w&&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:[k.map(R=>s.jsx("li",{children:s.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:R.display})},`${R.projectSlug??"standalone"}/${R.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((R,D)=>s.jsxs("li",{children:[s.jsx("span",{className:"text-foreground",children:R.section}),s.jsx("span",{className:"mx-1",children:"·"}),R.detail]},D))}),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:()=>d("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:w?"Remap to another status":"Remap rules to another status"}),s.jsxs("select",{value:f,onChange:R=>p(R.target.value),onClick:()=>d("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(R=>s.jsxs("option",{value:R.id,children:[R.label," (",R.id,")"]},R.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:()=>d("delete"),className:"mt-1"}),s.jsxs("span",{className:"flex-1",children:[s.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:w?"Delete these assignments":"Drop the referencing rules"}),s.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:w?`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:R=>g(R.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(R=>s.jsxs("option",{value:R.id,children:[R.label," (",R.id,")"]},R.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"&&w&&s.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:y,onChange:R=>S(R.target.checked)}),s.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),s.jsxs(Fr,{children:[s.jsx("button",{type:"button",onClick:a,className:"shell-action",children:"Cancel"}),s.jsx("button",{type:"button",onClick:N,disabled:!j,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"?w?`Remap ${t.count} → ${f||"..."}`:`Remap rules → ${f||"..."}`:w?`Delete ${t.count}`:"Drop rules"})]})]})})}function uX({open:e,references:t,onConfirm:n,onCancel:r}){return s.jsx(Bn,{open:e,onOpenChange:o=>o?void 0:r(),children:s.jsxs(_n,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:"Delete fact — referenced by derive rules"}),s.jsx(es,{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(Fr,{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 dX({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 fX({row:e,isSaved:t,onUpdate:n,onRemove:r}){const{attributes:o,listeners:i,setNodeRef:a,setActivatorNodeRef:l,transform:d,transition:f,isDragging:p}=pm({id:e.rowKey}),h={transform:gs.Transform.toString(d),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(lc,{className:"h-4 w-4"})}),s.jsx("div",{className:"min-w-[8rem] flex-1",children:t?s.jsxs(_r,{children:[s.jsx(Dr,{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(hr,{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(dX,{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(_r,{children:[s.jsx(Dr,{asChild:!0,children:s.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),s.jsx(hr,{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(jn,{className:"h-3.5 w-3.5"})})]})}function pX({statuses:e,savedStatusIds:t,onUpdate:n,onAdd:r,onRemove:o,onReorder:i}){const a=im(ci(gc,{activationConstraint:{distance:8}}),ci(mc,{coordinateGetter:vR}));function l(d){const{active:f,over:p}=d;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(xc(e,h,g))}return s.jsx(Ye,{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(Pt,{className:"h-3 w-3"}),"Add Status"]}),children:s.jsx(dm,{sensors:a,collisionDetection:am,onDragEnd:l,children:s.jsx(fm,{items:e.map(d=>d.rowKey),strategy:fw,children:s.jsx("div",{className:"space-y-2",children:e.map((d,f)=>s.jsx(fX,{row:d,isSaved:t.has(d.id),onUpdate:(p,h)=>n(f,p,h),onRemove:()=>o(f)},d.rowKey))})})})})}function hX(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 mX(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 gX(e,t){return t.headline.parked===e||t.headline.blocked===e}function xX(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 yX(e,t,n){return e.map(r=>({...r,from:r.from===t?n:r.from,to:r.to===t?n:r.to}))}function bX(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 vX(e,t){return e.filter(n=>n.from!==t&&n.to!==t)}function wX(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 BN(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 T_(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function jX(e){const t=e.statuses.map(n=>({rowKey:T_(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return wX(t,e.order)}function kX(e){return Rb(e)}function UN(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function SX(e){const t=new Map;for(let n=0;n<e.length;n++){const r=UN(Rb(e.slice(0,n))),o=UN(Rb(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 NX=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],CX=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function EX(){return{name:"",type:"bool",binds:null}}function TX({rows:e,onChange:t,saving:n}){const r=SX(e),o=m.useCallback(()=>{t([...e,EX()])},[e,t]),i=m.useCallback((l,d,f)=>{t(e.map((p,h)=>h===l?{...p,[d]:f}:p))},[e,t]),a=m.useCallback(l=>{t(e.filter((d,f)=>f!==l))},[e,t]);return s.jsxs(Ye,{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,d)=>{const f=r.get(d),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(d,"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,S)=>S===d?{...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:NX.map(h=>s.jsx("option",{value:h.value,children:h.label},h.value))}),p?s.jsx("select",{value:l.binds??"none",onChange:h=>i(d,"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:CX.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(_r,{children:[s.jsx(Dr,{asChild:!0,children:s.jsx("span",{className:"mt-1 inline-flex text-error-foreground","aria-label":"Invalid fact",children:s.jsx(Qp,{className:"h-3.5 w-3.5 flex-shrink-0"})})}),s.jsx(hr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:f})]}),s.jsx("button",{type:"button",onClick:()=>a(d),disabled:n,className:"mt-0.5 shell-action text-xs text-muted-foreground hover:text-error disabled:opacity-50",title:"Delete",children:s.jsx(jn,{className:"h-3.5 w-3.5"})})]}),f&&s.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:f})]},d)})]}),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(Pt,{className:"h-3.5 w-3.5"}),"Add fact"]})]})}function R_(e,t=wm){var r,o;if(e==="*")return null;const n=Jh(e);if(!n.ast)return((r=n.errors[0])==null?void 0:r.message)??"unparseable condition";try{return Au(n.ast,t),null}catch(i){if(i instanceof Ar)return((o=i.errors[0])==null?void 0:o.message)??"invalid condition";throw i}}function Iy(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 RX(e){if(e.kind==="atom"){const t=Iy(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=Iy(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 d=Iy(l);if(!d)return null;a.push(d)}o.push({join:r,comparisons:a})}else return null;return{outerJoin:t,groups:o}}return null}function HN(e){const t=e.trim();if(t===""||t==="*")return null;const n=Jh(t);return n.ast?RX(n.ast):null}const AX=/^[A-Za-z_][A-Za-z0-9_-]*$/;function PX(e){return e===""||!AX.test(e)||/^(and|or|not)$/i.test(e)}function _X(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function DX(e){return e.valueType==="number"||e.valueType==="date"||e.valueType==="duration"?e.value:PX(e.value)?_X(e.value):e.value}function $X(e){const t=DX(e);return e.op===":"?`${e.field}:${t}`:`${e.field} ${e.op} ${t}`}function IX(e){return e.groups.map(n=>{const r=n.comparisons.map($X).join(` ${n.join} `);return n.comparisons.length>1?`(${r})`:r}).join(` ${e.outerJoin} `)}function MX(e,t){return e.trim()==="*"?null:e.trim()===""?"condition is empty":R_(e,t)}function LX(e){return uU(cU(e))}function OX(e){const t=Cw(e),n=[];for(const r of fA(e)){const o=t[r.toLowerCase()];o&&n.push({name:r,kind:o.kind})}return n}function A_(e){switch(e){case"bool":return"word";case"number":case"ordinal":case"duration":case"timestamp":return"number";default:return"string"}}function Zb(e){switch(e){case"bool":return[":"];case"number":case"ordinal":case"duration":case"timestamp":return[":","=","!=","<","<=",">",">="];default:return[":","!="]}}function wu(e){const t=e[0];return{outerJoin:"AND",groups:[{join:"AND",comparisons:[t?{field:t.name,op:Zb(t.kind)[0],value:t.kind==="bool"?"true":"",valueType:A_(t.kind)}:{field:"",op:":",value:""}]}]}}function P_({value:e,onChange:t,fieldOptions:n,registry:r,disabled:o}){const i=m.useMemo(()=>HN(e),[e]),a=e.trim()===""||i!==null,[l,d]=m.useState(a?"builder":"raw"),[f,p]=m.useState(()=>i??wu(n)),h=m.useRef(e);m.useEffect(()=>{if(e===h.current)return;const T=HN(e);T&&p(T),!(e.trim()===""||T)&&l==="builder"&&d("raw"),h.current=e},[e]);const g=MX(e,r);function y(T){h.current=T,t(T)}function S(T){p(T),y(IX(T))}function w(T){S({outerJoin:T,groups:f.groups.map(R=>({...R,join:T==="AND"?"OR":"AND"}))})}function b(T,R,D){const $=f.groups.map((z,A)=>A===T?{...z,comparisons:z.comparisons.map((F,W)=>W===R?{...F,...D}:F)}:z);S({...f,groups:$})}function j(T){const R=wu(n).groups[0].comparisons[0],D=f.groups.map(($,z)=>z===T?{...$,comparisons:[...$.comparisons,{...R}]}:$);S({...f,groups:D})}function N(T,R){let D=f.groups.map(($,z)=>z===T?{...$,comparisons:$.comparisons.filter((A,F)=>F!==R)}:$);D=D.filter($=>$.comparisons.length>0),D.length===0&&(D=wu(n).groups),S({...f,groups:D})}function k(){const T=f.outerJoin==="AND"?"OR":"AND";S({...f,groups:[...f.groups,{join:T,comparisons:[wu(n).groups[0].comparisons[0]]}]})}function C(){if(l==="builder"){d("raw");return}a&&(p(i??wu(n)),d("builder"))}const I="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(EL,{className:"h-3 w-3"}):s.jsx(HL,{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:`${I} w-full font-mono`}):s.jsxs("div",{className:"space-y-2",children:[f.groups.map((T,R)=>s.jsxs("div",{children:[R>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:()=>w(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((D,$)=>{const z=n.find(W=>W.name===D.field),A=(z==null?void 0:z.kind)??"string",F=Zb(A);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:D.field,onChange:W=>{const P=n.find(H=>H.name===W.target.value),O=(P==null?void 0:P.kind)??"string",B=Zb(O);b(R,$,{field:W.target.value,op:B.includes(D.op)?D.op:B[0],value:O==="bool"?"true":D.value,valueType:A_(O)})},disabled:o,className:`${I} font-mono`,children:[n.length===0&&s.jsx("option",{value:"",children:"(no fields)"}),!n.some(W=>W.name===D.field)&&D.field!==""&&s.jsx("option",{value:D.field,children:D.field}),n.map(W=>s.jsx("option",{value:W.name,children:W.name},W.name))]}),s.jsx("select",{value:D.op,onChange:W=>b(R,$,{op:W.target.value}),disabled:o,className:`${I} font-mono`,children:F.map(W=>s.jsx("option",{value:W,children:W},W))}),A==="bool"?s.jsxs("select",{value:D.value||"true",onChange:W=>b(R,$,{value:W.target.value}),disabled:o,className:`${I} font-mono`,children:[s.jsx("option",{value:"true",children:"true"}),s.jsx("option",{value:"false",children:"false"})]}):s.jsx("input",{type:"text",value:D.value,onChange:W=>b(R,$,{value:W.target.value}),disabled:o,placeholder:"value",className:`${I} w-24 font-mono`}),s.jsx("button",{type:"button",onClick:()=>N(R,$),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(jn,{className:"h-3.5 w-3.5"})})]},$)}),s.jsxs("button",{type:"button",onClick:()=>j(R),disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(Pt,{className:"h-3 w-3"}),T.join," condition"]})]})]},R)),s.jsxs("button",{type:"button",onClick:k,disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(Pt,{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 VN=0;function Sh(){return VN+=1,`dr_${VN}_${Math.random().toString(36).slice(2,8)}`}function My(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:Sh(),phase:n.phase,when:n.when,next:n.next??""})),disposition:t.map(n=>({rowKey:Sh(),when:n.when,is:n.is})),headline:{parked:e.headline.parked,blocked:e.headline.blocked}}}function ev(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 FX(e){return e.findIndex(t=>t.when.trim()==="*")}function __(e,t,n){return j6(e,{statuses:t},r=>R_(r,n))}const WN=["active","blocked","parked"];function zX({value:e,deriveCustom:t,statuses:n,acceptedFacts:r,onChange:o,onReset:i,disabled:a}){const l=m.useMemo(()=>Cw(r),[r]),d=m.useMemo(()=>OX(r),[r]),f=im(ci(gc,{activationConstraint:{distance:8}}),ci(mc,{coordinateGetter:vR})),p=m.useMemo(()=>{try{return __(ev(e),n,l)}catch{return["derive rules are malformed"]}},[e,n,l]),h=FX(e.phaseLadder),g=h>=0?e.phaseLadder[h]:null,y=e.phaseLadder.filter(($,z)=>z!==h);function S($,z){o({...e,phaseLadder:[...$?[$]:[],...z]})}function w($,z){const A=e.phaseLadder.map(F=>F.rowKey===$?{...F,...z}:F);o({...e,phaseLadder:A})}function b(){var z;const $={rowKey:Sh(),phase:((z=n[0])==null?void 0:z.id)??"",when:"",next:""};S(g,[...y,$])}function j($){o({...e,phaseLadder:e.phaseLadder.filter(z=>z.rowKey!==$)})}function N($){const{active:z,over:A}=$;if(!A||z.id===A.id)return;const F=y.findIndex(P=>P.rowKey===z.id),W=y.findIndex(P=>P.rowKey===A.id);F===-1||W===-1||S(g,xc(y,F,W))}function k($,z){o({...e,disposition:e.disposition.map(A=>A.rowKey===$?{...A,...z}:A)})}function C(){const $={rowKey:Sh(),when:"",is:"active"},z=e.disposition.findIndex(F=>F.when===null),A=[...e.disposition];z>=0?A.splice(z,0,$):A.push($),o({...e,disposition:A})}function I($){o({...e,disposition:e.disposition.filter(z=>z.rowKey!==$)})}function T($,z){o({...e,headline:{...e.headline,[$]:z}})}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";function D($,z,A){return s.jsxs("select",{value:$,onChange:F=>z(F.target.value),disabled:a,"aria-label":A,className:`${R} font-mono`,children:[!n.some(F=>F.id===$)&&$!==""&&s.jsx("option",{value:$,children:$}),n.map(F=>s.jsxs("option",{value:F.id,children:[F.label," (",F.id,")"]},F.id))]})}return s.jsxs(Ye,{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(Gs,{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(lc,{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)"}),D(g.phase,$=>w(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:$=>w(g.rowKey,{next:$.target.value}),disabled:a,className:`${R} w-full`})]})]}),s.jsx(dm,{sensors:f,collisionDetection:am,onDragEnd:N,children:s.jsx(fm,{items:y.map($=>$.rowKey),strategy:fw,children:s.jsx("div",{className:"space-y-2",children:y.map($=>s.jsx(BX,{rung:$,disabled:a,statusSelect:D,fieldOptions:d,registry:l,onUpdate:z=>w($.rowKey,z),onRemove:()=>j($.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(Pt,{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=>k($.rowKey,{is:z.target.value}),disabled:a,className:`${R} font-mono`,children:WN.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(P_,{value:$.when,onChange:z=>k($.rowKey,{when:z}),fieldOptions:d,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=>k($.rowKey,{is:z.target.value}),disabled:a,className:`${R} font-mono`,children:WN.map(z=>s.jsx("option",{value:z,children:z},z))}),s.jsx("button",{type:"button",onClick:()=>I($.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(jn,{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(Pt,{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"}),D(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"}),D(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 BX({rung:e,disabled:t,statusSelect:n,fieldOptions:r,registry:o,onUpdate:i,onRemove:a}){const{attributes:l,listeners:d,setNodeRef:f,setActivatorNodeRef:p,transform:h,transition:g,isDragging:y}=pm({id:e.rowKey}),S={transform:gs.Transform.toString(h),transition:g,zIndex:y?50:void 0,position:y?"relative":void 0};return s.jsxs("div",{ref:f,style:S,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,...d,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(lc,{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,w=>i({phase:w}),"Rung phase")]}),s.jsx("div",{className:"min-w-[14rem] flex-1",children:s.jsx(P_,{value:e.when,onChange:w=>i({when:w}),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:w=>i({next:w.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(jn,{className:"h-3.5 w-3.5"})})]})}const UX=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 qN=0;function D_(){return qN+=1,`tr_${qN}_${Math.random().toString(36).slice(2,8)}`}function HX(e){return{rowKey:D_(),from:e.from,command:e.command,to:e.to,label:e.label??"",description:e.description??"",requiresReason:e.requiresReason??!1}}function tv(e){return e.map(HX)}function VX(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 WX(e){return e.map(VX)}function $_(){const e=[];for(const[t,n]of UX){const r=t.indexOf(":");e.push({from:t.slice(0,r),command:t.slice(r+1),to:n})}return e}function qX(e,t){return e.filter(n=>t.has(n.from)&&t.has(n.to))}function I_(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 KX(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 KN(e,t){const n=new Set(t.map(l=>l.id)),r=KX(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 d of[l.from,l.to])d&&!i.has(d)&&(i.add(d),o.push({id:d,label:d,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 Nn(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=Nn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var GX={value:()=>{}};function zm(){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 Up(n)}function Up(e){this._=e}function YX(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}})}Up.prototype=zm.prototype={constructor:Up,on:function(e,t){var n=this._,r=YX(e+"",n),o,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((o=(e=r[i]).type)&&(o=XX(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]=GN(n[o],e.name,t);else if(t==null)for(o in n)n[o]=GN(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 Up(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 XX(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function GN(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=GX,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var nv="http://www.w3.org/1999/xhtml";const YN={svg:"http://www.w3.org/2000/svg",xhtml:nv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bm(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),YN.hasOwnProperty(t)?{space:YN[t],local:e}:e}function QX(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===nv&&t.documentElement.namespaceURI===nv?t.createElement(e):t.createElementNS(n,e)}}function JX(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function M_(e){var t=Bm(e);return(t.local?JX:QX)(t)}function ZX(){}function c0(e){return e==null?ZX:function(){return this.querySelector(e)}}function eQ(e){typeof e!="function"&&(e=c0(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),d,f,p=0;p<a;++p)(d=i[p])&&(f=e.call(d,d.__data__,p,i))&&("__data__"in d&&(f.__data__=d.__data__),l[p]=f);return new Or(r,this._parents)}function tQ(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function nQ(){return[]}function L_(e){return e==null?nQ:function(){return this.querySelectorAll(e)}}function rQ(e){return function(){return tQ(e.apply(this,arguments))}}function sQ(e){typeof e=="function"?e=rQ(e):e=L_(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var a=t[i],l=a.length,d,f=0;f<l;++f)(d=a[f])&&(r.push(e.call(d,d.__data__,f,a)),o.push(d));return new Or(r,o)}function O_(e){return function(){return this.matches(e)}}function F_(e){return function(t){return t.matches(e)}}var oQ=Array.prototype.find;function iQ(e){return function(){return oQ.call(this.children,e)}}function aQ(){return this.firstElementChild}function lQ(e){return this.select(e==null?aQ:iQ(typeof e=="function"?e:F_(e)))}var cQ=Array.prototype.filter;function uQ(){return Array.from(this.children)}function dQ(e){return function(){return cQ.call(this.children,e)}}function fQ(e){return this.selectAll(e==null?uQ:dQ(typeof e=="function"?e:F_(e)))}function pQ(e){typeof e!="function"&&(e=O_(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]=[],d,f=0;f<a;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&l.push(d);return new Or(r,this._parents)}function z_(e){return new Array(e.length)}function hQ(){return new Or(this._enter||this._groups.map(z_),this._parents)}function Nh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Nh.prototype={constructor:Nh,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 mQ(e){return function(){return e}}function gQ(e,t,n,r,o,i){for(var a=0,l,d=t.length,f=i.length;a<f;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Nh(e,i[a]);for(;a<d;++a)(l=t[a])&&(o[a]=l)}function xQ(e,t,n,r,o,i,a){var l,d,f=new Map,p=t.length,h=i.length,g=new Array(p),y;for(l=0;l<p;++l)(d=t[l])&&(g[l]=y=a.call(d,d.__data__,l,t)+"",f.has(y)?o[l]=d:f.set(y,d));for(l=0;l<h;++l)y=a.call(e,i[l],l,i)+"",(d=f.get(y))?(r[l]=d,d.__data__=i[l],f.delete(y)):n[l]=new Nh(e,i[l]);for(l=0;l<p;++l)(d=t[l])&&f.get(g[l])===d&&(o[l]=d)}function yQ(e){return e.__data__}function bQ(e,t){if(!arguments.length)return Array.from(this,yQ);var n=t?xQ:gQ,r=this._parents,o=this._groups;typeof e!="function"&&(e=mQ(e));for(var i=o.length,a=new Array(i),l=new Array(i),d=new Array(i),f=0;f<i;++f){var p=r[f],h=o[f],g=h.length,y=vQ(e.call(p,p&&p.__data__,f,r)),S=y.length,w=l[f]=new Array(S),b=a[f]=new Array(S),j=d[f]=new Array(g);n(p,h,w,b,j,y,t);for(var N=0,k=0,C,I;N<S;++N)if(C=w[N]){for(N>=k&&(k=N+1);!(I=b[k])&&++k<S;);C._next=I||null}}return a=new Or(a,r),a._enter=l,a._exit=d,a}function vQ(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function wQ(){return new Or(this._exit||this._groups.map(z_),this._parents)}function jQ(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 kQ(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),d=0;d<a;++d)for(var f=n[d],p=r[d],h=f.length,g=l[d]=new Array(h),y,S=0;S<h;++S)(y=f[S]||p[S])&&(g[S]=y);for(;d<o;++d)l[d]=n[d];return new Or(l,this._parents)}function SQ(){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 NQ(e){e||(e=CQ);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,d=o[i]=new Array(l),f,p=0;p<l;++p)(f=a[p])&&(d[p]=f);d.sort(t)}return new Or(o,this._parents).order()}function CQ(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function EQ(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function TQ(){return Array.from(this)}function RQ(){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 AQ(){let e=0;for(const t of this)++e;return e}function PQ(){return!this.node()}function _Q(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 DQ(e){return function(){this.removeAttribute(e)}}function $Q(e){return function(){this.removeAttributeNS(e.space,e.local)}}function IQ(e,t){return function(){this.setAttribute(e,t)}}function MQ(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function LQ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function OQ(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 FQ(e,t){var n=Bm(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?$Q:DQ:typeof t=="function"?n.local?OQ:LQ:n.local?MQ:IQ)(n,t))}function B_(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function zQ(e){return function(){this.style.removeProperty(e)}}function BQ(e,t,n){return function(){this.style.setProperty(e,t,n)}}function UQ(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function HQ(e,t,n){return arguments.length>1?this.each((t==null?zQ:typeof t=="function"?UQ:BQ)(e,t,n??"")):Xl(this.node(),e)}function Xl(e,t){return e.style.getPropertyValue(t)||B_(e).getComputedStyle(e,null).getPropertyValue(t)}function VQ(e){return function(){delete this[e]}}function WQ(e,t){return function(){this[e]=t}}function qQ(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function KQ(e,t){return arguments.length>1?this.each((t==null?VQ:typeof t=="function"?qQ:WQ)(e,t)):this.node()[e]}function U_(e){return e.trim().split(/^|\s+/)}function u0(e){return e.classList||new H_(e)}function H_(e){this._node=e,this._names=U_(e.getAttribute("class")||"")}H_.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 V_(e,t){for(var n=u0(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function W_(e,t){for(var n=u0(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function GQ(e){return function(){V_(this,e)}}function YQ(e){return function(){W_(this,e)}}function XQ(e,t){return function(){(t.apply(this,arguments)?V_:W_)(this,e)}}function QQ(e,t){var n=U_(e+"");if(arguments.length<2){for(var r=u0(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?XQ:t?GQ:YQ)(n,t))}function JQ(){this.textContent=""}function ZQ(e){return function(){this.textContent=e}}function eJ(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function tJ(e){return arguments.length?this.each(e==null?JQ:(typeof e=="function"?eJ:ZQ)(e)):this.node().textContent}function nJ(){this.innerHTML=""}function rJ(e){return function(){this.innerHTML=e}}function sJ(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function oJ(e){return arguments.length?this.each(e==null?nJ:(typeof e=="function"?sJ:rJ)(e)):this.node().innerHTML}function iJ(){this.nextSibling&&this.parentNode.appendChild(this)}function aJ(){return this.each(iJ)}function lJ(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function cJ(){return this.each(lJ)}function uJ(e){var t=typeof e=="function"?e:M_(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function dJ(){return null}function fJ(e,t){var n=typeof e=="function"?e:M_(e),r=t==null?dJ:typeof t=="function"?t:c0(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function pJ(){var e=this.parentNode;e&&e.removeChild(this)}function hJ(){return this.each(pJ)}function mJ(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function gJ(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function xJ(e){return this.select(e?gJ:mJ)}function yJ(e){return arguments.length?this.property("__data__",e):this.node().__data__}function bJ(e){return function(t){e.call(this,t,this.__data__)}}function vJ(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 wJ(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 jJ(e,t,n){return function(){var r=this.__on,o,i=bJ(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 kJ(e,t,n){var r=vJ(e+""),o,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var d=0,f=l.length,p;d<f;++d)for(o=0,p=l[d];o<i;++o)if((a=r[o]).type===p.type&&a.name===p.name)return p.value}return}for(l=t?jJ:wJ,o=0;o<i;++o)this.each(l(r[o],t,n));return this}function q_(e,t,n){var r=B_(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 SJ(e,t){return function(){return q_(this,e,t)}}function NJ(e,t){return function(){return q_(this,e,t.apply(this,arguments))}}function CJ(e,t){return this.each((typeof t=="function"?NJ:SJ)(e,t))}function*EJ(){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 K_=[null];function Or(e,t){this._groups=e,this._parents=t}function Hd(){return new Or([[document.documentElement]],K_)}function TJ(){return this}Or.prototype=Hd.prototype={constructor:Or,select:eQ,selectAll:sQ,selectChild:lQ,selectChildren:fQ,filter:pQ,data:bQ,enter:hQ,exit:wQ,join:jQ,merge:kQ,selection:TJ,order:SQ,sort:NQ,call:EQ,nodes:TQ,node:RQ,size:AQ,empty:PQ,each:_Q,attr:FQ,style:HQ,property:KQ,classed:QQ,text:tJ,html:oJ,raise:aJ,lower:cJ,append:uJ,insert:fJ,remove:hJ,clone:xJ,datum:yJ,on:kJ,dispatch:CJ,[Symbol.iterator]:EJ};function $r(e){return typeof e=="string"?new Or([[document.querySelector(e)]],[document.documentElement]):new Or([[e]],K_)}function RJ(e){let t;for(;t=e.sourceEvent;)e=t;return e}function us(e,t){if(e=RJ(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 AJ={passive:!1},ld={capture:!0,passive:!1};function Ly(e){e.stopImmediatePropagation()}function zl(e){e.preventDefault(),e.stopImmediatePropagation()}function G_(e){var t=e.document.documentElement,n=$r(e).on("dragstart.drag",zl,ld);"onselectstart"in t?n.on("selectstart.drag",zl,ld):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Y_(e,t){var n=e.document.documentElement,r=$r(e).on("dragstart.drag",null);t&&(r.on("click.drag",zl,ld),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 pp=e=>()=>e;function rv(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:a,y:l,dx:d,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:d,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:p}})}rv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function PJ(e){return!e.ctrlKey&&!e.button}function _J(){return this.parentNode}function DJ(e,t){return t??{x:e.x,y:e.y}}function $J(){return navigator.maxTouchPoints||"ontouchstart"in this}function X_(){var e=PJ,t=_J,n=DJ,r=$J,o={},i=zm("start","drag","end"),a=0,l,d,f,p,h=0;function g(C){C.on("mousedown.drag",y).filter(r).on("touchstart.drag",b).on("touchmove.drag",j,AJ).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(C,I){if(!(p||!e.call(this,C,I))){var T=k(this,t.call(this,C,I),C,I,"mouse");T&&($r(C.view).on("mousemove.drag",S,ld).on("mouseup.drag",w,ld),G_(C.view),Ly(C),f=!1,l=C.clientX,d=C.clientY,T("start",C))}}function S(C){if(zl(C),!f){var I=C.clientX-l,T=C.clientY-d;f=I*I+T*T>h}o.mouse("drag",C)}function w(C){$r(C.view).on("mousemove.drag mouseup.drag",null),Y_(C.view,f),zl(C),o.mouse("end",C)}function b(C,I){if(e.call(this,C,I)){var T=C.changedTouches,R=t.call(this,C,I),D=T.length,$,z;for($=0;$<D;++$)(z=k(this,R,C,I,T[$].identifier,T[$]))&&(Ly(C),z("start",C,T[$]))}}function j(C){var I=C.changedTouches,T=I.length,R,D;for(R=0;R<T;++R)(D=o[I[R].identifier])&&(zl(C),D("drag",C,I[R]))}function N(C){var I=C.changedTouches,T=I.length,R,D;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),R=0;R<T;++R)(D=o[I[R].identifier])&&(Ly(C),D("end",C,I[R]))}function k(C,I,T,R,D,$){var z=i.copy(),A=us($||T,I),F,W,P;if((P=n.call(C,new rv("beforestart",{sourceEvent:T,target:g,identifier:D,active:a,x:A[0],y:A[1],dx:0,dy:0,dispatch:z}),R))!=null)return F=P.x-A[0]||0,W=P.y-A[1]||0,function O(B,H,L){var U=A,M;switch(B){case"start":o[D]=O,M=a++;break;case"end":delete o[D],--a;case"drag":A=us(L||H,I),M=a;break}z.call(B,C,new rv(B,{sourceEvent:H,subject:P,target:g,identifier:D,active:M,x:A[0]+F,y:A[1]+W,dx:A[0]-U[0],dy:A[1]-U[1],dispatch:z}),R)}}return g.filter=function(C){return arguments.length?(e=typeof C=="function"?C:pp(!!C),g):e},g.container=function(C){return arguments.length?(t=typeof C=="function"?C:pp(C),g):t},g.subject=function(C){return arguments.length?(n=typeof C=="function"?C:pp(C),g):n},g.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:pp(!!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 d0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Q_(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Vd(){}var cd=.7,Ch=1/cd,Bl="\\s*([+-]?\\d+)\\s*",ud="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ks="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",IJ=/^#([0-9a-f]{3,8})$/,MJ=new RegExp(`^rgb\\(${Bl},${Bl},${Bl}\\)$`),LJ=new RegExp(`^rgb\\(${Ks},${Ks},${Ks}\\)$`),OJ=new RegExp(`^rgba\\(${Bl},${Bl},${Bl},${ud}\\)$`),FJ=new RegExp(`^rgba\\(${Ks},${Ks},${Ks},${ud}\\)$`),zJ=new RegExp(`^hsl\\(${ud},${Ks},${Ks}\\)$`),BJ=new RegExp(`^hsla\\(${ud},${Ks},${Ks},${ud}\\)$`),XN={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};d0(Vd,aa,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:QN,formatHex:QN,formatHex8:UJ,formatHsl:HJ,formatRgb:JN,toString:JN});function QN(){return this.rgb().formatHex()}function UJ(){return this.rgb().formatHex8()}function HJ(){return J_(this).formatHsl()}function JN(){return this.rgb().formatRgb()}function aa(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=IJ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ZN(t):n===3?new gr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?hp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?hp(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=MJ.exec(e))?new gr(t[1],t[2],t[3],1):(t=LJ.exec(e))?new gr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=OJ.exec(e))?hp(t[1],t[2],t[3],t[4]):(t=FJ.exec(e))?hp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=zJ.exec(e))?nC(t[1],t[2]/100,t[3]/100,1):(t=BJ.exec(e))?nC(t[1],t[2]/100,t[3]/100,t[4]):XN.hasOwnProperty(e)?ZN(XN[e]):e==="transparent"?new gr(NaN,NaN,NaN,0):null}function ZN(e){return new gr(e>>16&255,e>>8&255,e&255,1)}function hp(e,t,n,r){return r<=0&&(e=t=n=NaN),new gr(e,t,n,r)}function VJ(e){return e instanceof Vd||(e=aa(e)),e?(e=e.rgb(),new gr(e.r,e.g,e.b,e.opacity)):new gr}function sv(e,t,n,r){return arguments.length===1?VJ(e):new gr(e,t,n,r??1)}function gr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}d0(gr,sv,Q_(Vd,{brighter(e){return e=e==null?Ch:Math.pow(Ch,e),new gr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?cd:Math.pow(cd,e),new gr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new gr(na(this.r),na(this.g),na(this.b),Eh(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:eC,formatHex:eC,formatHex8:WJ,formatRgb:tC,toString:tC}));function eC(){return`#${Qi(this.r)}${Qi(this.g)}${Qi(this.b)}`}function WJ(){return`#${Qi(this.r)}${Qi(this.g)}${Qi(this.b)}${Qi((isNaN(this.opacity)?1:this.opacity)*255)}`}function tC(){const e=Eh(this.opacity);return`${e===1?"rgb(":"rgba("}${na(this.r)}, ${na(this.g)}, ${na(this.b)}${e===1?")":`, ${e})`}`}function Eh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function na(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Qi(e){return e=na(e),(e<16?"0":"")+e.toString(16)}function nC(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ds(e,t,n,r)}function J_(e){if(e instanceof ds)return new ds(e.h,e.s,e.l,e.opacity);if(e instanceof Vd||(e=aa(e)),!e)return new ds;if(e instanceof ds)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,d=(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/=d<.5?i+o:2-i-o,a*=60):l=d>0&&d<1?0:a,new ds(a,l,d,e.opacity)}function qJ(e,t,n,r){return arguments.length===1?J_(e):new ds(e,t,n,r??1)}function ds(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}d0(ds,qJ,Q_(Vd,{brighter(e){return e=e==null?Ch:Math.pow(Ch,e),new ds(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?cd:Math.pow(cd,e),new ds(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 gr(Oy(e>=240?e-240:e+120,o,r),Oy(e,o,r),Oy(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new ds(rC(this.h),mp(this.s),mp(this.l),Eh(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=Eh(this.opacity);return`${e===1?"hsl(":"hsla("}${rC(this.h)}, ${mp(this.s)*100}%, ${mp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function rC(e){return e=(e||0)%360,e<0?e+360:e}function mp(e){return Math.max(0,Math.min(1,e||0))}function Oy(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 Um=e=>()=>e;function Z_(e,t){return function(n){return e+n*t}}function KJ(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 Xie(e,t){var n=t-e;return n?Z_(e,n>180||n<-180?n-360*Math.round(n/360):n):Um(isNaN(e)?t:e)}function GJ(e){return(e=+e)==1?e3:function(t,n){return n-t?KJ(t,n,e):Um(isNaN(t)?n:t)}}function e3(e,t){var n=t-e;return n?Z_(e,n):Um(isNaN(e)?t:e)}const Th=(function e(t){var n=GJ(t);function r(o,i){var a=n((o=sv(o)).r,(i=sv(i)).r),l=n(o.g,i.g),d=n(o.b,i.b),f=e3(o.opacity,i.opacity);return function(p){return o.r=a(p),o.g=l(p),o.b=d(p),o.opacity=f(p),o+""}}return r.gamma=e,r})(1);function YJ(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 XJ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function QJ(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]=Vu(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 JJ(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Fs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ZJ(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]=Vu(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var ov=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Fy=new RegExp(ov.source,"g");function eZ(e){return function(){return e}}function tZ(e){return function(t){return e(t)+""}}function t3(e,t){var n=ov.lastIndex=Fy.lastIndex=0,r,o,i,a=-1,l=[],d=[];for(e=e+"",t=t+"";(r=ov.exec(e))&&(o=Fy.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,d.push({i:a,x:Fs(r,o)})),n=Fy.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?d[0]?tZ(d[0].x):eZ(t):(t=d.length,function(f){for(var p=0,h;p<t;++p)l[(h=d[p]).i]=h.x(f);return l.join("")})}function Vu(e,t){var n=typeof t,r;return t==null||n==="boolean"?Um(t):(n==="number"?Fs:n==="string"?(r=aa(t))?(t=r,Th):t3:t instanceof aa?Th:t instanceof Date?JJ:XJ(t)?YJ:Array.isArray(t)?QJ:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ZJ:Fs)(e,t)}var sC=180/Math.PI,iv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function n3(e,t,n,r,o,i){var a,l,d;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(d=e*n+t*r)&&(n-=e*d,r-=t*d),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,d/=l),e*r<t*n&&(e=-e,t=-t,d=-d,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*sC,skewX:Math.atan(d)*sC,scaleX:a,scaleY:l}}var gp;function nZ(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?iv:n3(t.a,t.b,t.c,t.d,t.e,t.f)}function rZ(e){return e==null||(gp||(gp=document.createElementNS("http://www.w3.org/2000/svg","g")),gp.setAttribute("transform",e),!(e=gp.transform.baseVal.consolidate()))?iv:(e=e.matrix,n3(e.a,e.b,e.c,e.d,e.e,e.f))}function r3(e,t,n,r){function o(f){return f.length?f.pop()+" ":""}function i(f,p,h,g,y,S){if(f!==h||p!==g){var w=y.push("translate(",null,t,null,n);S.push({i:w-4,x:Fs(f,h)},{i:w-2,x:Fs(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:Fs(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:Fs(f,p)}):p&&h.push(o(h)+"skewX("+p+r)}function d(f,p,h,g,y,S){if(f!==h||p!==g){var w=y.push(o(y)+"scale(",null,",",null,")");S.push({i:w-4,x:Fs(f,h)},{i:w-2,x:Fs(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),d(f.scaleX,f.scaleY,p.scaleX,p.scaleY,h,g),f=p=null,function(y){for(var S=-1,w=g.length,b;++S<w;)h[(b=g[S]).i]=b.x(y);return h.join("")}}}var sZ=r3(nZ,"px, ","px)","deg)"),oZ=r3(rZ,", ",")",")"),iZ=1e-12;function oC(e){return((e=Math.exp(e))+1/e)/2}function aZ(e){return((e=Math.exp(e))-1/e)/2}function lZ(e){return((e=Math.exp(2*e))-1)/(e+1)}const Hp=(function e(t,n,r){function o(i,a){var l=i[0],d=i[1],f=i[2],p=a[0],h=a[1],g=a[2],y=p-l,S=h-d,w=y*y+S*S,b,j;if(w<iZ)j=Math.log(g/f)/t,b=function(R){return[l+R*y,d+R*S,f*Math.exp(t*R*j)]};else{var N=Math.sqrt(w),k=(g*g-f*f+r*w)/(2*f*n*N),C=(g*g-f*f-r*w)/(2*g*n*N),I=Math.log(Math.sqrt(k*k+1)-k),T=Math.log(Math.sqrt(C*C+1)-C);j=(T-I)/t,b=function(R){var D=R*j,$=oC(I),z=f/(n*N)*($*lZ(t*D+I)-aZ(I));return[l+z*y,d+z*S,f*$/oC(t*D+I)]}}return b.duration=j*1e3*t/Math.SQRT2,b}return o.rho=function(i){var a=Math.max(.001,+i),l=a*a,d=l*l;return e(a,l,d)},o})(Math.SQRT2,2,4);var Ql=0,Su=0,ju=0,s3=1e3,Rh,Nu,Ah=0,la=0,Hm=0,dd=typeof performance=="object"&&performance.now?performance:Date,o3=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function f0(){return la||(o3(cZ),la=dd.now()+Hm)}function cZ(){la=0}function Ph(){this._call=this._time=this._next=null}Ph.prototype=i3.prototype={constructor:Ph,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?f0():+n)+(t==null?0:+t),!this._next&&Nu!==this&&(Nu?Nu._next=this:Rh=this,Nu=this),this._call=e,this._time=n,av()},stop:function(){this._call&&(this._call=null,this._time=1/0,av())}};function i3(e,t,n){var r=new Ph;return r.restart(e,t,n),r}function uZ(){f0(),++Ql;for(var e=Rh,t;e;)(t=la-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ql}function iC(){la=(Ah=dd.now())+Hm,Ql=Su=0;try{uZ()}finally{Ql=0,fZ(),la=0}}function dZ(){var e=dd.now(),t=e-Ah;t>s3&&(Hm-=t,Ah=e)}function fZ(){for(var e,t=Rh,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:Rh=n);Nu=e,av(r)}function av(e){if(!Ql){Su&&(Su=clearTimeout(Su));var t=e-la;t>24?(e<1/0&&(Su=setTimeout(iC,e-dd.now()-Hm)),ju&&(ju=clearInterval(ju))):(ju||(Ah=dd.now(),ju=setInterval(dZ,s3)),Ql=1,o3(iC))}}function aC(e,t,n){var r=new Ph;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var pZ=zm("start","end","cancel","interrupt"),hZ=[],a3=0,lC=1,lv=2,Vp=3,cC=4,cv=5,Wp=6;function Vm(e,t,n,r,o,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;mZ(e,n,{name:t,index:r,group:o,on:pZ,tween:hZ,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:a3})}function p0(e,t){var n=Ns(e,t);if(n.state>a3)throw new Error("too late; already scheduled");return n}function Js(e,t){var n=Ns(e,t);if(n.state>Vp)throw new Error("too late; already running");return n}function Ns(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function mZ(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=i3(i,0,n.time);function i(f){n.state=lC,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!==lC)return d();for(p in r)if(y=r[p],y.name===n.name){if(y.state===Vp)return aC(a);y.state===cC?(y.state=Wp,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[p]):+p<t&&(y.state=Wp,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[p])}if(aC(function(){n.state===Vp&&(n.state=cC,n.timer.restart(l,n.delay,n.time),l(f))}),n.state=lv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===lv){for(n.state=Vp,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(d),n.state=cv,1),h=-1,g=o.length;++h<g;)o[h].call(e,p);n.state===cv&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=Wp,n.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function qp(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>lv&&r.state<cv,r.state=Wp,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function gZ(e){return this.each(function(){qp(this,e)})}function xZ(e,t){var n,r;return function(){var o=Js(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 yZ(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=Js(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var l={name:t,value:n},d=0,f=o.length;d<f;++d)if(o[d].name===t){o[d]=l;break}d===f&&o.push(l)}i.tween=o}}function bZ(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ns(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?xZ:yZ)(n,e,t))}function h0(e,t,n){var r=e._id;return e.each(function(){var o=Js(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Ns(o,r).value[t]}}function l3(e,t){var n;return(typeof t=="number"?Fs:t instanceof aa?Th:(n=aa(t))?(t=n,Th):t3)(e,t)}function vZ(e){return function(){this.removeAttribute(e)}}function wZ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function jZ(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 kZ(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 SZ(e,t,n){var r,o,i;return function(){var a,l=n(this),d;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),d=l+"",a===d?null:a===r&&d===o?i:(o=d,i=t(r=a,l)))}}function NZ(e,t,n){var r,o,i;return function(){var a,l=n(this),d;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),d=l+"",a===d?null:a===r&&d===o?i:(o=d,i=t(r=a,l)))}}function CZ(e,t){var n=Bm(e),r=n==="transform"?oZ:l3;return this.attrTween(e,typeof t=="function"?(n.local?NZ:SZ)(n,r,h0(this,"attr."+e,t)):t==null?(n.local?wZ:vZ)(n):(n.local?kZ:jZ)(n,r,t))}function EZ(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function TZ(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function RZ(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&TZ(e,i)),n}return o._value=t,o}function AZ(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&EZ(e,i)),n}return o._value=t,o}function PZ(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=Bm(e);return this.tween(n,(r.local?RZ:AZ)(r,t))}function _Z(e,t){return function(){p0(this,e).delay=+t.apply(this,arguments)}}function DZ(e,t){return t=+t,function(){p0(this,e).delay=t}}function $Z(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_Z:DZ)(t,e)):Ns(this.node(),t).delay}function IZ(e,t){return function(){Js(this,e).duration=+t.apply(this,arguments)}}function MZ(e,t){return t=+t,function(){Js(this,e).duration=t}}function LZ(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?IZ:MZ)(t,e)):Ns(this.node(),t).duration}function OZ(e,t){if(typeof t!="function")throw new Error;return function(){Js(this,e).ease=t}}function FZ(e){var t=this._id;return arguments.length?this.each(OZ(t,e)):Ns(this.node(),t).ease}function zZ(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Js(this,e).ease=n}}function BZ(e){if(typeof e!="function")throw new Error;return this.each(zZ(this._id,e))}function UZ(e){typeof e!="function"&&(e=O_(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]=[],d,f=0;f<a;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&l.push(d);return new jo(r,this._parents,this._name,this._id)}function HZ(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 d=t[l],f=n[l],p=d.length,h=a[l]=new Array(p),g,y=0;y<p;++y)(g=d[y]||f[y])&&(h[y]=g);for(;l<r;++l)a[l]=t[l];return new jo(a,this._parents,this._name,this._id)}function VZ(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 WZ(e,t,n){var r,o,i=VZ(t)?p0:Js;return function(){var a=i(this,e),l=a.on;l!==r&&(o=(r=l).copy()).on(t,n),a.on=o}}function qZ(e,t){var n=this._id;return arguments.length<2?Ns(this.node(),n).on.on(e):this.each(WZ(n,e,t))}function KZ(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function GZ(){return this.on("end.remove",KZ(this._id))}function YZ(e){var t=this._name,n=this._id;typeof e!="function"&&(e=c0(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var l=r[a],d=l.length,f=i[a]=new Array(d),p,h,g=0;g<d;++g)(p=l[g])&&(h=e.call(p,p.__data__,g,l))&&("__data__"in p&&(h.__data__=p.__data__),f[g]=h,Vm(f[g],t,n,g,f,Ns(p,n)));return new jo(i,this._parents,t,n)}function XZ(e){var t=this._name,n=this._id;typeof e!="function"&&(e=L_(e));for(var r=this._groups,o=r.length,i=[],a=[],l=0;l<o;++l)for(var d=r[l],f=d.length,p,h=0;h<f;++h)if(p=d[h]){for(var g=e.call(p,p.__data__,h,d),y,S=Ns(p,n),w=0,b=g.length;w<b;++w)(y=g[w])&&Vm(y,t,n,w,g,S);i.push(g),a.push(p)}return new jo(i,a,t,n)}var QZ=Hd.prototype.constructor;function JZ(){return new QZ(this._groups,this._parents)}function ZZ(e,t){var n,r,o;return function(){var i=Xl(this,e),a=(this.style.removeProperty(e),Xl(this,e));return i===a?null:i===n&&a===r?o:o=t(n=i,r=a)}}function c3(e){return function(){this.style.removeProperty(e)}}function eee(e,t,n){var r,o=n+"",i;return function(){var a=Xl(this,e);return a===o?null:a===r?i:i=t(r=a,n)}}function tee(e,t,n){var r,o,i;return function(){var a=Xl(this,e),l=n(this),d=l+"";return l==null&&(d=l=(this.style.removeProperty(e),Xl(this,e))),a===d?null:a===r&&d===o?i:(o=d,i=t(r=a,l))}}function nee(e,t){var n,r,o,i="style."+t,a="end."+i,l;return function(){var d=Js(this,e),f=d.on,p=d.value[i]==null?l||(l=c3(t)):void 0;(f!==n||o!==p)&&(r=(n=f).copy()).on(a,o=p),d.on=r}}function ree(e,t,n){var r=(e+="")=="transform"?sZ:l3;return t==null?this.styleTween(e,ZZ(e,r)).on("end.style."+e,c3(e)):typeof t=="function"?this.styleTween(e,tee(e,r,h0(this,"style."+e,t))).each(nee(this._id,e)):this.styleTween(e,eee(e,r,t),n).on("end.style."+e,null)}function see(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function oee(e,t,n){var r,o;function i(){var a=t.apply(this,arguments);return a!==o&&(r=(o=a)&&see(e,a,n)),r}return i._value=t,i}function iee(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,oee(e,t,n??""))}function aee(e){return function(){this.textContent=e}}function lee(e){return function(){var t=e(this);this.textContent=t??""}}function cee(e){return this.tween("text",typeof e=="function"?lee(h0(this,"text",e)):aee(e==null?"":e+""))}function uee(e){return function(t){this.textContent=e.call(this,t)}}function dee(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&uee(o)),t}return r._value=e,r}function fee(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,dee(e))}function pee(){for(var e=this._name,t=this._id,n=u3(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a=r[i],l=a.length,d,f=0;f<l;++f)if(d=a[f]){var p=Ns(d,t);Vm(d,e,n,f,a,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new jo(r,this._parents,e,n)}function hee(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,a){var l={value:a},d={value:function(){--o===0&&i()}};n.each(function(){var f=Js(this,r),p=f.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(d)),f.on=t}),o===0&&i()})}var mee=0;function jo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function u3(){return++mee}var po=Hd.prototype;jo.prototype={constructor:jo,select:YZ,selectAll:XZ,selectChild:po.selectChild,selectChildren:po.selectChildren,filter:UZ,merge:HZ,selection:JZ,transition:pee,call:po.call,nodes:po.nodes,node:po.node,size:po.size,empty:po.empty,each:po.each,on:qZ,attr:CZ,attrTween:PZ,style:ree,styleTween:iee,text:cee,textTween:fee,remove:GZ,tween:bZ,delay:$Z,duration:LZ,ease:FZ,easeVarying:BZ,end:hee,[Symbol.iterator]:po[Symbol.iterator]};function gee(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var xee={time:null,delay:0,duration:250,ease:gee};function yee(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 bee(e){var t,n;e instanceof jo?(t=e._id,e=e._name):(t=u3(),(n=xee).time=f0(),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,d,f=0;f<l;++f)(d=a[f])&&Vm(d,e,t,f,a,n||yee(d,t));return new jo(r,this._parents,e,t)}Hd.prototype.interrupt=gZ;Hd.prototype.transition=bee;const xp=e=>()=>e;function vee(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 yo(e,t,n){this.k=e,this.x=t,this.y=n}yo.prototype={constructor:yo,scale:function(e){return e===1?this:new yo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new yo(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 Wm=new yo(1,0,0);d3.prototype=yo.prototype;function d3(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Wm;return e.__zoom}function zy(e){e.stopImmediatePropagation()}function ku(e){e.preventDefault(),e.stopImmediatePropagation()}function wee(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function jee(){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 uC(){return this.__zoom||Wm}function kee(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function See(){return navigator.maxTouchPoints||"ontouchstart"in this}function Nee(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 f3(){var e=wee,t=jee,n=Nee,r=kee,o=See,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,d=Hp,f=zm("start","zoom","end"),p,h,g,y=500,S=150,w=0,b=10;function j(P){P.property("__zoom",uC).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",z).filter(o).on("touchstart.zoom",A).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}j.transform=function(P,O,B,H){var L=P.selection?P.selection():P;L.property("__zoom",uC),P!==L?I(P,O,B,H):L.interrupt().each(function(){T(this,arguments).event(H).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},j.scaleBy=function(P,O,B,H){j.scaleTo(P,function(){var L=this.__zoom.k,U=typeof O=="function"?O.apply(this,arguments):O;return L*U},B,H)},j.scaleTo=function(P,O,B,H){j.transform(P,function(){var L=t.apply(this,arguments),U=this.__zoom,M=B==null?C(L):typeof B=="function"?B.apply(this,arguments):B,V=U.invert(M),Y=typeof O=="function"?O.apply(this,arguments):O;return n(k(N(U,Y),M,V),L,a)},B,H)},j.translateBy=function(P,O,B,H){j.transform(P,function(){return n(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof B=="function"?B.apply(this,arguments):B),t.apply(this,arguments),a)},null,H)},j.translateTo=function(P,O,B,H,L){j.transform(P,function(){var U=t.apply(this,arguments),M=this.__zoom,V=H==null?C(U):typeof H=="function"?H.apply(this,arguments):H;return n(Wm.translate(V[0],V[1]).scale(M.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof B=="function"?-B.apply(this,arguments):-B),U,a)},H,L)};function N(P,O){return O=Math.max(i[0],Math.min(i[1],O)),O===P.k?P:new yo(O,P.x,P.y)}function k(P,O,B){var H=O[0]-B[0]*P.k,L=O[1]-B[1]*P.k;return H===P.x&&L===P.y?P:new yo(P.k,H,L)}function C(P){return[(+P[0][0]+ +P[1][0])/2,(+P[0][1]+ +P[1][1])/2]}function I(P,O,B,H){P.on("start.zoom",function(){T(this,arguments).event(H).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(H).end()}).tween("zoom",function(){var L=this,U=arguments,M=T(L,U).event(H),V=t.apply(L,U),Y=B==null?C(V):typeof B=="function"?B.apply(L,U):B,q=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),J=L.__zoom,ne=typeof O=="function"?O.apply(L,U):O,Q=d(J.invert(Y).concat(q/J.k),ne.invert(Y).concat(q/ne.k));return function(ce){if(ce===1)ce=ne;else{var te=Q(ce),pe=q/te[2];ce=new yo(pe,Y[0]-te[0]*pe,Y[1]-te[1]*pe)}M.zoom(null,ce)}})}function T(P,O,B){return!B&&P.__zooming||new R(P,O)}function R(P,O){this.that=P,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(P,O),this.taps=0}R.prototype={event:function(P){return P&&(this.sourceEvent=P),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(P,O){return this.mouse&&P!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&P!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&P!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(P){var O=$r(this.that).datum();f.call(P,this.that,new vee(P,{sourceEvent:this.sourceEvent,target:j,transform:this.that.__zoom,dispatch:f}),O)}};function D(P,...O){if(!e.apply(this,arguments))return;var B=T(this,O).event(P),H=this.__zoom,L=Math.max(i[0],Math.min(i[1],H.k*Math.pow(2,r.apply(this,arguments)))),U=us(P);if(B.wheel)(B.mouse[0][0]!==U[0]||B.mouse[0][1]!==U[1])&&(B.mouse[1]=H.invert(B.mouse[0]=U)),clearTimeout(B.wheel);else{if(H.k===L)return;B.mouse=[U,H.invert(U)],qp(this),B.start()}ku(P),B.wheel=setTimeout(M,S),B.zoom("mouse",n(k(N(H,L),B.mouse[0],B.mouse[1]),B.extent,a));function M(){B.wheel=null,B.end()}}function $(P,...O){if(g||!e.apply(this,arguments))return;var B=P.currentTarget,H=T(this,O,!0).event(P),L=$r(P.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",q,!0),U=us(P,B),M=P.clientX,V=P.clientY;G_(P.view),zy(P),H.mouse=[U,this.__zoom.invert(U)],qp(this),H.start();function Y(J){if(ku(J),!H.moved){var ne=J.clientX-M,Q=J.clientY-V;H.moved=ne*ne+Q*Q>w}H.event(J).zoom("mouse",n(k(H.that.__zoom,H.mouse[0]=us(J,B),H.mouse[1]),H.extent,a))}function q(J){L.on("mousemove.zoom mouseup.zoom",null),Y_(J.view,H.moved),ku(J),H.event(J).end()}}function z(P,...O){if(e.apply(this,arguments)){var B=this.__zoom,H=us(P.changedTouches?P.changedTouches[0]:P,this),L=B.invert(H),U=B.k*(P.shiftKey?.5:2),M=n(k(N(B,U),H,L),t.apply(this,O),a);ku(P),l>0?$r(this).transition().duration(l).call(I,M,H,P):$r(this).call(j.transform,M,H,P)}}function A(P,...O){if(e.apply(this,arguments)){var B=P.touches,H=B.length,L=T(this,O,P.changedTouches.length===H).event(P),U,M,V,Y;for(zy(P),M=0;M<H;++M)V=B[M],Y=us(V,this),Y=[Y,this.__zoom.invert(Y),V.identifier],L.touch0?!L.touch1&&L.touch0[2]!==Y[2]&&(L.touch1=Y,L.taps=0):(L.touch0=Y,U=!0,L.taps=1+!!p);p&&(p=clearTimeout(p)),U&&(L.taps<2&&(h=Y[0],p=setTimeout(function(){p=null},y)),qp(this),L.start())}}function F(P,...O){if(this.__zooming){var B=T(this,O).event(P),H=P.changedTouches,L=H.length,U,M,V,Y;for(ku(P),U=0;U<L;++U)M=H[U],V=us(M,this),B.touch0&&B.touch0[2]===M.identifier?B.touch0[0]=V:B.touch1&&B.touch1[2]===M.identifier&&(B.touch1[0]=V);if(M=B.that.__zoom,B.touch1){var q=B.touch0[0],J=B.touch0[1],ne=B.touch1[0],Q=B.touch1[1],ce=(ce=ne[0]-q[0])*ce+(ce=ne[1]-q[1])*ce,te=(te=Q[0]-J[0])*te+(te=Q[1]-J[1])*te;M=N(M,Math.sqrt(ce/te)),V=[(q[0]+ne[0])/2,(q[1]+ne[1])/2],Y=[(J[0]+Q[0])/2,(J[1]+Q[1])/2]}else if(B.touch0)V=B.touch0[0],Y=B.touch0[1];else return;B.zoom("touch",n(k(M,V,Y),B.extent,a))}}function W(P,...O){if(this.__zooming){var B=T(this,O).event(P),H=P.changedTouches,L=H.length,U,M;for(zy(P),g&&clearTimeout(g),g=setTimeout(function(){g=null},y),U=0;U<L;++U)M=H[U],B.touch0&&B.touch0[2]===M.identifier?delete B.touch0:B.touch1&&B.touch1[2]===M.identifier&&delete B.touch1;if(B.touch1&&!B.touch0&&(B.touch0=B.touch1,delete B.touch1),B.touch0)B.touch0[1]=this.__zoom.invert(B.touch0[0]);else if(B.end(),B.taps===2&&(M=us(M,this),Math.hypot(h[0]-M[0],h[1]-M[1])<b)){var V=$r(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return j.wheelDelta=function(P){return arguments.length?(r=typeof P=="function"?P:xp(+P),j):r},j.filter=function(P){return arguments.length?(e=typeof P=="function"?P:xp(!!P),j):e},j.touchable=function(P){return arguments.length?(o=typeof P=="function"?P:xp(!!P),j):o},j.extent=function(P){return arguments.length?(t=typeof P=="function"?P:xp([[+P[0][0],+P[0][1]],[+P[1][0],+P[1][1]]]),j):t},j.scaleExtent=function(P){return arguments.length?(i[0]=+P[0],i[1]=+P[1],j):[i[0],i[1]]},j.translateExtent=function(P){return arguments.length?(a[0][0]=+P[0][0],a[1][0]=+P[1][0],a[0][1]=+P[0][1],a[1][1]=+P[1][1],j):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},j.constrain=function(P){return arguments.length?(n=P,j):n},j.duration=function(P){return arguments.length?(l=+P,j):l},j.interpolate=function(P){return arguments.length?(d=P,j):d},j.on=function(){var P=f.on.apply(f,arguments);return P===f?j:P},j.clickDistance=function(P){return arguments.length?(w=(P=+P)*P,j):Math.sqrt(w)},j.tapDistance=function(P){return arguments.length?(b=+P,j):b},j}const vs={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.`},fd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],p3=["Enter"," ","Escape"],h3={"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 Jl;(function(e){e.Strict="strict",e.Loose="loose"})(Jl||(Jl={}));var ra;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ra||(ra={}));var pd;(function(e){e.Partial="partial",e.Full="full"})(pd||(pd={}));const m3={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ri;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ri||(ri={}));var hd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(hd||(hd={}));var rt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(rt||(rt={}));const dC={[rt.Left]:rt.Right,[rt.Right]:rt.Left,[rt.Top]:rt.Bottom,[rt.Bottom]:rt.Top};function g3(e){return e===null?null:e?"valid":"invalid"}const x3=e=>"id"in e&&"source"in e&&"target"in e,Cee=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),m0=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Wd=(e,t=[0,0])=>{const{width:n,height:r}=No(e),o=e.origin??t,i=n*o[0],a=r*o[1];return{x:e.position.x-i,y:e.position.y-a}},Eee=(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):m0(o)?o:t.nodeLookup.get(o.id));const l=a?_h(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return qm(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Km(n)},qd=(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=qm(n,_h(o)),r=!0)}),r?Km(n):{x:0,y:0,width:0,height:0}},g0=(e,t,[n,r,o]=[0,0,1],i=!1,a=!1)=>{const l={...Nc(t,[n,r,o]),width:t.width/o,height:t.height/o},d=[];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,S=p.height??f.height??f.initialHeight??null,w=md(l,ec(f)),b=(y??0)*(S??0),j=i&&w>0;(!f.internals.handleBounds||j||w>=b||f.dragging)&&d.push(f)}return d},Tee=(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 Ree(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 Aee({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},a){if(e.size===0)return!0;const l=Ree(e,a),d=qd(l),f=y0(d,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 y3({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:d,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",vs.error005());else{const y=l.measured.width,S=l.measured.height;y&&S&&(h=[[d,f],[d+y,f+S]])}else l&&ua(a.extent)&&(h=[[a.extent[0][0]+d,a.extent[0][1]+f],[a.extent[1][0]+d,a.extent[1][1]+f]]);const g=ua(h)?ca(t,h,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",vs.error015())),{position:{x:g.x-d+(a.measured.width??0)*p[0],y:g.y-f+(a.measured.height??0)*p[1]},positionAbsolute:g}}async function Pee({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),S=!y&&g.parentId&&a.find(w=>w.id===g.parentId);(y||S)&&a.push(g)}const l=new Set(t.map(g=>g.id)),d=r.filter(g=>g.deletable!==!1),p=Tee(a,d);for(const g of d)l.has(g.id)&&!p.find(S=>S.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 Zl=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ca=(e={x:0,y:0},t,n)=>({x:Zl(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Zl(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function b3(e,t,n){const{width:r,height:o}=No(n),{x:i,y:a}=n.internals.positionAbsolute;return ca(e,[[i,a],[i+r,a+o]],t)}const fC=(e,t,n)=>e<t?Zl(Math.abs(e-t),1,t)/t:e>n?-Zl(Math.abs(e-n),1,t)/t:0,x0=(e,t,n=15,r=40)=>{const o=fC(e.x,r,t.width-r)*n,i=fC(e.y,r,t.height-r)*n;return[o,i]},qm=(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)}),uv=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Km=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),ec=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=m0(e)?e.internals.positionAbsolute:Wd(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}},_h=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=m0(e)?e.internals.positionAbsolute:Wd(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)}},v3=(e,t)=>Km(qm(uv(e),uv(t))),md=(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)},pC=e=>fs(e.width)&&fs(e.height)&&fs(e.x)&&fs(e.y),fs=e=>!isNaN(e)&&isFinite(e),w3=(e,t)=>(n,r)=>{},Kd=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Nc=({x:e,y:t},[n,r,o],i=!1,a=[1,1])=>{const l={x:(e-n)/o,y:(t-r)/o};return i?Kd(l,a):l},tc=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function xl(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 _ee(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=xl(e,n),o=xl(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=xl(e.top??e.y??0,n),o=xl(e.bottom??e.y??0,n),i=xl(e.left??e.x??0,t),a=xl(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 Dee(e,t,n,r,o,i){const{x:a,y:l}=tc(e,[t,n,r]),{x:d,y:f}=tc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=o-d,h=i-f;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(h)}}const y0=(e,t,n,r,o,i)=>{const a=_ee(i,t,n),l=(t-a.x)/e.width,d=(n-a.y)/e.height,f=Math.min(l,d),p=Zl(f,r,o),h=e.x+e.width/2,g=e.y+e.height/2,y=t/2-h*p,S=n/2-g*p,w=Dee(e,y,S,p,t,n),b={left:Math.min(w.left-a.left,0),top:Math.min(w.top-a.top,0),right:Math.min(w.right-a.right,0),bottom:Math.min(w.bottom-a.bottom,0)};return{x:y-b.left+b.right,y:S-b.top+b.bottom,zoom:p}},gd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ua(e){return e!=null&&e!=="parent"}function No(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 j3(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 k3(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 hC(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function $ee(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Iee(e){return{...h3,...e||{}}}function Wu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:a}=ps(e),l=Nc({x:i-((o==null?void 0:o.left)??0),y:a-((o==null?void 0:o.top)??0)},r),{x:d,y:f}=n?Kd(l,t):l;return{xSnapped:d,ySnapped:f,...l}}const b0=e=>({width:e.offsetWidth,height:e.offsetHeight}),S3=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Mee=["INPUT","SELECT","TEXTAREA"];function N3(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:Mee.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const C3=e=>"clientX"in e,ps=(e,t)=>{var i,a;const n=C3(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)}},mC=(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,...b0(a)}})};function E3({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:a,targetControlY:l}){const d=e*.125+o*.375+a*.375+n*.125,f=t*.125+i*.375+l*.375+r*.125,p=Math.abs(d-e),h=Math.abs(f-t);return[d,f,p,h]}function yp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function gC({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case rt.Left:return[t-yp(t-r,i),n];case rt.Right:return[t+yp(r-t,i),n];case rt.Top:return[t,n-yp(n-o,i)];case rt.Bottom:return[t,n+yp(o-n,i)]}}function T3({sourceX:e,sourceY:t,sourcePosition:n=rt.Bottom,targetX:r,targetY:o,targetPosition:i=rt.Top,curvature:a=.25}){const[l,d]=gC({pos:n,x1:e,y1:t,x2:r,y2:o,c:a}),[f,p]=gC({pos:i,x1:r,y1:o,x2:e,y2:t,c:a}),[h,g,y,S]=E3({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:d,targetControlX:f,targetControlY:p});return[`M${e},${t} C${l},${d} ${f},${p} ${r},${o}`,h,g,y,S]}function R3({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 Lee({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 Oee({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=qm(_h(e),_h(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 md(a,Km(i))>0}const Fee=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,zee=(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)),Bee=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",vs.error006()),t;const r=n.getEdgeId||Fee;let o;return x3(e)?o={...e}:o={...e,id:r(e)},zee(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function A3({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,a,l]=R3({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,a,l]}const xC={[rt.Left]:{x:-1,y:0},[rt.Right]:{x:1,y:0},[rt.Top]:{x:0,y:-1},[rt.Bottom]:{x:0,y:1}},Uee=({source:e,sourcePosition:t=rt.Bottom,target:n})=>t===rt.Left||t===rt.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},yC=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Hee({source:e,sourcePosition:t=rt.Bottom,target:n,targetPosition:r=rt.Top,center:o,offset:i,stepPosition:a}){const l=xC[t],d=xC[r],f={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+d.x*i,y:n.y+d.y*i},h=Uee({source:f,sourcePosition:t,target:p}),g=h.x!==0?"x":"y",y=h[g];let S=[],w,b;const j={x:0,y:0},N={x:0,y:0},[,,k,C]=R3({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*d[g]===-1){g==="x"?(w=o.x??f.x+(p.x-f.x)*a,b=o.y??(f.y+p.y)/2):(w=o.x??(f.x+p.x)/2,b=o.y??f.y+(p.y-f.y)*a);const D=[{x:w,y:f.y},{x:w,y:p.y}],$=[{x:f.x,y:b},{x:p.x,y:b}];l[g]===y?S=g==="x"?D:$:S=g==="x"?$:D}else{const D=[{x:f.x,y:p.y}],$=[{x:p.x,y:f.y}];if(g==="x"?S=l.x===y?$:D:S=l.y===y?D:$,t===r){const P=Math.abs(e[g]-n[g]);if(P<=i){const O=Math.min(i-1,i-P);l[g]===y?j[g]=(f[g]>e[g]?-1:1)*O:N[g]=(p[g]>n[g]?-1:1)*O}}if(t!==r){const P=g==="x"?"y":"x",O=l[g]===d[P],B=f[P]>p[P],H=f[P]<p[P];(l[g]===1&&(!O&&B||O&&H)||l[g]!==1&&(!O&&H||O&&B))&&(S=g==="x"?D:$)}const z={x:f.x+j.x,y:f.y+j.y},A={x:p.x+N.x,y:p.y+N.y},F=Math.max(Math.abs(z.x-S[0].x),Math.abs(A.x-S[0].x)),W=Math.max(Math.abs(z.y-S[0].y),Math.abs(A.y-S[0].y));F>=W?(w=(z.x+A.x)/2,b=S[0].y):(w=S[0].x,b=(z.y+A.y)/2)}const I={x:f.x+j.x,y:f.y+j.y},T={x:p.x+N.x,y:p.y+N.y};return[[e,...I.x!==S[0].x||I.y!==S[0].y?[I]:[],...S,...T.x!==S[S.length-1].x||T.y!==S[S.length-1].y?[T]:[],n],w,b,k,C]}function Vee(e,t,n,r){const o=Math.min(yC(e,t)/2,yC(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,d=e.y<n.y?-1:1;return`L ${i},${a+o*d}Q ${i},${a} ${i+o*l},${a}`}function dv({sourceX:e,sourceY:t,sourcePosition:n=rt.Bottom,targetX:r,targetY:o,targetPosition:i=rt.Top,borderRadius:a=5,centerX:l,centerY:d,offset:f=20,stepPosition:p=.5}){const[h,g,y,S,w]=Hee({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:l,y:d},offset:f,stepPosition:p});let b=`M${h[0].x} ${h[0].y}`;for(let j=1;j<h.length-1;j++)b+=Vee(h[j-1],h[j],h[j+1],a);return b+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[b,g,y,S,w]}function bC(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Wee(e){var h;const{sourceNode:t,targetNode:n}=e;if(!bC(t)||!bC(n))return null;const r=t.internals.handleBounds||vC(t.handles),o=n.internals.handleBounds||vC(n.handles),i=wC((r==null?void 0:r.source)??[],e.sourceHandle),a=wC(e.connectionMode===Jl.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",vs.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||rt.Bottom,d=(a==null?void 0:a.position)||rt.Top,f=da(t,i,l),p=da(n,a,d);return{sourceX:f.x,sourceY:f.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:d}}function vC(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 da(e,t,n=rt.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??No(e);if(r)return{x:o+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case rt.Top:return{x:o+a/2,y:i};case rt.Right:return{x:o+a,y:i+l/2};case rt.Bottom:return{x:o+a/2,y:i+l};case rt.Left:return{x:o,y:i+l/2}}}function wC(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function fv(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function qee(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(d=>{if(d&&typeof d=="object"){const f=fv(d,t);i.has(f)||(a.push({id:f,color:d.color||n,...d}),i.add(f))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const P3=1e3,Kee=10,v0={nodeOrigin:[0,0],nodeExtent:fd,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Gee={...v0,checkEquality:!0};function w0(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Yee(e,t,n){const r=w0(v0,n);for(const o of e.values())if(o.parentId)k0(o,e,t,r);else{const i=Wd(o,r.nodeOrigin),a=ua(o.extent)?o.extent:r.nodeExtent,l=ca(i,a,No(o));o.internals.positionAbsolute=l}}function Xee(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 j0(e){return e==="manual"}function pv(e,t,n,r={}){var p,h;const o=w0(Gee,r),i={i:0},a=new Map(t),l=o!=null&&o.elevateNodesOnSelect&&!j0(o.zIndexMode)?P3:0;let d=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 S=Wd(g,o.nodeOrigin),w=ua(g.extent)?g.extent:o.nodeExtent,b=ca(S,w,No(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:Xee(g,y),z:_3(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&&(d=!1),g.parentId&&k0(y,t,n,r,i),f||(f=g.selected??!1)}return{nodesInitialized:d,hasSelectedNodes:f}}function Qee(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 k0(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:d}=w0(v0,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}Qee(e,n),o&&!p.parentId&&p.internals.rootParentIndex===void 0&&d==="auto"&&(p.internals.rootParentIndex=++o.i,p.internals.z=p.internals.z+o.i*Kee),o&&p.internals.rootParentIndex!==void 0&&(o.i=p.internals.rootParentIndex);const h=i&&!j0(d)?P3:0,{x:g,y,z:S}=Jee(e,p,a,l,h,d),{positionAbsolute:w}=e.internals,b=g!==w.x||y!==w.y;(b||S!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:g,y}:w,z:S}})}function _3(e,t,n){const r=fs(e.zIndex)?e.zIndex:0;return j0(n)?r:r+(e.selected?t:0)}function Jee(e,t,n,r,o,i){const{x:a,y:l}=t.internals.positionAbsolute,d=No(e),f=Wd(e,n),p=ua(e.extent)?ca(f,e.extent,d):f;let h=ca({x:a+p.x,y:l+p.y},r,d);e.extent==="parent"&&(h=b3(h,d,t));const g=_3(e,o,i),y=t.internals.z??0;return{x:h.x,y:h.y,z:y>=g?y+1:g}}function S0(e,t,n,r=[0,0]){var a;const o=[],i=new Map;for(const l of e){const d=t.get(l.parentId);if(!d)continue;const f=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??ec(d),p=v3(f,l.rect);i.set(l.parentId,{expandedRect:p,parent:d})}return i.size>0&&i.forEach(({expandedRect:l,parent:d},f)=>{var k;const p=d.internals.positionAbsolute,h=No(d),g=d.origin??r,y=l.x<p.x?Math.round(Math.abs(p.x-l.x)):0,S=l.y<p.y?Math.round(Math.abs(p.y-l.y)):0,w=Math.max(h.width,Math.round(l.width)),b=Math.max(h.height,Math.round(l.height)),j=(w-h.width)*g[0],N=(b-h.height)*g[1];(y>0||S>0||j||N)&&(o.push({id:f,type:"position",position:{x:d.position.x-y+j,y:d.position.y-S+N}}),(k=n.get(f))==null||k.forEach(C=>{e.some(I=>I.id===C.id)||o.push({id:C.id,type:"position",position:{x:C.position.x+y,y:C.position.y+S}})})),(h.width<l.width||h.height<l.height||y||S)&&o.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:w+(y?g[0]*y-j:0),height:b+(S?g[1]*S-N:0)}})}),o}function Zee(e,t,n,r,o,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let d=!1;if(!l)return{changes:[],updatedInternals:d};const f=[],p=window.getComputedStyle(l),{m22:h}=new window.DOMMatrixReadOnly(p.transform),g=[];for(const y of e.values()){const S=t.get(y.id);if(!S)continue;if(S.hidden){t.set(S.id,{...S,internals:{...S.internals,handleBounds:void 0}}),d=!0;continue}const w=b0(y.nodeElement),b=S.measured.width!==w.width||S.measured.height!==w.height;if(!!(w.width&&w.height&&(b||!S.internals.handleBounds||y.force))){const N=y.nodeElement.getBoundingClientRect(),k=ua(S.extent)?S.extent:i;let{positionAbsolute:C}=S.internals;S.parentId&&S.extent==="parent"?C=b3(C,w,t.get(S.parentId)):k&&(C=ca(C,k,w));const I={...S,measured:w,internals:{...S.internals,positionAbsolute:C,handleBounds:{source:mC("source",y.nodeElement,N,h,S.id),target:mC("target",y.nodeElement,N,h,S.id)}}};t.set(S.id,I),S.parentId&&k0(I,t,n,{nodeOrigin:o,zIndexMode:a}),d=!0,b&&(f.push({id:S.id,type:"dimensions",dimensions:w}),S.expandParent&&S.parentId&&g.push({id:S.id,parentId:S.parentId,rect:ec(I,o)}))}}if(g.length>0){const y=S0(g,t,n,o);f.push(...y)}return{changes:f,updatedInternals:d}}async function ete({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 jC(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 d=r.get(a)||new Map;if(r.set(a,d.set(n,t)),i){a=`${o}-${e}-${i}`;const f=r.get(a)||new Map;r.set(a,f.set(n,t))}}function D3(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:a=null,targetHandle:l=null}=r,d={edgeId:r.id,source:o,target:i,sourceHandle:a,targetHandle:l},f=`${o}-${a}--${i}-${l}`,p=`${i}-${l}--${o}-${a}`;jC("source",d,p,e,o,a),jC("target",d,f,e,i,l),t.set(r.id,r)}}function $3(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:$3(n,t):!1}function kC(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 tte(e,t,n,r){const o=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!$3(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 By({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,d;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:((d=t.get(e))==null?void 0:d.position)||i.position,dragging:r}:o[0],o]}function nte({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=Kd(i,t);return{x:a.x-i.x,y:a.y-i.y}}function rte({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},a=0,l=new Map,d=!1,f={x:0,y:0},p=null,h=!1,g=null,y=!1,S=!1,w=null;function b({noDragClassName:N,handleSelector:k,domNode:C,isSelectable:I,nodeId:T,nodeClickDistance:R=0}){g=$r(C);function D({x:F,y:W}){const{nodeLookup:P,nodeExtent:O,snapGrid:B,snapToGrid:H,nodeOrigin:L,onNodeDrag:U,onSelectionDrag:M,onError:V,updateNodePositions:Y}=t();i={x:F,y:W};let q=!1;const J=l.size>1,ne=J&&O?uv(qd(l)):null,Q=J&&H?nte({dragItems:l,snapGrid:B,x:F,y:W}):null;for(const[ce,te]of l){if(!P.has(ce))continue;let pe={x:F-te.distance.x,y:W-te.distance.y};H&&(pe=Q?{x:Math.round(pe.x+Q.x),y:Math.round(pe.y+Q.y)}:Kd(pe,B));let be=null;if(J&&O&&!te.extent&&ne){const{positionAbsolute:Se}=te.internals,Be=Se.x-ne.x+O[0][0],oe=Se.x+te.measured.width-ne.x2+O[1][0],je=Se.y-ne.y+O[0][1],ke=Se.y+te.measured.height-ne.y2+O[1][1];be=[[Be,je],[oe,ke]]}const{position:Ee,positionAbsolute:Te}=y3({nodeId:ce,nextPosition:pe,nodeLookup:P,nodeExtent:be||O,nodeOrigin:L,onError:V});q=q||te.position.x!==Ee.x||te.position.y!==Ee.y,te.position=Ee,te.internals.positionAbsolute=Te}if(S=S||q,!!q&&(Y(l,!0),w&&(r||U||!T&&M))){const[ce,te]=By({nodeId:T,dragItems:l,nodeLookup:P});r==null||r(w,l,ce,te),U==null||U(w,ce,te),T||M==null||M(w,te)}}async function $(){if(!p)return;const{transform:F,panBy:W,autoPanSpeed:P,autoPanOnNodeDrag:O}=t();if(!O){d=!1,cancelAnimationFrame(a);return}const[B,H]=x0(f,p,P);(B!==0||H!==0)&&(i.x=(i.x??0)-B/F[2],i.y=(i.y??0)-H/F[2],await W({x:B,y:H})&&D(i)),a=requestAnimationFrame($)}function z(F){var J;const{nodeLookup:W,multiSelectionActive:P,nodesDraggable:O,transform:B,snapGrid:H,snapToGrid:L,selectNodesOnDrag:U,onNodeDragStart:M,onSelectionDragStart:V,unselectNodesAndEdges:Y}=t();h=!0,(!U||!I)&&!P&&T&&((J=W.get(T))!=null&&J.selected||Y()),I&&U&&T&&(e==null||e(T));const q=Wu(F.sourceEvent,{transform:B,snapGrid:H,snapToGrid:L,containerBounds:p});if(i=q,l=tte(W,O,q,T),l.size>0&&(n||M||!T&&V)){const[ne,Q]=By({nodeId:T,dragItems:l,nodeLookup:W});n==null||n(F.sourceEvent,l,ne,Q),M==null||M(F.sourceEvent,ne,Q),T||V==null||V(F.sourceEvent,Q)}}const A=X_().clickDistance(R).on("start",F=>{const{domNode:W,nodeDragThreshold:P,transform:O,snapGrid:B,snapToGrid:H}=t();p=(W==null?void 0:W.getBoundingClientRect())||null,y=!1,S=!1,w=F.sourceEvent,P===0&&z(F),i=Wu(F.sourceEvent,{transform:O,snapGrid:B,snapToGrid:H,containerBounds:p}),f=ps(F.sourceEvent,p)}).on("drag",F=>{const{autoPanOnNodeDrag:W,transform:P,snapGrid:O,snapToGrid:B,nodeDragThreshold:H,nodeLookup:L}=t(),U=Wu(F.sourceEvent,{transform:P,snapGrid:O,snapToGrid:B,containerBounds:p});if(w=F.sourceEvent,(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1||T&&!L.has(T))&&(y=!0),!y){if(!d&&W&&h&&(d=!0,$()),!h){const M=ps(F.sourceEvent,p),V=M.x-f.x,Y=M.y-f.y;Math.sqrt(V*V+Y*Y)>H&&z(F)}(i.x!==U.xSnapped||i.y!==U.ySnapped)&&l&&h&&(f=ps(F.sourceEvent,p),D(U))}}).on("end",F=>{if(!h||y){y&&l.size>0&&t().updateNodePositions(l,!1);return}if(d=!1,h=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:W,updateNodePositions:P,onNodeDragStop:O,onSelectionDragStop:B}=t();if(S&&(P(l,!1),S=!1),o||O||!T&&B){const[H,L]=By({nodeId:T,dragItems:l,nodeLookup:W,dragging:!1});o==null||o(F.sourceEvent,l,H,L),O==null||O(F.sourceEvent,H,L),T||B==null||B(F.sourceEvent,L)}}}).filter(F=>{const W=F.target;return!F.button&&(!N||!kC(W,`.${N}`,C))&&(!k||kC(W,k,C))});g.call(A)}function j(){g==null||g.on(".drag",null)}return{update:b,destroy:j}}function ste(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())md(o,ec(i))>0&&r.push(i);return r}const ote=250;function ite(e,t,n,r){var l,d;let o=[],i=1/0;const a=ste(e,n,t+ote);for(const f of a){const p=[...((l=f.internals.handleBounds)==null?void 0:l.source)??[],...((d=f.internals.handleBounds)==null?void 0:d.target)??[]];for(const h of p){if(r.nodeId===h.nodeId&&r.type===h.type&&r.id===h.id)continue;const{x:g,y}=da(f,h,h.position,!0),S=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(y-e.y,2));S>t||(S<i?(o=[{...h,x:g,y}],i=S):S===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 I3(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)??[]],d=(n?l==null?void 0:l.find(g=>g.id===n):l==null?void 0:l[0])??null;return d&&i?{...d,...da(a,d,d.position,!0)}:d}function M3(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function ate(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const L3=()=>!0;function lte(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:d,lib:f,autoPanOnConnect:p,flowId:h,panBy:g,cancelConnection:y,onConnectStart:S,onConnect:w,onConnectEnd:b,isValidConnection:j=L3,onReconnectEnd:N,updateConnection:k,getTransform:C,getFromHandle:I,autoPanSpeed:T,dragThreshold:R=1,handleDomNode:D}){const $=S3(e.target);let z=0,A;const{x:F,y:W}=ps(e),P=M3(i,D),O=l==null?void 0:l.getBoundingClientRect();let B=!1;if(!O||!P)return;const H=I3(o,P,r,d,t);if(!H)return;let L=ps(e,O),U=!1,M=null,V=!1,Y=null;function q(){if(!p||!O)return;const[Ee,Te]=x0(L,O,T);g({x:Ee,y:Te}),z=requestAnimationFrame(q)}const J={...H,nodeId:o,type:P,position:H.position},ne=d.get(o);let ce={inProgress:!0,isValid:null,from:da(ne,J,rt.Left,!0),fromHandle:J,fromPosition:J.position,fromNode:ne,to:L,toHandle:null,toPosition:dC[J.position],toNode:null,pointer:L};function te(){B=!0,k(ce),S==null||S(e,{nodeId:o,handleId:r,handleType:P})}R===0&&te();function pe(Ee){if(!B){const{x:ke,y:_e}=ps(Ee),Ue=ke-F,et=_e-W;if(!(Ue*Ue+et*et>R*R))return;te()}if(!I()||!J){be(Ee);return}const Te=C();L=ps(Ee,O),A=ite(Nc(L,Te,!1,[1,1]),n,d,J),U||(q(),U=!0);const Se=O3(Ee,{handle:A,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:a?"target":"source",isValidConnection:j,doc:$,lib:f,flowId:h,nodeLookup:d});Y=Se.handleDomNode,M=Se.connection,V=ate(!!A,Se.isValid);const Be=d.get(o),oe=Be?da(Be,J,rt.Left,!0):ce.from,je={...ce,from:oe,isValid:V,to:Se.toHandle&&V?tc({x:Se.toHandle.x,y:Se.toHandle.y},Te):L,toHandle:Se.toHandle,toPosition:V&&Se.toHandle?Se.toHandle.position:dC[J.position],toNode:Se.toHandle?d.get(Se.toHandle.nodeId):null,pointer:L};k(je),ce=je}function be(Ee){if(!("touches"in Ee&&Ee.touches.length>0)){if(B){(A||Y)&&M&&V&&(w==null||w(M));const{inProgress:Te,...Se}=ce,Be={...Se,toPosition:ce.toHandle?ce.toPosition:null};b==null||b(Ee,Be),i&&(N==null||N(Ee,Be))}y(),cancelAnimationFrame(z),U=!1,V=!1,M=null,Y=null,$.removeEventListener("mousemove",pe),$.removeEventListener("mouseup",be),$.removeEventListener("touchmove",pe),$.removeEventListener("touchend",be)}}$.addEventListener("mousemove",pe),$.addEventListener("mouseup",be),$.addEventListener("touchmove",pe),$.addEventListener("touchend",be)}function O3(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:a,lib:l,flowId:d,isValidConnection:f=L3,nodeLookup:p}){const h=i==="target",g=t?a.querySelector(`.${l}-flow__handle[data-id="${d}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:S}=ps(e),w=a.elementFromPoint(y,S),b=w!=null&&w.classList.contains(`${l}-flow__handle`)?w:g,j={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const N=M3(void 0,b),k=b.getAttribute("data-nodeid"),C=b.getAttribute("data-handleid"),I=b.classList.contains("connectable"),T=b.classList.contains("connectableend");if(!k||!N)return j;const R={source:h?k:r,sourceHandle:h?C:o,target:h?r:k,targetHandle:h?o:C};j.connection=R;const $=I&&T&&(n===Jl.Strict?h&&N==="source"||!h&&N==="target":k!==r||C!==o);j.isValid=$&&f(R),j.toHandle=I3(k,N,C,p,n,!0)}return j}const hv={onPointerDown:lte,isValid:O3};function cte({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=$r(e);function i({translateExtent:l,width:d,height:f,zoomStep:p=1,pannable:h=!0,zoomable:g=!0,inversePan:y=!1}){const S=k=>{if(k.sourceEvent.type!=="wheel"||!t)return;const C=n(),I=k.sourceEvent.ctrlKey&&gd()?10:1,T=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*p,R=C[2]*Math.pow(2,T*I);t.scaleTo(R)};let w=[0,0];const b=k=>{(k.sourceEvent.type==="mousedown"||k.sourceEvent.type==="touchstart")&&(w=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY])},j=k=>{const C=n();if(k.sourceEvent.type!=="mousemove"&&k.sourceEvent.type!=="touchmove"||!t)return;const I=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],T=[I[0]-w[0],I[1]-w[1]];w=I;const R=r()*Math.max(C[2],Math.log(C[2]))*(y?-1:1),D={x:C[0]-T[0]*R,y:C[1]-T[1]*R},$=[[0,0],[d,f]];t.setViewportConstrained({x:D.x,y:D.y,zoom:C[2]},$,l)},N=f3().on("start",b).on("zoom",h?j:null).on("zoom.wheel",g?S:null);o.call(N,{})}function a(){o.on("zoom",null)}return{update:i,destroy:a,pointer:us}}const Gm=e=>({x:e.x,y:e.y,zoom:e.k}),Uy=({x:e,y:t,zoom:n})=>Wm.translate(e,t).scale(n),Sl=(e,t)=>e.target.closest(`.${t}`),F3=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ute=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Hy=(e,t=0,n=ute,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},z3=e=>{const t=e.ctrlKey&&gd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function dte({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:d,onPanZoomEnd:f}){return p=>{if(Sl(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=us(p),j=z3(p),N=h*Math.pow(2,j);r.scaleTo(n,N,b,p);return}const g=p.deltaMode===1?20:1;let y=o===ra.Vertical?0:p.deltaX*g,S=o===ra.Horizontal?0:p.deltaY*g;!gd()&&p.shiftKey&&o!==ra.Vertical&&(y=p.deltaY*g,S=0),r.translateBy(n,-(y/h)*i,-(S/h)*i,{internal:!0});const w=Gm(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(p,w),e.panScrollTimeout=setTimeout(()=>{f==null||f(p,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,w))}}function fte({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=Sl(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,o)}}function pte({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const o=Gm(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 hte({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&F3(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,Gm(i.transform)))}}function mte({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&&F3(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const d=Gm(a.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(a.sourceEvent,d)},n?150:0)}}}function gte({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:d,lib:f,connectionInProgress:p}){return h=>{var b;const g=e||t,y=n&&h.ctrlKey,S=h.type==="wheel";if(h.button===1&&h.type==="mousedown"&&(Sl(h,`${f}-flow__node`)||Sl(h,`${f}-flow__edge`)))return!0;if(!r&&!g&&!o&&!i&&!n||a||p&&!S||Sl(h,l)&&S||Sl(h,d)&&(!S||o&&S&&!e)||!n&&h.ctrlKey&&S)return!1;if(!n&&h.type==="touchstart"&&((b=h.touches)==null?void 0:b.length)>1)return h.preventDefault(),!1;if(!g&&!o&&!y&&S||!r&&(h.type==="mousedown"||h.type==="touchstart")||Array.isArray(r)&&!r.includes(h.button)&&h.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||S)&&w}}function xte({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:d}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),h=f3().scaleExtent([t,n]).translateExtent(r),g=$r(e).call(h);N({x:o.x,y:o.y,zoom:Zl(o.zoom,t,n)},[[0,0],[p.width,p.height]],r);const y=g.on("wheel.zoom"),S=g.on("dblclick.zoom");h.wheelDelta(z3);async function w(A,F){return g?new Promise(W=>{h==null||h.interpolate((F==null?void 0:F.interpolate)==="linear"?Vu:Hp).transform(Hy(g,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>W(!0)),A)}):!1}function b({noWheelClassName:A,noPanClassName:F,onPaneContextMenu:W,userSelectionActive:P,panOnScroll:O,panOnDrag:B,panOnScrollMode:H,panOnScrollSpeed:L,preventScrolling:U,zoomOnPinch:M,zoomOnScroll:V,zoomOnDoubleClick:Y,zoomActivationKeyPressed:q,lib:J,onTransformChange:ne,connectionInProgress:Q,paneClickDistance:ce,selectionOnDrag:te}){P&&!f.isZoomingOrPanning&&j();const pe=O&&!q&&!P;h.clickDistance(te?1/0:!fs(ce)||ce<0?0:ce);const be=pe?dte({zoomPanValues:f,noWheelClassName:A,d3Selection:g,d3Zoom:h,panOnScrollMode:H,panOnScrollSpeed:L,zoomOnPinch:M,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):fte({noWheelClassName:A,preventScrolling:U,d3ZoomHandler:y});g.on("wheel.zoom",be,{passive:!1});const Ee=pte({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:a});h.on("start",Ee);const Te=hte({zoomPanValues:f,panOnDrag:B,onPaneContextMenu:!!W,onPanZoom:i,onTransformChange:ne});h.on("zoom",Te);const Se=mte({zoomPanValues:f,panOnDrag:B,panOnScroll:O,onPaneContextMenu:W,onPanZoomEnd:l,onDraggingChange:d});h.on("end",Se);const Be=gte({zoomActivationKeyPressed:q,panOnDrag:B,zoomOnScroll:V,panOnScroll:O,zoomOnDoubleClick:Y,zoomOnPinch:M,userSelectionActive:P,noPanClassName:F,noWheelClassName:A,lib:J,connectionInProgress:Q});h.filter(Be),Y?g.on("dblclick.zoom",S):g.on("dblclick.zoom",null)}function j(){h.on("zoom",null)}async function N(A,F,W){const P=Uy(A),O=h==null?void 0:h.constrain()(P,F,W);return O&&await w(O),O}async function k(A,F){const W=Uy(A);return await w(W,F),W}function C(A){if(g){const F=Uy(A),W=g.property("__zoom");(W.k!==A.zoom||W.x!==A.x||W.y!==A.y)&&(h==null||h.transform(g,F,null,{sync:!0}))}}function I(){const A=g?d3(g.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}async function T(A,F){return g?new Promise(W=>{h==null||h.interpolate((F==null?void 0:F.interpolate)==="linear"?Vu:Hp).scaleTo(Hy(g,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>W(!0)),A)}):!1}async function R(A,F){return g?new Promise(W=>{h==null||h.interpolate((F==null?void 0:F.interpolate)==="linear"?Vu:Hp).scaleBy(Hy(g,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>W(!0)),A)}):!1}function D(A){h==null||h.scaleExtent(A)}function $(A){h==null||h.translateExtent(A)}function z(A){const F=!fs(A)||A<0?0:A;h==null||h.clickDistance(F)}return{update:b,destroy:j,setViewport:k,setViewportConstrained:N,getViewport:I,scaleTo:T,scaleBy:R,setScaleExtent:D,setTranslateExtent:$,syncViewport:C,setClickDistance:z}}var nc;(function(e){e.Line="line",e.Handle="handle"})(nc||(nc={}));function yte({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const a=e-t,l=n-r,d=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&o&&(d[0]=d[0]*-1),l&&i&&(d[1]=d[1]*-1),d}function SC(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 Zo(e,t){return Math.max(0,t-e)}function ei(e,t){return Math.max(0,e-t)}function bp(e,t,n){return Math.max(0,t-e,e-n)}function NC(e,t){return e?!t:t}function bte(e,t,n,r,o,i,a,l){let{affectsX:d,affectsY:f}=t;const{isHorizontal:p,isVertical:h}=t,g=p&&h,{xSnapped:y,ySnapped:S}=n,{minWidth:w,maxWidth:b,minHeight:j,maxHeight:N}=r,{x:k,y:C,width:I,height:T,aspectRatio:R}=e;let D=Math.floor(p?y-e.pointerX:0),$=Math.floor(h?S-e.pointerY:0);const z=I+(d?-D:D),A=T+(f?-$:$),F=-i[0]*I,W=-i[1]*T;let P=bp(z,w,b),O=bp(A,j,N);if(a){let L=0,U=0;d&&D<0?L=Zo(k+D+F,a[0][0]):!d&&D>0&&(L=ei(k+z+F,a[1][0])),f&&$<0?U=Zo(C+$+W,a[0][1]):!f&&$>0&&(U=ei(C+A+W,a[1][1])),P=Math.max(P,L),O=Math.max(O,U)}if(l){let L=0,U=0;d&&D>0?L=ei(k+D,l[0][0]):!d&&D<0&&(L=Zo(k+z,l[1][0])),f&&$>0?U=ei(C+$,l[0][1]):!f&&$<0&&(U=Zo(C+A,l[1][1])),P=Math.max(P,L),O=Math.max(O,U)}if(o){if(p){const L=bp(z/R,j,N)*R;if(P=Math.max(P,L),a){let U=0;!d&&!f||d&&!f&&g?U=ei(C+W+z/R,a[1][1])*R:U=Zo(C+W+(d?D:-D)/R,a[0][1])*R,P=Math.max(P,U)}if(l){let U=0;!d&&!f||d&&!f&&g?U=Zo(C+z/R,l[1][1])*R:U=ei(C+(d?D:-D)/R,l[0][1])*R,P=Math.max(P,U)}}if(h){const L=bp(A*R,w,b)/R;if(O=Math.max(O,L),a){let U=0;!d&&!f||f&&!d&&g?U=ei(k+A*R+F,a[1][0])/R:U=Zo(k+(f?$:-$)*R+F,a[0][0])/R,O=Math.max(O,U)}if(l){let U=0;!d&&!f||f&&!d&&g?U=Zo(k+A*R,l[1][0])/R:U=ei(k+(f?$:-$)*R,l[0][0])/R,O=Math.max(O,U)}}}$=$+($<0?O:-O),D=D+(D<0?P:-P),o&&(g?z>A*R?$=(NC(d,f)?-D:D)/R:D=(NC(d,f)?-$:$)*R:p?($=D/R,f=d):(D=$*R,d=f));const B=d?k+D:k,H=f?C+$:C;return{width:I+(d?-D:D),height:T+(f?-$:$),x:i[0]*D*(d?-1:1)+B,y:i[1]*$*(f?-1:1)+H}}const B3={width:0,height:0,x:0,y:0},vte={...B3,pointerX:0,pointerY:0,aspectRatio:1};function wte(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,d=n[1]*a;return[[r-l,o-d],[r+i-l,o+a-d]]}function jte({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=$r(e);let a={controlDirection:SC("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:S,onResizeEnd:w,shouldResize:b}){let j={...B3},N={...vte};a={boundaries:p,resizeDirection:g,keepAspectRatio:h,controlDirection:SC(f)};let k,C=null,I=[],T,R,D,$=!1;const z=X_().on("start",A=>{const{nodeLookup:F,transform:W,snapGrid:P,snapToGrid:O,nodeOrigin:B,paneDomNode:H}=n();if(k=F.get(t),!k)return;C=(H==null?void 0:H.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:U}=Wu(A.sourceEvent,{transform:W,snapGrid:P,snapToGrid:O,containerBounds:C});j={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},N={...j,pointerX:L,pointerY:U,aspectRatio:j.width/j.height},T=void 0,R=ua(k.extent)?k.extent:void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&(T=F.get(k.parentId)),T&&k.extent==="parent"&&(R=[[0,0],[T.measured.width,T.measured.height]]),I=[],D=void 0;for(const[M,V]of F)if(V.parentId===t&&(I.push({id:M,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const Y=wte(V,k,V.origin??B);D?D=[[Math.min(Y[0][0],D[0][0]),Math.min(Y[0][1],D[0][1])],[Math.max(Y[1][0],D[1][0]),Math.max(Y[1][1],D[1][1])]]:D=Y}y==null||y(A,{...j})}).on("drag",A=>{const{transform:F,snapGrid:W,snapToGrid:P,nodeOrigin:O}=n(),B=Wu(A.sourceEvent,{transform:F,snapGrid:W,snapToGrid:P,containerBounds:C}),H=[];if(!k)return;const{x:L,y:U,width:M,height:V}=j,Y={},q=k.origin??O,{width:J,height:ne,x:Q,y:ce}=bte(N,a.controlDirection,B,a.boundaries,a.keepAspectRatio,q,R,D),te=J!==M,pe=ne!==V,be=Q!==L&&te,Ee=ce!==U&&pe;if(!be&&!Ee&&!te&&!pe)return;if((be||Ee||q[0]===1||q[1]===1)&&(Y.x=be?Q:j.x,Y.y=Ee?ce:j.y,j.x=Y.x,j.y=Y.y,I.length>0)){const oe=Q-L,je=ce-U;for(const ke of I)ke.position={x:ke.position.x-oe+q[0]*(J-M),y:ke.position.y-je+q[1]*(ne-V)},H.push(ke)}if((te||pe)&&(Y.width=te&&(!a.resizeDirection||a.resizeDirection==="horizontal")?J:j.width,Y.height=pe&&(!a.resizeDirection||a.resizeDirection==="vertical")?ne:j.height,j.width=Y.width,j.height=Y.height),T&&k.expandParent){const oe=q[0]*(Y.width??0);Y.x&&Y.x<oe&&(j.x=oe,N.x=N.x-(Y.x-oe));const je=q[1]*(Y.height??0);Y.y&&Y.y<je&&(j.y=je,N.y=N.y-(Y.y-je))}const Te=yte({width:j.width,prevWidth:M,height:j.height,prevHeight:V,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),Se={...j,direction:Te};(b==null?void 0:b(A,Se))!==!1&&($=!0,S==null||S(A,Se),r(Y,H))}).on("end",A=>{$&&(w==null||w(A,{...j}),o==null||o({...j}),$=!1)});i.call(z)}function d(){i.on(".drag",null)}return{update:l,destroy:d}}var Vy={exports:{}},Wy={},qy={exports:{}},Ky={};/**
|
|
618
|
+
* @license React
|
|
619
|
+
* use-sync-external-store-shim.production.js
|
|
620
|
+
*
|
|
621
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
622
|
+
*
|
|
623
|
+
* This source code is licensed under the MIT license found in the
|
|
624
|
+
* LICENSE file in the root directory of this source tree.
|
|
625
|
+
*/var CC;function kte(){if(CC)return Ky;CC=1;var e=vd();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(),S=r({inst:{value:y,getSnapshot:g}}),w=S[0].inst,b=S[1];return i(function(){w.value=y,w.getSnapshot=g,d(w)&&b({inst:w})},[h,y,g]),o(function(){return d(w)&&b({inst:w}),h(function(){d(w)&&b({inst:w})})},[h]),a(y),y}function d(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 Ky.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Ky}var EC;function Ste(){return EC||(EC=1,qy.exports=kte()),qy.exports}/**
|
|
626
|
+
* @license React
|
|
627
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
628
|
+
*
|
|
629
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
630
|
+
*
|
|
631
|
+
* This source code is licensed under the MIT license found in the
|
|
632
|
+
* LICENSE file in the root directory of this source tree.
|
|
633
|
+
*/var TC;function Nte(){if(TC)return Wy;TC=1;var e=vd(),t=Ste();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,d=e.useDebugValue;return Wy.useSyncExternalStoreWithSelector=function(f,p,h,g,y){var S=i(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=l(function(){function j(T){if(!N){if(N=!0,k=T,T=g(T),y!==void 0&&w.hasValue){var R=w.value;if(y(R,T))return C=R}return C=T}if(R=C,r(k,T))return R;var D=g(T);return y!==void 0&&y(R,D)?(k=T,R):(k=T,C=D)}var N=!1,k,C,I=h===void 0?null:h;return[function(){return j(p())},I===null?void 0:function(){return j(I())}]},[p,h,g,y]);var b=o(f,S[0],S[1]);return a(function(){w.hasValue=!0,w.value=b},[b]),d(b),b},Wy}var RC;function Cte(){return RC||(RC=1,Vy.exports=Nte()),Vy.exports}var Ete=Cte();const Tte=bd(Ete),Rte={},AC=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(S=>S(t,y))}},o=()=>t,d={setState:r,getState:o,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Rte?"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,d);return d},Ate=e=>e?AC(e):AC,{useDebugValue:Pte}=$t,{useSyncExternalStoreWithSelector:_te}=Tte,Dte=e=>e;function U3(e,t=Dte,n){const r=_te(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Pte(r),r}const PC=(e,t)=>{const n=Ate(e),r=(o,i=t)=>U3(n,o,i);return Object.assign(r,n),r},$te=(e,t)=>e?PC(e,t):PC;function sn(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 Ym=m.createContext(null),Ite=Ym.Provider,H3=vs.error001("react");function Et(e,t){const n=m.useContext(Ym);if(n===null)throw new Error(H3);return U3(n,e,t)}function on(){const e=m.useContext(Ym);if(e===null)throw new Error(H3);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const _C={display:"none"},Mte={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},V3="react-flow__node-desc",W3="react-flow__edge-desc",Lte="react-flow__aria-live",Ote=e=>e.ariaLiveMessage,Fte=e=>e.ariaLabelConfig;function zte({rfId:e}){const t=Et(Ote);return s.jsx("div",{id:`${Lte}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Mte,children:t})}function Bte({rfId:e,disableKeyboardA11y:t}){const n=Et(Fte);return s.jsxs(s.Fragment,{children:[s.jsx("div",{id:`${V3}-${e}`,style:_C,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),s.jsx("div",{id:`${W3}-${e}`,style:_C,children:n["edge.a11yDescription.default"]}),!t&&s.jsx(zte,{rfId:e})]})}const Gd=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const a=`${e}`.split("-");return s.jsx("div",{className:Nn(["react-flow__panel",n,...a]),style:r,ref:i,...o,children:t})});Gd.displayName="Panel";function Ute({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:s.jsx(Gd,{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 Hte=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}},vp=e=>e.id;function Vte(e,t){return sn(e.selectedNodes.map(vp),t.selectedNodes.map(vp))&&sn(e.selectedEdges.map(vp),t.selectedEdges.map(vp))}function Wte({onSelectionChange:e}){const t=on(),{selectedNodes:n,selectedEdges:r}=Et(Hte,Vte);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 qte=e=>!!e.onSelectionChangeHandlers;function Kte({onSelectionChange:e}){const t=Et(qte);return e||t?s.jsx(Wte,{onSelectionChange:e}):null}const q3=[0,0],Gte={x:0,y:0,zoom:1},Yte=["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"],DC=[...Yte,"rfId"],Xte=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}),$C={translateExtent:fd,nodeOrigin:q3,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Qte(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:d}=Et(Xte,sn),f=on();m.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{p.current=$C,l()}),[]);const p=m.useRef($C);return m.useEffect(()=>{for(const h of DC){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:Iee(g)}):h==="fitView"?f.setState({fitViewQueued:g}):h==="fitViewOptions"?f.setState({fitViewOptions:g}):f.setState({[h]:g})))}p.current=e},DC.map(h=>e[h])),null}function IC(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Jte(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const o=IC(),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=IC())!=null&&r.matches?"dark":"light"}const MC=typeof document<"u"?document:null;function xd(e=null,t={target:MC,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("+",`
|
|
634
|
+
`).replace(`
|
|
635
|
+
|
|
636
|
+
`,`
|
|
637
|
+
+`).split(`
|
|
638
|
+
`)),p=f.reduce((h,g)=>h.concat(...g),[]);return[f,p]}return[[],[]]},[e]);return m.useEffect(()=>{const d=(t==null?void 0:t.target)??MC,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=y=>{var b,j;if(o.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!o.current||o.current&&!f)&&N3(y))return!1;const w=OC(y.code,l);if(i.current.add(y[w]),LC(a,i.current,!1)){const N=((j=(b=y.composedPath)==null?void 0:b.call(y))==null?void 0:j[0])||y.target,k=(N==null?void 0:N.nodeName)==="BUTTON"||(N==null?void 0:N.nodeName)==="A";t.preventDefault!==!1&&(o.current||!k)&&y.preventDefault(),r(!0)}},h=y=>{const S=OC(y.code,l);LC(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(y[S]),y.key==="Meta"&&i.current.clear(),o.current=!1},g=()=>{i.current.clear(),r(!1)};return d==null||d.addEventListener("keydown",p),d==null||d.addEventListener("keyup",h),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{d==null||d.removeEventListener("keydown",p),d==null||d.removeEventListener("keyup",h),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function LC(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function OC(e,t){return t.includes(e)?"code":"key"}const Zte=()=>{const e=on();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(),d=y0(t,r,o,i,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(d,{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:d}=a.getBoundingClientRect(),f={x:t.x-l,y:t.y-d},p=n.snapGrid??o,h=n.snapToGrid??i;return Nc(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=tc(t,n);return{x:a.x+o,y:a.y+i}}}),[])};function K3(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 d of a)ene(d,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 ene(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 G3(e,t){return K3(e,t)}function Y3(e,t){return K3(e,t)}function Vi(e,t){return{id:e,type:"select",selected:t}}function Nl(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(Vi(i.id,a)))}return r}function FC({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),d=((o=l==null?void 0:l.internals)==null?void 0:o.userNode)??l;d!==void 0&&d!==a&&n.push({id:a.id,item:a,type:"replace"}),d===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 zC(e){return{id:e.id,type:"remove"}}const tne=w3();function nne(e,t,n={}){return Bee(e,t,{...n,onError:n.onError??tne})}const BC=e=>Cee(e),rne=e=>x3(e);function X3(e){return m.forwardRef(e)}const sne=typeof window<"u"?m.useLayoutEffect:m.useEffect;function UC(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>one(()=>n(o=>o+BigInt(1))));return sne(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function one(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Q3=m.createContext(null);function ine({children:e}){const t=on(),n=m.useCallback(l=>{const{nodes:d=[],setNodes:f,hasDefaultNodes:p,onNodesChange:h,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:S}=t.getState();let w=d;for(const j of l)w=typeof j=="function"?j(w):j;let b=FC({items:w,lookup:g});for(const j of S.values())b=j(b);p&&f(w),b.length>0?h==null||h(b):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:j,nodes:N,setNodes:k}=t.getState();j&&k(N)})},[]),r=UC(n),o=m.useCallback(l=>{const{edges:d=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:h,edgeLookup:g}=t.getState();let y=d;for(const S of l)y=typeof S=="function"?S(y):S;p?f(y):h&&h(FC({items:y,lookup:g}))},[]),i=UC(o),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return s.jsx(Q3.Provider,{value:a,children:e})}function ane(){const e=m.useContext(Q3);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const lne=e=>!!e.panZoom;function Xm(){const e=Zte(),t=on(),n=ane(),r=Et(lne),o=m.useMemo(()=>{const i=h=>t.getState().nodeLookup.get(h),a=h=>{n.nodeQueue.push(h)},l=h=>{n.edgeQueue.push(h)},d=h=>{var j,N;const{nodeLookup:g,nodeOrigin:y}=t.getState(),S=BC(h)?h:g.get(h.id),w=S.parentId?k3(S.position,S.measured,S.parentId,g,y):S.position,b={...S,position:w,width:((j=S.measured)==null?void 0:j.width)??S.width,height:((N=S.measured)==null?void 0:N.height)??S.height};return ec(b)},f=(h,g,y={replace:!1})=>{a(S=>S.map(w=>{if(w.id===h){const b=typeof g=="function"?g(w):g;return y.replace&&BC(b)?b:{...w,...b}}return w}))},p=(h,g,y={replace:!1})=>{l(S=>S.map(w=>{if(w.id===h){const b=typeof g=="function"?g(w):g;return y.replace&&rne(b)?b:{...w,...b}}return w}))};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(),[S,w,b]=y;return{nodes:h.map(j=>({...j})),edges:g.map(j=>({...j})),viewport:{x:S,y:w,zoom:b}}},deleteElements:async({nodes:h=[],edges:g=[]})=>{const{nodes:y,edges:S,onNodesDelete:w,onEdgesDelete:b,triggerNodeChanges:j,triggerEdgeChanges:N,onDelete:k,onBeforeDelete:C}=t.getState(),{nodes:I,edges:T}=await Pee({nodesToRemove:h,edgesToRemove:g,nodes:y,edges:S,onBeforeDelete:C}),R=T.length>0,D=I.length>0;if(R){const $=T.map(zC);b==null||b(T),N($)}if(D){const $=I.map(zC);w==null||w(I),j($)}return(D||R)&&(k==null||k({nodes:I,edges:T})),{deletedNodes:I,deletedEdges:T}},getIntersectingNodes:(h,g=!0,y)=>{const S=pC(h),w=S?h:d(h),b=y!==void 0;return w?(y||t.getState().nodes).filter(j=>{const N=t.getState().nodeLookup.get(j.id);if(N&&!S&&(j.id===h.id||!N.internals.positionAbsolute))return!1;const k=ec(b?j:N),C=md(k,w);return g&&C>0||C>=k.width*k.height||C>=w.width*w.height}):[]},isNodeIntersecting:(h,g,y=!0)=>{const w=pC(h)?h:d(h);if(!w)return!1;const b=md(w,g);return y&&b>0||b>=g.width*g.height||b>=w.width*w.height},updateNode:f,updateNodeData:(h,g,y={replace:!1})=>{f(h,S=>{const w=typeof g=="function"?g(S):g;return y.replace?{...S,data:w}:{...S,data:{...S.data,...w}}},y)},updateEdge:p,updateEdgeData:(h,g,y={replace:!1})=>{p(h,S=>{const w=typeof g=="function"?g(S):g;return y.replace?{...S,data:w}:{...S,data:{...S.data,...w}}},y)},getNodesBounds:h=>{const{nodeLookup:g,nodeOrigin:y}=t.getState();return Eee(h,{nodeLookup:g,nodeOrigin:y})},getHandleConnections:({type:h,id:g,nodeId:y})=>{var S;return Array.from(((S=t.getState().connectionLookup.get(`${y}-${h}${g?`-${g}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:h,handleId:g,nodeId:y})=>{var S;return Array.from(((S=t.getState().connectionLookup.get(`${y}${h?g?`-${h}-${g}`:`-${h}`:""}`))==null?void 0:S.values())??[])},fitView:async h=>{const g=t.getState().fitViewResolver??$ee();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 HC=e=>e.selected,cne=typeof window<"u"?window:void 0;function une({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=on(),{deleteElements:r}=Xm(),o=xd(e,{actInsideInputWithModifier:!1}),i=xd(t,{target:cne});m.useEffect(()=>{if(o){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(HC),edges:a.filter(HC)}),n.setState({nodesSelectionActive:!1})}},[o]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function dne(e){const t=on();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=b0(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",vs.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 Qm={position:"absolute",width:"100%",height:"100%",top:0,left:0},fne=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function pne({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=ra.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:d,translateExtent:f,minZoom:p,maxZoom:h,zoomActivationKeyCode:g,preventScrolling:y=!0,children:S,noWheelClassName:w,noPanClassName:b,onViewportChange:j,isControlledViewport:N,paneClickDistance:k,selectionOnDrag:C}){const I=on(),T=m.useRef(null),{userSelectionActive:R,lib:D,connectionInProgress:$}=Et(fne,sn),z=xd(g),A=m.useRef();dne(T);const F=m.useCallback(W=>{j==null||j({x:W[0],y:W[1],zoom:W[2]}),N||I.setState({transform:W})},[j,N]);return m.useEffect(()=>{if(T.current){A.current=xte({domNode:T.current,minZoom:p,maxZoom:h,translateExtent:f,viewport:d,onDraggingChange:B=>I.setState(H=>H.paneDragging===B?H:{paneDragging:B}),onPanZoomStart:(B,H)=>{const{onViewportChangeStart:L,onMoveStart:U}=I.getState();U==null||U(B,H),L==null||L(H)},onPanZoom:(B,H)=>{const{onViewportChange:L,onMove:U}=I.getState();U==null||U(B,H),L==null||L(H)},onPanZoomEnd:(B,H)=>{const{onViewportChangeEnd:L,onMoveEnd:U}=I.getState();U==null||U(B,H),L==null||L(H)}});const{x:W,y:P,zoom:O}=A.current.getViewport();return I.setState({panZoom:A.current,transform:[W,P,O],domNode:T.current.closest(".react-flow")}),()=>{var B;(B=A.current)==null||B.destroy()}}},[]),m.useEffect(()=>{var W;(W=A.current)==null||W.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:z,preventScrolling:y,noPanClassName:b,userSelectionActive:R,noWheelClassName:w,lib:D,onTransformChange:F,connectionInProgress:$,selectionOnDrag:C,paneClickDistance:k})},[e,t,n,r,o,i,a,l,z,y,b,R,w,D,F,$,C,k]),s.jsx("div",{className:"react-flow__renderer",ref:T,style:Qm,children:S})}const hne=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function mne(){const{userSelectionActive:e,userSelectionRect:t}=Et(hne,sn);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 Gy=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},gne=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function xne({isSelecting:e,selectionKeyPressed:t,selectionMode:n=pd.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:d,onPaneClick:f,onPaneContextMenu:p,onPaneScroll:h,onPaneMouseEnter:g,onPaneMouseMove:y,onPaneMouseLeave:S,children:w}){const b=m.useRef(0),j=on(),{userSelectionActive:N,elementsSelectable:k,dragging:C,connectionInProgress:I,panBy:T,autoPanSpeed:R}=Et(gne,sn),D=k&&(e||N),$=m.useRef(null),z=m.useRef(),A=m.useRef(new Set),F=m.useRef(new Set),W=m.useRef(!1),P=m.useRef({x:0,y:0}),O=m.useRef(!1),B=te=>{if(W.current||I){W.current=!1;return}f==null||f(te),j.getState().resetSelectedElements(),j.setState({nodesSelectionActive:!1})},H=te=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){te.preventDefault();return}p==null||p(te)},L=h?te=>h(te):void 0,U=te=>{W.current&&(te.stopPropagation(),W.current=!1)},M=te=>{var ke,_e;const{domNode:pe,transform:be}=j.getState();if(z.current=pe==null?void 0:pe.getBoundingClientRect(),!z.current)return;const Ee=te.target===$.current;if(!Ee&&!!te.target.closest(".nokey")||!e||!(a&&Ee||t)||te.button!==0||!te.isPrimary)return;(_e=(ke=te.target)==null?void 0:ke.setPointerCapture)==null||_e.call(ke,te.pointerId),W.current=!1;const{x:Be,y:oe}=ps(te.nativeEvent,z.current),je=Nc({x:Be,y:oe},be);j.setState({userSelectionRect:{width:0,height:0,startX:je.x,startY:je.y,x:Be,y:oe}}),Ee||(te.stopPropagation(),te.preventDefault())};function V(te,pe){const{userSelectionRect:be}=j.getState();if(!be)return;const{transform:Ee,nodeLookup:Te,edgeLookup:Se,connectionLookup:Be,triggerNodeChanges:oe,triggerEdgeChanges:je,defaultEdgeOptions:ke}=j.getState(),_e={x:be.startX,y:be.startY},{x:Ue,y:et}=tc(_e,Ee),Me={startX:_e.x,startY:_e.y,x:te<Ue?te:Ue,y:pe<et?pe:et,width:Math.abs(te-Ue),height:Math.abs(pe-et)},qe=A.current,vt=F.current;A.current=new Set(g0(Te,Me,Ee,n===pd.Partial,!0).map(st=>st.id)),F.current=new Set;const ft=(ke==null?void 0:ke.selectable)??!0;for(const st of A.current){const le=Be.get(st);if(le)for(const{edgeId:ee}of le.values()){const ye=Se.get(ee);ye&&(ye.selectable??ft)&&F.current.add(ee)}}if(!hC(qe,A.current)){const st=Nl(Te,A.current,!0);oe(st)}if(!hC(vt,F.current)){const st=Nl(Se,F.current);je(st)}j.setState({userSelectionRect:Me,userSelectionActive:!0,nodesSelectionActive:!1})}function Y(){if(!o||!z.current)return;const[te,pe]=x0(P.current,z.current,R);T({x:te,y:pe}).then(be=>{if(!W.current||!be){b.current=requestAnimationFrame(Y);return}const{x:Ee,y:Te}=P.current;V(Ee,Te),b.current=requestAnimationFrame(Y)})}const q=()=>{cancelAnimationFrame(b.current),b.current=0,O.current=!1};m.useEffect(()=>()=>q(),[]);const J=te=>{const{userSelectionRect:pe,transform:be,resetSelectedElements:Ee}=j.getState();if(!z.current||!pe)return;const{x:Te,y:Se}=ps(te.nativeEvent,z.current);P.current={x:Te,y:Se};const Be=tc({x:pe.startX,y:pe.startY},be);if(!W.current){const oe=t?0:i;if(Math.hypot(Te-Be.x,Se-Be.y)<=oe)return;Ee(),l==null||l(te)}W.current=!0,O.current||(Y(),O.current=!0),V(Te,Se)},ne=te=>{var pe,be;te.button===0&&((be=(pe=te.target)==null?void 0:pe.releasePointerCapture)==null||be.call(pe,te.pointerId),!N&&te.target===$.current&&j.getState().userSelectionRect&&(B==null||B(te)),j.setState({userSelectionActive:!1,userSelectionRect:null}),W.current&&(d==null||d(te),j.setState({nodesSelectionActive:A.current.size>0})),q())},Q=te=>{var pe,be;(be=(pe=te.target)==null?void 0:pe.releasePointerCapture)==null||be.call(pe,te.pointerId),q()},ce=r===!0||Array.isArray(r)&&r.includes(0);return s.jsxs("div",{className:Nn(["react-flow__pane",{draggable:ce,dragging:C,selection:e}]),onClick:D?void 0:Gy(B,$),onContextMenu:Gy(H,$),onWheel:Gy(L,$),onPointerEnter:D?void 0:g,onPointerMove:D?J:y,onPointerUp:D?ne:void 0,onPointerCancel:D?Q:void 0,onPointerDownCapture:D?M:void 0,onClickCapture:D?U:void 0,onPointerLeave:S,ref:$,style:Qm,children:[w,s.jsx(mne,{})]})}function mv({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:d}=t.getState(),f=l.get(e);if(!f){d==null||d("012",vs.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 J3({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:a}){const l=on(),[d,f]=m.useState(!1),p=m.useRef();return m.useEffect(()=>{p.current=rte({getStoreItems:()=>l.getState(),onNodeMouseDown:h=>{mv({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]),d}const yne=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Z3(){const e=on();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:d,nodeLookup:f,nodeOrigin:p}=e.getState(),h=new Map,g=yne(a),y=o?i[0]:5,S=o?i[1]:5,w=n.direction.x*y*n.factor,b=n.direction.y*S*n.factor;for(const[,j]of f){if(!g(j))continue;let N={x:j.internals.positionAbsolute.x+w,y:j.internals.positionAbsolute.y+b};o&&(N=Kd(N,i));const{position:k,positionAbsolute:C}=y3({nodeId:j.id,nextPosition:N,nodeLookup:f,nodeExtent:r,nodeOrigin:p,onError:l});j.position=k,j.internals.positionAbsolute=C,h.set(j.id,j)}d(h)},[])}const N0=m.createContext(null),bne=N0.Provider;N0.Consumer;const eD=()=>m.useContext(N0),vne=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),wne=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:d,isValid:f}=a,p=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===t&&(d==null?void 0:d.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===Jl.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 jne({type:e="source",position:t=rt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:d,className:f,onMouseDown:p,onTouchStart:h,...g},y){var O,B;const S=a||null,w=e==="target",b=on(),j=eD(),{connectOnClick:N,noPanClassName:k,rfId:C}=Et(vne,sn),{connectingFrom:I,connectingTo:T,clickConnecting:R,isPossibleEndHandle:D,connectionInProcess:$,clickConnectionInProcess:z,valid:A}=Et(wne(j,S,e),sn);j||(B=(O=b.getState()).onError)==null||B.call(O,"010",vs.error010());const F=H=>{const{defaultEdgeOptions:L,onConnect:U,hasDefaultEdges:M}=b.getState(),V={...L,...H};if(M){const{edges:Y,setEdges:q,onError:J}=b.getState();q(nne(V,Y,{onError:J}))}U==null||U(V),l==null||l(V)},W=H=>{if(!j)return;const L=C3(H.nativeEvent);if(o&&(L&&H.button===0||!L)){const U=b.getState();hv.onPointerDown(H.nativeEvent,{handleDomNode:H.currentTarget,autoPanOnConnect:U.autoPanOnConnect,connectionMode:U.connectionMode,connectionRadius:U.connectionRadius,domNode:U.domNode,nodeLookup:U.nodeLookup,lib:U.lib,isTarget:w,handleId:S,nodeId:j,flowId:U.rfId,panBy:U.panBy,cancelConnection:U.cancelConnection,onConnectStart:U.onConnectStart,onConnectEnd:(...M)=>{var V,Y;return(Y=(V=b.getState()).onConnectEnd)==null?void 0:Y.call(V,...M)},updateConnection:U.updateConnection,onConnect:F,isValidConnection:n||((...M)=>{var V,Y;return((Y=(V=b.getState()).isValidConnection)==null?void 0:Y.call(V,...M))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:U.autoPanSpeed,dragThreshold:U.connectionDragThreshold})}L?p==null||p(H):h==null||h(H)},P=H=>{const{onClickConnectStart:L,onClickConnectEnd:U,connectionClickStartHandle:M,connectionMode:V,isValidConnection:Y,lib:q,rfId:J,nodeLookup:ne,connection:Q}=b.getState();if(!j||!M&&!o)return;if(!M){L==null||L(H.nativeEvent,{nodeId:j,handleId:S,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:j,type:e,id:S}});return}const ce=S3(H.target),te=n||Y,{connection:pe,isValid:be}=hv.isValid(H.nativeEvent,{handle:{nodeId:j,id:S,type:e},connectionMode:V,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:te,flowId:J,doc:ce,lib:q,nodeLookup:ne});be&&pe&&F(pe);const Ee=structuredClone(Q);delete Ee.inProgress,Ee.toPosition=Ee.toHandle?Ee.toHandle.position:null,U==null||U(H,Ee),b.setState({connectionClickStartHandle:null})};return s.jsx("div",{"data-handleid":S,"data-nodeid":j,"data-handlepos":t,"data-id":`${C}-${j}-${S}-${e}`,className:Nn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",k,f,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:i,clickconnecting:R,connectingfrom:I,connectingto:T,valid:A,connectionindicator:r&&(!$||D)&&($||z?i:o)}]),onMouseDown:W,onTouchStart:W,onClick:N?P:void 0,ref:y,...g,children:d})}const rc=m.memo(X3(jne));function kne({data:e,isConnectable:t,sourcePosition:n=rt.Bottom}){return s.jsxs(s.Fragment,{children:[e==null?void 0:e.label,s.jsx(rc,{type:"source",position:n,isConnectable:t})]})}function Sne({data:e,isConnectable:t,targetPosition:n=rt.Top,sourcePosition:r=rt.Bottom}){return s.jsxs(s.Fragment,{children:[s.jsx(rc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,s.jsx(rc,{type:"source",position:r,isConnectable:t})]})}function Nne(){return null}function Cne({data:e,isConnectable:t,targetPosition:n=rt.Top}){return s.jsxs(s.Fragment,{children:[s.jsx(rc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Dh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},VC={input:kne,default:Sne,output:Cne,group:Nne};function Ene(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 Tne=e=>{const{width:t,height:n,x:r,y:o}=qd(e.nodeLookup,{filter:i=>!!i.selected});return{width:fs(t)?t:null,height:fs(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 Rne({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=on(),{width:o,height:i,transformString:a,userSelectionActive:l}=Et(Tne,sn),d=Z3(),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(J3({nodeRef:f,disabled:!p}),!p)return null;const h=e?y=>{const S=r.getState().nodes.filter(w=>w.selected);e(y,S)}:void 0,g=y=>{Object.prototype.hasOwnProperty.call(Dh,y.key)&&(y.preventDefault(),d({direction:Dh[y.key],factor:y.shiftKey?4:1}))};return s.jsx("div",{className:Nn(["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 WC=typeof window<"u"?window:void 0,Ane=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function tD({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:d,selectionKeyCode:f,selectionOnDrag:p,selectionMode:h,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:S,panActivationKeyCode:w,zoomActivationKeyCode:b,elementsSelectable:j,zoomOnScroll:N,zoomOnPinch:k,panOnScroll:C,panOnScrollSpeed:I,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:D,autoPanOnSelection:$,defaultViewport:z,translateExtent:A,minZoom:F,maxZoom:W,preventScrolling:P,onSelectionContextMenu:O,noWheelClassName:B,noPanClassName:H,disableKeyboardA11y:L,onViewportChange:U,isControlledViewport:M}){const{nodesSelectionActive:V,userSelectionActive:Y}=Et(Ane,sn),q=xd(f,{target:WC}),J=xd(w,{target:WC}),ne=J||D,Q=J||C,ce=p&&ne!==!0,te=q||Y||ce;return une({deleteKeyCode:d,multiSelectionKeyCode:S}),s.jsx(pne,{onPaneContextMenu:i,elementsSelectable:j,zoomOnScroll:N,zoomOnPinch:k,panOnScroll:Q,panOnScrollSpeed:I,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:!q&&ne,defaultViewport:z,translateExtent:A,minZoom:F,maxZoom:W,zoomActivationKeyCode:b,preventScrolling:P,noWheelClassName:B,noPanClassName:H,onViewportChange:U,isControlledViewport:M,paneClickDistance:l,selectionOnDrag:ce,children:s.jsxs(xne,{onSelectionStart:g,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:ne,autoPanOnSelection:$,isSelecting:!!te,selectionMode:h,selectionKeyPressed:q,paneClickDistance:l,selectionOnDrag:ce,children:[e,V&&s.jsx(Rne,{onSelectionContextMenu:O,noPanClassName:H,disableKeyboardA11y:L})]})})}tD.displayName="FlowRenderer";const Pne=m.memo(tD),_ne=e=>t=>e?g0(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 Dne(e){return Et(m.useCallback(_ne(e),[e]),sn)}const $ne=e=>e.updateNodeInternals;function Ine(){const e=Et($ne),[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 Mne({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=on(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),d=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=d.current!==e.targetPosition;(h||g||y)&&(f.current=t,l.current=e.sourcePosition,d.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 Lne({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:d,nodesConnectable:f,nodesFocusable:p,resizeObserver:h,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:S,rfId:w,nodeTypes:b,nodeClickDistance:j,onError:N}){const{node:k,internals:C,isParent:I}=Et(te=>{const pe=te.nodeLookup.get(e),be=te.parentLookup.has(e);return{node:pe,internals:pe.internals,isParent:be}},sn);let T=k.type||"default",R=(b==null?void 0:b[T])||VC[T];R===void 0&&(N==null||N("003",vs.error003(T)),T="default",R=(b==null?void 0:b.default)||VC.default);const D=!!(k.draggable||l&&typeof k.draggable>"u"),$=!!(k.selectable||d&&typeof k.selectable>"u"),z=!!(k.connectable||f&&typeof k.connectable>"u"),A=!!(k.focusable||p&&typeof k.focusable>"u"),F=on(),W=j3(k),P=Mne({node:k,nodeType:T,hasDimensions:W,resizeObserver:h}),O=J3({nodeRef:P,disabled:k.hidden||!D,noDragClassName:g,handleSelector:k.dragHandle,nodeId:e,isSelectable:$,nodeClickDistance:j}),B=Z3();if(k.hidden)return null;const H=No(k),L=Ene(k),U=$||D||t||n||r||o,M=n?te=>n(te,{...C.userNode}):void 0,V=r?te=>r(te,{...C.userNode}):void 0,Y=o?te=>o(te,{...C.userNode}):void 0,q=i?te=>i(te,{...C.userNode}):void 0,J=a?te=>a(te,{...C.userNode}):void 0,ne=te=>{const{selectNodesOnDrag:pe,nodeDragThreshold:be}=F.getState();$&&(!pe||!D||be>0)&&mv({id:e,store:F,nodeRef:P}),t&&t(te,{...C.userNode})},Q=te=>{if(!(N3(te.nativeEvent)||S)){if(p3.includes(te.key)&&$){const pe=te.key==="Escape";mv({id:e,store:F,unselect:pe,nodeRef:P})}else if(D&&k.selected&&Object.prototype.hasOwnProperty.call(Dh,te.key)){te.preventDefault();const{ariaLabelConfig:pe}=F.getState();F.setState({ariaLiveMessage:pe["node.a11yDescription.ariaLiveMessage"]({direction:te.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),B({direction:Dh[te.key],factor:te.shiftKey?4:1})}}},ce=()=>{var Be;if(S||!((Be=P.current)!=null&&Be.matches(":focus-visible")))return;const{transform:te,width:pe,height:be,autoPanOnNodeFocus:Ee,setCenter:Te}=F.getState();if(!Ee)return;g0(new Map([[e,k]]),{x:0,y:0,width:pe,height:be},te,!0).length>0||Te(k.position.x+H.width/2,k.position.y+H.height/2,{zoom:te[2]})};return s.jsx("div",{className:Nn(["react-flow__node",`react-flow__node-${T}`,{[y]:D},k.className,{selected:k.selected,selectable:$,parent:I,draggable:D,dragging:O}]),ref:P,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:U?"all":"none",visibility:W?"visible":"hidden",...k.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:M,onMouseMove:V,onMouseLeave:Y,onContextMenu:q,onClick:ne,onDoubleClick:J,onKeyDown:A?Q:void 0,tabIndex:A?0:void 0,onFocus:A?ce:void 0,role:k.ariaRole??(A?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${V3}-${w}`,"aria-label":k.ariaLabel,...k.domAttributes,children:s.jsx(bne,{value:e,children:s.jsx(R,{id:e,data:k.data,type:T,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:k.selected??!1,selectable:$,draggable:D,deletable:k.deletable??!0,isConnectable:z,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:O,dragHandle:k.dragHandle,zIndex:C.z,parentId:k.parentId,...H})})})}var One=m.memo(Lne);const Fne=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function nD(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=Et(Fne,sn),a=Dne(e.onlyRenderVisibleElements),l=Ine();return s.jsx("div",{className:"react-flow__nodes",style:Qm,children:a.map(d=>s.jsx(One,{id:d,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},d))})}nD.displayName="NodeRenderer";const zne=m.memo(nD);function Bne(e){return Et(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&&Oee({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),sn)}const Une=({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"})},Hne=({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"})},qC={[hd.Arrow]:Une,[hd.ArrowClosed]:Hne};function Vne(e){const t=on();return m.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(qC,e)?qC[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",vs.error009(e)),null)},[e])}const Wne=({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 d=Vne(t);return d?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(d,{color:n,strokeWidth:a})}):null},rD=({defaultColor:e,rfId:t})=>{const n=Et(i=>i.edges),r=Et(i=>i.defaultEdgeOptions),o=m.useMemo(()=>qee(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(Wne,{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};rD.displayName="MarkerDefinitions";var qne=m.memo(rD);function sD({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:d,className:f,...p}){const[h,g]=m.useState({x:1,y:0,width:0,height:0}),y=Nn(["react-flow__edge-textwrapper",f]),S=m.useRef(null);return m.useEffect(()=>{if(S.current){const w=S.current.getBBox();g({x:w.x,y:w.y,width:w.width,height:w.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:S,style:r,children:n}),d]}):null}sD.displayName="EdgeText";const Kne=m.memo(sD);function Jm({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:d,interactionWidth:f=20,...p}){return s.jsxs(s.Fragment,{children:[s.jsx("path",{...p,d:e,fill:"none",className:Nn(["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&&fs(t)&&fs(n)?s.jsx(Kne,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:d}):null]})}function KC({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===rt.Left||e===rt.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function oD({sourceX:e,sourceY:t,sourcePosition:n=rt.Bottom,targetX:r,targetY:o,targetPosition:i=rt.Top}){const[a,l]=KC({pos:n,x1:e,y1:t,x2:r,y2:o}),[d,f]=KC({pos:i,x1:r,y1:o,x2:e,y2:t}),[p,h,g,y]=E3({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:l,targetControlX:d,targetControlY:f});return[`M${e},${t} C${a},${l} ${d},${f} ${r},${o}`,p,h,g,y]}function iD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a,targetPosition:l,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:S,markerEnd:w,markerStart:b,interactionWidth:j})=>{const[N,k,C]=oD({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l}),I=e.isInternal?void 0:t;return s.jsx(Jm,{id:I,path:N,labelX:k,labelY:C,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:S,markerEnd:w,markerStart:b,interactionWidth:j})})}const Gne=iD({isInternal:!1}),aD=iD({isInternal:!0});Gne.displayName="SimpleBezierEdge";aD.displayName="SimpleBezierEdgeInternal";function lD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,sourcePosition:y=rt.Bottom,targetPosition:S=rt.Top,markerEnd:w,markerStart:b,pathOptions:j,interactionWidth:N})=>{const[k,C,I]=dv({sourceX:n,sourceY:r,sourcePosition:y,targetX:o,targetY:i,targetPosition:S,borderRadius:j==null?void 0:j.borderRadius,offset:j==null?void 0:j.offset,stepPosition:j==null?void 0:j.stepPosition}),T=e.isInternal?void 0:t;return s.jsx(Jm,{id:T,path:k,labelX:C,labelY:I,label:a,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:b,interactionWidth:N})})}const cD=lD({isInternal:!1}),uD=lD({isInternal:!0});cD.displayName="SmoothStepEdge";uD.displayName="SmoothStepEdgeInternal";function dD(e){return m.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return s.jsx(cD,{...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 Yne=dD({isInternal:!1}),fD=dD({isInternal:!0});Yne.displayName="StepEdge";fD.displayName="StepEdgeInternal";function pD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:S,interactionWidth:w})=>{const[b,j,N]=A3({sourceX:n,sourceY:r,targetX:o,targetY:i}),k=e.isInternal?void 0:t;return s.jsx(Jm,{id:k,path:b,labelX:j,labelY:N,label:a,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:S,interactionWidth:w})})}const Xne=pD({isInternal:!1}),hD=pD({isInternal:!0});Xne.displayName="StraightEdge";hD.displayName="StraightEdgeInternal";function mD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a=rt.Bottom,targetPosition:l=rt.Top,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:S,markerEnd:w,markerStart:b,pathOptions:j,interactionWidth:N})=>{const[k,C,I]=T3({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l,curvature:j==null?void 0:j.curvature}),T=e.isInternal?void 0:t;return s.jsx(Jm,{id:T,path:k,labelX:C,labelY:I,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:S,markerEnd:w,markerStart:b,interactionWidth:N})})}const Qne=mD({isInternal:!1}),gD=mD({isInternal:!0});Qne.displayName="BezierEdge";gD.displayName="BezierEdgeInternal";const GC={default:gD,straight:hD,step:fD,smoothstep:uD,simplebezier:aD},YC={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Jne=(e,t,n)=>n===rt.Left?e-t:n===rt.Right?e+t:e,Zne=(e,t,n)=>n===rt.Top?e-t:n===rt.Bottom?e+t:e,XC="react-flow__edgeupdater";function QC({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:Nn([XC,`${XC}-${l}`]),cx:Jne(t,r,e),cy:Zne(n,r,e),r,stroke:"transparent",fill:"transparent"})}function ere({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:a,sourcePosition:l,targetPosition:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,setReconnecting:g,setUpdateHover:y}){const S=on(),w=(C,I)=>{if(C.button!==0)return;const{autoPanOnConnect:T,domNode:R,connectionMode:D,connectionRadius:$,lib:z,onConnectStart:A,cancelConnection:F,nodeLookup:W,rfId:P,panBy:O,updateConnection:B}=S.getState(),H=I.type==="target",L=(V,Y)=>{g(!1),h==null||h(V,n,I.type,Y)},U=V=>f==null?void 0:f(n,V),M=(V,Y)=>{g(!0),p==null||p(C,n,I.type),A==null||A(V,Y)};hv.onPointerDown(C.nativeEvent,{autoPanOnConnect:T,connectionMode:D,connectionRadius:$,domNode:R,handleId:I.id,nodeId:I.nodeId,nodeLookup:W,isTarget:H,edgeUpdaterType:I.type,lib:z,flowId:P,cancelConnection:F,panBy:O,isValidConnection:(...V)=>{var Y,q;return((q=(Y=S.getState()).isValidConnection)==null?void 0:q.call(Y,...V))??!0},onConnect:U,onConnectStart:M,onConnectEnd:(...V)=>{var Y,q;return(q=(Y=S.getState()).onConnectEnd)==null?void 0:q.call(Y,...V)},onReconnectEnd:L,updateConnection:B,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},b=C=>w(C,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),j=C=>w(C,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),N=()=>y(!0),k=()=>y(!1);return s.jsxs(s.Fragment,{children:[(e===!0||e==="source")&&s.jsx(QC,{position:l,centerX:r,centerY:o,radius:t,onMouseDown:b,onMouseEnter:N,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&s.jsx(QC,{position:d,centerX:i,centerY:a,radius:t,onMouseDown:j,onMouseEnter:N,onMouseOut:k,type:"target"})]})}function tre({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:d,onMouseLeave:f,reconnectRadius:p,onReconnect:h,onReconnectStart:g,onReconnectEnd:y,rfId:S,edgeTypes:w,noPanClassName:b,onError:j,disableKeyboardA11y:N}){let k=Et(Te=>Te.edgeLookup.get(e));const C=Et(Te=>Te.defaultEdgeOptions);k=C?{...C,...k}:k;let I=k.type||"default",T=(w==null?void 0:w[I])||GC[I];T===void 0&&(j==null||j("011",vs.error011(I)),I="default",T=(w==null?void 0:w.default)||GC.default);const R=!!(k.focusable||t&&typeof k.focusable>"u"),D=typeof h<"u"&&(k.reconnectable||n&&typeof k.reconnectable>"u"),$=!!(k.selectable||r&&typeof k.selectable>"u"),z=m.useRef(null),[A,F]=m.useState(!1),[W,P]=m.useState(!1),O=on(),{zIndex:B,sourceX:H,sourceY:L,targetX:U,targetY:M,sourcePosition:V,targetPosition:Y}=Et(m.useCallback(Te=>{const Se=Te.nodeLookup.get(k.source),Be=Te.nodeLookup.get(k.target);if(!Se||!Be)return{zIndex:k.zIndex,...YC};const oe=Wee({id:e,sourceNode:Se,targetNode:Be,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:Te.connectionMode,onError:j});return{zIndex:Lee({selected:k.selected,zIndex:k.zIndex,sourceNode:Se,targetNode:Be,elevateOnSelect:Te.elevateEdgesOnSelect,zIndexMode:Te.zIndexMode}),...oe||YC}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),sn),q=m.useMemo(()=>k.markerStart?`url('#${fv(k.markerStart,S)}')`:void 0,[k.markerStart,S]),J=m.useMemo(()=>k.markerEnd?`url('#${fv(k.markerEnd,S)}')`:void 0,[k.markerEnd,S]);if(k.hidden||H===null||L===null||U===null||M===null)return null;const ne=Te=>{var je;const{addSelectedEdges:Se,unselectNodesAndEdges:Be,multiSelectionActive:oe}=O.getState();$&&(O.setState({nodesSelectionActive:!1}),k.selected&&oe?(Be({nodes:[],edges:[k]}),(je=z.current)==null||je.blur()):Se([e])),o&&o(Te,k)},Q=i?Te=>{i(Te,{...k})}:void 0,ce=a?Te=>{a(Te,{...k})}:void 0,te=l?Te=>{l(Te,{...k})}:void 0,pe=d?Te=>{d(Te,{...k})}:void 0,be=f?Te=>{f(Te,{...k})}:void 0,Ee=Te=>{var Se;if(!N&&p3.includes(Te.key)&&$){const{unselectNodesAndEdges:Be,addSelectedEdges:oe}=O.getState();Te.key==="Escape"?((Se=z.current)==null||Se.blur(),Be({edges:[k]})):oe([e])}};return s.jsx("svg",{style:{zIndex:B},children:s.jsxs("g",{className:Nn(["react-flow__edge",`react-flow__edge-${I}`,k.className,b,{selected:k.selected,animated:k.animated,inactive:!$&&!o,updating:A,selectable:$}]),onClick:ne,onDoubleClick:Q,onContextMenu:ce,onMouseEnter:te,onMouseMove:pe,onMouseLeave:be,onKeyDown:R?Ee:void 0,tabIndex:R?0:void 0,role:k.ariaRole??(R?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":k.ariaLabel===null?void 0:k.ariaLabel||`Edge from ${k.source} to ${k.target}`,"aria-describedby":R?`${W3}-${S}`:void 0,ref:z,...k.domAttributes,children:[!W&&s.jsx(T,{id:e,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:$,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:H,sourceY:L,targetX:U,targetY:M,sourcePosition:V,targetPosition:Y,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:q,markerEnd:J,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),D&&s.jsx(ere,{edge:k,isReconnectable:D,reconnectRadius:p,onReconnect:h,onReconnectStart:g,onReconnectEnd:y,sourceX:H,sourceY:L,targetX:U,targetY:M,sourcePosition:V,targetPosition:Y,setUpdateHover:F,setReconnecting:P})]})})}var nre=m.memo(tre);const rre=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function xD({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:p,reconnectRadius:h,onEdgeDoubleClick:g,onReconnectStart:y,onReconnectEnd:S,disableKeyboardA11y:w}){const{edgesFocusable:b,edgesReconnectable:j,elementsSelectable:N,onError:k}=Et(rre,sn),C=Bne(t);return s.jsxs("div",{className:"react-flow__edges",children:[s.jsx(qne,{defaultColor:e,rfId:n}),C.map(I=>s.jsx(nre,{id:I,edgesFocusable:b,edgesReconnectable:j,elementsSelectable:N,noPanClassName:o,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:d,onMouseLeave:f,onClick:p,reconnectRadius:h,onDoubleClick:g,onReconnectStart:y,onReconnectEnd:S,rfId:n,onError:k,edgeTypes:r,disableKeyboardA11y:w},I))]})}xD.displayName="EdgeRenderer";const sre=m.memo(xD),ore=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function ire({children:e}){const t=Et(ore);return s.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function are(e){const t=Xm(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const lre=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function cre(e){const t=Et(lre),n=on();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function ure(e){return e.connection.inProgress?{...e.connection,to:Nc(e.connection.to,e.transform)}:{...e.connection}}function dre(e){return ure}function fre(e){const t=dre();return Et(t,sn)}const pre=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function hre({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:a,isValid:l,inProgress:d}=Et(pre,sn);return!(i&&o&&d)?null:s.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:s.jsx("g",{className:Nn(["react-flow__connection",g3(l)]),children:s.jsx(yD,{style:t,type:n,CustomComponent:r,isValid:l})})})}const yD=({style:e,type:t=ri.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:a,fromHandle:l,fromPosition:d,to:f,toNode:p,toHandle:h,toPosition:g,pointer:y}=fre();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:d,toPosition:g,connectionStatus:g3(r),toNode:p,toHandle:h,pointer:y});let S="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:d,targetX:f.x,targetY:f.y,targetPosition:g};switch(t){case ri.Bezier:[S]=T3(w);break;case ri.SimpleBezier:[S]=oD(w);break;case ri.Step:[S]=dv({...w,borderRadius:0});break;case ri.SmoothStep:[S]=dv(w);break;default:[S]=A3(w)}return s.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};yD.displayName="ConnectionLine";const mre={};function JC(e=mre){m.useRef(e),on(),m.useEffect(()=>{},[e])}function gre(){on(),m.useRef(!1),m.useEffect(()=>{},[])}function bD({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:h,onSelectionStart:g,onSelectionEnd:y,connectionLineType:S,connectionLineStyle:w,connectionLineComponent:b,connectionLineContainerStyle:j,selectionKeyCode:N,selectionOnDrag:k,selectionMode:C,multiSelectionKeyCode:I,panActivationKeyCode:T,zoomActivationKeyCode:R,deleteKeyCode:D,onlyRenderVisibleElements:$,elementsSelectable:z,defaultViewport:A,translateExtent:F,minZoom:W,maxZoom:P,preventScrolling:O,defaultMarkerColor:B,zoomOnScroll:H,zoomOnPinch:L,panOnScroll:U,panOnScrollSpeed:M,panOnScrollMode:V,zoomOnDoubleClick:Y,panOnDrag:q,autoPanOnSelection:J,onPaneClick:ne,onPaneMouseEnter:Q,onPaneMouseMove:ce,onPaneMouseLeave:te,onPaneScroll:pe,onPaneContextMenu:be,paneClickDistance:Ee,nodeClickDistance:Te,onEdgeContextMenu:Se,onEdgeMouseEnter:Be,onEdgeMouseMove:oe,onEdgeMouseLeave:je,reconnectRadius:ke,onReconnect:_e,onReconnectStart:Ue,onReconnectEnd:et,noDragClassName:Me,noWheelClassName:qe,noPanClassName:vt,disableKeyboardA11y:ft,nodeExtent:st,rfId:le,viewport:ee,onViewportChange:ye}){return JC(e),JC(t),gre(),are(n),cre(ee),s.jsx(Pne,{onPaneClick:ne,onPaneMouseEnter:Q,onPaneMouseMove:ce,onPaneMouseLeave:te,onPaneContextMenu:be,onPaneScroll:pe,paneClickDistance:Ee,deleteKeyCode:D,selectionKeyCode:N,selectionOnDrag:k,selectionMode:C,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:I,panActivationKeyCode:T,zoomActivationKeyCode:R,elementsSelectable:z,zoomOnScroll:H,zoomOnPinch:L,zoomOnDoubleClick:Y,panOnScroll:U,panOnScrollSpeed:M,panOnScrollMode:V,panOnDrag:q,autoPanOnSelection:J,defaultViewport:A,translateExtent:F,minZoom:W,maxZoom:P,onSelectionContextMenu:h,preventScrolling:O,noDragClassName:Me,noWheelClassName:qe,noPanClassName:vt,disableKeyboardA11y:ft,onViewportChange:ye,isControlledViewport:!!ee,children:s.jsxs(ire,{children:[s.jsx(sre,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:a,onReconnect:_e,onReconnectStart:Ue,onReconnectEnd:et,onlyRenderVisibleElements:$,onEdgeContextMenu:Se,onEdgeMouseEnter:Be,onEdgeMouseMove:oe,onEdgeMouseLeave:je,reconnectRadius:ke,defaultMarkerColor:B,noPanClassName:vt,disableKeyboardA11y:ft,rfId:le}),s.jsx(hre,{style:w,type:S,component:b,containerStyle:j}),s.jsx("div",{className:"react-flow__edgelabel-renderer"}),s.jsx(zne,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,nodeClickDistance:Te,onlyRenderVisibleElements:$,noPanClassName:vt,noDragClassName:Me,disableKeyboardA11y:ft,nodeExtent:st,rfId:le}),s.jsx("div",{className:"react-flow__viewport-portal"})]})})}bD.displayName="GraphView";const xre=m.memo(bD),yre=w3(),ZC=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:d=.5,maxZoom:f=2,nodeOrigin:p,nodeExtent:h,zIndexMode:g="basic"}={})=>{const y=new Map,S=new Map,w=new Map,b=new Map,j=r??t??[],N=n??e??[],k=p??[0,0],C=h??fd;D3(w,b,j);const{nodesInitialized:I}=pv(N,y,S,{nodeOrigin:k,nodeExtent:C,zIndexMode:g});let T=[0,0,1];if(a&&o&&i){const R=qd(y,{filter:A=>!!((A.width||A.initialWidth)&&(A.height||A.initialHeight))}),{x:D,y:$,zoom:z}=y0(R,o,i,d,f,(l==null?void 0:l.padding)??.1);T=[D,$,z]}return{rfId:"1",width:o??0,height:i??0,transform:T,nodes:N,nodesInitialized:I,nodeLookup:y,parentLookup:S,edges:j,edgeLookup:b,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:d,maxZoom:f,translateExtent:fd,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Jl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:k,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:{...m3},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:yre,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:h3,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},bre=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:d,maxZoom:f,nodeOrigin:p,nodeExtent:h,zIndexMode:g})=>$te((y,S)=>{async function w(){const{nodeLookup:b,panZoom:j,fitViewOptions:N,fitViewResolver:k,width:C,height:I,minZoom:T,maxZoom:R}=S();j&&(await Aee({nodes:b,width:C,height:I,panZoom:j,minZoom:T,maxZoom:R},N),k==null||k.resolve(!0),y({fitViewResolver:null}))}return{...ZC({nodes:e,edges:t,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:d,maxZoom:f,nodeOrigin:p,nodeExtent:h,defaultNodes:n,defaultEdges:r,zIndexMode:g}),setNodes:b=>{const{nodeLookup:j,parentLookup:N,nodeOrigin:k,elevateNodesOnSelect:C,fitViewQueued:I,zIndexMode:T,nodesSelectionActive:R}=S(),{nodesInitialized:D,hasSelectedNodes:$}=pv(b,j,N,{nodeOrigin:k,nodeExtent:h,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:T}),z=R&&$;I&&D?(w(),y({nodes:b,nodesInitialized:D,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:z})):y({nodes:b,nodesInitialized:D,nodesSelectionActive:z})},setEdges:b=>{const{connectionLookup:j,edgeLookup:N}=S();D3(j,N,b),y({edges:b})},setDefaultNodesAndEdges:(b,j)=>{if(b){const{setNodes:N}=S();N(b),y({hasDefaultNodes:!0})}if(j){const{setEdges:N}=S();N(j),y({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:j,nodeLookup:N,parentLookup:k,domNode:C,nodeOrigin:I,nodeExtent:T,debug:R,fitViewQueued:D,zIndexMode:$}=S(),{changes:z,updatedInternals:A}=Zee(b,N,k,C,I,T,$);A&&(Yee(N,k,{nodeOrigin:I,nodeExtent:T,zIndexMode:$}),D?(w(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),(z==null?void 0:z.length)>0&&(R&&console.log("React Flow: trigger node changes",z),j==null||j(z)))},updateNodePositions:(b,j=!1)=>{const N=[];let k=[];const{nodeLookup:C,triggerNodeChanges:I,connection:T,updateConnection:R,onNodesChangeMiddlewareMap:D}=S();for(const[$,z]of b){const A=C.get($),F=!!(A!=null&&A.expandParent&&(A!=null&&A.parentId)&&(z!=null&&z.position)),W={id:$,type:"position",position:F?{x:Math.max(0,z.position.x),y:Math.max(0,z.position.y)}:z.position,dragging:j};if(A&&T.inProgress&&T.fromNode.id===A.id){const P=da(A,T.fromHandle,rt.Left,!0);R({...T,from:P})}F&&A.parentId&&N.push({id:$,parentId:A.parentId,rect:{...z.internals.positionAbsolute,width:z.measured.width??0,height:z.measured.height??0}}),k.push(W)}if(N.length>0){const{parentLookup:$,nodeOrigin:z}=S(),A=S0(N,C,$,z);k.push(...A)}for(const $ of D.values())k=$(k);I(k)},triggerNodeChanges:b=>{const{onNodesChange:j,setNodes:N,nodes:k,hasDefaultNodes:C,debug:I}=S();if(b!=null&&b.length){if(C){const T=G3(b,k);N(T)}I&&console.log("React Flow: trigger node changes",b),j==null||j(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:j,setEdges:N,edges:k,hasDefaultEdges:C,debug:I}=S();if(b!=null&&b.length){if(C){const T=Y3(b,k);N(T)}I&&console.log("React Flow: trigger edge changes",b),j==null||j(b)}},addSelectedNodes:b=>{const{multiSelectionActive:j,edgeLookup:N,nodeLookup:k,triggerNodeChanges:C,triggerEdgeChanges:I}=S();if(j){const T=b.map(R=>Vi(R,!0));C(T);return}C(Nl(k,new Set([...b]),!0)),I(Nl(N))},addSelectedEdges:b=>{const{multiSelectionActive:j,edgeLookup:N,nodeLookup:k,triggerNodeChanges:C,triggerEdgeChanges:I}=S();if(j){const T=b.map(R=>Vi(R,!0));I(T);return}I(Nl(N,new Set([...b]))),C(Nl(k,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:j}={})=>{const{edges:N,nodes:k,nodeLookup:C,triggerNodeChanges:I,triggerEdgeChanges:T}=S(),R=b||k,D=j||N,$=[];for(const A of R){if(!A.selected)continue;const F=C.get(A.id);F&&(F.selected=!1),$.push(Vi(A.id,!1))}const z=[];for(const A of D)A.selected&&z.push(Vi(A.id,!1));I($),T(z)},setMinZoom:b=>{const{panZoom:j,maxZoom:N}=S();j==null||j.setScaleExtent([b,N]),y({minZoom:b})},setMaxZoom:b=>{const{panZoom:j,minZoom:N}=S();j==null||j.setScaleExtent([N,b]),y({maxZoom:b})},setTranslateExtent:b=>{var j;(j=S().panZoom)==null||j.setTranslateExtent(b),y({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:j,triggerNodeChanges:N,triggerEdgeChanges:k,elementsSelectable:C}=S();if(!C)return;const I=j.reduce((R,D)=>D.selected?[...R,Vi(D.id,!1)]:R,[]),T=b.reduce((R,D)=>D.selected?[...R,Vi(D.id,!1)]:R,[]);N(I),k(T)},setNodeExtent:b=>{const{nodes:j,nodeLookup:N,parentLookup:k,nodeOrigin:C,elevateNodesOnSelect:I,nodeExtent:T,zIndexMode:R}=S();b[0][0]===T[0][0]&&b[0][1]===T[0][1]&&b[1][0]===T[1][0]&&b[1][1]===T[1][1]||(pv(j,N,k,{nodeOrigin:C,nodeExtent:b,elevateNodesOnSelect:I,checkEquality:!1,zIndexMode:R}),y({nodeExtent:b}))},panBy:b=>{const{transform:j,width:N,height:k,panZoom:C,translateExtent:I}=S();return ete({delta:b,panZoom:C,transform:j,translateExtent:I,width:N,height:k})},setCenter:async(b,j,N)=>{const{width:k,height:C,maxZoom:I,panZoom:T}=S();if(!T)return!1;const R=typeof(N==null?void 0:N.zoom)<"u"?N.zoom:I;return await T.setViewport({x:k/2-b*R,y:C/2-j*R,zoom:R},{duration:N==null?void 0:N.duration,ease:N==null?void 0:N.ease,interpolate:N==null?void 0:N.interpolate}),!0},cancelConnection:()=>{y({connection:{...m3}})},updateConnection:b=>{y({connection:b})},reset:()=>y({...ZC()})}},Object.is);function vre({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:d,fitView:f,nodeOrigin:p,nodeExtent:h,zIndexMode:g,children:y}){const[S]=m.useState(()=>bre({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:f,minZoom:a,maxZoom:l,fitViewOptions:d,nodeOrigin:p,nodeExtent:h,zIndexMode:g}));return s.jsx(Ite,{value:S,children:s.jsx(ine,{children:y})})}function wre({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:a,fitView:l,fitViewOptions:d,minZoom:f,maxZoom:p,nodeOrigin:h,nodeExtent:g,zIndexMode:y}){return m.useContext(Ym)?s.jsx(s.Fragment,{children:e}):s.jsx(vre,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:d,initialMinZoom:f,initialMaxZoom:p,nodeOrigin:h,nodeExtent:g,zIndexMode:y,children:e})}const jre={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function kre({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:d,onInit:f,onMove:p,onMoveStart:h,onMoveEnd:g,onConnect:y,onConnectStart:S,onConnectEnd:w,onClickConnectStart:b,onClickConnectEnd:j,onNodeMouseEnter:N,onNodeMouseMove:k,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:T,onNodeDragStart:R,onNodeDrag:D,onNodeDragStop:$,onNodesDelete:z,onEdgesDelete:A,onDelete:F,onSelectionChange:W,onSelectionDragStart:P,onSelectionDrag:O,onSelectionDragStop:B,onSelectionContextMenu:H,onSelectionStart:L,onSelectionEnd:U,onBeforeDelete:M,connectionMode:V,connectionLineType:Y=ri.Bezier,connectionLineStyle:q,connectionLineComponent:J,connectionLineContainerStyle:ne,deleteKeyCode:Q="Backspace",selectionKeyCode:ce="Shift",selectionOnDrag:te=!1,selectionMode:pe=pd.Full,panActivationKeyCode:be="Space",multiSelectionKeyCode:Ee=gd()?"Meta":"Control",zoomActivationKeyCode:Te=gd()?"Meta":"Control",snapToGrid:Se,snapGrid:Be,onlyRenderVisibleElements:oe=!1,selectNodesOnDrag:je,nodesDraggable:ke,autoPanOnNodeFocus:_e,nodesConnectable:Ue,nodesFocusable:et,nodeOrigin:Me=q3,edgesFocusable:qe,edgesReconnectable:vt,elementsSelectable:ft=!0,defaultViewport:st=Gte,minZoom:le=.5,maxZoom:ee=2,translateExtent:ye=fd,preventScrolling:ie=!0,nodeExtent:we,defaultMarkerColor:$e="#b1b1b7",zoomOnScroll:Ce=!0,zoomOnPinch:se=!0,panOnScroll:me=!1,panOnScrollSpeed:Pe=.5,panOnScrollMode:Ke=ra.Free,zoomOnDoubleClick:de=!0,panOnDrag:pt=!0,onPaneClick:xt,onPaneMouseEnter:jt,onPaneMouseMove:lt,onPaneMouseLeave:ge,onPaneScroll:He,onPaneContextMenu:Je,paneClickDistance:It=1,nodeClickDistance:qt=0,children:un,onReconnect:Ut,onReconnectStart:Un,onReconnectEnd:St,onEdgeContextMenu:$n,onEdgeDoubleClick:Nt,onEdgeMouseEnter:ue,onEdgeMouseMove:We,onEdgeMouseLeave:ot,reconnectRadius:yt=10,onNodesChange:Gn,onEdgesChange:vr,noDragClassName:rs="nodrag",noWheelClassName:va="nowheel",noPanClassName:ht="nopan",fitView:yi,fitViewOptions:Co,connectOnClick:wa,attributionPosition:en,proOptions:ja,defaultEdgeOptions:ka,elevateNodesOnSelect:Sa=!0,elevateEdgesOnSelect:Ec=!1,disableKeyboardA11y:Na=!1,autoPanOnConnect:Kt,autoPanOnNodeDrag:Tc,autoPanOnSelection:bi=!0,autoPanSpeed:Ca,connectionRadius:Es,isValidConnection:Eo,onError:Ea,style:To,id:tn,nodeDragThreshold:Ro,connectionDragThreshold:In,viewport:Rc,onViewportChange:Ac,width:Pc,height:Hn,colorMode:Ao="light",debug:Ts,onScroll:zr,ariaLabelConfig:Ta,zIndexMode:vi="basic",...Zs},wi){const Ot=tn||"1",wr=Jte(Ao),ji=m.useCallback(Po=>{Po.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),zr==null||zr(Po)},[zr]);return s.jsx("div",{"data-testid":"rf__wrapper",...Zs,onScroll:ji,style:{...To,...jre},ref:wi,className:Nn(["react-flow",o,wr]),id:tn,role:"application",children:s.jsxs(wre,{nodes:e,edges:t,width:Pc,height:Hn,fitView:yi,fitViewOptions:Co,minZoom:le,maxZoom:ee,nodeOrigin:Me,nodeExtent:we,zIndexMode:vi,children:[s.jsx(Qte,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:S,onConnectEnd:w,onClickConnectStart:b,onClickConnectEnd:j,nodesDraggable:ke,autoPanOnNodeFocus:_e,nodesConnectable:Ue,nodesFocusable:et,edgesFocusable:qe,edgesReconnectable:vt,elementsSelectable:ft,elevateNodesOnSelect:Sa,elevateEdgesOnSelect:Ec,minZoom:le,maxZoom:ee,nodeExtent:we,onNodesChange:Gn,onEdgesChange:vr,snapToGrid:Se,snapGrid:Be,connectionMode:V,translateExtent:ye,connectOnClick:wa,defaultEdgeOptions:ka,fitView:yi,fitViewOptions:Co,onNodesDelete:z,onEdgesDelete:A,onDelete:F,onNodeDragStart:R,onNodeDrag:D,onNodeDragStop:$,onSelectionDrag:O,onSelectionDragStart:P,onSelectionDragStop:B,onMove:p,onMoveStart:h,onMoveEnd:g,noPanClassName:ht,nodeOrigin:Me,rfId:Ot,autoPanOnConnect:Kt,autoPanOnNodeDrag:Tc,autoPanSpeed:Ca,onError:Ea,connectionRadius:Es,isValidConnection:Eo,selectNodesOnDrag:je,nodeDragThreshold:Ro,connectionDragThreshold:In,onBeforeDelete:M,debug:Ts,ariaLabelConfig:Ta,zIndexMode:vi}),s.jsx(xre,{onInit:f,onNodeClick:l,onEdgeClick:d,onNodeMouseEnter:N,onNodeMouseMove:k,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:T,nodeTypes:i,edgeTypes:a,connectionLineType:Y,connectionLineStyle:q,connectionLineComponent:J,connectionLineContainerStyle:ne,selectionKeyCode:ce,selectionOnDrag:te,selectionMode:pe,deleteKeyCode:Q,multiSelectionKeyCode:Ee,panActivationKeyCode:be,zoomActivationKeyCode:Te,onlyRenderVisibleElements:oe,defaultViewport:st,translateExtent:ye,minZoom:le,maxZoom:ee,preventScrolling:ie,zoomOnScroll:Ce,zoomOnPinch:se,zoomOnDoubleClick:de,panOnScroll:me,panOnScrollSpeed:Pe,panOnScrollMode:Ke,panOnDrag:pt,autoPanOnSelection:bi,onPaneClick:xt,onPaneMouseEnter:jt,onPaneMouseMove:lt,onPaneMouseLeave:ge,onPaneScroll:He,onPaneContextMenu:Je,paneClickDistance:It,nodeClickDistance:qt,onSelectionContextMenu:H,onSelectionStart:L,onSelectionEnd:U,onReconnect:Ut,onReconnectStart:Un,onReconnectEnd:St,onEdgeContextMenu:$n,onEdgeDoubleClick:Nt,onEdgeMouseEnter:ue,onEdgeMouseMove:We,onEdgeMouseLeave:ot,reconnectRadius:yt,defaultMarkerColor:$e,noDragClassName:rs,noWheelClassName:va,noPanClassName:ht,rfId:Ot,disableKeyboardA11y:Na,nodeExtent:we,viewport:Rc,onViewportChange:Ac}),s.jsx(Kte,{onSelectionChange:W}),un,s.jsx(Ute,{proOptions:ja,position:en}),s.jsx(Bte,{rfId:Ot,disableKeyboardA11y:Na})]})})}var Sre=X3(kre);function Nre(e){const[t,n]=m.useState(e),r=m.useCallback(o=>n(i=>G3(o,i)),[]);return[t,n,r]}function Cre(e){const[t,n]=m.useState(e),r=m.useCallback(o=>n(i=>Y3(o,i)),[]);return[t,n,r]}function Ere({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:Nn(["react-flow__background-pattern",n,r])})}function Tre({radius:e,className:t}){return s.jsx("circle",{cx:e,cy:e,r:e,className:Nn(["react-flow__background-pattern","dots",t])})}var ii;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ii||(ii={}));const Rre={[ii.Dots]:1,[ii.Lines]:1,[ii.Cross]:6},Are=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function vD({id:e,variant:t=ii.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:a,bgColor:l,style:d,className:f,patternClassName:p}){const h=m.useRef(null),{transform:g,patternId:y}=Et(Are,sn),S=r||Rre[t],w=t===ii.Dots,b=t===ii.Cross,j=Array.isArray(n)?n:[n,n],N=[j[0]*g[2]||1,j[1]*g[2]||1],k=S*g[2],C=Array.isArray(i)?i:[i,i],I=b?[k,k]:N,T=[C[0]*g[2]||1+I[0]/2,C[1]*g[2]||1+I[1]/2],R=`${y}${e||""}`;return s.jsxs("svg",{className:Nn(["react-flow__background",f]),style:{...d,...Qm,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:h,"data-testid":"rf__background",children:[s.jsx("pattern",{id:R,x:g[0]%N[0],y:g[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:w?s.jsx(Tre,{radius:k/2,className:p}):s.jsx(Ere,{dimensions:I,lineWidth:o,variant:t,className:p})}),s.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}vD.displayName="Background";const Pre=m.memo(vD);function _re(){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 Dre(){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 $re(){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 Ire(){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 Mre(){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 wp({children:e,className:t,...n}){return s.jsx("button",{type:"button",className:Nn(["react-flow__controls-button",t]),...n,children:e})}const Lre=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function wD({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:d,className:f,children:p,position:h="bottom-left",orientation:g="vertical","aria-label":y}){const S=on(),{isInteractive:w,minZoomReached:b,maxZoomReached:j,ariaLabelConfig:N}=Et(Lre,sn),{zoomIn:k,zoomOut:C,fitView:I}=Xm(),T=()=>{k(),i==null||i()},R=()=>{C(),a==null||a()},D=()=>{I(o),l==null||l()},$=()=>{S.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d==null||d(!w)},z=g==="horizontal"?"horizontal":"vertical";return s.jsxs(Gd,{className:Nn(["react-flow__controls",z,f]),position:h,style:e,"data-testid":"rf__controls","aria-label":y??N["controls.ariaLabel"],children:[t&&s.jsxs(s.Fragment,{children:[s.jsx(wp,{onClick:T,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:j,children:s.jsx(_re,{})}),s.jsx(wp,{onClick:R,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:b,children:s.jsx(Dre,{})})]}),n&&s.jsx(wp,{className:"react-flow__controls-fitview",onClick:D,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:s.jsx($re,{})}),r&&s.jsx(wp,{className:"react-flow__controls-interactive",onClick:$,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:w?s.jsx(Mre,{}):s.jsx(Ire,{})}),p]})}wD.displayName="Controls";const Ore=m.memo(wD);function Fre({id:e,x:t,y:n,width:r,height:o,style:i,color:a,strokeColor:l,strokeWidth:d,className:f,borderRadius:p,shapeRendering:h,selected:g,onClick:y}){const{background:S,backgroundColor:w}=i||{},b=a||S||w;return s.jsx("rect",{className:Nn(["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:d},shapeRendering:h,onClick:y?j=>y(j,e):void 0})}const zre=m.memo(Fre),Bre=e=>e.nodes.map(t=>t.id),Yy=e=>e instanceof Function?e:()=>e;function Ure({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=zre,onClick:a}){const l=Et(Bre,sn),d=Yy(t),f=Yy(e),p=Yy(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return s.jsx(s.Fragment,{children:l.map(g=>s.jsx(Vre,{id:g,nodeColorFunc:d,nodeStrokeColorFunc:f,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:a,shapeRendering:h},g))})}function Hre({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:d}){const{node:f,x:p,y:h,width:g,height:y}=Et(S=>{const w=S.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const b=w.internals.userNode,{x:j,y:N}=w.internals.positionAbsolute,{width:k,height:C}=No(b);return{node:b,x:j,y:N,width:k,height:C}},sn);return!f||f.hidden||!j3(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:d,id:f.id})}const Vre=m.memo(Hre);var Wre=m.memo(Ure);const qre=200,Kre=150,Gre=e=>!e.hidden,Yre=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?v3(qd(e.nodeLookup,{filter:Gre}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Xre="react-flow__minimap-desc";function jD({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:d,maskColor:f,maskStrokeColor:p,maskStrokeWidth:h,position:g="bottom-right",onClick:y,onNodeClick:S,pannable:w=!1,zoomable:b=!1,ariaLabel:j,inversePan:N,zoomStep:k=1,offsetScale:C=5}){const I=on(),T=m.useRef(null),{boundingRect:R,viewBB:D,rfId:$,panZoom:z,translateExtent:A,flowWidth:F,flowHeight:W,ariaLabelConfig:P}=Et(Yre,sn),O=(e==null?void 0:e.width)??qre,B=(e==null?void 0:e.height)??Kre,H=R.width/O,L=R.height/B,U=Math.max(H,L),M=U*O,V=U*B,Y=C*U,q=R.x-(M-R.width)/2-Y,J=R.y-(V-R.height)/2-Y,ne=M+Y*2,Q=V+Y*2,ce=`${Xre}-${$}`,te=m.useRef(0),pe=m.useRef();te.current=U,m.useEffect(()=>{if(T.current&&z)return pe.current=cte({domNode:T.current,panZoom:z,getTransform:()=>I.getState().transform,getViewScale:()=>te.current}),()=>{var Se;(Se=pe.current)==null||Se.destroy()}},[z]),m.useEffect(()=>{var Se;(Se=pe.current)==null||Se.update({translateExtent:A,width:F,height:W,inversePan:N,pannable:w,zoomStep:k,zoomable:b})},[w,b,N,k,A,F,W]);const be=y?Se=>{var je;const[Be,oe]=((je=pe.current)==null?void 0:je.pointer(Se))||[0,0];y(Se,{x:Be,y:oe})}:void 0,Ee=S?m.useCallback((Se,Be)=>{const oe=I.getState().nodeLookup.get(Be).internals.userNode;S(Se,oe)},[]):void 0,Te=j??P["minimap.ariaLabel"];return s.jsx(Gd,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d: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*U: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:Nn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:s.jsxs("svg",{width:O,height:B,viewBox:`${q} ${J} ${ne} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ce,ref:T,onClick:be,children:[Te&&s.jsx("title",{id:ce,children:Te}),s.jsx(Wre,{onClick:Ee,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:a,nodeComponent:l}),s.jsx("path",{className:"react-flow__minimap-mask",d:`M${q-Y},${J-Y}h${ne+Y*2}v${Q+Y*2}h${-ne-Y*2}z
|
|
639
|
+
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}jD.displayName="MiniMap";m.memo(jD);const Qre=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Jre={[nc.Line]:"right",[nc.Handle]:"bottom-right"};function Zre({nodeId:e,position:t,variant:n=nc.Handle,className:r,style:o=void 0,children:i,color:a,minWidth:l=10,minHeight:d=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:g,autoScale:y=!0,shouldResize:S,onResizeStart:w,onResize:b,onResizeEnd:j}){const N=eD(),k=typeof e=="string"?e:N,C=on(),I=m.useRef(null),T=n===nc.Handle,R=Et(m.useCallback(Qre(T&&y),[T,y]),sn),D=m.useRef(null),$=t??Jre[n];m.useEffect(()=>{if(!(!I.current||!k))return D.current||(D.current=jte({domNode:I.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:A,transform:F,snapGrid:W,snapToGrid:P,nodeOrigin:O,domNode:B}=C.getState();return{nodeLookup:A,transform:F,snapGrid:W,snapToGrid:P,nodeOrigin:O,paneDomNode:B}},onChange:(A,F)=>{const{triggerNodeChanges:W,nodeLookup:P,parentLookup:O,nodeOrigin:B}=C.getState(),H=[],L={x:A.x,y:A.y},U=P.get(k);if(U&&U.expandParent&&U.parentId){const M=U.origin??B,V=A.width??U.measured.width??0,Y=A.height??U.measured.height??0,q={id:U.id,parentId:U.parentId,rect:{width:V,height:Y,...k3({x:A.x??U.position.x,y:A.y??U.position.y},{width:V,height:Y},U.parentId,P,M)}},J=S0([q],P,O,B);H.push(...J),L.x=A.x?Math.max(M[0]*V,A.x):void 0,L.y=A.y?Math.max(M[1]*Y,A.y):void 0}if(L.x!==void 0&&L.y!==void 0){const M={id:k,type:"position",position:{...L}};H.push(M)}if(A.width!==void 0&&A.height!==void 0){const V={id:k,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:A.width,height:A.height}};H.push(V)}for(const M of F){const V={...M,type:"position"};H.push(V)}W(H)},onEnd:({width:A,height:F})=>{const W={id:k,type:"dimensions",resizing:!1,dimensions:{width:A,height:F}};C.getState().triggerNodeChanges([W])}})),D.current.update({controlPosition:$,boundaries:{minWidth:l,minHeight:d,maxWidth:f,maxHeight:p},keepAspectRatio:h,resizeDirection:g,onResizeStart:w,onResize:b,onResizeEnd:j,shouldResize:S}),()=>{var A;(A=D.current)==null||A.destroy()}},[$,l,d,f,p,h,w,b,j,S]);const z=$.split("-");return s.jsx("div",{className:Nn(["react-flow__resize-control","nodrag",...z,n,r]),ref:I,style:{...o,scale:R,...a&&{[T?"backgroundColor":"borderColor"]:a}},children:i})}m.memo(Zre);var kD=Object.defineProperty,ese=(e,t,n)=>t in e?kD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tse=(e,t)=>{for(var n in t)kD(e,n,{get:t[n],enumerable:!0})},nse=(e,t,n)=>ese(e,t+"",n),SD={};tse(SD,{Graph:()=>Cs,alg:()=>C0,json:()=>CD,version:()=>ose});var rse=Object.defineProperty,ND=(e,t)=>{for(var n in t)rse(e,n,{get:t[n],enumerable:!0})},Cs=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,d=!1;typeof e=="object"&&e!==null&&"v"in e?(o=e.v,i=e.w,a=e.name,arguments.length===2&&(l=t,d=!0)):(o=e,i=t,a=r,arguments.length>2&&(l=n,d=!0)),o=""+o,i=""+i,a!==void 0&&(a=""+a);let f=Cu(this._isDirected,o,i,a);if(f in this._edgeLabels)return d&&(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]=d?l:this._defaultEdgeLabelFn(o,i,a);let p=sse(this._isDirected,o,i,a);return o=p.v,i=p.w,Object.freeze(p),this._edgeObjs[f]=p,eE(this._preds[i],o),eE(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?Xy(this._isDirected,e):Cu(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?Xy(this._isDirected,e):Cu(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?Xy(this._isDirected,e):Cu(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],tE(this._preds[a],i),tE(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 eE(e,t){e[t]?e[t]++:e[t]=1}function tE(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Cu(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 sse(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 Xy(e,t){return Cu(e,t.v,t.w,t.name)}var ose="4.0.1",CD={};ND(CD,{read:()=>cse,write:()=>ise});function ise(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:ase(e),edges:lse(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function ase(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 lse(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 cse(e){let t=new Cs(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 C0={};ND(C0,{CycleException:()=>Ih,bellmanFord:()=>ED,components:()=>fse,dijkstra:()=>$h,dijkstraAll:()=>mse,findCycles:()=>gse,floydWarshall:()=>yse,isAcyclic:()=>vse,postorder:()=>jse,preorder:()=>kse,prim:()=>Sse,shortestPaths:()=>Nse,tarjan:()=>RD,topsort:()=>AD});var use=()=>1;function ED(e,t,n,r){return dse(e,String(t),n||use,r||function(o){return e.outEdges(o)})}function dse(e,t,n,r){let o={},i,a=0,l=e.nodes(),d=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,S=y===g.v?g.w:g.v;d({v:y,w:S})})})};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 fse(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 TD=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}},pse=()=>1;function $h(e,t,n,r){let o=function(i){return e.outEdges(i)};return hse(e,String(t),n||pse,r||o)}function hse(e,t,n,r){let o={},i=new TD,a,l,d=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(d);return o}function mse(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=$h(e,o,t,n),r},{})}function RD(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(d){d in r?r[d].onStack&&(l.lowlink=Math.min(l.lowlink,r[d].index)):(i(d),l.lowlink=Math.min(l.lowlink,r[d].lowlink))}),l.lowlink===l.index){let d=[],f;do f=n.pop(),r[f].onStack=!1,d.push(f);while(a!==f);o.push(d)}}return e.nodes().forEach(function(a){a in r||i(a)}),o}function gse(e){return RD(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var xse=()=>1;function yse(e,t,n){return bse(e,t||xse,n||function(r){return e.outEdges(r)})}function bse(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,d=t(a);r[i][l]={distance:d,predecessor:i}})}),o.forEach(function(i){let a=r[i];o.forEach(function(l){let d=r[l];o.forEach(function(f){let p=d[i],h=a[f],g=d[f],y=p.distance+h.distance;y<g.distance&&(g.distance=y,g.predecessor=h.predecessor)})})}),r}var Ih=class extends Error{constructor(...e){super(...e)}};function AD(e){let t={},n={},r=[];function o(i){if(i in n)throw new Ih;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 Ih;return r}function vse(e){try{AD(e)}catch(t){if(t instanceof Ih)return!1;throw t}return!0}function wse(e,t,n,r,o){Array.isArray(t)||(t=[t]);let i=(l=>{var d;return(d=e.isDirected()?e.successors(l):e.neighbors(l))!=null?d:[]}),a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);o=PD(e,l,n==="post",a,i,r,o)}),o}function PD(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=PD(e,l,n,r,o,i,a)}),n&&(a=i(a,t))),a}function _D(e,t,n){return wse(e,t,n,function(r,o){return r.push(o),r},[])}function jse(e,t){return _D(e,t,"post")}function kse(e,t){return _D(e,t,"pre")}function Sse(e,t){let n=new Cs,r={},o=new TD,i;function a(d){let f=d.v===i?d.w:d.v,p=o.priority(f);if(p!==void 0){let h=t(d);h<p&&(r[f]=i,o.decrease(f,h))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(d){o.add(d,Number.POSITIVE_INFINITY),n.setNode(d)}),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 Nse(e,t,n,r){return Cse(e,t,n,r??(o=>{let i=e.outEdges(o);return i??[]}))}function Cse(e,t,n,r){if(n===void 0)return $h(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 d=0;d<l.length;d++){let f=l[d],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 ED(e,t,n,r)}return $h(e,t,n,r)}function Cc(e,t,n,r){let o=r;for(;e.hasNode(o);)o=E0(r);return n.dummy=t,e.setNode(o,n),o}function Ese(e){let t=new Cs().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 DD(e){let t=new Cs({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 nE(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 d,f;return Math.abs(i)*a>Math.abs(o)*l?(i<0&&(l=-l),d=l*o/i,f=l):(o<0&&(a=-a),d=a,f=a*i/o),{x:n+d,y:r+f}}function Zm(e){let t=yd(ID(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 Tse(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=Hs(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function Rse(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=Hs(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(d=>e.node(d).rank+=o)})}function rE(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),Cc(e,"border",o,t)}function Ase(e,t=$D){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n}var $D=65535;function Hs(e,t){if(t.length>$D){let n=Ase(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function ID(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return Hs(Math.max,t)}function Pse(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function _se(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Dse(e,t){return t()}var $se=0;function E0(e){let t=++$se;return e+(""+t)}function yd(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 Mh(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function eg(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 Ise(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}var tg="\0",Mse=class{constructor(){nse(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return sE(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&sE(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,Lse)),n=n._prev;return"["+e.join(", ")+"]"}};function sE(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Lse(e,t){if(e!=="_next"&&e!=="_prev")return t}var Ose=Mse,Fse=()=>1;function zse(e,t){if(e.nodeCount()<=1)return[];let n=Use(e,t||Fse);return Bse(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function Bse(e,t,n){var r;let o=[],i=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)Qy(e,t,n,l);for(;l=i.dequeue();)Qy(e,t,n,l);if(e.nodeCount()){for(let d=t.length-2;d>0;--d)if(l=(r=t[d])==null?void 0:r.dequeue(),l){o=o.concat(Qy(e,t,n,l,!0)||[]);break}}}return o}function Qy(e,t,n,r,o){let i=[],a=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(l=>{let d=e.edge(l),f=e.node(l.v);o&&i.push({v:l.v,w:l.w}),f.out-=d,gv(t,n,f)}),(e.outEdges(r.v)||[]).forEach(l=>{let d=e.edge(l),f=l.w,p=e.node(f);p.in-=d,gv(t,n,p)}),e.removeNode(r.v),a}function Use(e,t){let n=new Cs,r=0,o=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let d=n.edge(l.v,l.w)||0,f=t(l),p=d+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=Hse(o+r+3).map(()=>new Ose),a=r+1;return n.nodes().forEach(l=>{gv(i,a,n.node(l))}),{graph:n,buckets:i,zeroIdx:a}}function gv(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 Hse(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function Vse(e){(e.graph().acyclicer==="greedy"?zse(e,t(e)):Wse(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,E0("rev"))});function t(n){return r=>n.edge(r).weight}}function Wse(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 qse(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 Kse(e){e.graph().dummyChains=[],e.edges().forEach(t=>Gse(e,t))}function Gse(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),d=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=Cc(e,"edge",p,"_d"),r===d&&(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 Yse(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 T0(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(d=>d==null?Number.POSITIVE_INFINITY:n(d.w)-e.edge(d).minlen):[],l=Hs(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),o.rank=l}e.sources().forEach(n)}function sc(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var MD=Xse;function Xse(e){let t=new Cs({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(;Qse(t,e)<o&&(i=Jse(t,e),!!i);)a=t.hasNode(i.v)?sc(e,i):-sc(e,i),Zse(t,e,a);return t}function Qse(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)&&!sc(t,i)&&(e.setNode(l,{}),e.setEdge(r,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function Jse(e,t){return t.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=sc(t,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function Zse(e,t,n){e.nodes().forEach(r=>t.node(r).rank+=n)}var{preorder:eoe,postorder:toe}=C0,noe=ba;ba.initLowLimValues=A0;ba.initCutValues=R0;ba.calcCutValue=LD;ba.leaveEdge=FD;ba.enterEdge=zD;ba.exchangeEdges=BD;function ba(e){e=Ese(e),T0(e);let t=MD(e);A0(t),R0(t,e);let n,r;for(;n=FD(t);)r=zD(t,e,n),BD(t,e,n,r)}function R0(e,t){let n=toe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>roe(e,t,r))}function roe(e,t,n){let r=e.node(n).parent,o=e.edge(n,r);o.cutvalue=LD(e,t,n)}function LD(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(d=>{let f=d.v===n,p=f?d.w:d.v;if(p!==r){let h=f===o,g=t.edge(d).weight;if(a+=h?g:-g,ooe(e,n,p)){let y=e.edge(n,p).cutvalue;a+=h?-y:y}}}),a}function A0(e,t){arguments.length<2&&(t=e.nodes()[0]),OD(e,{},1,t)}function OD(e,t,n,r,o){let i=n,a=e.node(r);t[r]=!0;let l=e.neighbors(r);return l&&l.forEach(d=>{Object.hasOwn(t,d)||(n=OD(e,t,n,d,r))}),a.low=i,a.lim=n++,o?a.parent=o:delete a.parent,n}function FD(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function zD(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,d=!1;return i.lim>a.lim&&(l=a,d=!0),t.edges().filter(f=>d===oE(e,e.node(f.v),l)&&d!==oE(e,e.node(f.w),l)).reduce((f,p)=>sc(t,p)<sc(t,f)?p:f)}function BD(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),A0(e),R0(e,t),soe(e,t)}function soe(e,t){let n=e.nodes().find(o=>!e.node(o).parent);if(!n)return;let r=eoe(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 ooe(e,t,n){return e.hasEdge(t,n)}function oE(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var ioe=aoe;function aoe(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":iE(e);break;case"tight-tree":coe(e);break;case"longest-path":loe(e);break;case"none":break;default:iE(e)}}var loe=T0;function coe(e){T0(e),MD(e)}function iE(e){noe(e)}var uoe=doe;function doe(e){let t=poe(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),o=r.edgeObj,i=foe(e,t,o.v,o.w),a=i.path,l=i.lca,d=0,f=a[d],p=!0;for(;n!==o.w;){if(r=e.node(n),p){for(;(f=a[d])!==l&&e.node(f).maxRank<r.rank;)d++;f===l&&(p=!1)}if(!p){for(;d<a.length-1&&e.node(a[d+1]).minRank<=r.rank;)d++;f=a[d]}f!==void 0&&e.setParent(n,f),n=e.successors(n)[0]}})}function foe(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),d;d=n;do d=e.parent(d),o.push(d);while(d&&(t[d].low>a||l>t[d].lim));let f=d,p=r;for(;(p=e.parent(p))!==f;)i.push(p);return{path:o.concat(i.reverse()),lca:f}}function poe(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(tg).forEach(r),t}function hoe(e){let t=Cc(e,"root",{},"_root"),n=moe(e),r=Object.values(n),o=Hs(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=i);let a=goe(e)+1;e.children(tg).forEach(l=>UD(e,t,i,a,o,n,l)),e.graph().nodeRankFactor=i}function UD(e,t,n,r,o,i,a){var l;let d=e.children(a);if(!d.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let f=rE(e,"_bt"),p=rE(e,"_bb"),h=e.node(a);e.setParent(f,a),h.borderTop=f,e.setParent(p,a),h.borderBottom=p,d.forEach(g=>{var y;UD(e,t,n,r,o,i,g);let S=e.node(g),w=S.borderTop?S.borderTop:g,b=S.borderBottom?S.borderBottom:g,j=S.borderTop?r:2*r,N=w!==b?1:o-((y=i[a])!=null?y:0)+1;e.setEdge(f,w,{weight:j,minlen:N,nestingEdge:!0}),e.setEdge(b,p,{weight:j,minlen:N,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,f,{weight:0,minlen:o+((l=i[a])!=null?l:0)})}function moe(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(tg).forEach(r=>n(r,1)),t}function goe(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function xoe(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var yoe=boe;function boe(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)aE(e,"borderLeft","_bl",n,o,i),aE(e,"borderRight","_br",n,o,i)}}e.children(tg).forEach(t)}function aE(e,t,n,r,o,i){let a={width:0,height:0,rank:i,borderType:t},l=o[t][i-1],d=Cc(e,"border",a,n);o[t][i]=d,e.setParent(d,r),l&&e.setEdge(l,d,{weight:1})}function voe(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&HD(e)}function woe(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&joe(e),(n==="lr"||n==="rl")&&(koe(e),HD(e))}function HD(e){e.nodes().forEach(t=>lE(e.node(t))),e.edges().forEach(t=>lE(e.edge(t)))}function lE(e){let t=e.width;e.width=e.height,e.height=t}function joe(e){e.nodes().forEach(t=>Jy(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Jy),Object.hasOwn(r,"y")&&Jy(r)})}function Jy(e){e.y=-e.y}function koe(e){e.nodes().forEach(t=>Zy(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Zy),Object.hasOwn(r,"x")&&Zy(r)})}function Zy(e){let t=e.x;e.x=e.y,e.y=t}function Soe(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),r=n.map(l=>e.node(l).rank),o=Hs(Math.max,r),i=yd(o+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let d=e.node(l);i[d.rank].push(l);let f=e.successors(l);f&&f.forEach(a)}return n.sort((l,d)=>e.node(l).rank-e.node(d).rank).forEach(a),i}function Noe(e,t){let n=0;for(let r=1;r<t.length;++r)n+=Coe(e,t[r-1],t[r]);return n}function Coe(e,t,n){let r=Ise(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),d=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;d+=f.weight*h}),d}function Eoe(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),d=e.node(a.v);return{sum:i.sum+l.weight*d.order,weight:i.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function Toe(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 Roe(r)}function Roe(e){let t=[];function n(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&Aoe(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=>Mh(o,["vs","i","barycenter","weight"]))}function Aoe(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 Poe(e,t){let n=Pse(e,p=>Object.hasOwn(p,"barycenter")),r=n.lhs,o=n.rhs.sort((p,h)=>h.i-p.i),i=[],a=0,l=0,d=0;r.sort(_oe(!!t)),d=cE(i,o,d),r.forEach(p=>{d+=p.vs.length,i.push(p.vs),a+=p.barycenter*p.weight,l+=p.weight,d=cE(i,o,d)});let f={vs:i.flat(1)};return l&&(f.barycenter=a/l,f.weight=l),f}function cE(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 _oe(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function VD(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,d={};a&&(o=o.filter(g=>g!==a&&g!==l));let f=Eoe(e,o);f.forEach(g=>{if(e.children(g.v).length){let y=VD(e,g.v,n,r);d[g.v]=y,Object.hasOwn(y,"barycenter")&&$oe(g,y)}});let p=Toe(f,n);Doe(p,d);let h=Poe(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]),S=e.predecessors(l),w=e.node(S[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+y.order+w.order)/(h.weight+2),h.weight+=2}}return h}function Doe(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function $oe(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 Ioe(e,t,n,r){r||(r=e.nodes());let o=Moe(e),i=new Cs({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let l=e.node(a),d=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){i.setNode(a),i.setParent(a,d||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 Moe(e){let t;for(;e.hasNode(t=E0("_root")););return t}function Loe(e,t,n){let r={},o;n.forEach(i=>{let a=e.parent(i),l,d;for(;a;){if(l=e.parent(a),l?(d=r[l],r[l]=a):(d=o,o=a),d&&d!==a){t.setEdge(d,a);return}a=l}})}function WD(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,WD);return}let n=ID(e),r=uE(e,yd(1,n+1),"inEdges"),o=uE(e,yd(n-1,-1,-1),"outEdges"),i=Soe(e);if(dE(e,i),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,d=t.constraints||[];for(let f=0,p=0;p<4;++f,++p){Ooe(f%2?r:o,f%4>=2,d),i=Zm(e);let h=Noe(e,i);h<a?(p=0,l=Object.assign({},i),a=h):h===a&&(l=structuredClone(i))}dE(e,l)}function uE(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 Ioe(e,i,n,r.get(i)||[])})}function Ooe(e,t,n){let r=new Cs;e.forEach(function(o){n.forEach(l=>r.setEdge(l.left,l.right));let i=o.graph().root,a=VD(o,i,r,t);a.vs.forEach((l,d)=>o.node(l).order=d),Loe(o,r,a.vs)})}function dE(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}function Foe(e,t){let n={};function r(o,i){let a=0,l=0,d=o.length,f=i[i.length-1];return i.forEach((p,h)=>{let g=Boe(e,p),y=g?e.node(g).order:d;(g||p===f)&&(i.slice(l,h+1).forEach(S=>{let w=e.predecessors(S);w&&w.forEach(b=>{let j=e.node(b),N=j.order;(N<a||y<N)&&!(j.dummy&&e.node(S).dummy)&&qD(n,b,S)})}),l=h+1,a=y)}),i}return t.length&&t.reduce(r),n}function zoe(e,t){let n={};function r(i,a,l,d,f){yd(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 S=e.node(y);S.dummy&&(S.order<d||S.order>f)&&qD(n,y,h)})}})}function o(i,a){let l=-1,d=-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;d=e.node(y).order,r(a,f,h,l,d),f=h,l=d}}r(a,f,a.length,d,i.length)}),a}return t.length&&t.reduce(o),n}function Boe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function qD(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 Uoe(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 Hoe(e,t,n,r){let o={},i={},a={};return t.forEach(l=>{l.forEach((d,f)=>{o[d]=d,i[d]=d,a[d]=f})}),t.forEach(l=>{let d=-1;l.forEach(f=>{let p=r(f);if(p&&p.length){let h=p.sort((y,S)=>{let w=a[y],b=a[S];return(w!==void 0?w:0)-(b!==void 0?b:0)}),g=(h.length-1)/2;for(let y=Math.floor(g),S=Math.ceil(g);y<=S;++y){let w=h[y];if(w===void 0)continue;let b=a[w];if(b!==void 0&&i[f]===f&&d<b&&!Uoe(n,f,w)){let j=o[w];j!==void 0&&(i[w]=f,i[f]=o[f]=j,d=b)}}}})}),{root:o,align:i}}function Voe(e,t,n,r,o=!1){let i={},a=Woe(e,t,n,o),l=o?"borderLeft":"borderRight";function d(y,S){let w=a.nodes().slice(),b={},j=w.pop();for(;j;){if(b[j])y(j);else{b[j]=!0,w.push(j);for(let N of S(j))w.push(N)}j=w.pop()}}function f(y){let S=a.inEdges(y);S?i[y]=S.reduce((w,b)=>{var j;let N=(j=i[b.v])!=null?j:0,k=a.edge(b);return Math.max(w,N+(k!==void 0?k:0))},0):i[y]=0}function p(y){let S=a.outEdges(y),w=Number.POSITIVE_INFINITY;S&&(w=S.reduce((j,N)=>{let k=i[N.w],C=a.edge(N);return Math.min(j,(k!==void 0?k:0)-(C!==void 0?C:0))},Number.POSITIVE_INFINITY));let b=e.node(y);w!==Number.POSITIVE_INFINITY&&b.borderType!==l&&(i[y]=Math.max(i[y]!==void 0?i[y]:0,w))}function h(y){return a.predecessors(y)||[]}function g(y){return a.successors(y)||[]}return d(f,h),d(p,g),Object.keys(r).forEach(y=>{var S;let w=n[y];w!==void 0&&(i[y]=(S=i[w])!=null?S:0)}),i}function Woe(e,t,n,r){let o=new Cs,i=e.graph(),a=Xoe(i.nodesep,i.edgesep,r);return t.forEach(l=>{let d;l.forEach(f=>{let p=n[f];if(p!==void 0){if(o.setNode(p),d!==void 0){let h=n[d];if(h!==void 0){let g=o.edge(h,p);o.setEdge(h,p,Math.max(a(e,f,d),g||0))}}d=f}})}),o}function qoe(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([l,d])=>{let f=Qoe(e,l)/2;o=Math.max(d+f,o),i=Math.min(d-f,i)});let a=o-i;return a<n[0]&&(n=[a,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function Koe(e,t){let n=Object.values(t),r=Hs(Math.min,n),o=Hs(Math.max,n);["u","d"].forEach(i=>{["l","r"].forEach(a=>{let l=i+a,d=e[l];if(!d||d===t)return;let f=Object.values(d),p=r-Hs(Math.min,f);a!=="l"&&(p=o-Hs(Math.max,f)),p&&(e[l]=eg(d,h=>h+p))})})}function Goe(e,t=void 0){let n=e.ul;return n?eg(n,(r,o)=>{var i,a;if(t){let d=t.toLowerCase(),f=e[d];if(f&&f[o]!==void 0)return f[o]}let l=Object.values(e).map(d=>{let f=d[o];return f!==void 0?f:0}).sort((d,f)=>d-f);return(((i=l[1])!=null?i:0)+((a=l[2])!=null?a:0))/2}):{}}function Yoe(e){let t=Zm(e),n=Object.assign(Foe(e,t),zoe(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 d=Hoe(e,o,n,p=>(a==="u"?e.predecessors(p):e.successors(p))||[]),f=Voe(e,o,d.root,d.align,l==="r");l==="r"&&(f=eg(f,p=>-p)),r[a+l]=f})});let i=qoe(e,r);return Koe(r,i),Goe(r,e.graph().align)}function Xoe(e,t,n){return(r,o,i)=>{let a=r.node(o),l=r.node(i),d=0,f;if(d+=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&&(d+=n?f:-f),f=void 0,d+=(a.dummy?t:e)/2,d+=(l.dummy?t:e)/2,d+=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&&(d+=n?f:-f),d}}function Qoe(e,t){return e.node(t).width}function Joe(e){e=DD(e),Zoe(e),Object.entries(Yoe(e)).forEach(([t,n])=>e.node(t).x=n)}function Zoe(e){let t=Zm(e),n=e.graph(),r=n.ranksep,o=n.rankalign,i=0;t.forEach(a=>{let l=a.reduce((d,f)=>{var p;let h=(p=e.node(f).height)!=null?p:0;return d>h?d:h},0);a.forEach(d=>{let f=e.node(d);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 eie(e,t={}){let n=t.debugTiming?_se:Dse;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>uie(e));return n(" runLayout",()=>tie(r,n,t)),n(" updateInputGraph",()=>nie(e,r)),r})}function tie(e,t,n){t(" makeSpaceForEdgeLabels",()=>die(e)),t(" removeSelfEdges",()=>vie(e)),t(" acyclic",()=>Vse(e)),t(" nestingGraph.run",()=>hoe(e)),t(" rank",()=>ioe(DD(e))),t(" injectEdgeLabelProxies",()=>fie(e)),t(" removeEmptyRanks",()=>Rse(e)),t(" nestingGraph.cleanup",()=>xoe(e)),t(" normalizeRanks",()=>Tse(e)),t(" assignRankMinMax",()=>pie(e)),t(" removeEdgeLabelProxies",()=>hie(e)),t(" normalize.run",()=>Kse(e)),t(" parentDummyChains",()=>uoe(e)),t(" addBorderSegments",()=>yoe(e)),t(" order",()=>WD(e,n)),t(" insertSelfEdges",()=>wie(e)),t(" adjustCoordinateSystem",()=>voe(e)),t(" position",()=>Joe(e)),t(" positionSelfEdges",()=>jie(e)),t(" removeBorderNodes",()=>bie(e)),t(" normalize.undo",()=>Yse(e)),t(" fixupEdgeLabelCoords",()=>xie(e)),t(" undoCoordinateSystem",()=>woe(e)),t(" translateGraph",()=>mie(e)),t(" assignNodeIntersects",()=>gie(e)),t(" reversePoints",()=>yie(e)),t(" acyclic.undo",()=>qse(e))}function nie(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 rie=["nodesep","edgesep","ranksep","marginx","marginy"],sie={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},oie=["acyclicer","ranker","rankdir","align","rankalign"],iie=["width","height","rank"],fE={width:0,height:0},aie=["minlen","weight","width","height","labeloffset"],lie={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},cie=["labelpos"];function uie(e){let t=new Cs({multigraph:!0,compound:!0}),n=tb(e.graph());return t.setGraph(Object.assign({},sie,eb(n,rie),Mh(n,oie))),e.nodes().forEach(r=>{let o=tb(e.node(r)),i=eb(o,iie);Object.keys(fE).forEach(l=>{i[l]===void 0&&(i[l]=fE[l])}),t.setNode(r,i);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let o=tb(e.edge(r));t.setEdge(r,Object.assign({},lie,eb(o,aie),Mh(o,cie)))}),t}function die(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 fie(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};Cc(e,"edge-proxy",o,"_ep")}})}function pie(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 hie(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 mie(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 d(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=>d(e.node(f))),e.edges().forEach(f=>{let p=e.edge(f);Object.hasOwn(p,"x")&&d(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 gie(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(nE(r,i)),n.points.push(nE(o,a))})}function xie(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 yie(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function bie(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 vie(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 wie(e){Zm(e).forEach(t=>{let n=0;t.forEach((r,o)=>{let i=e.node(r);i.order=o+n,(i.selfEdges||[]).forEach(a=>{Cc(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 jie(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,d=o.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*l/3,y:a-d},{x:i+5*l/6,y:a-d},{x:i+l,y:a},{x:i+5*l/6,y:a+d},{x:i+2*l/3,y:a+d}],r.label.x=n.x,r.label.y=n.y}})}function eb(e,t){return eg(Mh(e,t),Number)}function tb(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 kie(e,t,n={}){const r=new Map;if(e.length===0)return r;const o=n.nodeWidth??150,i=n.nodeHeight??64,a=new SD.Graph;a.setGraph({rankdir:n.direction??"LR",nodesep:40,ranksep:90}),a.setDefaultEdgeLabel(()=>({}));const l=new Set;for(const d of e)l.add(d.id),a.setNode(d.id,{width:o,height:i});for(const d of t)l.has(d.from)&&l.has(d.to)&&a.setEdge(d.from,d.to);eie(a);for(const d of l){const f=a.node(d);f&&r.set(d,{x:f.x-o/2,y:f.y-i/2})}return r}function Sie({data:e,selected:t}){const{label:n,statusId:r,color:o,terminal:i,orphan:a,missing:l}=e;return s.jsxs("div",{className:Ne("min-w-[120px] rounded-md border px-3 py-2 text-xs shadow-sm transition-colors",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"),children:[s.jsx(rc,{type:"target",position:rt.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(wL,{className:"h-3 w-3 shrink-0","aria-label":"Undefined status"}),a&&!l&&s.jsx(Vh,{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(DL,{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(rc,{type:"source",position:rt.Right,className:"!h-2 !w-2 !bg-muted-foreground"})]})}const Nie={status:Sie},Cie="oklch(var(--muted-foreground))",Eie="oklch(var(--primary))",Tie="oklch(var(--error-foreground))";function Rie({onRelayout:e}){const{fitView:t}=Xm();return s.jsx(Gd,{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(OL,{className:"h-3 w-3"}),"Re-layout"]})})}function pE({nodes:e,edges:t,selectedRowKey:n,editable:r,onSelectEdge:o,onCreateEdge:i,onDeleteEdge:a}){const[l,d,f]=Nre([]),[p,h]=Cre([]),g=m.useRef(new Map),[y,S]=m.useState(0),w=m.useMemo(()=>JSON.stringify(e.map(R=>[R.id,R.label,R.color??"",R.terminal,R.orphan,R.missing])),[e]);m.useEffect(()=>{const R=kie(e,t,{direction:"LR"}),D=new Set(e.map($=>$.id));for(const $ of g.current.keys())D.has($)||g.current.delete($);d(e.map($=>{let z=g.current.get($.id);return z||(z=R.get($.id)??{x:0,y:0},g.current.set($.id,z)),{id:$.id,type:"status",position:z,data:{label:$.label,statusId:$.id,color:$.color,terminal:$.terminal,orphan:$.orphan,missing:$.missing},draggable:!0,deletable:!1}}))},[w,y,d]);const b=m.useCallback(()=>{g.current.clear(),S(R=>R+1)},[]),j=m.useMemo(()=>t.map(R=>`${R.rowKey}:${R.from}>${R.to}:${R.command}:${R.requiresReason?1:0}:${R.undefinedRef?1:0}`).join("|"),[t]);m.useEffect(()=>{h(t.map(R=>{const D=R.rowKey===n,$=R.undefinedRef?Tie:D?Eie:Cie;return{id:R.rowKey,source:R.from,target:R.to,label:R.requiresReason?`${R.command} (reason)`:R.command,selected:D,deletable:r,markerEnd:{type:hd.ArrowClosed,color:$},style:{stroke:$,strokeWidth:D?2.5:1.5},labelStyle:{fill:"oklch(var(--foreground))",fontSize:11,fontFamily:"ui-monospace, monospace"},labelBgStyle:{fill:"oklch(var(--card))"},labelBgPadding:[4,2],labelBgBorderRadius:4}}))},[j,n,r,h]);const N=m.useCallback(R=>{for(const D of R)D.type==="position"&&D.position&&g.current.set(D.id,D.position);f(R)},[f]),k=m.useCallback(R=>{r&&R.source&&R.target&&i(R.source,R.target)},[r,i]),C=m.useCallback(R=>{if(r)for(const D of R)a(D.id)},[r,a]),I=m.useCallback((R,D)=>o(D.id),[o]),T=m.useCallback(({edges:R})=>{R.length===1&&o(R[0].id)},[o]);return s.jsx("div",{className:"h-[460px] w-full overflow-hidden rounded-md border border-border/60 bg-background",children:s.jsxs(Sre,{nodes:l,edges:p,nodeTypes:Nie,onNodesChange:N,onConnect:k,onEdgesDelete:C,onEdgeClick:I,onSelectionChange:T,nodesConnectable:r,deleteKeyCode:r?["Backspace","Delete"]:null,elementsSelectable:!0,fitView:!0,fitViewOptions:{padding:.2},proOptions:{hideAttribution:!1},children:[s.jsx(Pre,{gap:16}),s.jsx(Ore,{showInteractive:!1}),s.jsx(Rie,{onRelayout:b})]})})}const jp="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 Aie({transition:e,statuses:t,knownCommands:n,onChange:r,onDelete:o,disabled:i}){const a=m.useRef(null);if(m.useEffect(()=>{var y;e&&!i&&((y=a.current)==null||y.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,d=new Set(t.map(y=>y.id)),f=!d.has(l.from),p=!d.has(l.to);function h(y){r({...l,...y})}function g(y,S,w,b){const j=d.has(y);return s.jsxs("select",{ref:b,value:y,onChange:N=>S(N.target.value),disabled:i,"aria-label":w,className:`${jp} w-full font-mono`,children:[!j&&y!==""&&s.jsxs("option",{value:y,children:[y," (undefined)"]}),y===""&&s.jsx("option",{value:"",children:"Select a status…"}),t.map(N=>s.jsxs("option",{value:N.id,children:[N.label," (",N.id,")"]},N.id))]})}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(jn,{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"}),g(l.from,y=>h({from:y}),"From status",a),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("input",{type:"text",list:"transition-inspector-commands",value:l.command,onChange:y=>h({command:y.target.value}),disabled:i,placeholder:"command",className:`${jp} w-full font-mono`})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"To status"}),g(l.to,y=>h({to:y}),"To status"),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:y=>h({label:y.target.value}),disabled:i,placeholder:"label",className:`${jp} 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:y=>h({description:y.target.value}),disabled:i,placeholder:"description",rows:2,className:`${jp} w-full resize-y`})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("button",{type:"button",role:"switch","aria-checked":l.requiresReason,"aria-label":"Requires reason",onClick:()=>h({requiresReason:!l.requiresReason}),disabled:i,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${l.requiresReason?"bg-primary":"bg-muted"}`,children:s.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm transition-transform ${l.requiresReason?"translate-x-4":"translate-x-0"}`})}),"Requires a reason"]}),s.jsx("datalist",{id:"transition-inspector-commands",children:n.map(y=>s.jsx("option",{value:y},y))})]})}function hE(){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-2.5 w-4 rounded",style:{backgroundColor:"oklch(var(--error-foreground))"}}),"references an undefined status"]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full border-2 border-dashed border-error-foreground/70"}),"ghost (undefined) status"]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-sm border border-warning-foreground/70 bg-warning/10"}),"orphan status (no incoming edge)"]})]})}function Pie({value:e,customizing:t,statuses:n,knownCommands:r,onChange:o,onCustomize:i,disabled:a}){var k;const l=m.useMemo(()=>new Set(n.map(C=>C.id)),[n]),[d,f]=m.useState(null),p=m.useMemo(()=>tv($_()),[]),h=m.useMemo(()=>KN(p,n),[p,n]);if(!t&&e.length===0)return s.jsxs(Ye,{title:"Transitions",description:"Which commands move an assignment between statuses, as a state-machine graph. Showing the built-in defaults.",actions:s.jsx("button",{type:"button",onClick:i,disabled:a,className:"shell-action text-xs",children:"Customize defaults"}),children:[s.jsx(hE,{}),s.jsx(pE,{nodes:h.nodes,edges:h.edges,selectedRowKey:null,editable:!1,onSelectEdge:()=>{},onCreateEdge:()=>{},onDeleteEdge:()=>{}})]});const g=I_(e,l),y=KN(e,n),S=e.find(C=>C.rowKey===d)??null;function w(C){o(e.map(I=>I.rowKey===C.rowKey?C:I))}function b(C){o(e.filter(I=>I.rowKey!==C)),d===C&&f(null)}function j(C,I){const T={rowKey:D_(),from:C,command:r[0]??"",to:I,label:"",description:"",requiresReason:!1};o([...e,T]),f(T.rowKey)}const N=((k=n[0])==null?void 0:k.id)??"";return s.jsxs(Ye,{title:"Transitions",description:"Statuses are nodes; commands are labeled directed edges. Drag node-to-node to add a transition, or use “Add transition”, then edit it in the panel.",actions:s.jsxs("button",{type:"button",onClick:()=>j(N,N),disabled:a||n.length===0,className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[s.jsx(Pt,{className:"h-3 w-3"}),"Add transition"]}),children:[g.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:g.map((C,I)=>s.jsx("li",{children:C},I))})]}),s.jsx(hE,{}),s.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(pE,{nodes:y.nodes,edges:y.edges,selectedRowKey:d,editable:!a,onSelectEdge:f,onCreateEdge:j,onDeleteEdge:b})}),s.jsx("div",{className:"w-full shrink-0 lg:w-80",children:s.jsx(Aie,{transition:S,statuses:n,knownCommands:r,onChange:w,onDelete:b,disabled:a})})]})]})}function _ie(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 Die(){var $e;const[e,t]=m.useState(!0),[n,r]=m.useState(null),[o,i]=m.useState(!1),[a,l]=m.useState([]),[d,f]=m.useState(!1),[p,h]=m.useState(null),[g,y]=m.useState(!1),[S,w]=m.useState(new Set),[b,j]=m.useState(new Map),[N,k]=m.useState({open:!1}),[C,I]=m.useState([]),[T,R]=m.useState([]),[D,$]=m.useState({open:!1}),[z,A]=m.useState(()=>My(_p)),[F,W]=m.useState(!1),[P,O]=m.useState(!1),[B,H]=m.useState(!1),[L,U]=m.useState([]),[M,V]=m.useState(!1),[Y,q]=m.useState([]),[J,ne]=m.useState("statuses"),Q=m.useCallback(Ce=>{const se=jX(Ce);l(se),i(Ce.custom),w(new Set(se.map(me=>me.id))),j(new Map),I(Ce.rawFacts??[]),R([]),A(My(Ce.derive??_p)),W(Ce.deriveCustom??!1),O(!1),H(!1),U(tv(Ce.transitions??[])),V(Ce.transitionsCustom??!1),q(Ce.knownCommands??[]),y(!1)},[]),ce=m.useCallback(async()=>{try{const Ce=await fetch("/api/config/statuses");if(!Ce.ok)throw new Error(`HTTP ${Ce.status}`);const se=await Ce.json();Q(se),r(null)}catch(Ce){r(Ce instanceof Error?Ce.message:"Failed to load config")}finally{t(!1)}},[Q]);m.useEffect(()=>{ce()},[ce]);function te(){setTimeout(()=>h(null),3e3)}const pe=m.useMemo(()=>a.map(Ce=>({id:Ce.id,label:Ce.label,color:Ce.color,terminal:Ce.terminal})),[a]),be=m.useMemo(()=>new Set(a.map(Ce=>Ce.id)),[a]),Ee=m.useMemo(()=>LX(C),[C]),Te=m.useMemo(()=>Cw(Ee),[Ee]),Se=m.useMemo(()=>kX(C),[C]),Be=m.useMemo(()=>{try{return __(ev(z),a,Te)}catch{return["derive rules are malformed"]}},[z,a,Te]),oe=m.useMemo(()=>M?I_(L,be):[],[L,M,be]),je=Se.length+Be.length+oe.length,ke=m.useCallback(Ce=>{I(Ce),y(!0)},[]),_e=m.useCallback(Ce=>{A(Ce),O(!0),H(!1),W(!0),y(!0)},[]),Ue=m.useCallback(()=>{A(My(_p)),H(!0),O(!0),W(!1),y(!0)},[]),et=m.useCallback(Ce=>{U(Ce),y(!0)},[]),Me=m.useCallback(()=>{U(Ce=>Ce.length>0?Ce:tv(qX($_(),be))),V(!0),y(!0)},[be]);async function qe(Ce=T){f(!0),h(null);try{const{body:se}=hX({statuses:a,order:a.map(de=>de.id),pendingResolutions:b,facts:C,factRemovalAcks:Ce,derive:B?null:P?ev(z):void 0,transitions:M?WX(L):void 0}),me=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)});if(!me.ok){const de=await me.json().catch(()=>null);if(me.status===409&&(de==null?void 0:de.error)==="unresolved-fact-references"&&de.references){$({open:!0,references:de.references}),f(!1);return}if((de==null?void 0:de.error)==="invalid-derive")throw new Error(`Invalid derive rules: ${(de.problems??[]).join("; ")}`);if((de==null?void 0:de.error)==="invalid-transitions")throw new Error(`Invalid transitions: ${(de.problems??[]).join("; ")}`);if((de==null?void 0:de.error)==="invalid-facts")throw new Error(`Invalid facts: ${(de.problems??[]).join("; ")}`);if(me.status===409&&(de==null?void 0:de.error)==="unresolved-orphans"){const pt=Array.isArray(de.unresolved)?de.unresolved.map(xt=>xt.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${pt}. Click the trash icon on each row to choose remap or delete.`)}if(me.status===409&&(de==null?void 0:de.error)==="concurrent-edit"){const pt=de.applied?` (${de.applied.remapped} remapped, ${de.applied.deleted} deleted before the conflict)`:"";h({type:"error",message:`Concurrent edit detected${pt}: ${de.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await ce();return}if(me.status===500&&(de==null?void 0:de.error)==="config-write-failed"&&(de!=null&&de.applied)){const{remapped:pt,deleted:xt}=de.applied,jt=de.message?`: ${de.message}`:"";h({type:"error",message:`Resolutions applied (${pt} remapped, ${xt} deleted) but the status config write failed${jt}. Click Save again to retry.`}),await ce();return}throw(de==null?void 0:de.error)==="invalid-remap-target"?new Error(`Invalid remap target (${de.reason}): ${de.id} → ${de.target}.`):(de==null?void 0:de.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(de.ids??[]).join(", ")}`):(de==null?void 0:de.error)==="stale-resolution"?new Error(`Stale resolution for id "${de.id??"?"}".`):(de==null?void 0:de.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${de.message??"unknown"}`):(de==null?void 0:de.error)==="remap-write-failed"||(de==null?void 0:de.error)==="delete-failed"||(de==null?void 0:de.error)==="scan-failed"?new Error(`${de.error}: ${de.cause??"unknown"}`):new Error((de==null?void 0:de.error)??`Save failed (HTTP ${me.status})`)}const Pe=await me.json();Q(Pe),$1();const Ke=Pe.applied?` (${Pe.applied.remapped} remapped, ${Pe.applied.deleted} deleted)`:"";h({type:"success",message:`Status config saved${Ke}`}),te()}catch(se){h({type:"error",message:se instanceof Error?se.message:"Save failed"})}finally{f(!1)}}async function vt(){f(!0),h(null);try{const Ce=await fetch("/api/config/statuses",{method:"DELETE"});if(!Ce.ok)throw new Error("Reset failed");const se=await Ce.json();Q(se),$1(),h({type:"success",message:"Reset to defaults"}),te()}catch(Ce){h({type:"error",message:Ce instanceof Error?Ce.message:"Reset failed"})}finally{f(!1)}}function ft(Ce,se,me){l(Pe=>{const Ke=[...Pe];return Ke[Ce]={...Ke[Ce],[se]:me},Ke}),y(!0)}function st(){const Ce=`status_${a.length+1}`;l(se=>[...se,{rowKey:T_(),id:Ce,label:"New Status",description:"",color:"",terminal:!1}]),y(!0)}function le(Ce){l(se=>{const me=se.filter(Ke=>Ke.id!==Ce),Pe=new Set(me.map(Ke=>Ke.id));return j(Ke=>BN(Ke,Pe)),me}),y(!0)}async function ee(Ce){const se=a[Ce].id,me=mX(se,z,L),Pe=gX(se,z);if(!S.has(se)){if(me.length===0){le(se);return}k({open:!0,affected:{id:se,count:0,truncated:!1,assignments:[]},pendingId:se,ruleReferences:me,headlineReferences:Pe});return}try{const Ke=await fetch(`/api/config/statuses/affected/${encodeURIComponent(se)}`);if(!Ke.ok)throw new Error(`HTTP ${Ke.status}`);const de=await Ke.json();if(de.count===0&&me.length===0){le(se);return}k({open:!0,affected:de,pendingId:se,ruleReferences:me,headlineReferences:Pe})}catch(Ke){h({type:"error",message:`Could not check affected assignments for "${se}": ${Ke instanceof Error?Ke.message:String(Ke)}`})}}function ye(Ce,se){if(!N.open)return;const{pendingId:me,affected:Pe,ruleReferences:Ke}=N;if(me!==Ce.id){k({open:!1});return}if(!a.some(de=>de.id===me)){h({type:"error",message:`Row for "${me}" was already removed — modal action ignored.`}),k({open:!1});return}Ce.mode==="remap"?(A(de=>xX(de,me,se)),U(de=>yX(de,me,se))):(A(de=>bX(de,me,se)),U(de=>vX(de,me))),Ke.some(de=>de.section!=="transitions")&&(O(!0),W(!0)),l(de=>{const pt=de.filter(jt=>jt.id!==me),xt=new Set(pt.map(jt=>jt.id));return j(jt=>{const lt=BN(jt,xt),ge=new Map(lt);return Pe.count>0&&ge.set(me,Ce),ge}),pt}),y(!0),k({open:!1})}function ie(){if(!D.open)return;const Ce=D.references.map(me=>me.factName),se=Array.from(new Set([...T,...Ce]));R(se),$({open:!1}),qe(se)}function we(){k({open:!1})}return e?s.jsx(bt,{label:"Loading workflow..."}):n?s.jsx(Tt,{error:n}):s.jsx(ea,{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(Cv,{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:vt,disabled:d||!o&&!g,children:[s.jsx(Gs,{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(Rm,{value:J,onValueChange:ne,items:[{value:"statuses",label:"Statuses",content:s.jsx(pX,{statuses:a,savedStatusIds:S,onUpdate:ft,onAdd:st,onRemove:ee,onReorder:Ce=>{l(Ce),y(!0)}})},{value:"transitions",label:"Transitions",problemCount:oe.length,content:s.jsx(Pie,{value:L,customizing:M,statuses:pe,knownCommands:Y,onChange:et,onCustomize:Me,disabled:d})},{value:"derive",label:"Derive Rules",problemCount:Be.length,content:s.jsx(zX,{value:z,deriveCustom:F,statuses:pe,acceptedFacts:Ee,onChange:_e,onReset:Ue,disabled:d})},{value:"facts",label:"Facts",problemCount:Se.length,content:s.jsx(TX,{rows:C,onChange:ke,saving:d})}]}),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 qe(),disabled:d||!g||je>0,children:[s.jsx(Hh,{className:"h-3.5 w-3.5"}),d?"Saving...":"Save Configuration"]}),g&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),ce()},disabled:d,children:"Discard Changes"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:_ie({transitions:oe.length,derive:Be.length,facts:Se.length}).message})]})]}),N.open&&s.jsx(cX,{open:N.open,affected:{...N.affected,label:(($e=a.find(Ce=>Ce.id===N.affected.id))==null?void 0:$e.label)??N.affected.id},remaining:a.filter(Ce=>Ce.id!==N.affected.id&&S.has(Ce.id)).map(Ce=>({id:Ce.id,label:Ce.label})),ruleReferences:N.ruleReferences,headlineReferences:N.headlineReferences,onResolve:ye,onCancel:we}),s.jsx(uX,{open:D.open,references:D.open?D.references:[],onConfirm:ie,onCancel:()=>{$({open:!1}),f(!1)}})]})})}const ho=e=>`${e.workspace}::${e.id}`;function mE(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function $ie(){var Ce;const{data:e,loading:t,error:n,refetch:r}=C2(),o=zt(),[i,a]=m.useState(""),l=m.useRef(null);mi("list:todos");const[d,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(""),[S,w]=m.useState("_global"),[b,j]=m.useState(null),[N,k]=m.useState(null),[C,I]=m.useState(new Set),[T,R]=m.useState(!1),D=m.useRef(null),[$,z]=m.useState(null),A=Qw("all"),[F,W]=m.useState(null),[P,O]=m.useState(null),B=m.useRef(null);m.useEffect(()=>{let se=!1;return(async()=>{try{const me=await fetch("/api/projects");if(!me.ok)return;const Pe=await me.json();se||z(Pe.filter(Ke=>!Ke.archived))}catch{}})(),()=>{se=!0}},[]);async function H(se,me){se.stopPropagation(),await Fd(me)&&(j(me),setTimeout(()=>j(Pe=>Pe===me?null:Pe),1500))}const L=m.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const se=[];for(const me of e.workspaces)for(const Pe of me.items)se.push({...Pe,workspace:me.workspace});return se},[e]),U=m.useMemo(()=>{const se=new Set;for(const me of L)for(const Pe of me.tags)se.add(Pe);return Array.from(se).sort()},[L]),M=m.useMemo(()=>{let se=L;if(i.trim()){const me=i.toLowerCase();se=se.filter(Pe=>Pe.description.toLowerCase().includes(me)||Pe.tags.some(Ke=>Ke.toLowerCase().includes(me))||Pe.id.includes(me))}return d&&(se=se.filter(me=>me.status===d)),p&&(se=se.filter(me=>me.tags.includes(p))),se},[L,i,d,p]);m.useEffect(()=>{I(new Set),D.current=null},[i,d,p]);const V=m.useMemo(()=>M.filter(se=>C.has(ho(se))),[M,C]),Y=M.length>0&&V.length===M.length,q=V.length>0&&!Y,J=m.useMemo(()=>{if(V.length===0)return null;const se=new Set(V.map(me=>me.workspace));return se.size===1?[...se][0]:null},[V]),ne=m.useMemo(()=>{if(!J||!$)return;const se=$.filter(me=>me.workspace===J);return se.length===1?se[0].slug:void 0},[J,$]),Q=((Ce=V[0])==null?void 0:Ce.description)??"",ce=m.useMemo(()=>{if(J)return null;const se=new Map;for(const me of V)se.has(me.workspace)||se.set(me.workspace,[]),se.get(me.workspace).push(me.id);return Array.from(se,([me,Pe])=>({workspace:me,todoIds:Pe}))},[V,J]),te=J?{kind:"workspace",workspace:J}:{kind:"aggregate",groups:ce??[]};function pe(se,me,Pe){const Ke=ho(se),de=!!(Pe&&"shiftKey"in Pe&&Pe.shiftKey),pt=D.current?Me.findIndex(xt=>ho(xt)===D.current):-1;if(de&&pt!==-1){const xt=Math.min(pt,me),jt=Math.max(pt,me);I(lt=>{const ge=new Set(lt);for(let He=xt;He<=jt;He++){const Je=Me[He];Je&&ge.add(ho(Je))}return ge})}else I(xt=>{const jt=new Set(xt);return jt.has(Ke)?jt.delete(Ke):jt.add(Ke),jt});D.current=Ke}function be(){I(se=>{const me=new Set(se);if(Y)for(const Pe of M)me.delete(ho(Pe));else for(const Pe of M)me.add(ho(Pe));return me})}function Ee(){I(new Set),D.current=null}function Te(se){Ee(),r(),se!=null&&se.assignmentRef&&o(mE(se.assignmentRef))}const Se=m.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const se={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const me of e.workspaces)se.open+=me.counts.open,se.in_progress+=me.counts.in_progress,se.completed+=me.counts.completed,se.blocked+=me.counts.blocked,se.total+=me.counts.total;return se},[e]);async function Be(){g.trim()&&(await Iv(S,g.trim()),y(""),r())}async function oe(se,me,Pe){switch(Pe){case"open":await A2(se,me);break;case"in_progress":await R2(se,me);break;case"completed":await E2(se,me);break;case"blocked":await T2(se,me);break}r()}async function je(se,me){await P2(se,me),r()}async function ke(se,me,Pe){await _2(se,me,Pe),r()}async function _e(se,me,Pe){await D2(se,me,Pe),r()}async function Ue(se,me,Pe){await $2(se,me,Pe),r()}const et=Xw(M),Me=et.filter(se=>!A.isCollapsed(se.config.id)).flatMap(se=>se.items),{hotkeyRowProps:qe}=Rd(Me,{scope:"list:todos",bindO:!1,onOpen:se=>k(ho(se))});Jt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var se;return(se=l.current)==null?void 0:se.focus()}}),Jt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>r()});const[vt,ft]=js(),st=vt.get("focus");m.useEffect(()=>{if(!st)return;const se=L.find(Pe=>Pe.id===st);if(!se)return;const me=Dm(se.status);A.isCollapsed(me)&&A.toggle(me)},[st,L]),m.useEffect(()=>{if(!st)return;const se=document.querySelector(`[data-todo-id="${CSS.escape(st)}"]`);if(!se)return;se.scrollIntoView({block:"nearest"}),se.classList.add("ring-2","ring-primary/60");const me=window.setTimeout(()=>{se.classList.remove("ring-2","ring-primary/60"),ft(Pe=>{const Ke=new URLSearchParams(Pe);return Ke.delete("focus"),Ke})},1500);return()=>window.clearTimeout(me)},[st,Me.length,ft]);const le=F?M.find(se=>ho(se)===F)??null:null;function ee(se,me){const Pe=B.current;if(Pe!=null&&Pe.closest(Gl)){se.preventDefault();return}se.dataTransfer.effectAllowed="move",se.dataTransfer.setData("text/plain",me),W(me)}function ye(){W(null),O(null)}function ie(se,me){!le||me.statuses.includes(le.status)||(se.preventDefault(),se.dataTransfer.dropEffect="move",O(me.id))}function we(se,me){P===me.id&&!se.currentTarget.contains(se.relatedTarget)&&O(null)}function $e(se,me){se.preventDefault();const Pe=le;ye(),!(!Pe||me.statuses.includes(Pe.status))&&oe(Pe.workspace,Pe.id,me.dropStatus)}return t?s.jsx(bt,{label:"Loading todos..."}):n?s.jsx(Tt,{error:n}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(qn,{label:"Open",value:Se.open,icon:Xr}),s.jsx(qn,{label:"In Progress",value:Se.in_progress,icon:Ev,tone:"info"}),s.jsx(qn,{label:"Blocked",value:Se.blocked,icon:Vh,tone:"warn"}),s.jsx(qn,{label:"Completed",value:Se.completed,icon:Xr,tone:"default"})]}),s.jsx("div",{className:"surface-panel p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("select",{value:S,onChange:se=>w(se.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(se=>se.workspace!=="_global").map(se=>s.jsx("option",{value:se.workspace,children:se.workspace},se.workspace))]}),s.jsx("input",{type:"text",placeholder:"Add a todo...",value:g,onChange:se=>y(se.target.value),onKeyDown:se=>se.key==="Enter"&&Be(),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:Be,disabled:!g.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(Pt,{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(pi,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:l,type:"text",placeholder:"Search todos...",value:i,onChange:se=>a(se.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:d,onChange:se=>f(se.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"})]}),U.length>0&&s.jsxs("select",{value:p,onChange:se=>h(se.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"}),U.map(se=>s.jsxs("option",{value:se,children:["#",se]},se))]})]}),V.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:[V.length," selected",J?s.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",s.jsx("strong",{children:J}),")"]}):s.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(V.map(se=>se.workspace)).size," workspaces"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>R(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),s.jsx("button",{type:"button",onClick:Ee,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,M.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:Y,ref:se=>{se&&(se.indeterminate=q)},onChange:be,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",M.length,")"]}),s.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),s.jsx("div",{className:"space-y-3",children:(()=>{let se=-1;return et.map(({config:me,items:Pe})=>{const Ke=!A.isCollapsed(me.id);return s.jsx(Yw,{label:me.label,count:Pe.length,expanded:Ke,onToggle:()=>A.toggle(me.id),isDropTarget:P===me.id,onDragOver:de=>ie(de,me),onDragLeave:de=>we(de,me),onDrop:de=>$e(de,me),children:Ke&&Pe.map(de=>{se+=1;const pt=se,xt=ho(de),jt=C.has(xt);return s.jsxs("div",{draggable:!0,"data-todo-id":de.id,...qe(pt),onMouseDown:lt=>{B.current=lt.target},onDragStart:lt=>ee(lt,xt),onDragEnd:ye,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${jt?"ring-1 ring-foreground/20":""} ${F===xt?"opacity-50 shadow-lg":""}`,children:[s.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${de.id}`,title:"Select",checked:jt,onChange:()=>{},onClick:lt=>{lt.stopPropagation(),pe(de,pt,lt)},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($P,{status:de.status,onChange:lt=>oe(de.workspace,de.id,lt)})}),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(MP,{description:de.description,status:de.status,editing:N===xt,onBeginEdit:()=>k(xt),onEndEdit:()=>k(null),onSave:lt=>ke(de.workspace,de.id,lt)}),de.tags.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:de.tags.map(lt=>`#${lt}`).join(" ")}),de.linkedAssignmentRef?s.jsxs(Ie,{to:mE(de.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:lt=>lt.stopPropagation(),children:[s.jsx(zE,{className:"h-2.5 w-2.5"}),de.linkedAssignmentRef.includes("/")?de.linkedAssignmentRef:`oneoff:${de.linkedAssignmentRef.slice(0,8)}`]}):null]}),s.jsx(LP,{item:de,attachmentUrl:(lt,ge)=>Mv(de.workspace,lt,ge),onAdd:lt=>_e(de.workspace,de.id,lt),onDelete:lt=>Ue(de.workspace,de.id,lt)})]}),s.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:de.workspace!=="_global"&&s.jsx(Ie,{to:`/w/${de.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:lt=>lt.stopPropagation(),children:de.workspace})}),b===de.id?s.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[s.jsx(Lr,{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:lt=>H(lt,de.id),children:["t:",de.id]}),s.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:lt=>H(lt,de.id),children:s.jsx(Jp,{className:"h-3 w-3"})})]}),s.jsx("button",{onClick:lt=>{lt.stopPropagation(),je(de.workspace,de.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${de.workspace}-${de.id}`)})},me.id)})})()}),s.jsx(Gw,{open:T,selectedIds:V.map(se=>se.id),scope:te,onOpenChange:R,onDone:Te,defaultProject:ne,defaultTitle:Q,allowOneOff:!0})]})}const Iie={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 Mie({bundle:e}){const t=Iie[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 Lie({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(Mie,{bundle:n},n.id))]})}function Oie(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const d=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),a(null)}catch(d){a(d instanceof Error?d.message:"Failed to fetch bundles")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),dc(d=>{d.type==="todos-updated"&&!d.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}function Fie(){const{workspace:e}=Bt(),t=e||"_global",{data:n,loading:r,error:o,refetch:i}=jO(t),{data:a}=Oie(t),[l,d]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState(""),[y,S]=m.useState(""),[w,b]=m.useState(null),[j,N]=m.useState(null),[k,C]=m.useState(new Set),[I,T]=m.useState(!1),[R,D]=m.useState(!1),[$,z]=m.useState(null),A=m.useRef(null);mi("list:todos");const F=Qw("workspace:"+t),[W,P]=m.useState(null),[O,B]=m.useState(null),H=m.useRef(null);async function L(ie,we){ie.stopPropagation(),await Fd(we)&&(b(we),setTimeout(()=>b($e=>$e===we?null:$e),1500))}const U=m.useMemo(()=>{if(!(n!=null&&n.items))return[];const ie=new Set;for(const we of n.items)for(const $e of we.tags)ie.add($e);return Array.from(ie).sort()},[n]),M=m.useMemo(()=>{if(!(n!=null&&n.items))return[];let ie=n.items;if(l.trim()){const we=l.toLowerCase();ie=ie.filter($e=>$e.description.toLowerCase().includes(we)||$e.tags.some(Ce=>Ce.toLowerCase().includes(we))||$e.id.includes(we))}return f&&(ie=ie.filter(we=>we.status===f)),h&&(ie=ie.filter(we=>we.tags.includes(h))),ie},[n,l,f,h]);m.useEffect(()=>{C(new Set)},[l,f,h,t]);const V=m.useMemo(()=>M.filter(ie=>k.has(ie.id)).length,[M,k]),Y=M.length>0&&V===M.length,q=V>0&&!Y;function J(ie){C(we=>{const $e=new Set(we);return $e.has(ie)?$e.delete(ie):$e.add(ie),$e})}function ne(){C(ie=>{const we=new Set(ie);if(Y)for(const $e of M)we.delete($e.id);else for(const $e of M)we.add($e.id);return we})}function Q(){C(new Set)}const ce=$?[$]:Array.from(k);function te(){C(new Set),z(null),i()}function pe(){C(new Set),i()}async function be(){y.trim()&&(await Iv(t,y.trim()),S(""),i())}async function Ee(ie,we,$e){ie.stopPropagation(),window.confirm(`Delete "${$e}"? This can't be undone.`)&&(await P2(t,we),i())}async function Te(ie,we){switch(we){case"open":await A2(t,ie);break;case"in_progress":await R2(t,ie);break;case"completed":await E2(t,ie);break;case"blocked":await T2(t,ie);break}i()}async function Se(ie,we){await _2(t,ie,we),i()}async function Be(ie,we){await D2(t,ie,we),i()}async function oe(ie,we){await $2(t,ie,we),i()}const je=Xw(M),ke=je.filter(ie=>!F.isCollapsed(ie.config.id)).flatMap(ie=>ie.items),{hotkeyRowProps:_e}=Rd(ke,{scope:"list:todos",bindO:!1,onOpen:ie=>N(ie.id)});Jt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ie;return(ie=A.current)==null?void 0:ie.focus()}}),Jt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>i()});const[Ue,et]=js(),Me=Ue.get("focus");m.useEffect(()=>{if(!Me||!(n!=null&&n.items))return;const ie=n.items.find($e=>$e.id===Me);if(!ie)return;const we=Dm(ie.status);F.isCollapsed(we)&&F.toggle(we)},[Me,n==null?void 0:n.items]),m.useEffect(()=>{if(!Me)return;const ie=document.querySelector(`[data-todo-id="${window.CSS.escape(Me)}"]`);if(!ie)return;ie.scrollIntoView({block:"nearest"}),ie.classList.add("ring-2","ring-primary/60");const we=window.setTimeout(()=>{ie.classList.remove("ring-2","ring-primary/60"),et($e=>{const Ce=new URLSearchParams($e);return Ce.delete("focus"),Ce})},1500);return()=>window.clearTimeout(we)},[Me,ke.length,et]);const qe=W?(n==null?void 0:n.items.find(ie=>ie.id===W))??null:null;function vt(ie,we){const $e=H.current;if($e!=null&&$e.closest(Gl)){ie.preventDefault();return}ie.dataTransfer.effectAllowed="move",ie.dataTransfer.setData("text/plain",we),P(we)}function ft(){P(null),B(null)}function st(ie,we){!qe||we.statuses.includes(qe.status)||(ie.preventDefault(),ie.dataTransfer.dropEffect="move",B(we.id))}function le(ie,we){O===we.id&&!ie.currentTarget.contains(ie.relatedTarget)&&B(null)}function ee(ie,we){ie.preventDefault();const $e=qe;ft(),!(!$e||we.statuses.includes($e.status))&&Te($e.id,we.dropStatus)}if(r)return s.jsx(bt,{label:"Loading todos..."});if(o)return s.jsx(Tt,{error:o});const ye=(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.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(qn,{label:"Open",value:ye.open,icon:Xr}),s.jsx(qn,{label:"In Progress",value:ye.in_progress,icon:Xr,tone:"info"}),s.jsx(qn,{label:"Blocked",value:ye.blocked,icon:Vh,tone:"warn"}),s.jsx(qn,{label:"Total",value:ye.total,icon:Xr})]}),a&&s.jsx(Lie,{bundles:a.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:y,onChange:ie=>S(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&be(),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:be,disabled:!y.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(Pt,{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(pi,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:A,type:"text",placeholder:"Search...",value:l,onChange:ie=>d(ie.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:f,onChange:ie=>p(ie.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"})]}),U.length>0&&s.jsxs("select",{value:h,onChange:ie=>g(ie.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"}),U.map(ie=>s.jsxs("option",{value:ie,children:["#",ie]},ie))]})]}),k.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:[k.size," selected"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>T(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),s.jsx("button",{type:"button",onClick:()=>{z(null),D(!0)},className:"shell-action",children:"Move to…"}),s.jsx("button",{type:"button",onClick:Q,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,M.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:Y,ref:ie=>{ie&&(ie.indeterminate=q)},onChange:ne,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",M.length,")"]})]}),s.jsx("div",{className:"space-y-3",children:(()=>{let ie=-1;return je.map(({config:we,items:$e})=>{const Ce=!F.isCollapsed(we.id);return s.jsx(Yw,{label:we.label,count:$e.length,expanded:Ce,onToggle:()=>F.toggle(we.id),isDropTarget:O===we.id,onDragOver:se=>st(se,we),onDragLeave:se=>le(se,we),onDrop:se=>ee(se,we),children:Ce&&$e.map(se=>(ie+=1,s.jsx(IP,{item:se,copiedId:w,selected:k.has(se.id),editing:j===se.id,onBeginEdit:me=>N(me),onEndEdit:()=>N(null),onPatchDescription:Se,onAddAttachments:Be,onDeleteAttachment:oe,attachmentUrl:(me,Pe)=>Mv(t,me,Pe),onToggleSelected:me=>J(me),onMoveOne:(me,Pe)=>{Pe.stopPropagation(),z(me),D(!0)},onStatusChange:Te,onCopyId:L,onDelete:Ee,hotkeyRowProps:_e(ie),onDragOrigin:me=>{H.current=me.target},onDragStart:vt,onDragEnd:ft,isDragging:W===se.id},se.id)))},we.id)})})()}),s.jsx(Gw,{open:I,selectedIds:Array.from(k),scope:{kind:"workspace",workspace:t},onOpenChange:T,onDone:pe}),s.jsx(FP,{open:R,selectedIds:ce,scope:{kind:"workspace",workspace:t},onOpenChange:ie=>{D(ie),ie||z(null)},onDone:te})]})}function KD(){const{views:e}=$d();async function t(i,a,l){const d=e.find(h=>h.id===i.id)??i,f=kA(l,d.workspace).config,p=mh(d.config,f,d.config);await uh(i.id,{name:a,config:p})}async function n(i,a,l){const d=e.find(h=>h.id===i.id)??i,f=Ew(l,d.workspace).config,p=mh(d.config,f,d.config);await uh(i.id,{name:a,config:p})}async function r(i){await Wl({name:`${i.name} (copy)`,workspace:i.workspace,config:i.config,entityType:i.entityType})}async function o(i){await h8(i.id)}return{submitEdit:t,submitEditSession:n,duplicate:r,remove:o}}const gE=80,zie={kanban:"Kanban",list:"List",table:"Table"},Bie={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function GD({open:e,onOpenChange:t,workspace:n,initialView:r,onSubmit:o}){const i=!!r,a=Ss(),l=Td(),{data:d}=Xs(),{data:f}=qh(),[p,h]=m.useState(""),[g,y]=m.useState(ll.viewMode),[S,w]=m.useState([]),[b,j]=m.useState([]),[N,k]=m.useState([]),[C,I]=m.useState([]),[T,R]=m.useState([]),[D,$]=m.useState([]),[z,A]=m.useState("all"),[F,W]=m.useState(null),[P,O]=m.useState(""),[B,H]=m.useState(ll.sortField),[L,U]=m.useState(ll.sortDirection),[M,V]=m.useState(!1),[Y,q]=m.useState(null);function J(){y(ll.viewMode),w([]),j([]),k([]),I([]),R([]),$([]),A("all"),W(null),O(""),H(ll.sortField),U(ll.sortDirection)}m.useEffect(()=>{if(e)if(q(null),V(!1),r){const oe=r.config.filters;h(r.name),y(r.config.viewMode),w(Ve(oe.status)),j(Ve(oe.priority)),k(Ve(oe.type)),I(Ve(oe.project)),R(Ve(oe.assignee)),$(Ve(oe.tags)),A(oe.activity??"all"),W(Nm(oe.dateRange)),O(oe.search??""),H(r.config.sortField),U(r.config.sortDirection)}else h(""),J()},[e,r]);const ne=oe=>je=>oe?oe==="_ungrouped"?je.projectWorkspace===null:je.projectWorkspace===oe:!0,Q=m.useMemo(()=>{const oe=ke=>n?n==="_ungrouped"?ke.workspace===null:ke.workspace===n:!0,je=(d??[]).filter(oe);return[{value:"__standalone__",label:"No project"},...je.map(ke=>({value:ke.slug,label:ke.title}))]},[d,n]),ce=m.useMemo(()=>{const oe=new Set,je=ne(n);for(const _e of(f==null?void 0:f.assignments)??[])je(_e)&&_e.assignee&&oe.add(_e.assignee);const ke=[{value:"__unassigned__",label:"Unassigned"}];for(const _e of Array.from(oe).sort())ke.push({value:_e,label:_e});return ke},[f,n]),te=m.useMemo(()=>{const oe=new Set,je=ne(n);for(const ke of(f==null?void 0:f.assignments)??[])if(je(ke))for(const _e of ke.tags??[])oe.add(_e);return Array.from(oe).sort().map(ke=>({value:ke,label:ke}))},[f,n]),pe=m.useMemo(()=>a.order.map(oe=>({value:oe,label:li(a,oe)})),[a]),be=m.useMemo(()=>zU.map(oe=>({value:oe,label:oe[0].toUpperCase()+oe.slice(1)})),[]),Ee=m.useMemo(()=>l.definitions.map(oe=>({value:oe.id,label:Pl(l,oe.id)})),[l]),Te=Zv.map(oe=>({value:oe,label:zie[oe]})),Se=p.trim(),Be=Se.length>0&&Se.length<=gE;return s.jsx(Bn,{open:e,onOpenChange:t,children:s.jsx(_n,{className:"max-w-lg",children:s.jsxs("form",{className:"space-y-4",onSubmit:async oe=>{if(oe.preventDefault(),!Be||M)return;V(!0),q(null);const je={viewMode:g,filters:{status:S,priority:b,type:N,project:C,assignee:T,tags:D,activity:z,dateRange:ta(F),search:P},sortField:B,sortDirection:L};try{await o(Se,je)}catch(ke){q(ke instanceof Error?ke.message:String(ke)),V(!1)}},children:[s.jsx(sr,{children:s.jsx(Dn,{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:gE,onChange:oe=>h(oe.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(Em,{value:g,onChange:oe=>y(oe),options:Te})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(Ls,{label:"Status",children:s.jsx(wn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:pe,value:S,onChange:w})}),s.jsx(Ls,{label:"Priority",children:s.jsx(wn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:be,value:b,onChange:j})}),s.jsx(Ls,{label:"Type",children:s.jsx(wn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:Ee,value:N,onChange:k})}),s.jsx(Ls,{label:"Project",children:s.jsx(wn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:Q,value:C,onChange:I})}),s.jsx(Ls,{label:"Assignee",children:s.jsx(wn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ce,value:T,onChange:R})}),s.jsx(Ls,{label:"Tags",children:s.jsx(wn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:te,value:D,onChange:$})}),s.jsx(Ls,{label:"Activity",children:s.jsxs("select",{value:z,onChange:oe=>A(oe.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(Ls,{label:"Date range",children:s.jsx(Sm,{className:"w-full",value:F,onChange:W})}),s.jsx(Ls,{label:"Search",className:"sm:col-span-2",children:s.jsx("input",{type:"text",value:P,onChange:oe=>O(oe.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),s.jsx(Ls,{label:"Sort by",className:"sm:col-span-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{value:B,onChange:oe=>H(oe.target.value),className:"editor-input w-full",children:bT.map(oe=>s.jsx("option",{value:oe,children:Bie[oe]??oe},oe))}),s.jsx("button",{type:"button",onClick:()=>U(oe=>oe==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:L==="asc"?"Ascending":"Descending",children:L==="asc"?"Asc":"Desc"})]})})]}),Y?s.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:Y}):null,s.jsxs(Fr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:J,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 Ls({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 Uie={kanban:"Kanban",list:"List",table:"Table"},Hie={assignment:"Assignment",session:"Session"},Vie={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function xE(){const{workspace:e}=Bt(),{views:t,loading:n}=$d(),{submitEdit:r,submitEditSession:o,duplicate:i,remove:a}=KD(),{toast:l,showToast:d,dismissToast:f}=gi(),[p,h]=m.useState(null),[g,y]=m.useState(!1),[S,w]=m.useState(!1),[b,j]=m.useState(!1),[N,k]=m.useState(null);async function C(W,P){const{workspace:O,config:B}=kA(P,e??null);try{await Wl({name:W,workspace:O,config:B}),w(!1),d(`Created view "${W}"`)}catch(H){throw d(H instanceof Error?H.message:"Failed to create saved view"),H}}async function I(W,P){const{workspace:O,config:B}=Ew(P,e??null);try{await Wl({name:W,workspace:O,config:B,entityType:"session"}),j(!1),d(`Created session view "${W}"`)}catch(H){throw d(H instanceof Error?H.message:"Failed to create session view"),H}}async function T(W,P,O){try{await r(W,P,O),k(null),d(`Updated view "${P}"`)}catch(B){throw d(B instanceof Error?B.message:"Failed to update saved view"),B}}async function R(W,P,O){try{await o(W,P,O),k(null),d(`Updated session view "${P}"`)}catch(B){throw d(B instanceof Error?B.message:"Failed to update session view"),B}}async function D(W){try{await i(W),d(`Duplicated "${W.name}"`)}catch(P){d(P instanceof Error?P.message:"Failed to duplicate saved view")}}async function $(){if(p){y(!0);try{await a(p),h(null)}catch(W){d(W instanceof Error?W.message:"Failed to delete saved view")}finally{y(!1)}}}const z=s.jsxs("button",{type:"button",onClick:()=>w(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[s.jsx(Pt,{className:"h-4 w-4"}),"Create view"]}),A=s.jsxs("button",{type:"button",onClick:()=>j(!0),className:"shell-action inline-flex items-center gap-1.5",children:[s.jsx(Pt,{className:"h-4 w-4"}),"Create session view"]}),F=(N==null?void 0:N.entityType)==="session";return s.jsxs("div",{className:"space-y-4",children:[s.jsx(yh,{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:[A,z]})}),n?s.jsx(bt,{label:"Loading saved views…"}):t.length===0?s.jsx(Ct,{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:[A,z]})}):s.jsx(Ye,{children:s.jsx("ul",{className:"divide-y divide-border/60",children:t.map(W=>s.jsx(Wie,{view:W,onRequestDelete:()=>h(W),onRequestEdit:()=>k(W),onRequestDuplicate:()=>void D(W)},W.id))})}),s.jsx(GD,{open:S||!F&&N!==null,onOpenChange:W=>{W||(w(!1),F||k(null))},workspace:N&&!F?N.workspace:e??null,initialView:N&&!F?N:null,onSubmit:N&&!F?(W,P)=>T(N,W,P):C}),s.jsx(TA,{open:b||F&&N!==null,onOpenChange:W=>{W||(j(!1),F&&k(null))},workspace:N&&F?N.workspace:e??null,initialView:N&&F?N:null,onSubmit:N&&F?(W,P)=>R(N,W,P):I}),s.jsx(ya,{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:W=>{!W&&!g&&h(null)}}),s.jsx(ga,{toast:l,onDismiss:f})]})}function Wie({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:r}){const o=zt(),i=()=>o(NA(e)),a=EA(e.config.filters),l=e.workspace?Tn(e.workspace):null,d=e.entityType??"assignment",f=d==="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 ${Vie[d]??"bg-muted text-muted-foreground"}`,children:Hie[d]??d}),!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:Uie[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 qie={kanban:"Kanban",list:"List",table:"Table"};function yE(){const{id:e,workspace:t}=Bt(),n=zt(),{view:r,ready:o,error:i,refetch:a}=ui(e),{submitEdit:l,duplicate:d,remove:f}=KD(),{toast:p,showToast:h,dismissToast:g}=gi(),[y,S]=m.useState(!1),[w,b]=m.useState(!1),[j,N]=m.useState(!1);if(m.useEffect(()=>{!o||!r||(t??null)!==(r.workspace??null)&&n(NA(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(yh,{title:"View not found",description:"This saved view no longer exists."}),s.jsxs(Ie,{to:Op(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[s.jsx(Yp,{className:"h-4 w-4"})," Back to Saved Views"]})]});const k=r.workspace?Tn(r.workspace):null;async function C(R,D){const $=r;try{await l($,R,D),S(!1),h(`Updated view "${R}"`)}catch(z){throw h(z instanceof Error?z.message:"Failed to update saved view"),z}}async function I(){const R=r;try{await d(R),h(`Duplicated "${R.name}"`)}catch(D){h(D instanceof Error?D.message:"Failed to duplicate saved view")}}async function T(){const R=r;N(!0);try{await f(R),b(!1),n(Op(R.workspace))}catch(D){h(D instanceof Error?D.message:"Failed to delete saved view")}finally{N(!1)}}return s.jsxs("div",{className:"space-y-4",children:[s.jsxs(Ie,{to:Op(r.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[s.jsx(Yp,{className:"h-4 w-4"})," Saved Views"]}),s.jsx(yh,{title:r.name,description:EA(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:qie[r.config.viewMode]}),k?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:k}):null,s.jsx("button",{type:"button",onClick:()=>S(!0),className:"shell-action",children:"Edit"}),s.jsx("button",{type:"button",onClick:()=>void I(),className:"shell-action",children:"Duplicate"}),s.jsx("button",{type:"button",onClick:()=>n(CA(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(wA,{view:r}),y?s.jsx(GD,{open:y,onOpenChange:S,workspace:r.workspace,initialView:r,onSubmit:C}):null,s.jsx(ya,{open:w,title:"Delete saved view?",description:`Delete '${r.name}'? Any Overview widgets referencing this view will become empty.`,confirmLabel:"Delete",loading:j,destructive:!0,onConfirm:T,onOpenChange:R=>{!R&&!j&&b(!1)}}),s.jsx(ga,{toast:p,onDismiss:g})]})}function Kie(){return s.jsx(rL,{children:s.jsx(B6,{children:s.jsx(_M,{children:s.jsxs(Qe,{element:s.jsx(gz,{}),children:[s.jsx(Qe,{path:"/",element:s.jsx(h9,{})}),s.jsx(Qe,{path:"/projects",element:s.jsx(vS,{})}),s.jsx(Qe,{path:"/archive",element:s.jsx(R9,{})}),s.jsx(Qe,{path:"/assignments",element:s.jsx(RN,{})}),s.jsx(Qe,{path:"/assignments/new",element:s.jsx(DN,{})}),s.jsx(Qe,{path:"/assignments/:id",element:s.jsx(RG,{})}),s.jsx(Qe,{path:"/assignments/:id/edit",element:s.jsx(Ry,{})}),s.jsx(Qe,{path:"/assignments/:id/plan/edit",element:s.jsx(Ay,{})}),s.jsx(Qe,{path:"/assignments/:id/scratchpad/edit",element:s.jsx(Py,{})}),s.jsx(Qe,{path:"/assignments/:id/handoff/edit",element:s.jsx(_y,{})}),s.jsx(Qe,{path:"/assignments/:id/decision-record/edit",element:s.jsx(Dy,{})}),s.jsx(Qe,{path:"/servers",element:s.jsx(IN,{})}),s.jsx(Qe,{path:"/inventories",element:s.jsx(MN,{})}),s.jsx(Qe,{path:"/schedules",element:s.jsx(yY,{})}),s.jsx(Qe,{path:"/usage",element:s.jsx(LN,{})}),s.jsx(Qe,{path:"/agent-sessions",element:s.jsx(ON,{})}),s.jsx(Qe,{path:"/playbooks",element:s.jsx(kY,{})}),s.jsx(Qe,{path:"/playbooks/create",element:s.jsx(NY,{})}),s.jsx(Qe,{path:"/playbooks/:slug",element:s.jsx(SY,{})}),s.jsx(Qe,{path:"/playbooks/:slug/edit",element:s.jsx(CY,{})}),s.jsx(Qe,{path:"/memories",element:s.jsx(EY,{})}),s.jsx(Qe,{path:"/memories/new",element:s.jsx(RY,{})}),s.jsx(Qe,{path:"/projects/:slug/memories/:itemSlug",element:s.jsx(TY,{})}),s.jsx(Qe,{path:"/projects/:slug/memories/:itemSlug/edit",element:s.jsx(AY,{})}),s.jsx(Qe,{path:"/resources",element:s.jsx(PY,{})}),s.jsx(Qe,{path:"/resources/new",element:s.jsx(DY,{})}),s.jsx(Qe,{path:"/projects/:slug/resources/:itemSlug",element:s.jsx(_Y,{})}),s.jsx(Qe,{path:"/projects/:slug/resources/:itemSlug/edit",element:s.jsx($Y,{})}),s.jsx(Qe,{path:"/todos",element:s.jsx($ie,{})}),s.jsx(Qe,{path:"/views",element:s.jsx(xE,{})}),s.jsx(Qe,{path:"/views/:id",element:s.jsx(yE,{})}),s.jsx(Qe,{path:"/help",element:s.jsx(g9,{})}),s.jsx(Qe,{path:"/settings",element:s.jsx(lX,{})}),s.jsx(Qe,{path:"/workflow",element:s.jsx(Die,{})}),s.jsx(Qe,{path:"/create/project",element:s.jsx(PN,{})}),s.jsx(Qe,{path:"/projects/:slug",element:s.jsx(vN,{})}),s.jsx(Qe,{path:"/projects/:slug/edit",element:s.jsx($N,{})}),s.jsx(Qe,{path:"/projects/:slug/create/assignment",element:s.jsx(_N,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug",element:s.jsx(NN,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug/edit",element:s.jsx(Ry,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:s.jsx(Ay,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:s.jsx(Py,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:s.jsx(_y,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:s.jsx(Dy,{})}),s.jsx(Qe,{path:"/w/:workspace/projects",element:s.jsx(vS,{})}),s.jsx(Qe,{path:"/w/:workspace/assignments",element:s.jsx(RN,{})}),s.jsx(Qe,{path:"/w/:workspace/assignments/new",element:s.jsx(DN,{})}),s.jsx(Qe,{path:"/w/:workspace/servers",element:s.jsx(IN,{})}),s.jsx(Qe,{path:"/w/:workspace/inventories",element:s.jsx(MN,{})}),s.jsx(Qe,{path:"/w/:workspace/usage",element:s.jsx(LN,{})}),s.jsx(Qe,{path:"/w/:workspace/agent-sessions",element:s.jsx(ON,{})}),s.jsx(Qe,{path:"/w/:workspace/todos",element:s.jsx(Fie,{})}),s.jsx(Qe,{path:"/w/:workspace/views",element:s.jsx(xE,{})}),s.jsx(Qe,{path:"/w/:workspace/views/:id",element:s.jsx(yE,{})}),s.jsx(Qe,{path:"/w/:workspace/create/project",element:s.jsx(PN,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug",element:s.jsx(vN,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/edit",element:s.jsx($N,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/create/assignment",element:s.jsx(_N,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:s.jsx(NN,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:s.jsx(Ry,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:s.jsx(Ay,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:s.jsx(Py,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:s.jsx(_y,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:s.jsx(Dy,{})})]})})})})}W4();_I.createRoot(document.getElementById("root")).render(s.jsx(m.StrictMode,{children:s.jsx(q4,{children:s.jsx(Kie,{})})}));export{Vd as C,gr as R,eH as _,Vu as a,Yie as b,d0 as d,Q_ as e,bd as g,Xie as h,Fs as i,e3 as n,VJ as r,$r as s};
|